Clean up flake.nix a little
This commit is contained in:
parent
7a91c520ee
commit
18946f2d57
28
flake.nix
28
flake.nix
@ -13,27 +13,38 @@
|
||||
haskellPackages = pkgs.haskell.packages."${settings.ghc}";
|
||||
|
||||
ghc = haskellPackages.ghcWithPackages haskellDeps;
|
||||
|
||||
# Wrap stack to disable its slow Nix integration.
|
||||
# Instead, make it use the GHC defined above.
|
||||
stack = pkgs.stdenv.mkDerivation {
|
||||
name = "stack";
|
||||
|
||||
# The build is simply a call to makeWrapper, so we don't have to
|
||||
# do any of the typical build steps.
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
# makeBinaryWrapper creates a stack executable for us that uses
|
||||
# the GHC defined in this file.
|
||||
installPhase = ''
|
||||
makeWrapper ${pkgs.stack}/bin/stack $out/bin/stack \
|
||||
makeBinaryWrapper ${pkgs.stack}/bin/stack $out/bin/stack \
|
||||
--prefix PATH : ${ghc}/bin \
|
||||
--add-flags '--no-nix --system-ghc --no-install-ghc'
|
||||
'';
|
||||
};
|
||||
utoy' =
|
||||
{ mkDerivation }:
|
||||
|
||||
utoy = haskellPackages.callPackage
|
||||
({ mkDerivation }:
|
||||
mkDerivation {
|
||||
version = "0.5";
|
||||
pname = "utoy";
|
||||
license = pkgs.lib.licenses.mit;
|
||||
src =
|
||||
# We only need these files for building:
|
||||
let
|
||||
buildFiles = [
|
||||
whitelist = [
|
||||
./LICENSE
|
||||
./utoy.cabal
|
||||
./Setup.hs
|
||||
@ -45,17 +56,14 @@
|
||||
in
|
||||
pkgs.lib.sources.cleanSourceWith {
|
||||
src = ./.;
|
||||
filter = path: _type: pkgs.lib.any (prefix: pkgs.lib.hasPrefix (toString prefix) path) buildFiles;
|
||||
filter = path: _type: pkgs.lib.any (prefix: pkgs.lib.hasPrefix (toString prefix) path) whitelist;
|
||||
};
|
||||
|
||||
libraryHaskellDepends = haskellDeps haskellPackages;
|
||||
};
|
||||
utoy = pkgs.haskell.lib.justStaticExecutables (haskellPackages.callPackage utoy' {});
|
||||
}) {};
|
||||
in {
|
||||
packages.x86_64-linux = {
|
||||
inherit ghc;
|
||||
inherit stack;
|
||||
inherit utoy;
|
||||
|
||||
docker =
|
||||
pkgs.dockerTools.buildImage {
|
||||
@ -64,7 +72,7 @@
|
||||
config.Cmd = [ "${utoy}/bin/utoy" ];
|
||||
};
|
||||
|
||||
default = utoy;
|
||||
default = pkgs.haskell.lib.justStaticExecutables utoy;
|
||||
};
|
||||
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
|
Loading…
x
Reference in New Issue
Block a user