summaryrefslogtreecommitdiffstats
path: root/3modules/krebs/retiolum.nix
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-07-24 12:41:41 +0200
committertv <tv@shackspace.de>2015-07-24 12:41:41 +0200
commitfaf5f6c172d6a6915e18cdec85e3543051eb0449 (patch)
tree504fc54dbce27eda2e541863d3d09a102fb0249a /3modules/krebs/retiolum.nix
parente082da2c23ebff82717df11d266ecfd22a70db56 (diff)
krebs.retiolum: define type of hosts
Diffstat (limited to '3modules/krebs/retiolum.nix')
-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 447592eef..1406f2fc4 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