about summary refs log tree commit diff
path: root/modules/nix/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-02-22 19:48:02 +0000
committerAlyssa Ross <hi@alyssa.is>2019-02-22 19:48:02 +0000
commit768bc58b26fdea93e3f341124c5ec70b446c3f6e (patch)
tree054ada3a1ca56069b74e247202dce723ad9b35a3 /modules/nix/default.nix
parentebe5e2aaaf5c385e9fc0d685d2c94c206f14b78a (diff)
downloadnixlib-768bc58b26fdea93e3f341124c5ec70b446c3f6e.tar
nixlib-768bc58b26fdea93e3f341124c5ec70b446c3f6e.tar.gz
nixlib-768bc58b26fdea93e3f341124c5ec70b446c3f6e.tar.bz2
nixlib-768bc58b26fdea93e3f341124c5ec70b446c3f6e.tar.lz
nixlib-768bc58b26fdea93e3f341124c5ec70b446c3f6e.tar.xz
nixlib-768bc58b26fdea93e3f341124c5ec70b446c3f6e.tar.zst
nixlib-768bc58b26fdea93e3f341124c5ec70b446c3f6e.zip
nix: replace bootstrapping hack with cleanSource
Diffstat (limited to 'modules/nix/default.nix')
-rw-r--r--modules/nix/default.nix23
1 files changed, 2 insertions, 21 deletions
diff --git a/modules/nix/default.nix b/modules/nix/default.nix
index eb2f41c49697..598c27aff11f 100644
--- a/modules/nix/default.nix
+++ b/modules/nix/default.nix
@@ -5,31 +5,12 @@ let
   isDarwin = options.environment ? "darwinConfig";
 
   # Copy entire nixlib tree to the store.
-  root =
-    let
-      # Just needed for runCommand and git.
-      bootstrapPkgs = import ../.. {};
-
-      # Remove .git before adding to the store, because it's likely to
-      # be large. Ideally, we would also remove files in .gitignore
-      # here too, but that would require either a builtin for running a
-      # shell command, or a gitignore parser written in Nix (eww).
-      workingTree = builtins.filterSource (path: type: baseNameOf path != ".git") ../..;
-    in
-      # Now, use a derivation to delete any gitignored files. Then, we
-      # can use the resulting Nix store path as root tree.
-      toString (bootstrapPkgs.runCommand "nixlib-root" {} ''
-        cp -R ${workingTree} "$out"
-        chmod -R u+w "$out"
-        ${bootstrapPkgs.git}/bin/git init "$out"
-        ${bootstrapPkgs.git}/bin/git -C "$out" clean -fX
-        rm -rf "$out/.git"
-      '');
+  root = lib.cleanSource ../..;
 
 in {
   nix.nixPath = [
     "nixos-config=${root}/sys/${config.networking.hostName}.nix"
-    root
+    root.outPath
   ];
 
   nixpkgs.overlays =