From 928ac9f153682aa2a98213a39b6732591a8c27a6 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 9 Sep 2016 19:38:12 +0200 Subject: k 4 types: add default value for user.mail --- krebs/4lib/types.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'krebs/4lib') diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index 37d44606b..02ca2b8db 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -284,6 +284,7 @@ types // rec { }; mail = mkOption { type = str; # TODO retiolum mail address + default = "${config._module.args.name}@${config.networking.hostName}.r"; }; name = mkOption { type = username; -- cgit v1.2.3 From 6c71792b6d22c7564b187fa6891fb8d36270a9ef Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 13 Oct 2016 21:49:50 +0200 Subject: krebs lib: with lib --- krebs/4lib/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'krebs/4lib') diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index 49241cc82..c901a1bde 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -1,9 +1,12 @@ -{ config, lib, ... }: +_: + +let + lib = import ; +in -with builtins; with lib; -let out = import // rec { +let out = lib // rec { eq = x: y: x == y; ne = x: y: x != y; -- cgit v1.2.3 From 9cb65273b1e832f1bf7d98e977a0179c81d24b44 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 13 Oct 2016 21:01:22 +0200 Subject: lib: remove addName* --- krebs/4lib/default.nix | 5 ----- krebs/4lib/git.nix | 7 ++++++- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'krebs/4lib') diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index c901a1bde..cf5395039 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -13,11 +13,6 @@ let out = lib // rec { mod = x: y: x - y * (x / y); - addName = name: set: - set // { inherit name; }; - - addNames = mapAttrs addName; - guard = spec@{ type, value, ... }: assert isOptionType type; if type.check value diff --git a/krebs/4lib/git.nix b/krebs/4lib/git.nix index d50ba2018..005c017a9 100644 --- a/krebs/4lib/git.nix +++ b/krebs/4lib/git.nix @@ -1,7 +1,12 @@ { lib, ... }: +with lib; + let - inherit (lib) addNames escapeShellArg makeSearchPath optionalString; + addName = name: set: + set // { inherit name; }; + + addNames = mapAttrs addName; commands = addNames { git-receive-pack = {}; -- cgit v1.2.3 From b4ec1fba50dc81df89cce88808dab1e232806cf4 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 13 Oct 2016 21:06:43 +0200 Subject: lib: inline has-default-nix --- krebs/4lib/default.nix | 2 -- 1 file changed, 2 deletions(-) (limited to 'krebs/4lib') diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index cf5395039..b95564f74 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -28,8 +28,6 @@ let out = lib // rec { lib = lib // { inherit genid optionalTrace; }; }; - dir.has-default-nix = path: pathExists (path + "/default.nix"); - genid = import ./genid.nix { lib = lib // out; }; genid_signed = x: ((genid x) + 16777216) / 2; git = import ./git.nix { lib = lib // out; }; -- cgit v1.2.3 From 1a5f52234e4a21f21eb198ed0bffeb7dc2168bdf Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 13 Oct 2016 21:18:40 +0200 Subject: krebs lib: move {eq,ne,mod} to lib --- krebs/4lib/default.nix | 5 ----- 1 file changed, 5 deletions(-) (limited to 'krebs/4lib') diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index b95564f74..3f224edd1 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -8,11 +8,6 @@ with lib; let out = lib // rec { - eq = x: y: x == y; - ne = x: y: x != y; - - mod = x: y: x - y * (x / y); - guard = spec@{ type, value, ... }: assert isOptionType type; if type.check value -- cgit v1.2.3 From 7c91a1954992db9fa06619753faa3a193a196040 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 13 Oct 2016 21:49:04 +0200 Subject: lib: don't define defaults that require config --- krebs/4lib/default.nix | 1 - krebs/4lib/types.nix | 13 +------------ 2 files changed, 1 insertion(+), 13 deletions(-) (limited to 'krebs/4lib') diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index 3f224edd1..c40b9a868 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -19,7 +19,6 @@ let out = lib // rec { ])); types = import ./types.nix { - inherit config; lib = lib // { inherit genid optionalTrace; }; }; diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index 02ca2b8db..8d6ace2e5 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -1,14 +1,9 @@ -{ config, lib, ... }: +{ lib, ... }: with builtins; with lib; with types; -let - # Inherited attributes are used in submodules that have their own `config`. - inherit (config.krebs) build users; -in - types // rec { host = submodule ({ config, ... }: { @@ -27,7 +22,6 @@ types // rec { owner = mkOption { type = user; - default = users.krebs; }; extraZones = mkOption { @@ -49,10 +43,6 @@ types // rec { ssh.pubkey = mkOption { type = nullOr ssh-pubkey; default = null; - apply = x: - optionalTrace (x == null && config.owner.name == build.user.name) - "The option `krebs.hosts.${config.name}.ssh.pubkey' is unused." - x; }; ssh.privkey = mkOption { type = nullOr ssh-privkey; @@ -187,7 +177,6 @@ types // rec { }; owner = mkOption { type = user; - default = users.root; }; group-name = mkOption { type = str; -- cgit v1.2.3