From 47ef169276fcb500a3764c050dbeca1f7fc4a18b Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 19 Feb 2016 16:18:28 +0100 Subject: krebs.hosts.*: set owner --- krebs/4lib/types.nix | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'krebs/4lib/types.nix') diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index d0a537467..d63080b99 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -20,6 +20,15 @@ types // rec { default = {}; }; + owner = mkOption { + type = user; + # TODO proper user + default = { + name = "krebs"; + mail = "spam@krebsco.de"; + }; + }; + extraZones = mkOption { default = {}; # TODO: string is either MX, NS, A or AAAA -- cgit v1.2.3 From dbe2ece8ad962d654bc34f3a7c4802768df71ebb Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 19 Feb 2016 16:18:50 +0100 Subject: krebs.hosts.*.infest: RIP --- krebs/4lib/types.nix | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'krebs/4lib/types.nix') diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index d63080b99..7fb206928 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -35,19 +35,6 @@ types // rec { type = with types; attrsOf string; }; - infest = { - addr = mkOption { - type = str; - apply = trace "Obsolete option `krebs.hosts.${config.name}.infest.addr' is used. It was replaced by the `target' argument to `make` or `get`. See Makefile for more information."; - }; - port = mkOption { - type = int; - default = 22; - # TODO replacement: allow target with port, SSH-style: [lol]:666 - apply = trace "Obsolete option `krebs.hosts.${config.name}.infest.port' is used. It's gone without replacement."; - }; - }; - secure = mkOption { type = bool; default = false; -- cgit v1.2.3 From b5fbca3a365b1188c1274e3288ba39a88ecad2e3 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 21 Feb 2016 05:27:37 +0100 Subject: krebs.secret: init --- krebs/4lib/types.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'krebs/4lib/types.nix') diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index 7fb206928..55301add5 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -143,6 +143,19 @@ types // rec { merge = mergeOneOption; }; + secret-file = submodule ({ config, ... }: { + 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"; }; + source-path = mkOption { + type = str; + default = toString + "/${config._module.args.name}"; + }; + }; + }); + suffixed-str = suffs: mkOptionType { name = "string suffixed by ${concatStringsSep ", " suffs}"; -- cgit v1.2.3 From e4d427602c229a782297a74b50b2f67524e9e0d6 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 21 Feb 2016 06:38:09 +0100 Subject: krebs.types.user: add home :: absolute-pathname --- krebs/4lib/types.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'krebs/4lib/types.nix') diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index 55301add5..41af1cd4f 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -165,6 +165,10 @@ types // rec { user = submodule ({ config, ... }: { options = { + home = mkOption { + type = absolute-pathname; + default = "/home/${config.name}"; + }; mail = mkOption { type = str; # TODO retiolum mail address }; @@ -226,6 +230,21 @@ types // rec { merge = mergeOneOption; }; + # POSIX.1‐2013, 3.2 Absolute Pathname + # TODO normalize slashes + # TODO two slashes + absolute-pathname = mkOptionType { + name = "POSIX absolute pathname"; + check = s: pathname.check s && substring 0 1 s == "/"; + }; + + # POSIX.1‐2013, 3.267 Pathname + # TODO normalize slashes + pathname = mkOptionType { + name = "POSIX pathname"; + check = s: isString s && all filename.check (splitString "/" s); + }; + # POSIX.1-2013, 3.431 User Name username = mkOptionType { name = "POSIX username"; -- cgit v1.2.3 From 05be525be6d0896b155da7305b2cee950fb3530e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 21 Feb 2016 06:56:57 +0100 Subject: krebs.types.user: add uid :: int --- krebs/4lib/types.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'krebs/4lib/types.nix') diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index 41af1cd4f..422627296 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -179,6 +179,10 @@ types // rec { pubkey = mkOption { type = str; }; + uid = mkOption { + type = int; + default = genid config.name; + }; }; }); -- cgit v1.2.3 From e3ddf995e92985ee14dab5735ac55045c166aaaf Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 21 Feb 2016 07:18:13 +0100 Subject: krebs types.secret-file: owner-name -> owner :: user --- krebs/4lib/types.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'krebs/4lib/types.nix') 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}"; -- cgit v1.2.3 From 67e5fddc0bfe624c6b53b673582e92a28cf530f9 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 21 Feb 2016 07:39:24 +0100 Subject: krebs.users.krebs: init --- krebs/4lib/types.nix | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'krebs/4lib/types.nix') diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index 7792b31d5..fcb6ff3d3 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ config, lib, ... }: with builtins; with lib; @@ -22,11 +22,7 @@ types // rec { owner = mkOption { type = user; - # TODO proper user - default = { - name = "krebs"; - mail = "spam@krebsco.de"; - }; + default = config.krebs.users.krebs; }; extraZones = mkOption { @@ -183,7 +179,8 @@ types // rec { default = config._module.args.name; }; pubkey = mkOption { - type = str; + type = nullOr str; + default = null; }; uid = mkOption { type = int; -- cgit v1.2.3 From 76f1f8770d1b469d42f3f48c21208100199e17a1 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 22 Feb 2016 11:20:52 +0100 Subject: krebs types.host: properly access config.krebs.users --- krebs/4lib/types.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'krebs/4lib/types.nix') diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index fcb6ff3d3..839a1a923 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -4,6 +4,11 @@ with builtins; with lib; with types; +let + # Inherited attributes are used in submodules that have their own `config`. + inherit (config.krebs) users; +in + types // rec { host = submodule ({ config, ... }: { @@ -22,7 +27,7 @@ types // rec { owner = mkOption { type = user; - default = config.krebs.users.krebs; + default = users.krebs; }; extraZones = mkOption { -- cgit v1.2.3