diff options
author | lassulus <lass@aidsballs.de> | 2016-02-06 18:45:38 +0100 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2016-02-06 18:45:38 +0100 |
commit | fe586d704eed42421ad3fe0d140c0caa64764a68 (patch) | |
tree | a07d0c4d09ef780f703ae03435d51ac60019c956 /default.nix | |
parent | 138bdc6bf6a18a59cf47d2d2db7c4e7640f50641 (diff) | |
parent | c784d271c5dc8783e5e6308baf4f6dd26430bfca (diff) |
Merge remote-tracking branch 'cd/master'
Diffstat (limited to 'default.nix')
-rw-r--r-- | default.nix | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/default.nix b/default.nix index 1637aa464..b0ad60d8a 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,15 @@ -{ current-date ? abort "current-date not defined" -, current-host-name ? abort "current-host-name not defined" -, current-user-name ? builtins.getEnv "LOGNAME" +{ configuration ? import (nixpkgs-path + "/nixos/lib/from-env.nix") "NIXOS_CONFIG" <nixos-config> +, system ? builtins.currentSystem +, current-host-name ? + let v = builtins.getEnv "HOSTNAME"; in + if v != "" then v else builtins.readFile /proc/sys/kernel/hostname +, current-user-name ? + let v = builtins.getEnv "LOGNAME"; in + if v != "" then v else abort "undefined variable: LOGNAME" +, nixpkgs-path ? + if (builtins.tryEval <nixpkgs/krebs>).success + then <upstream-nixpkgs> + else <nixpkgs> , StrictHostKeyChecking ? "yes" }@args: @@ -8,17 +17,18 @@ let stockholm = { inherit krebs; inherit users; inherit lib; - inherit pkgs; + inherit config options pkgs; + system = config.system.build.toplevel; }; krebs = import ./krebs (args // { inherit lib stockholm; }); lib = let - nlib = import <nixpkgs/lib>; + nlib = import (slib.npath "lib"); klib = import (slib.kpath "4lib") { lib = nlib; }; slib = rec { - stockholm-path = ./.; - nspath = ns: p: stockholm-path + "/${ns}/${p}"; + nspath = ns: p: ./. + "/${ns}/${p}"; + npath = p: nixpkgs-path + "/${p}"; kpath = nspath "krebs"; upath = nspath current-user-name; }; @@ -27,7 +37,7 @@ let stockholm = { (import p { lib = nlib // klib; }); in nlib // klib // slib // ulib // builtins; - inherit (eval {}) pkgs; + inherit (eval configuration) config options pkgs; base-module = { config, ... }: { imports = builtins.filter lib.dir.has-default-nix (lib.concatLists [ @@ -45,7 +55,8 @@ let stockholm = { in kpkgs // upkgs; }; - eval = config: import <nixpkgs/nixos/lib/eval-config.nix> { + eval = config: import (lib.npath "nixos/lib/eval-config.nix") { + inherit system; specialArgs = { inherit lib; }; |