diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2016-12-02 23:54:46 +0100 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2016-12-02 23:54:46 +0100 |
| commit | 61a91d3c9994aa1a176a499552c44b15dbb053d7 (patch) | |
| tree | 06095a67785502cd53aef50ece893638e1f8504b /modules | |
| parent | b0e55cb39e6ee9b7c7b3f54827c8d776ae3946bf (diff) | |
improve system activation
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/system/activation-scripts.nix | 13 | ||||
| -rw-r--r-- | modules/system/default.nix | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/modules/system/activation-scripts.nix b/modules/system/activation-scripts.nix index fda882f..f32e1de 100644 --- a/modules/system/activation-scripts.nix +++ b/modules/system/activation-scripts.nix @@ -34,6 +34,19 @@ in config = { + system.build.activate = pkgs.writeText "activate-system" '' + #! ${pkgs.stdenv.shell} + + # Make this configuration the current configuration. + # The readlink is there to ensure that when $systemConfig = /system + # (which is a symlink to the store), /run/current-system is still + # used as a garbage collection root. + ln -sfn $(cat /nix/var/nix/profiles/system/systemConfig) /run/current-system + + # Prevent the current configuration from being garbage-collected. + ln -sfn /run/current-system /nix/var/nix/gcroots/current-system + ''; + system.activationScripts.script.text = '' #! ${pkgs.stdenv.shell} diff --git a/modules/system/default.nix b/modules/system/default.nix index 7689e42..9cf190e 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -46,6 +46,8 @@ in buildCommand = '' mkdir $out + systemConfig=$out + ln -s ${cfg.build.etc}/etc $out/etc ln -s ${cfg.path} $out/sw @@ -57,6 +59,8 @@ in chmod u+x $out/activate unset activationScript + echo -n "$systemConfig" > $out/systemConfig + echo -n "$nixdarwinLabel" > $out/nixdarwin-version echo -n "$system" > $out/system ''; |
