nix derivation

This commit is contained in:
David Mosbach 2024-01-27 16:59:49 +00:00
parent 4785a98ebe
commit 159839dc83
2 changed files with 31 additions and 4 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
.stack-work/ .stack-work/
*~ *~
database/* database/*
result

View File

@ -29,14 +29,40 @@
with haskell.packages."ghc927"; [ ghc haskell-language-server ] with haskell.packages."ghc927"; [ ghc haskell-language-server ]
) )
); );
libPath = pkgs.lib.makeLibraryPath buildInputs;
#oms = pkgs.haskell.lib.buildStackProject {
# ghc = pkgs.haskell.packages.ghc927.ghc;
# inherit buildInputs;
# inherit name;
# dontUnpack = true;
#};
oms = pkgs.stdenv.mkDerivation {
inherit buildInputs;
inherit name;
pname = name;
src = ./.;
# dontUnpack = true;
buildPhase = ''
HOME=$out
LD_LIBRARY_PATH=${libPath}
mkdir -p $HOME/.stack
stack build --verbose
'';
installPhase = ''
mv .stack-work/install/${system}/*/*/bin/${name}-exe $out
echo "moved"
'';
};
in { in {
packages.${system}.${name} = nixpkgs.legacyPackages.${system}.${name}; packages.${system} = {
packages.${system}.default = self.packages.${system}.${name}; ${name} = oms; # nixpkgs.legacyPackages.${system}.${name};
default = self.packages.${system}.${name};
};
devShells.${system}.default = pkgs.mkShell { devShells.${system}.default = pkgs.mkShell {
buildInputs = buildInputs; buildInputs = buildInputs;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs; LD_LIBRARY_PATH = libPath;
shellHook = builtins.readFile ./mkDB.sh; shellHook = builtins.readFile ./mkDB.sh;
}; };
}; };