about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--modules/nix/default.nix13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/nix/default.nix b/modules/nix/default.nix
index 598c27aff11f..9f5af88ff117 100644
--- a/modules/nix/default.nix
+++ b/modules/nix/default.nix
@@ -4,22 +4,23 @@ let
   # Most of the standard Darwin-detection methods cause infinite recursion.
   isDarwin = options.environment ? "darwinConfig";
 
-  # Copy entire nixlib tree to the store.
-  root = lib.cleanSource ../..;
-
 in {
   nix.nixPath = [
-    "nixos-config=${root}/sys/${config.networking.hostName}.nix"
-    root.outPath
+    "nixos-config=/run/current-system/nixlib/sys/${config.networking.hostName}.nix"
+    "/run/current-system/nixlib"
   ];
 
+  system.extraSystemBuilderCmds = ''
+    ln -s ${lib.cleanSource ../..} $out/nixlib
+  '';
+
   nixpkgs.overlays =
     let
       inherit (builtins) attrNames readDir;
       dir = ../../nixpkgs-overlays;
       names = attrNames (readDir dir);
     in
-      map (o: import "${root}/nixpkgs-overlays/${o}") names;
+      map (o: import "${dir}/${o}") names;
 
   services = lib.optionalAttrs isDarwin
     { nix-daemon.enable = true; };