summaryrefslogtreecommitdiffstats
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
parente082da2c23ebff82717df11d266ecfd22a70db56 (diff)
krebs.retiolum: define type of hosts
-rw-r--r--1systems/tv/cd.nix1
-rw-r--r--1systems/tv/mkdir.nix1
-rw-r--r--1systems/tv/nomic.nix1
-rw-r--r--1systems/tv/rmdir.nix1
-rw-r--r--1systems/tv/wu.nix1
-rw-r--r--3modules/krebs/retiolum.nix40
6 files changed, 18 insertions, 27 deletions
diff --git a/1systems/tv/cd.nix b/1systems/tv/cd.nix
index 2f8cf819..bf556e01 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 05d76c4c..823f0443 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 bae12d36..ef4a5ca3 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 2cf9668c..f15c7902 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 c5678a19..0b5b8289 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 447592ee..1406f2fc 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