diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2016-11-06 22:38:31 +0100 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2016-11-06 22:38:31 +0100 |
| commit | 926395d628aa4cf9c96f234e5039a2d117d8f67a (patch) | |
| tree | 565024322564530bfcb5cde3244519eeb15e2997 /modules/system/default.nix | |
| parent | 50081e675e947c6c4271bfcf0dca76e1379e16b4 (diff) | |
reorganize modules
Diffstat (limited to 'modules/system/default.nix')
| -rw-r--r-- | modules/system/default.nix | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/modules/system/default.nix b/modules/system/default.nix new file mode 100644 index 0000000..9435f92 --- /dev/null +++ b/modules/system/default.nix @@ -0,0 +1,63 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.system; + +in + +{ + options = { + + system.build = mkOption { + internal = true; + default = {}; + description = '' + Attribute set of derivation used to setup the system. + ''; + }; + + system.path = mkOption { + internal = true; + type = types.package; + description = '' + The packages you want in the system environment. + ''; + }; + + system.nixdarwinLabel = mkOption { + type = types.str; + default = "16.09"; + }; + + }; + + config = { + + system.build.toplevel = pkgs.stdenvNoCC.mkDerivation { + name = "nixdarwin-system-${cfg.nixdarwinLabel}"; + preferLocalBuild = true; + + activationScript = cfg.activationScripts.script.text; + inherit (cfg) nixdarwinLabel; + + buildCommand = '' + mkdir $out + + ln -s ${cfg.build.etc}/etc $out/etc + ln -s ${cfg.path} $out/sw + + echo "$activationScript" > $out/activate + substituteInPlace $out/activate --subst-var out + chmod u+x $out/activate + unset activationScript + + echo -n "$nixdarwinLabel" > $out/nixdarwin-version + echo -n "$system" > $out/system + ''; + }; + + }; +} |
