on master help sign in
Code to build Stackage with Nix
commitd7817d5653e8aabd7eb06948e771b1c878b68fb5 authorKirill Zaborsky <qrilka@gmail.com> dateWed 6 Feb 2019, 17:56 (8 years ago) parent1625ac4
5 files changed+87
automated/nix-build/README.md+5 automated/nix-build/build.sh+12 automated/nix-build/fetch-nixpkgs.nix+23 automated/nix-build/nixpkgs-src.json+6 automated/nix-build/snapshot-fixed.nix+41
automated/nix-build/README.mdnew file+5
@@ -0,0 +1,5 @@
1+# Building Stackage with Nix
2+
3+The script `build.sh` is supposed to be run in a directory where `curator unpack`
4+was run - it assumes existence of `unpack-dir` directory with a Stackage
5+snapshot `stack.yaml` and unpacked packages in it.
automated/nix-build/build.shnew file+12
@@ -0,0 +1,12 @@
1+#!/usr/bin/env bash
2+
3+set -eu +x
4+
5+NIX_VERSION="2.0.4"
6+curl https://nixos.org/releases/nix/nix-$NIX_VERSION/install | sh
7+
8+# no code to install stack2nix yet
9+
10+stack2nix --cabal2nix-args="--no-hpack" unpack-dir > snapshot.nix
11+
12+nix build -f snapshot-fixed.nix
automated/nix-build/fetch-nixpkgs.nixnew file+23
@@ -0,0 +1,23 @@
1+let
2+ spec = builtins.fromJSON (builtins.readFile ./nixpkgs-src.json);
3+ src = import <nix/fetchurl.nix> {
4+ url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz";
5+ inherit (spec) sha256;
6+ };
7+ nixcfg = import <nix/config.nix>;
8+in builtins.derivation {
9+ system = builtins.currentSystem;
10+ name = "${src.name}-unpacked";
11+ builder = builtins.storePath nixcfg.shell;
12+ inherit src;
13+ args = [
14+ (builtins.toFile "builder" ''
15+ $coreutils/mkdir $out
16+ cd $out
17+ $gzip -d < $src | $tar -x --strip-components=1
18+ '')
19+ ];
20+ coreutils = builtins.storePath nixcfg.coreutils;
21+ tar = builtins.storePath nixcfg.tar;
22+ gzip = builtins.storePath nixcfg.gzip;
23+}
automated/nix-build/nixpkgs-src.jsonnew file+6
@@ -0,0 +1,6 @@
1+{
2+ "owner": "NixOS",
3+ "repo": "nixpkgs",
4+ "rev": "c2950341d038995bf46a7b72db961bb3d3e9ac12",
5+ "sha256": "0ghirjm6xvsihci3fladrn4nrnh2yr529v7c406hmw0yp25kv0i4"
6+}
automated/nix-build/snapshot-fixed.nixnew file+41
@@ -0,0 +1,41 @@
1+{ pkgs ? import (import ./fetch-nixpkgs.nix) {}
2+, compiler ? pkgs.haskell.packages.ghc863
3+}:
4+let
5+ snapshot = import ./snapshot.nix { pkgs = pkgs; compiler = compiler; };
6+in
7+ snapshot.override (with pkgs.haskell.lib; {
8+ overrides = self: super: {
9+ # disabling packages from non-hackage-packages.nix
10+ futhark = null;
11+ multi-ghc-travis = null;
12+ vaultenv = null;
13+ # native deps
14+ check-email = super.check-email.override { resolv = null; };
15+ flac = super.flac.override { FLAC = pkgs.flac; };
16+ freenect = super.freenect.override { freenect_sync = null; libfreenect = null; };
17+ haskell-gi = super.haskell-gi.override { gobject-introspection = pkgs.gnome3.gobjectIntrospection; };
18+ HDBC-mysql = super.HDBC-mysql.override { mysqlclient = pkgs.mysql;};
19+ libffi = super.libffi.override { ffi = null; };
20+ # fixes
21+ blas-ffi = overrideCabal super.blas-ffi (
22+ old: { libraryPkgconfigDepends = old.libraryPkgconfigDepends ++ [ pkgs.openblasCompat ]; }
23+ );
24+ odbc = overrideCabal super.odbc (
25+ old: { librarySystemDepends = old.librarySystemDepends ++ [ pkgs.freetds ]; }
26+ );
27+ html-entities = null; # https://github.com/nikita-volkov/html-entities/issues/8
28+ category = null; # conflict in Prelude.hs
29+ constraint = null; # because of category
30+ lame = null; # fails with 'Total ticks: 451489'
31+ proto-lens-protobuf-types = overrideCabal super.proto-lens-protobuf-types (
32+ old: { libraryToolDepends = old.libraryToolDepends ++ [ pkgs.protobuf ]; }
33+ );
34+ # libraft = null; # xxx/postgres/entries.sql: openFile: does not exist (No such file or directory) in libraft-0.2.0.0
35+ xmlbf-xeno = null; # because of html-entities
36+ xmonad = null; # xmonad requires extra patches for Nix
37+ xmonad-contrib = null;
38+ xmonad-extras = null;
39+ hlibgit2 = disableHardening super.hlibgit2 [ "format" ];
40+ };
41+ })