chore: fix build environment on NixOS

This commit is contained in:
Gregor Kleen 2019-06-26 13:39:33 +02:00
parent 463b2b7878
commit d63a890327
4 changed files with 44 additions and 25 deletions

View File

@ -1,8 +1,7 @@
{ nixpkgs ? import <nixpkgs>, compiler ? null }: { nixpkgs ? import <nixpkgs> }:
let let
inherit (nixpkgs {}) pkgs; haskellPackages = import ./stackage.nix { inherit nixpkgs; };
haskellPackages = if isNull compiler then pkgs.haskellPackages else pkgs.haskell.packages."${compiler}";
drv = haskellPackages.callPackage ./uniworx.nix {}; drv = haskellPackages.callPackage ./uniworx.nix {};
@ -19,7 +18,7 @@ let
''; '';
override = oldAttrs: { override = oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ (with pkgs; [ postgresql pgadmin openldap ]) ++ (with haskellPackages; [ stack yesod-bin hlint cabal-install ]); nativeBuildInputs = oldAttrs.nativeBuildInputs ++ (with pkgs; [ nodejs-8_x postgresql pgadmin openldap ]) ++ (with haskellPackages; [ stack yesod-bin hlint cabal-install ]);
shellHook = '' shellHook = ''
export PROMPT_INFO="${oldAttrs.name}" export PROMPT_INFO="${oldAttrs.name}"

View File

@ -1,16 +1,11 @@
{ ghc, nixpkgs ? import <nixpkgs> }: { ghc, nixpkgs ? import <nixpkgs> }:
let let
snapshot = "lts-10.5"; haskellPackages = import ./stackage.nix { inherit nixpkgs; };
stackage = import (fetchTarball { inherit (nixpkgs {}) pkgs;
url = "https://stackage.serokell.io/drczwlyf6mi0ilh3kgv01wxwjfgvq14b-stackage/default.nix.tar.gz"; in pkgs.haskell.lib.buildStackProject {
sha256 = "1bwlbxx6np0jfl6z9gkmmcq22crm0pa07a8zrwhz5gkal64y6jpz";
});
inherit (nixpkgs { overlays = [ stackage."${snapshot}" ]; }) haskell pkgs;
haskellPackages = pkgs.haskell.packages."${snapshot}";
in haskell.lib.buildStackProject {
inherit ghc; inherit ghc;
inherit (haskellPackages) stack;
name = "stackenv"; name = "stackenv";
buildInputs = (with pkgs; buildInputs = (with pkgs;
[ postgresql zlib libsodium [ postgresql zlib libsodium

View File

@ -9,20 +9,15 @@ extra-package-dbs: []
packages: packages:
- . - .
- location:
git: https://github.com/pngwjpgh/zip-stream.git
commit: 9272bbed000928d500febad1cdc98d1da29d399e
extra-dep: true
- location:
git: https://github.com/pngwjpgh/encoding.git
commit: 67bb87ceff53f0178c988dd4e15eeb2daee92b84
extra-dep: true
- location:
git: https://github.com/pngwjpgh/memcached-binary.git
commit: b5461747e7be226d3b67daebc3c9aefe8a4490ad
extra-dep: true
extra-deps: extra-deps:
- git: https://github.com/pngwjpgh/zip-stream.git
commit: 9272bbed000928d500febad1cdc98d1da29d399e
- git: https://github.com/pngwjpgh/encoding.git
commit: 67bb87ceff53f0178c988dd4e15eeb2daee92b84
- git: https://github.com/pngwjpgh/memcached-binary.git
commit: b5461747e7be226d3b67daebc3c9aefe8a4490ad
- colonnade-1.2.0 - colonnade-1.2.0
- yesod-colonnade-1.2.0 - yesod-colonnade-1.2.0

30
stackage.nix Normal file
View File

@ -0,0 +1,30 @@
{ nixpkgs ? import <nixpkgs>
, snapshot ? "lts-10.5"
}:
let
stackage = import (fetchTarball {
url = "https://stackage.serokell.io/drczwlyf6mi0ilh3kgv01wxwjfgvq14b-stackage/default.nix.tar.gz";
sha256 = "1bwlbxx6np0jfl6z9gkmmcq22crm0pa07a8zrwhz5gkal64y6jpz";
});
overlays =
[ stackage."${snapshot}"
(self: super: {
haskell = super.haskell // {
packages = super.haskell.packages // {
"${snapshot}" = super.haskell.packages."${snapshot}".override {
overrides = hself: hsuper: {
zip-archive = self.haskell.lib.overrideCabal hsuper.zip-archive (old: {
testToolDepends = old.testToolDepends ++ (with self; [ unzip ]);
});
};
};
};
};
}
)
];
inherit (nixpkgs { inherit overlays; }) pkgs;
in pkgs.haskell.packages."${snapshot}"