about summary refs log tree commit diff
diff options
context:
space:
mode:
-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 =