summaryrefslogtreecommitdiffstats
path: root/3modules/krebs/retiolum.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-07-24 21:04:22 +0200
committermakefu <github@syntax-fehler.de>2015-07-24 21:04:22 +0200
commite1f4ef731f34056c8360de8be21c2bfbc396d2e4 (patch)
treea960212d1ee8b0666ebb934c383816900d45cc7a /3modules/krebs/retiolum.nix
parent7d71db1eb0ce36f8be914f53412615eba0090747 (diff)
parenta62be1cef8726a2afa61df3dac9e19a71882b370 (diff)
Merge remote-tracking branch 'cd/master'
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 5c26dff18..481d6565c 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.
'';
};
@@ -131,24 +131,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"
@@ -226,5 +222,5 @@ let
chmod +x $out/tinc-up
'';
-in
-out
+
+in out