From 7ee135c044a616b8cca565624412b75d4bb40211 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Thu, 18 Jun 2020 17:59:09 -0400 Subject: [PATCH 1/4] Remove Haskell refs from final neuron drv --- default.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index accc1f999..cbb6c84f2 100644 --- a/default.nix +++ b/default.nix @@ -1 +1,14 @@ -(import ./project.nix {}).ghc.neuron +let + ghc = (import ./project.nix {}).ghc; + neuron = ghc.neuron; +in + neuron.overrideDerivation (drv: { + disallowedReferences = [ ghc.pandoc ghc.pandoc-types ghc.shake ghc.warp ghc.HTTP ]; + postInstall = '' + remove-references-to -t ${ghc.pandoc} $out/bin/neuron + remove-references-to -t ${ghc.pandoc-types} $out/bin/neuron + remove-references-to -t ${ghc.shake} $out/bin/neuron + remove-references-to -t ${ghc.warp} $out/bin/neuron + remove-references-to -t ${ghc.HTTP} $out/bin/neuron + ''; + }) From 931288d06e6b9a9db14fad7536ca885b4547f0b6 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Thu, 18 Jun 2020 18:34:21 -0400 Subject: [PATCH 2/4] Discard more references --- default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index cbb6c84f2..e9cb8b8fc 100644 --- a/default.nix +++ b/default.nix @@ -3,12 +3,15 @@ let neuron = ghc.neuron; in neuron.overrideDerivation (drv: { - disallowedReferences = [ ghc.pandoc ghc.pandoc-types ghc.shake ghc.warp ghc.HTTP ]; + disallowedReferences = [ ghc.pandoc ghc.pandoc-types ghc.shake ghc.warp ghc.HTTP ghc.js-jquery ghc.js-dgtable ghc.js-flot ]; postInstall = '' remove-references-to -t ${ghc.pandoc} $out/bin/neuron remove-references-to -t ${ghc.pandoc-types} $out/bin/neuron remove-references-to -t ${ghc.shake} $out/bin/neuron remove-references-to -t ${ghc.warp} $out/bin/neuron remove-references-to -t ${ghc.HTTP} $out/bin/neuron + remove-references-to -t ${ghc.js-jquery} $out/bin/neuron + remove-references-to -t ${ghc.js-dgtable} $out/bin/neuron + remove-references-to -t ${ghc.js-flot} $out/bin/neuron ''; }) From 036b78cba428e13cb169bf5d7ef3b787e2dd8a78 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Thu, 18 Jun 2020 18:40:15 -0400 Subject: [PATCH 3/4] Update ci.nix to reuse existing Nix files --- .gitignore | 1 + ci.nix | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index da47f8fd8..1073eb824 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ dist dist-* .ghc.environment.* result +result-2 .shake .neuron neuron.prof diff --git a/ci.nix b/ci.nix index aa189d5bf..64b3f9343 100644 --- a/ci.nix +++ b/ci.nix @@ -1,11 +1,10 @@ let - project = import ./project.nix { }; pkgs = import { }; in pkgs.recurseIntoAttrs { # Build both default.nix and shell.nix such that both derivations are # pushed to cachix. This allows the development workflow (bin/run, etc.) to # use cachix to full extent. - neuron = project.ghc.neuron; - neuronShell = project.shells.ghc; + neuron = import ./default.nix; + neuronShell = import ./shell.nix; } From 93e4d04a6c5727a38ca98383f9196410f2833824 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Thu, 18 Jun 2020 18:43:42 -0400 Subject: [PATCH 4/4] Add comments --- default.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index e9cb8b8fc..feee52c96 100644 --- a/default.nix +++ b/default.nix @@ -3,8 +3,14 @@ let neuron = ghc.neuron; in neuron.overrideDerivation (drv: { - disallowedReferences = [ ghc.pandoc ghc.pandoc-types ghc.shake ghc.warp ghc.HTTP ghc.js-jquery ghc.js-dgtable ghc.js-flot ]; - postInstall = '' + # Avoid transitive runtime dependency on the whole GHC distribution due to + # Cabal's `Path_*` module thingy. For details, see: + # https://github.com/NixOS/nixpkgs/blob/46405e7952c4b41ca0ba9c670fe9a84e8a5b3554/pkgs/development/tools/pandoc/default.nix#L13-L28 + # + # In order to keep this list up to date, use nix-store and why-depends as + # explained here: https://www.srid.ca/04b88e01.html + disallowedReferences = [ ghc.pandoc ghc.pandoc-types ghc.shake ghc.warp ghc.HTTP ghc.js-jquery ghc.js-dgtable ghc.js-flot ]; + postInstall = '' remove-references-to -t ${ghc.pandoc} $out/bin/neuron remove-references-to -t ${ghc.pandoc-types} $out/bin/neuron remove-references-to -t ${ghc.shake} $out/bin/neuron @@ -13,5 +19,5 @@ in remove-references-to -t ${ghc.js-jquery} $out/bin/neuron remove-references-to -t ${ghc.js-dgtable} $out/bin/neuron remove-references-to -t ${ghc.js-flot} $out/bin/neuron - ''; + ''; })