From e3ddf995e92985ee14dab5735ac55045c166aaaf Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 21 Feb 2016 07:18:13 +0100 Subject: [PATCH] krebs types.secret-file: owner-name -> owner :: user --- krebs/3modules/default.nix | 7 +++++++ krebs/3modules/secret.nix | 2 +- krebs/4lib/types.nix | 10 ++++++++-- tv/3modules/charybdis/default.nix | 4 ++-- tv/3modules/ejabberd/default.nix | 2 +- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index df1c7db63..7a343d333 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -104,6 +104,13 @@ let retiolum = "hosts"; }; + krebs.users.root = { + home = "/root"; + name = "root"; + pubkey = config.krebs.build.host.ssh.pubkey; + uid = 0; + }; + networking.extraHosts = concatStringsSep "\n" (flatten ( mapAttrsToList (hostname: host: mapAttrsToList (netname: net: diff --git a/krebs/3modules/secret.nix b/krebs/3modules/secret.nix index 46802a661..579f375f3 100644 --- a/krebs/3modules/secret.nix +++ b/krebs/3modules/secret.nix @@ -25,7 +25,7 @@ in { --compare \ --verbose \ --mode=${shell.escape file.mode} \ - --owner=${shell.escape file.owner-name} \ + --owner=${shell.escape file.owner.name} \ --group=${shell.escape file.group-name} \ ${shell.escape file.source-path} \ ${shell.escape file.path} \ diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index 422627296..7792b31d5 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -147,8 +147,14 @@ types // rec { options = { path = mkOption { type = str; }; mode = mkOption { type = str; default = "0400"; }; - owner-name = mkOption { type = str; default = "root"; }; - group-name = mkOption { type = str; default = "root"; }; + owner = mkOption { + type = user; + default = config.krebs.users.root; + }; + group-name = mkOption { + type = str; + default = "root"; + }; source-path = mkOption { type = str; default = toString + "/${config._module.args.name}"; diff --git a/tv/3modules/charybdis/default.nix b/tv/3modules/charybdis/default.nix index 87cb37ef4..3af971cd4 100644 --- a/tv/3modules/charybdis/default.nix +++ b/tv/3modules/charybdis/default.nix @@ -18,7 +18,7 @@ in { type = types.secret-file; default = { path = "${cfg.user.home}/dh.pem"; - owner-name = "charybdis"; + owner = cfg.user; source-path = toString + "/charybdis.dh.pem"; }; }; @@ -26,7 +26,7 @@ in { type = types.secret-file; default = { path = "${cfg.user.home}/ssl.key.pem"; - owner-name = "charybdis"; + owner = cfg.user; source-path = toString + "/charybdis.key.pem"; }; }; diff --git a/tv/3modules/ejabberd/default.nix b/tv/3modules/ejabberd/default.nix index da108eb52..95ea24be1 100644 --- a/tv/3modules/ejabberd/default.nix +++ b/tv/3modules/ejabberd/default.nix @@ -7,7 +7,7 @@ in { type = types.secret-file; default = { path = "${cfg.user.home}/ejabberd.pem"; - owner-name = "ejabberd"; + owner = cfg.user; source-path = toString + "/ejabberd.pem"; }; };