From 5fdae43a99af8783549e8b7d1424556d1f219bf6 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 19 Oct 2015 21:20:38 +0200 Subject: [PATCH] move user namespaces into "users" attribute IOW get ${user-name} -> get users.${user-name} --- Makefile | 2 +- default.nix | 22 ++++++++++++---------- krebs/default.nix | 3 ++- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 8834cb7c8..aefd17147 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # make infest system=foo [target=bar] # make [deploy] system=foo [target=bar] # make [deploy] systems='foo bar' -# make eval get=tv.wu.config.time.timeZone [filter=json] +# make eval get=users.tv.wu.config.time.timeZone [filter=json] # .ONESHELL: diff --git a/default.nix b/default.nix index 841882f54..ff782e281 100644 --- a/default.nix +++ b/default.nix @@ -25,16 +25,18 @@ in with klib; let kpkgs // upkgs; }; - out = - { inherit (eval {}) config options pkgs; } // - lib.mapAttrs - (name: _: - if builtins.pathExists (nspath name "default.nix") - then import (nspath name "default.nix") - else import-1systems (nspath name "1systems")) - (lib.filterAttrs - (n: t: !lib.hasPrefix "." n && t == "directory") - (builtins.readDir ./.)); + out = { + inherit (eval {}) config options pkgs; + krebs = import ./krebs; + users = lib.mapAttrs + (name: _: + if builtins.pathExists (nspath name "default.nix") + then import (nspath name "default.nix") + else import-1systems (nspath name "1systems")) + (lib.filterAttrs + (n: t: !lib.hasPrefix "." n && t == "directory" && n != "krebs") + (builtins.readDir ./.)); + }; eval = path: import { modules = [ diff --git a/krebs/default.nix b/krebs/default.nix index b98fad558..6e2aa2f9e 100644 --- a/krebs/default.nix +++ b/krebs/default.nix @@ -132,7 +132,7 @@ stockholm = import ../. current; get-config = system: - stockholm.${current-user-name}.${system}.config + stockholm.users.${current-user-name}.${system}.config or (abort "unknown system: ${system}"); doc = s: @@ -181,6 +181,7 @@ --profile ${lib.shell.escape config.krebs.build.profile} \ --set \ -A ${lib.escapeShellArg (lib.concatStringsSep "." [ + "users" config.krebs.build.user.name config.krebs.build.host.name "system"