diff options
author | tv <tv@krebsco.de> | 2015-07-24 12:41:41 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2015-07-24 12:41:41 +0200 |
commit | 1fa2d83e3cdd3305fde7751d0c3ae64d5f8fed48 (patch) | |
tree | 504fc54dbce27eda2e541863d3d09a102fb0249a | |
parent | 873e1f90025f7eb1b13607130dbc4164cc2a0c44 (diff) |
krebs.retiolum: define type of hosts
-rw-r--r-- | 1systems/tv/cd.nix | 1 | ||||
-rw-r--r-- | 1systems/tv/mkdir.nix | 1 | ||||
-rw-r--r-- | 1systems/tv/nomic.nix | 1 | ||||
-rw-r--r-- | 1systems/tv/rmdir.nix | 1 | ||||
-rw-r--r-- | 1systems/tv/wu.nix | 1 | ||||
-rw-r--r-- | 3modules/krebs/retiolum.nix | 40 |
6 files changed, 18 insertions, 27 deletions
diff --git a/1systems/tv/cd.nix b/1systems/tv/cd.nix index 2f8cf81..bf556e0 100644 --- a/1systems/tv/cd.nix +++ b/1systems/tv/cd.nix @@ -89,7 +89,6 @@ in imports = [ ../../3modules/krebs/retiolum.nix ]; krebs.retiolum = { enable = true; - hosts = ../../Zhosts; connectTo = [ "fastpoke" "pigstarter" diff --git a/1systems/tv/mkdir.nix b/1systems/tv/mkdir.nix index 05d76c4..823f044 100644 --- a/1systems/tv/mkdir.nix +++ b/1systems/tv/mkdir.nix @@ -32,7 +32,6 @@ with lib; imports = [ ../../3modules/krebs/retiolum.nix ]; krebs.retiolum = { enable = true; - hosts = ../../Zhosts; connectTo = [ "cd" "fastpoke" diff --git a/1systems/tv/nomic.nix b/1systems/tv/nomic.nix index bae12d3..ef4a5ca 100644 --- a/1systems/tv/nomic.nix +++ b/1systems/tv/nomic.nix @@ -40,7 +40,6 @@ with lib; imports = [ ../../3modules/krebs/retiolum.nix ]; krebs.retiolum = { enable = true; - hosts = ../../Zhosts; connectTo = [ "gum" "pigstarter" diff --git a/1systems/tv/rmdir.nix b/1systems/tv/rmdir.nix index 2cf9668..f15c790 100644 --- a/1systems/tv/rmdir.nix +++ b/1systems/tv/rmdir.nix @@ -32,7 +32,6 @@ with lib; imports = [ ../../3modules/krebs/retiolum.nix ]; krebs.retiolum = { enable = true; - hosts = ../../Zhosts; connectTo = [ "cd" "mkdir" diff --git a/1systems/tv/wu.nix b/1systems/tv/wu.nix index c5678a1..0b5b828 100644 --- a/1systems/tv/wu.nix +++ b/1systems/tv/wu.nix @@ -148,7 +148,6 @@ in imports = [ ../../3modules/krebs/retiolum.nix ]; krebs.retiolum = { enable = true; - hosts = ../../Zhosts; connectTo = [ "gum" "pigstarter" diff --git a/3modules/krebs/retiolum.nix b/3modules/krebs/retiolum.nix index 447592e..1406f2f 100644 --- a/3modules/krebs/retiolum.nix +++ b/3modules/krebs/retiolum.nix @@ -57,9 +57,9 @@ let }; hosts = mkOption { - default = null; + type = with types; either package path; + default = ../../Zhosts; description = '' - Hosts package or path to use. If a path is given, then it will be used to generate an ad-hoc package. ''; }; @@ -127,24 +127,20 @@ let }; tinc = cfg.tincPackage; - hostsType = builtins.typeOf cfg.hosts; - hosts = - if hostsType == "package" then - # use package as is - cfg.hosts - else if hostsType == "path" then - # use path to generate a package - pkgs.stdenv.mkDerivation { - name = "custom-retiolum-hosts"; - src = cfg.hosts; - installPhase = '' - mkdir $out - find . -name .git -prune -o -type f -print0 | xargs -0 cp --target-directory $out - ''; - } - else - abort "The option `services.retiolum.hosts' must be set to a package or a path" - ; + + hosts = getAttr (typeOf cfg.hosts) { + package = cfg.hosts; + path = pkgs.stdenv.mkDerivation { + name = "custom-retiolum-hosts"; + src = cfg.hosts; + installPhase = '' + mkdir $out + find . -name .git -prune -o -type f -print0 \ + | xargs -0 cp --target-directory $out + ''; + }; + }; + iproute = cfg.iproutePackage; retiolumExtraHosts = import (pkgs.runCommand "retiolum-etc-hosts" @@ -222,5 +218,5 @@ let chmod +x $out/tinc-up ''; -in -out + +in out |