Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let
gitMinimal nodePackages.sass nodejs

# For building diagrams:
poppler_utils our-texlive
poppler-utils our-texlive
] ++ (if interactive then [
sort-imports
] else [
Expand Down
41 changes: 22 additions & 19 deletions support/nix/build-shake.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ pkgs
, lib
, nix-gitignore
, our-ghc
, makeWrapper
Expand All @@ -9,25 +10,27 @@
, gmp
, name
, main
, importNpmLock
}:
let
nodeEnv = import ./node/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript nodejs;
inherit pkgs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
nodeModules = importNpmLock.buildNodeModules {
npmRoot = ../..;
inherit (pkgs) nodejs;

# To cut down on the image size we maim all references to Python and bash here.
nodeDependencies = (import ./node/node-dependencies.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit nodeEnv;
}).nodeDependencies.overrideDerivation (old: {
installPhase = ''
${old.installPhase}
find $out -print0 | xargs -0 ${pkgs.removeReferencesTo}/bin/remove-references-to -t ${pkgs.python3}
find $out -print0 | xargs -0 ${pkgs.removeReferencesTo}/bin/remove-references-to -t ${pkgs.bash}
'';
});
# To cut down on the image size we maim some references here.
derivationArgs = let
forbiddenRefs = [
pkgs.python3
pkgs.bashNonInteractive
];
in {
nativeBuildInputs = [ removeReferencesTo ];
postInstall = ''
find "$out" -exec remove-references-to ${lib.concatMapStringsSep " " (x: "-t ${lib.escapeShellArg x}") forbiddenRefs} '{}' +
'';
disallowedReferences = forbiddenRefs;
};
};
in
stdenv.mkDerivation {
inherit name;
Expand All @@ -36,7 +39,8 @@ stdenv.mkDerivation {
propagatedBuildInputs = [ lua5_3 gmp ];

buildPhase = ''
ghc -o ${main} app/${main} -threaded -with-rtsopts "-A128M -N -I0" -rtsopts -iapp -O2 -split-sections -DNODE_LIB_PATH="\"${nodeDependencies}/lib/node_modules\"" -DNODE_BIN_PATH="\"${nodeDependencies}/bin\""
ghc -o ${main} app/${main} -threaded -with-rtsopts "-A128M -N -I0" -rtsopts -iapp -O2 -split-sections \
-DNODE_BIN_PATH="\"${nodeModules}/node_modules/.bin\"" # see Utils.hs
'';

installPhase = ''
Expand All @@ -52,8 +56,7 @@ stdenv.mkDerivation {
remove-references-to -t ${labHaskellPackages.js-dgtable} ${main}
cp ${main} $out/bin/${name}
wrapProgram $out/bin/${name} \
--prefix PATH : ${nodeDependencies}/bin \
--prefix NODE_PATH : ${nodeDependencies}/lib/node_modules
--prefix NODE_PATH : ${nodeModules}/node_modules
'';

disallowedReferences = with labHaskellPackages; [
Expand Down
4 changes: 2 additions & 2 deletions support/nix/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
args: import (builtins.fetchTarball {
name = "1lab-nixpkgs";
url = "https://github.com/nixos/nixpkgs/archive/45f4a9dfc86f0628270e35fb3bcdec035d6205df.tar.gz";
sha256 = "sha256:1z6ssk35am53pgf5h907302mx47kvgqnp4qm2z3xfy3vyly19xn8";
url = "https://github.com/nixos/nixpkgs/archive/e99366c665bdd53b7b500ccdc5226675cfc51f45.tar.gz";
sha256 = "sha256-EiED5k6gXTWoAIS8yQqi5mAX6ojnzpHwAQTS3ykeYMg=";
}) ({
overlays = [ (import ./haskell-packages.nix) ];
} // args)
Loading
Loading