krebs.retiolum: don't generate extraHosts
This commit is contained in:
parent
23c7c10f5a
commit
df89fb7e91
@ -96,7 +96,6 @@ let
|
|||||||
retiolum = "hosts";
|
retiolum = "hosts";
|
||||||
};
|
};
|
||||||
|
|
||||||
# XXX This overlaps with krebs.retiolum
|
|
||||||
networking.extraHosts = concatStringsSep "\n" (flatten (
|
networking.extraHosts = concatStringsSep "\n" (flatten (
|
||||||
mapAttrsToList (hostname: host:
|
mapAttrsToList (hostname: host:
|
||||||
mapAttrsToList (netname: net:
|
mapAttrsToList (netname: net:
|
||||||
|
@ -29,22 +29,13 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
generateEtcHosts = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "both";
|
|
||||||
description = ''
|
|
||||||
If set to <literal>short</literal>, <literal>long</literal>, or <literal>both</literal>,
|
|
||||||
then generate entries in <filename>/etc/hosts</filename> from subnets.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
netname = mkOption {
|
netname = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "retiolum";
|
default = "retiolum";
|
||||||
description = ''
|
description = ''
|
||||||
The tinc network name.
|
The tinc network name.
|
||||||
It is used to generate long host entries,
|
It is used to name the TUN device and to generate the default value for
|
||||||
and name the TUN device.
|
<literal>config.krebs.retiolum.hosts</literal>.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -107,8 +98,6 @@ let
|
|||||||
imp = {
|
imp = {
|
||||||
environment.systemPackages = [ tinc iproute ];
|
environment.systemPackages = [ tinc iproute ];
|
||||||
|
|
||||||
networking.extraHosts = retiolumExtraHosts;
|
|
||||||
|
|
||||||
systemd.services.retiolum = {
|
systemd.services.retiolum = {
|
||||||
description = "Tinc daemon for Retiolum";
|
description = "Tinc daemon for Retiolum";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
@ -155,45 +144,6 @@ let
|
|||||||
|
|
||||||
iproute = cfg.iproutePackage;
|
iproute = cfg.iproutePackage;
|
||||||
|
|
||||||
retiolumExtraHosts = import (pkgs.runCommand "retiolum-etc-hosts"
|
|
||||||
{ }
|
|
||||||
''
|
|
||||||
generate() {
|
|
||||||
(cd ${tinc-hosts}
|
|
||||||
printf \'\'
|
|
||||||
for i in `ls`; do
|
|
||||||
names=$(hostnames $i)
|
|
||||||
for j in `sed -En 's|^ *Aliases *= *(.+)|\1|p' $i`; do
|
|
||||||
names="$names $(hostnames $j)"
|
|
||||||
done
|
|
||||||
sed -En '
|
|
||||||
s|^ *Subnet *= *([^ /]*)(/[0-9]*)? *$|\1 '"$names"'|p
|
|
||||||
' $i
|
|
||||||
done | sort
|
|
||||||
printf \'\'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
case ${cfg.generateEtcHosts} in
|
|
||||||
short)
|
|
||||||
hostnames() { echo "$1"; }
|
|
||||||
generate
|
|
||||||
;;
|
|
||||||
long)
|
|
||||||
hostnames() { echo "$1.${cfg.netname}"; }
|
|
||||||
generate
|
|
||||||
;;
|
|
||||||
both)
|
|
||||||
hostnames() { echo "$1.${cfg.netname} $1"; }
|
|
||||||
generate
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo '""'
|
|
||||||
;;
|
|
||||||
esac > $out
|
|
||||||
'');
|
|
||||||
|
|
||||||
|
|
||||||
confDir = pkgs.runCommand "retiolum" {
|
confDir = pkgs.runCommand "retiolum" {
|
||||||
# TODO text
|
# TODO text
|
||||||
executable = true;
|
executable = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user