Run statix fix

This commit is contained in:
Sandro - 2021-10-31 19:00:03 +01:00
parent 502f04040f
commit c32aad0ab1
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
22 changed files with 63 additions and 63 deletions

View File

@ -30,32 +30,32 @@
recursiveUpdate ( recursiveUpdate (
builtins.foldl' (result: name: builtins.foldl' (result: name:
recursiveUpdate result { recursiveUpdate result {
"${name}".ip4 = hosts4.${name}; "${name}".ip4 = hosts4."${name}";
} }
) {} (builtins.attrNames hosts4) ) {} (builtins.attrNames hosts4)
) ( ) (
builtins.foldl' (result: ctx: builtins.foldl' (result: ctx:
builtins.foldl' (result: name: builtins.foldl' (result: name:
recursiveUpdate result { recursiveUpdate result {
"${name}".ip6 = hosts6.${ctx}.${name}; "${name}".ip6 = hosts6."${ctx}"."${name}";
} }
) result (builtins.attrNames hosts6.${ctx}) ) result (builtins.attrNames hosts6."${ctx}")
) {} (builtins.attrNames hosts6) ) {} (builtins.attrNames hosts6)
); );
zwHostRegistry = { zwHostRegistry = {
hosts = hosts =
builtins.foldl' (result: net: builtins.foldl' (result: net:
recursiveUpdate result (extractZwHosts zentralwerk.lib.config.site.net.${net}) recursiveUpdate result (extractZwHosts zentralwerk.lib.config.site.net."${net}")
) {} [ "core" "c3d2" "serv" ]; ) {} [ "core" "c3d2" "serv" ];
}; };
extraHostRegistry = import ./host-registry.nix; extraHostRegistry = import ./host-registry.nix;
hostRegistry = nixpkgs.lib.recursiveUpdate zwHostRegistry extraHostRegistry; hostRegistry = nixpkgs.lib.recursiveUpdate zwHostRegistry extraHostRegistry;
flakifiedHosts = nixpkgs.lib.filterAttrs (name: _: self.nixosConfigurations ? ${name}) hostRegistry.hosts; flakifiedHosts = nixpkgs.lib.filterAttrs (name: _: self.nixosConfigurations ? "${name}") hostRegistry.hosts;
getHostAddr = name: getHostAddr = name:
let let
hostConf = hostRegistry.hosts.${name}; hostConf = hostRegistry.hosts."${name}";
in in
if hostConf ? ip4 if hostConf ? ip4
then hostConf.ip4 then hostConf.ip4
@ -65,11 +65,11 @@
in { in {
overlay = import ./overlay; overlay = import ./overlay;
legacyPackages = forAllSystems (system: nixpkgs.legacyPackages.${system}.extend self.overlay); legacyPackages = forAllSystems (system: nixpkgs.legacyPackages."${system}".extend self.overlay);
packages = forAllSystems (system: packages = forAllSystems (system:
let let
pkgs = self.legacyPackages.${system}; pkgs = self.legacyPackages."${system}";
in { in {
inherit (pkgs) bmxd openwebrx; inherit (pkgs) bmxd openwebrx;
@ -110,7 +110,7 @@
mkdir $out mkdir $out
${pkgs.lib.concatMapStrings (name: '' ${pkgs.lib.concatMapStrings (name: ''
ln -s ${self.nixosConfigurations.${name}.config.system.build.toplevel} name ln -s ${self.nixosConfigurations."${name}".config.system.build.toplevel} name
'') (builtins.attrNames flakifiedHosts)} '') (builtins.attrNames flakifiedHosts)}
''; '';
@ -121,7 +121,7 @@
# execute wol on a machine in HQ. # execute wol on a machine in HQ.
"${host}-wake" = pkgs.writeScriptBin "${host}-wake" '' "${host}-wake" = pkgs.writeScriptBin "${host}-wake" ''
#!${pkgs.runtimeShell} #!${pkgs.runtimeShell}
exec ${pkgs.wol}/bin/wol ${hostRegistry.hosts.${host}.ether} exec ${pkgs.wol}/bin/wol ${hostRegistry.hosts."${host}".ether}
''; '';
}) {} (builtins.attrNames (nixpkgs.lib.filterAttrs (_: { wol ? false, ... }: wol) hostRegistry.hosts)) // }) {} (builtins.attrNames (nixpkgs.lib.filterAttrs (_: { wol ? false, ... }: wol) hostRegistry.hosts)) //
@ -130,7 +130,7 @@
host = getHostAddr name; host = getHostAddr name;
target = ''root@"${host}"''; target = ''root@"${host}"'';
rebuildArg = "--flake ${self}#${name}"; rebuildArg = "--flake ${self}#${name}";
profile = self.nixosConfigurations.${name}.config.system.build.toplevel; profile = self.nixosConfigurations."${name}".config.system.build.toplevel;
in result // { in result // {
# Generate a small script for copying this flake to the # Generate a small script for copying this flake to the
# remote machine and bulding and switching there. # remote machine and bulding and switching there.
@ -157,7 +157,7 @@
}) {} (builtins.attrNames flakifiedHosts) // }) {} (builtins.attrNames flakifiedHosts) //
builtins.foldl' (result: host: result // { builtins.foldl' (result: host: result // {
"${host}-sdImage" = self.nixosConfigurations.${host}.config.system.build.sdImage; "${host}-sdImage" = self.nixosConfigurations."${host}".config.system.build.sdImage;
}) {} (builtins.attrNames (nixpkgs.lib.filterAttrs (host: nixosConfiguration: }) {} (builtins.attrNames (nixpkgs.lib.filterAttrs (host: nixosConfiguration:
nixosConfiguration.config.system.build ? sdImage nixosConfiguration.config.system.build ? sdImage
) self.nixosConfigurations)) ) self.nixosConfigurations))
@ -183,7 +183,7 @@
freifunk = nixosSystem' { freifunk = nixosSystem' {
modules = [ modules = [
./hosts/containers/freifunk ./hosts/containers/freifunk
({ ... }: { (_: {
nixpkgs.overlays = with secrets.overlays; [ nixpkgs.overlays = with secrets.overlays; [
freifunk ospf freifunk ospf
]; ];
@ -274,7 +274,7 @@
./hosts/containers/yggdrasil ./hosts/containers/yggdrasil
./lib/lxc-container.nix ./lib/lxc-container.nix
./lib/users/emery.nix ./lib/users/emery.nix
({ ... }: { (_: {
nixpkgs.overlays = [ secrets.overlays.ospf ]; nixpkgs.overlays = [ secrets.overlays.ospf ];
}) })
]; ];
@ -287,7 +287,7 @@
./hosts/containers/matemat ./hosts/containers/matemat
yammat.nixosModule yammat.nixosModule
secrets.nixosModules.admins secrets.nixosModules.admins
({ ... }: { (_: {
nixpkgs.overlays = [ secrets.overlays.matemat ]; nixpkgs.overlays = [ secrets.overlays.matemat ];
}) })
]; ];
@ -298,7 +298,7 @@
modules = [ modules = [
./lib/lxc-container.nix ./lib/lxc-container.nix
./hosts/containers/scrape ./hosts/containers/scrape
({ ... }: { (_: {
nixpkgs.overlays = [ secrets.overlays.scrape ]; nixpkgs.overlays = [ secrets.overlays.scrape ];
}) })
]; ];
@ -310,7 +310,7 @@
modules = [ modules = [
./lib/lxc-container.nix ./lib/lxc-container.nix
./hosts/containers/dn42 ./hosts/containers/dn42
({ ... }: { (_: {
nixpkgs.overlays = [ secrets.overlays.dn42 ]; nixpkgs.overlays = [ secrets.overlays.dn42 ];
}) })
]; ];
@ -418,7 +418,7 @@
keycloak = nixosSystem' { keycloak = nixosSystem' {
modules = [ modules = [
./lib/lxc-container.nix ./lib/lxc-container.nix
({ ... }: { (_: {
nixpkgs.overlays = with secrets.overlays; [ nixpkgs.overlays = with secrets.overlays; [
keycloak keycloak
]; ];
@ -432,7 +432,7 @@
modules = [ modules = [
./lib/lxc-container.nix ./lib/lxc-container.nix
./hosts/containers/c3d2-web ./hosts/containers/c3d2-web
({ ... }: { (_: {
nixpkgs.overlays = [ secrets.overlays.c3d2-web ]; nixpkgs.overlays = [ secrets.overlays.c3d2-web ];
}) })
]; ];
@ -454,7 +454,7 @@
bind = nixosSystem' { bind = nixosSystem' {
modules = [ modules = [
({ ... }: { (_: {
nixpkgs.overlays = with secrets.overlays; [ nixpkgs.overlays = with secrets.overlays; [
bind bind
]; ];
@ -467,7 +467,7 @@
jabber = nixosSystem' { jabber = nixosSystem' {
modules = [ modules = [
({ ... }: { (_: {
nixpkgs.overlays = with secrets.overlays; [ nixpkgs.overlays = with secrets.overlays; [
jabber jabber
]; ];

View File

@ -14,7 +14,7 @@ in
networking.hostName = "bind"; networking.hostName = "bind";
networking.useNetworkd = true; networking.useNetworkd = true;
networking.interfaces.eth0.ipv4.addresses = [{ networking.interfaces.eth0.ipv4.addresses = [{
address = hostRegistry.hosts.${config.networking.hostName}.ip4; address = hostRegistry.hosts."${config.networking.hostName}".ip4;
prefixLength = 26; prefixLength = 26;
}]; }];
networking.defaultGateway = "172.20.73.1"; networking.defaultGateway = "172.20.73.1";

View File

@ -9,7 +9,7 @@ in
networking.hostName = "c3d2-web"; networking.hostName = "c3d2-web";
networking.useNetworkd = true; networking.useNetworkd = true;
networking.interfaces.eth0.ipv4.addresses = [{ networking.interfaces.eth0.ipv4.addresses = [{
address = hostRegistry.hosts.${config.networking.hostName}.ip4; address = hostRegistry.hosts."${config.networking.hostName}".ip4;
prefixLength = 26; prefixLength = 26;
}]; }];
networking.defaultGateway = "172.20.73.1"; networking.defaultGateway = "172.20.73.1";

View File

@ -3,7 +3,7 @@
let let
address4 = "172.22.99.253"; address4 = "172.22.99.253";
address6 = "fe80::deca:fbad"; address6 = "fe80::deca:fbad";
neighbors = pkgs.neighbors; inherit (pkgs) neighbors;
in { in {
networking = { networking = {
hostName = "dn42"; hostName = "dn42";
@ -79,7 +79,7 @@ in {
}; };
in { in {
servers = servers =
builtins.mapAttrs (name: conf: mkServer name conf) openvpnNeighbors; builtins.mapAttrs mkServer openvpnNeighbors;
}; };
networking.wireguard = { networking.wireguard = {

View File

@ -6,7 +6,7 @@ let
meshInterface = "bmx"; meshInterface = "bmx";
meshLoopback = "bmx_prime"; meshLoopback = "bmx_prime";
ddmeshRegisterUrl = "https://register.freifunk-dresden.de/bot.php"; ddmeshRegisterUrl = "https://register.freifunk-dresden.de/bot.php";
ddmeshRegisterKey = pkgs.c3d2-freifunk.ddmeshRegisterKey; inherit (pkgs.c3d2-freifunk) ddmeshRegisterKey;
ddmeshNode = 51073; ddmeshNode = 51073;
ddmeshAddrPart = "200.74"; ddmeshAddrPart = "200.74";
rt_table_hosts = 7; rt_table_hosts = 7;

View File

@ -22,7 +22,7 @@ in
hostName = "jabber"; hostName = "jabber";
useNetworkd = true; useNetworkd = true;
interfaces.eth0.ipv4.addresses = [{ interfaces.eth0.ipv4.addresses = [{
address = hostRegistry.hosts.${config.networking.hostName}.ip4; address = hostRegistry.hosts."${config.networking.hostName}".ip4;
prefixLength = 26; prefixLength = 26;
}]; }];
defaultGateway = "172.20.73.1"; defaultGateway = "172.20.73.1";

View File

@ -10,7 +10,7 @@ in
interfaces.eth0 = { interfaces.eth0 = {
useDHCP = false; useDHCP = false;
ipv4.addresses = [{ ipv4.addresses = [{
address = hostRegistry.hosts.${config.networking.hostName}.ip4; address = hostRegistry.hosts."${config.networking.hostName}".ip4;
prefixLength = 26; prefixLength = 26;
} }
]; ];

View File

@ -4,7 +4,7 @@
networking = { networking = {
hostName = "mobilizon"; hostName = "mobilizon";
interfaces.eth0.ipv4.addresses = [{ interfaces.eth0.ipv4.addresses = [{
address = hostRegistry.hosts.${config.networking.hostName}.ip4; address = hostRegistry.hosts."${config.networking.hostName}".ip4;
prefixLength = 26; prefixLength = 26;
}]; }];
defaultGateway = "172.20.73.1"; defaultGateway = "172.20.73.1";

View File

@ -20,8 +20,8 @@
enable = true; enable = true;
user = "tigger"; user = "tigger";
group = "tigger"; group = "tigger";
jid = pkgs.mucbot.jid; inherit (pkgs.mucbot) jid;
password = pkgs.mucbot.password; inherit (pkgs.mucbot) password;
mucs = mucs =
[ "c3d2@chat.c3d2.de/Astrobot" "international@chat.c3d2.de/Astrobot" ]; [ "c3d2@chat.c3d2.de/Astrobot" "international@chat.c3d2.de/Astrobot" ];
}; };

View File

@ -38,21 +38,21 @@
# Generated forwarding configurations from other nixosConfigurations # Generated forwarding configurations from other nixosConfigurations
map (host: map (host:
let let
nixosConfig = nixosConfigurations.${host}.config; nixosConfig = nixosConfigurations."${host}".config;
in { in {
hostNames = hostNames =
builtins.filter (vhost: vhost != "localhost") ( builtins.filter (vhost: vhost != "localhost") (
builtins.concatMap (vhost: builtins.concatMap (vhost:
let let
vhostConfig = nixosConfig.services.nginx.virtualHosts.${vhost}; vhostConfig = nixosConfig.services.nginx.virtualHosts."${vhost}";
in [ vhost ] ++ vhostConfig.serverAliases in [ vhost ] ++ vhostConfig.serverAliases
) (builtins.attrNames nixosConfig.services.nginx.virtualHosts) ) (builtins.attrNames nixosConfig.services.nginx.virtualHosts)
); );
proxyTo.host = proxyTo.host =
if hostRegistry.hosts.${host} ? ip4 if hostRegistry.hosts."${host}" ? ip4
then hostRegistry.hosts.${host}.ip4 then hostRegistry.hosts."${host}".ip4
else if hostRegistry.hosts.${host} ? ip6 else if hostRegistry.hosts."${host}" ? ip6
then "[${hostRegistry.hosts.${host}.ip6}]" then "[${hostRegistry.hosts."${host}".ip6}]"
else throw "No known addresses for ${host}"; else throw "No known addresses for ${host}";
} }
) (builtins.attrNames ( ) (builtins.attrNames (

View File

@ -16,7 +16,7 @@ in {
}; };
proxyHosts = mkOption { proxyHosts = mkOption {
type = types.listOf (types.submodule ({ type = types.listOf (types.submodule {
options = { options = {
hostNames = mkOption { hostNames = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
@ -26,7 +26,7 @@ in {
''; '';
}; };
proxyTo = mkOption { proxyTo = mkOption {
type = types.submodule ({ type = types.submodule {
options = { options = {
host = mkOption { host = mkOption {
type = types.nullOr types.string; type = types.nullOr types.string;
@ -51,7 +51,7 @@ in {
''; '';
}; };
}; };
}); };
description = '' description = ''
{ host = /* ip or fqdn */; httpPort = 80; httpsPort = 443; } to proxy to { host = /* ip or fqdn */; httpPort = 80; httpsPort = 443; } to proxy to
''; '';
@ -65,7 +65,7 @@ in {
}; };
})); });
default = [ ]; default = [ ];
example = [{ example = [{
hostNames = [ "test.hq.c3d2.de" "test.c3d2.de" ]; hostNames = [ "test.hq.c3d2.de" "test.c3d2.de" ];

View File

@ -45,7 +45,7 @@ in {
scraperPkgs = import scrapers { inherit pkgs; }; scraperPkgs = import scrapers { inherit pkgs; };
makeService = { script, host ? "", user ? "", password ? "" }: { makeService = { script, host ? "", user ? "", password ? "" }: {
script = script =
"${scraperPkgs.${script}}/bin/${script} ${host} ${user} ${password}"; "${scraperPkgs."${script}"}/bin/${script} ${host} ${user} ${password}";
serviceConfig = { serviceConfig = {
User = config.users.users.scrape.name; User = config.users.users.scrape.name;
Group = config.users.users.scrape.group; Group = config.users.users.scrape.group;
@ -55,7 +55,7 @@ in {
name = "scrape-node${nodeId}"; name = "scrape-node${nodeId}";
value = makeService { value = makeService {
script = "freifunk_node"; script = "freifunk_node";
host = freifunkNodes.${nodeId}; host = freifunkNodes."${nodeId}";
}; };
}; };
makeLuftScraper = station: { makeLuftScraper = station: {

View File

@ -8,7 +8,7 @@
networking.hostName = "sdrweb"; networking.hostName = "sdrweb";
networking.useNetworkd = true; networking.useNetworkd = true;
networking.interfaces.eth0.ipv4.addresses = [{ networking.interfaces.eth0.ipv4.addresses = [{
address = hostRegistry.hosts.${config.networking.hostName}.ip4; address = hostRegistry.hosts."${config.networking.hostName}".ip4;
prefixLength = 26; prefixLength = 26;
}]; }];
networking.defaultGateway = "172.20.73.1"; networking.defaultGateway = "172.20.73.1";
@ -82,8 +82,8 @@
services.heliwatch = { services.heliwatch = {
enable = true; enable = true;
jid = pkgs.mucbot.jid; inherit (pkgs.mucbot) jid;
password = pkgs.mucbot.password; inherit (pkgs.mucbot) password;
muc = "luftraum@chat.c3d2.de/Hubschraubereinsatz"; muc = "luftraum@chat.c3d2.de/Hubschraubereinsatz";
}; };

View File

@ -143,7 +143,7 @@ in
}; };
# Allow access to printer serial port and GPIO # Allow access to printer serial port and GPIO
users.users.${config.services.octoprint.user}.extraGroups = [ "dialout" "gpio" ]; users.users."${config.services.octoprint.user}".extraGroups = [ "dialout" "gpio" ];
services.mjpg-streamer = { services.mjpg-streamer = {
enable = true; enable = true;

View File

@ -78,7 +78,7 @@
hostName = "radiobert"; # Define your hostname. hostName = "radiobert"; # Define your hostname.
useDHCP = false; useDHCP = false;
interfaces.eth0.ipv4.addresses = [{ interfaces.eth0.ipv4.addresses = [{
address = hostRegistry.hosts.${config.networking.hostName}.ip4; address = hostRegistry.hosts."${config.networking.hostName}".ip4;
prefixLength = 26; prefixLength = 26;
}]; }];
defaultGateway = "172.20.73.1"; defaultGateway = "172.20.73.1";

View File

@ -30,7 +30,7 @@ in
networking = { networking = {
hostName = "storage-ng"; hostName = "storage-ng";
# usePredictableInterfacenames = false; # usePredictableInterfacenames = false;
interfaces.${eth0} = { interfaces."${eth0}" = {
ipv4.addresses = [{ ipv4.addresses = [{
address = "172.22.99.20"; address = "172.22.99.20";
prefixLength = 24; prefixLength = 24;

View File

@ -133,7 +133,7 @@ in {
{ {
assertion = let assertion = let
check = hostName: hostName == config.networking.hostName; check = hostName: hostName == config.networking.hostName;
checkRegistry = list: builtins.any check list; checkRegistry = builtins.any check;
in cfg.isInHq -> checkRegistry hostRegistry.hqLocal; in cfg.isInHq -> checkRegistry hostRegistry.hqLocal;
message = "${config.networking.hostName} is not registered in ${ message = "${config.networking.hostName} is not registered in ${
toString ../host-registry.nix toString ../host-registry.nix
@ -143,12 +143,12 @@ in {
let let
getAddrHosts = key: getAddrHosts = key:
builtins.foldl' (result: host: builtins.foldl' (result: host:
if hostRegistry.hosts.${host} ? "${key}" if hostRegistry.hosts."${host}" ? "${key}"
then let then let
addr = hostRegistry.hosts.${host}.${key}; addr = hostRegistry.hosts."${host}"."${key}";
in if result ? "${addr}" in if result ? "${addr}"
then result // { then result // {
"${addr}" = result.${addr} ++ [ host ]; "${addr}" = result."${addr}" ++ [ host ];
} }
else result // { else result // {
"${addr}" = [ host ]; "${addr}" = [ host ];
@ -234,7 +234,7 @@ in {
}; };
}) // }) //
*/ */
(if cfg.hq.interface == null then if cfg.hq.interface == null then
{ } { }
else { else {
"${cfg.hq.interface}" = { "${cfg.hq.interface}" = {
@ -243,7 +243,7 @@ in {
prefixLength = 64; prefixLength = 64;
}]; }];
}; };
}); };
nix = { nix = {
autoOptimiseStore = true; autoOptimiseStore = true;

View File

@ -8,11 +8,11 @@ let
rev = "3a0767f0536fac811065eb87e6342f27eac085aa"; rev = "3a0767f0536fac811065eb87e6342f27eac085aa";
sha256 = "vC0vBu+0HchrevuWsmE7giouKnSt/q4F0TffwhuNJv8="; sha256 = "vC0vBu+0HchrevuWsmE7giouKnSt/q4F0TffwhuNJv8=";
}; };
nixcloud = (import "${nixcloud-webservices}/pkgs" { inherit pkgs; }).nixcloud; inherit ((import "${nixcloud-webservices}/pkgs" { inherit pkgs; })) nixcloud;
profilesDir = "/nix/var/nix/profiles/lxc"; profilesDir = "/nix/var/nix/profiles/lxc";
containers = config.lxc.containers; inherit (config.lxc) containers;
nixPath = config.nix.nixPath; inherit (config.nix) nixPath;
toLxcConfig' = path: a: toLxcConfig' = path: a:
if builtins.isString a then '' if builtins.isString a then ''

View File

@ -2,7 +2,7 @@
{ {
options.c3d2.pi-sensors = lib.mkOption { options.c3d2.pi-sensors = lib.mkOption {
default = []; default = [];
type = with lib.types; listOf (submodule ({ ... }: { type = with lib.types; listOf (submodule (_: {
options = { options = {
type = lib.mkOption { type = lib.mkOption {
description = "Sensor type"; description = "Sensor type";

View File

@ -7,7 +7,7 @@ let
in lib.filterAttrs filter userDir; in lib.filterAttrs filter userDir;
import' = name: import' = name:
lib.mkIf config.c3d2.users.${name} lib.mkIf config.c3d2.users."${name}"
(import (./. + "/${name}.nix") { inherit config lib pkgs; }); (import (./. + "/${name}.nix") { inherit config lib pkgs; });
userNames = let f = replaceStrings [ ".nix" ] [ "" ]; userNames = let f = replaceStrings [ ".nix" ] [ "" ];
@ -36,7 +36,7 @@ in {
users.users.root = lib.mkIf config.c3d2.allUsersCanSshRoot { users.users.root = lib.mkIf config.c3d2.allUsersCanSshRoot {
openssh = lib.mkMerge (map (name: openssh = lib.mkMerge (map (name:
let let
userConf = (import' name).content.users.users.${name}; userConf = (import' name).content.users.users."${name}";
in lib.optionalAttrs (userConf ? openssh) userConf.openssh in lib.optionalAttrs (userConf ? openssh) userConf.openssh
) userNames); ) userNames);
}; };

View File

@ -1,4 +1,4 @@
{ ... }: _:
{ {
users.users.nek0 = { users.users.nek0 = {
isNormalUser = true; isNormalUser = true;

View File

@ -1,4 +1,4 @@
{ ... }: _:
{ {
users.users.tboston = { users.users.tboston = {
isNormalUser = true; isNormalUser = true;