From 6cbe21aac7680af7a6c6c2ea367ee0569d53bb21 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 11 Feb 2016 23:16:08 +0100 Subject: krebs.retiolum: make hostsPackage configurable --- krebs/3modules/retiolum.nix | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'krebs/3modules/retiolum.nix') diff --git a/krebs/3modules/retiolum.nix b/krebs/3modules/retiolum.nix index 2bf8aa5d..3ebb5e23 100644 --- a/krebs/3modules/retiolum.nix +++ b/krebs/3modules/retiolum.nix @@ -64,6 +64,21 @@ let ''; }; + hostsPackage = mkOption { + type = types.package; + default = pkgs.stdenv.mkDerivation { + name = "${cfg.netname}-tinc-hosts"; + phases = [ "installPhase" ]; + installPhase = '' + mkdir $out + ${concatStrings (mapAttrsToList (_: host: '' + echo ${shell.escape host.nets.${cfg.netname}.tinc.config} \ + > $out/${shell.escape host.name} + '') cfg.hosts)} + ''; + }; + }; + iproutePackage = mkOption { type = types.package; default = pkgs.iproute; @@ -130,18 +145,6 @@ let tinc = cfg.tincPackage; - tinc-hosts = pkgs.stdenv.mkDerivation { - name = "${cfg.netname}-tinc-hosts"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir $out - ${concatStrings (mapAttrsToList (_: host: '' - echo ${shell.escape host.nets.${cfg.netname}.tinc.config} \ - > $out/${shell.escape host.name} - '') cfg.hosts)} - ''; - }; - iproute = cfg.iproutePackage; confDir = pkgs.runCommand "retiolum" { @@ -153,7 +156,7 @@ let mkdir -p $out - ln -s ${tinc-hosts} $out/hosts + ln -s ${cfg.hostsPackage} $out/hosts cat > $out/tinc.conf < Date: Thu, 11 Feb 2016 23:49:45 +0100 Subject: krebs.retiolum.hosts*: bump description --- krebs/3modules/retiolum.nix | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'krebs/3modules/retiolum.nix') diff --git a/krebs/3modules/retiolum.nix b/krebs/3modules/retiolum.nix index 3ebb5e23..40769527 100644 --- a/krebs/3modules/retiolum.nix +++ b/krebs/3modules/retiolum.nix @@ -58,9 +58,9 @@ let default = filterAttrs (_: h: hasAttr cfg.netname h.nets) config.krebs.hosts; description = '' - Hosts which should be part of the tinc configuration. - Note that these hosts must have a correspondingly named network - configured, see config.krebs.retiolum.netname. + Hosts to generate config.krebs.retiolum.hostsPackage. + Note that these hosts must have a network named + config.krebs.retiolum.netname. ''; }; @@ -77,6 +77,20 @@ let '') cfg.hosts)} ''; }; + description = '' + Package of tinc host configuration files. By default, a package will + be generated from config.krebs.retiolum.hosts. This + option's main purpose is to expose the generated hosts package to other + modules, like config.krebs.tinc_graphs. But it can + also be used to provide a custom hosts directory. + ''; + example = literalExample '' + (pkgs.stdenv.mkDerivation { + name = "my-tinc-hosts"; + src = /home/tv/my-tinc-hosts; + installPhase = "cp -R . $out"; + }) + ''; }; iproutePackage = mkOption { -- cgit v1.2.3 From 673853e092c211e26a08030f87f9c868c6442a71 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 14 Feb 2016 16:43:44 +0100 Subject: RIP specialArgs.lib --- krebs/3modules/retiolum.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'krebs/3modules/retiolum.nix') diff --git a/krebs/3modules/retiolum.nix b/krebs/3modules/retiolum.nix index 40769527..d0162eae 100644 --- a/krebs/3modules/retiolum.nix +++ b/krebs/3modules/retiolum.nix @@ -1,11 +1,11 @@ { config, pkgs, lib, ... }: -with lib; +with config.krebs.lib; let cfg = config.krebs.retiolum; out = { options.krebs.retiolum = api; - config = mkIf cfg.enable imp; + config = lib.mkIf cfg.enable imp; }; api = { -- cgit v1.2.3