From 926395d628aa4cf9c96f234e5039a2d117d8f67a Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Sun, 6 Nov 2016 22:38:31 +0100 Subject: reorganize modules --- modules/system/default.nix | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 modules/system/default.nix (limited to 'modules/system') 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 + ''; + }; + + }; +} -- cgit v1.2.3