Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning unnecessary Nix deps using remove-references-to #240

Merged
merged 4 commits into from
Jun 18, 2020
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dist
dist-*
.ghc.environment.*
result
result-2
.shake
.neuron
neuron.prof
5 changes: 2 additions & 3 deletions ci.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
let
project = import ./project.nix { };
pkgs = import <nixpkgs> { };
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;
}
24 changes: 23 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
(import ./project.nix {}).ghc.neuron
let
ghc = (import ./project.nix {}).ghc;
neuron = ghc.neuron;
in
neuron.overrideDerivation (drv: {
# 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
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
'';
})