[Nix-dev] optionally copying configuration.nix into system derivation

Marc Weber marco-oweber at gmx.de
Tue Apr 27 04:47:55 CEST 2010


Do you mind me comitting this to NixOS ?

commit 776312087c01271ea127daa92abe5742ba53b230
Author: Marc Weber <marco-oweber at gmx.de>
Date:   Tue Apr 27 03:40:54 2010 +0200

    add system.extraSystemBuilderCmds option which can be used to copy
    configuration.nix to the system store path. This may be helpful to track
    down regressions faster.

diff --git a/modules/system/activation/top-level.nix b/modules/system/activation/top-level.nix
index 0128ffb..09cbbf8 100644
--- a/modules/system/activation/top-level.nix
+++ b/modules/system/activation/top-level.nix
@@ -31,6 +31,15 @@ let
         Name of the kernel file to be passed to the bootloader.
       '';
     };
+
+    system.extraSystemBuilderCmds = pkgs.lib.mkOption {
+      default = "";
+      description = ''
+        You can add additional commands which will be executed when creating
+        the system derivation. One usage example is:
+        cp /etc/nixos/configuration.nix $out
+      '';
+    };
     
   };
 
@@ -94,6 +103,8 @@ let
       ensureDir $out/bin
       substituteAll ${./switch-to-configuration.sh} $out/bin/switch-to-configuration
       chmod +x $out/bin/switch-to-configuration
+
+      ${config.system.extraSystemBuilderCmds}
     '';
 
Marc Weber



More information about the nix-dev mailing list