summaryrefslogtreecommitdiffstats
path: root/3modules/krebs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2015-07-24 12:41:41 +0200
committertv <tv@krebsco.de>2015-07-24 12:41:41 +0200
commit1fa2d83e3cdd3305fde7751d0c3ae64d5f8fed48 (patch)
tree504fc54dbce27eda2e541863d3d09a102fb0249a /3modules/krebs
parent873e1f90025f7eb1b13607130dbc4164cc2a0c44 (diff)
krebs.retiolum: define type of hosts
Diffstat (limited to '3modules/krebs')
-rw-r--r--3modules/krebs/retiolum.nix40
1 files changed, 18 insertions, 22 deletions
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