From c32aad0ab1ed6512e7677f3c86e51ec7ed6c12ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 31 Oct 2021 19:00:03 +0100 Subject: [PATCH] Run statix fix --- flake.nix | 42 +++++++++---------- hosts/containers/bind/default.nix | 2 +- hosts/containers/c3d2-web/default.nix | 2 +- hosts/containers/dn42/default.nix | 4 +- hosts/containers/freifunk/default.nix | 2 +- hosts/containers/jabber/default.nix | 2 +- hosts/containers/keycloak/default.nix | 2 +- hosts/containers/mobilizon/default.nix | 2 +- hosts/containers/mucbot/default.nix | 4 +- .../public-access-proxy/default.nix | 12 +++--- .../containers/public-access-proxy/proxy.nix | 8 ++-- hosts/containers/scrape/default.nix | 4 +- hosts/containers/sdrweb/default.nix | 6 +-- hosts/pulsebert/default.nix | 2 +- hosts/radiobert/base.nix | 2 +- hosts/storage-ng/configuration.nix | 2 +- lib/default.nix | 12 +++--- lib/lxc/default.nix | 6 +-- lib/pi-sensors.nix | 2 +- lib/users/default.nix | 4 +- lib/users/nek0.nix | 2 +- lib/users/tboston.nix | 2 +- 22 files changed, 63 insertions(+), 63 deletions(-) diff --git a/flake.nix b/flake.nix index 3387e351..567f04f6 100644 --- a/flake.nix +++ b/flake.nix @@ -30,32 +30,32 @@ recursiveUpdate ( builtins.foldl' (result: name: recursiveUpdate result { - "${name}".ip4 = hosts4.${name}; + "${name}".ip4 = hosts4."${name}"; } ) {} (builtins.attrNames hosts4) ) ( builtins.foldl' (result: ctx: builtins.foldl' (result: name: 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) ); zwHostRegistry = { hosts = 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" ]; }; extraHostRegistry = import ./host-registry.nix; 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: let - hostConf = hostRegistry.hosts.${name}; + hostConf = hostRegistry.hosts."${name}"; in if hostConf ? ip4 then hostConf.ip4 @@ -65,11 +65,11 @@ in { overlay = import ./overlay; - legacyPackages = forAllSystems (system: nixpkgs.legacyPackages.${system}.extend self.overlay); + legacyPackages = forAllSystems (system: nixpkgs.legacyPackages."${system}".extend self.overlay); packages = forAllSystems (system: let - pkgs = self.legacyPackages.${system}; + pkgs = self.legacyPackages."${system}"; in { inherit (pkgs) bmxd openwebrx; @@ -110,7 +110,7 @@ mkdir $out ${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)} ''; @@ -121,7 +121,7 @@ # execute wol on a machine in HQ. "${host}-wake" = pkgs.writeScriptBin "${host}-wake" '' #!${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)) // @@ -130,7 +130,7 @@ host = getHostAddr name; target = ''root@"${host}"''; rebuildArg = "--flake ${self}#${name}"; - profile = self.nixosConfigurations.${name}.config.system.build.toplevel; + profile = self.nixosConfigurations."${name}".config.system.build.toplevel; in result // { # Generate a small script for copying this flake to the # remote machine and bulding and switching there. @@ -157,7 +157,7 @@ }) {} (builtins.attrNames flakifiedHosts) // 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: nixosConfiguration.config.system.build ? sdImage ) self.nixosConfigurations)) @@ -183,7 +183,7 @@ freifunk = nixosSystem' { modules = [ ./hosts/containers/freifunk - ({ ... }: { + (_: { nixpkgs.overlays = with secrets.overlays; [ freifunk ospf ]; @@ -274,7 +274,7 @@ ./hosts/containers/yggdrasil ./lib/lxc-container.nix ./lib/users/emery.nix - ({ ... }: { + (_: { nixpkgs.overlays = [ secrets.overlays.ospf ]; }) ]; @@ -287,7 +287,7 @@ ./hosts/containers/matemat yammat.nixosModule secrets.nixosModules.admins - ({ ... }: { + (_: { nixpkgs.overlays = [ secrets.overlays.matemat ]; }) ]; @@ -298,7 +298,7 @@ modules = [ ./lib/lxc-container.nix ./hosts/containers/scrape - ({ ... }: { + (_: { nixpkgs.overlays = [ secrets.overlays.scrape ]; }) ]; @@ -310,7 +310,7 @@ modules = [ ./lib/lxc-container.nix ./hosts/containers/dn42 - ({ ... }: { + (_: { nixpkgs.overlays = [ secrets.overlays.dn42 ]; }) ]; @@ -418,7 +418,7 @@ keycloak = nixosSystem' { modules = [ ./lib/lxc-container.nix - ({ ... }: { + (_: { nixpkgs.overlays = with secrets.overlays; [ keycloak ]; @@ -432,7 +432,7 @@ modules = [ ./lib/lxc-container.nix ./hosts/containers/c3d2-web - ({ ... }: { + (_: { nixpkgs.overlays = [ secrets.overlays.c3d2-web ]; }) ]; @@ -454,7 +454,7 @@ bind = nixosSystem' { modules = [ - ({ ... }: { + (_: { nixpkgs.overlays = with secrets.overlays; [ bind ]; @@ -467,7 +467,7 @@ jabber = nixosSystem' { modules = [ - ({ ... }: { + (_: { nixpkgs.overlays = with secrets.overlays; [ jabber ]; diff --git a/hosts/containers/bind/default.nix b/hosts/containers/bind/default.nix index 3dddad18..b66bab79 100644 --- a/hosts/containers/bind/default.nix +++ b/hosts/containers/bind/default.nix @@ -14,7 +14,7 @@ in networking.hostName = "bind"; networking.useNetworkd = true; networking.interfaces.eth0.ipv4.addresses = [{ - address = hostRegistry.hosts.${config.networking.hostName}.ip4; + address = hostRegistry.hosts."${config.networking.hostName}".ip4; prefixLength = 26; }]; networking.defaultGateway = "172.20.73.1"; diff --git a/hosts/containers/c3d2-web/default.nix b/hosts/containers/c3d2-web/default.nix index 3ad1d889..75291040 100644 --- a/hosts/containers/c3d2-web/default.nix +++ b/hosts/containers/c3d2-web/default.nix @@ -9,7 +9,7 @@ in networking.hostName = "c3d2-web"; networking.useNetworkd = true; networking.interfaces.eth0.ipv4.addresses = [{ - address = hostRegistry.hosts.${config.networking.hostName}.ip4; + address = hostRegistry.hosts."${config.networking.hostName}".ip4; prefixLength = 26; }]; networking.defaultGateway = "172.20.73.1"; diff --git a/hosts/containers/dn42/default.nix b/hosts/containers/dn42/default.nix index fdd0008c..5052fd21 100644 --- a/hosts/containers/dn42/default.nix +++ b/hosts/containers/dn42/default.nix @@ -3,7 +3,7 @@ let address4 = "172.22.99.253"; address6 = "fe80::deca:fbad"; - neighbors = pkgs.neighbors; + inherit (pkgs) neighbors; in { networking = { hostName = "dn42"; @@ -79,7 +79,7 @@ in { }; in { servers = - builtins.mapAttrs (name: conf: mkServer name conf) openvpnNeighbors; + builtins.mapAttrs mkServer openvpnNeighbors; }; networking.wireguard = { diff --git a/hosts/containers/freifunk/default.nix b/hosts/containers/freifunk/default.nix index 4618192f..f9c1ed14 100644 --- a/hosts/containers/freifunk/default.nix +++ b/hosts/containers/freifunk/default.nix @@ -6,7 +6,7 @@ let meshInterface = "bmx"; meshLoopback = "bmx_prime"; ddmeshRegisterUrl = "https://register.freifunk-dresden.de/bot.php"; - ddmeshRegisterKey = pkgs.c3d2-freifunk.ddmeshRegisterKey; + inherit (pkgs.c3d2-freifunk) ddmeshRegisterKey; ddmeshNode = 51073; ddmeshAddrPart = "200.74"; rt_table_hosts = 7; diff --git a/hosts/containers/jabber/default.nix b/hosts/containers/jabber/default.nix index a6285d05..675982ff 100644 --- a/hosts/containers/jabber/default.nix +++ b/hosts/containers/jabber/default.nix @@ -22,7 +22,7 @@ in hostName = "jabber"; useNetworkd = true; interfaces.eth0.ipv4.addresses = [{ - address = hostRegistry.hosts.${config.networking.hostName}.ip4; + address = hostRegistry.hosts."${config.networking.hostName}".ip4; prefixLength = 26; }]; defaultGateway = "172.20.73.1"; diff --git a/hosts/containers/keycloak/default.nix b/hosts/containers/keycloak/default.nix index 4896e4af..6a80d0e0 100644 --- a/hosts/containers/keycloak/default.nix +++ b/hosts/containers/keycloak/default.nix @@ -10,7 +10,7 @@ in interfaces.eth0 = { useDHCP = false; ipv4.addresses = [{ - address = hostRegistry.hosts.${config.networking.hostName}.ip4; + address = hostRegistry.hosts."${config.networking.hostName}".ip4; prefixLength = 26; } ]; diff --git a/hosts/containers/mobilizon/default.nix b/hosts/containers/mobilizon/default.nix index 46a79733..69261d32 100644 --- a/hosts/containers/mobilizon/default.nix +++ b/hosts/containers/mobilizon/default.nix @@ -4,7 +4,7 @@ networking = { hostName = "mobilizon"; interfaces.eth0.ipv4.addresses = [{ - address = hostRegistry.hosts.${config.networking.hostName}.ip4; + address = hostRegistry.hosts."${config.networking.hostName}".ip4; prefixLength = 26; }]; defaultGateway = "172.20.73.1"; diff --git a/hosts/containers/mucbot/default.nix b/hosts/containers/mucbot/default.nix index 18fac577..147522b6 100644 --- a/hosts/containers/mucbot/default.nix +++ b/hosts/containers/mucbot/default.nix @@ -20,8 +20,8 @@ enable = true; user = "tigger"; group = "tigger"; - jid = pkgs.mucbot.jid; - password = pkgs.mucbot.password; + inherit (pkgs.mucbot) jid; + inherit (pkgs.mucbot) password; mucs = [ "c3d2@chat.c3d2.de/Astrobot" "international@chat.c3d2.de/Astrobot" ]; }; diff --git a/hosts/containers/public-access-proxy/default.nix b/hosts/containers/public-access-proxy/default.nix index 21e4531d..875571be 100644 --- a/hosts/containers/public-access-proxy/default.nix +++ b/hosts/containers/public-access-proxy/default.nix @@ -38,21 +38,21 @@ # Generated forwarding configurations from other nixosConfigurations map (host: let - nixosConfig = nixosConfigurations.${host}.config; + nixosConfig = nixosConfigurations."${host}".config; in { hostNames = builtins.filter (vhost: vhost != "localhost") ( builtins.concatMap (vhost: let - vhostConfig = nixosConfig.services.nginx.virtualHosts.${vhost}; + vhostConfig = nixosConfig.services.nginx.virtualHosts."${vhost}"; in [ vhost ] ++ vhostConfig.serverAliases ) (builtins.attrNames nixosConfig.services.nginx.virtualHosts) ); proxyTo.host = - if hostRegistry.hosts.${host} ? ip4 - then hostRegistry.hosts.${host}.ip4 - else if hostRegistry.hosts.${host} ? ip6 - then "[${hostRegistry.hosts.${host}.ip6}]" + if hostRegistry.hosts."${host}" ? ip4 + then hostRegistry.hosts."${host}".ip4 + else if hostRegistry.hosts."${host}" ? ip6 + then "[${hostRegistry.hosts."${host}".ip6}]" else throw "No known addresses for ${host}"; } ) (builtins.attrNames ( diff --git a/hosts/containers/public-access-proxy/proxy.nix b/hosts/containers/public-access-proxy/proxy.nix index e20fce60..2414aabd 100644 --- a/hosts/containers/public-access-proxy/proxy.nix +++ b/hosts/containers/public-access-proxy/proxy.nix @@ -16,7 +16,7 @@ in { }; proxyHosts = mkOption { - type = types.listOf (types.submodule ({ + type = types.listOf (types.submodule { options = { hostNames = mkOption { type = types.listOf types.str; @@ -26,7 +26,7 @@ in { ''; }; proxyTo = mkOption { - type = types.submodule ({ + type = types.submodule { options = { host = mkOption { type = types.nullOr types.string; @@ -51,7 +51,7 @@ in { ''; }; }; - }); + }; description = '' { host = /* ip or fqdn */; httpPort = 80; httpsPort = 443; } to proxy to ''; @@ -65,7 +65,7 @@ in { }; - })); + }); default = [ ]; example = [{ hostNames = [ "test.hq.c3d2.de" "test.c3d2.de" ]; diff --git a/hosts/containers/scrape/default.nix b/hosts/containers/scrape/default.nix index 5ce5611a..e1777bf3 100644 --- a/hosts/containers/scrape/default.nix +++ b/hosts/containers/scrape/default.nix @@ -45,7 +45,7 @@ in { scraperPkgs = import scrapers { inherit pkgs; }; makeService = { script, host ? "", user ? "", password ? "" }: { script = - "${scraperPkgs.${script}}/bin/${script} ${host} ${user} ${password}"; + "${scraperPkgs."${script}"}/bin/${script} ${host} ${user} ${password}"; serviceConfig = { User = config.users.users.scrape.name; Group = config.users.users.scrape.group; @@ -55,7 +55,7 @@ in { name = "scrape-node${nodeId}"; value = makeService { script = "freifunk_node"; - host = freifunkNodes.${nodeId}; + host = freifunkNodes."${nodeId}"; }; }; makeLuftScraper = station: { diff --git a/hosts/containers/sdrweb/default.nix b/hosts/containers/sdrweb/default.nix index e305b8fc..38928f23 100644 --- a/hosts/containers/sdrweb/default.nix +++ b/hosts/containers/sdrweb/default.nix @@ -8,7 +8,7 @@ networking.hostName = "sdrweb"; networking.useNetworkd = true; networking.interfaces.eth0.ipv4.addresses = [{ - address = hostRegistry.hosts.${config.networking.hostName}.ip4; + address = hostRegistry.hosts."${config.networking.hostName}".ip4; prefixLength = 26; }]; networking.defaultGateway = "172.20.73.1"; @@ -82,8 +82,8 @@ services.heliwatch = { enable = true; - jid = pkgs.mucbot.jid; - password = pkgs.mucbot.password; + inherit (pkgs.mucbot) jid; + inherit (pkgs.mucbot) password; muc = "luftraum@chat.c3d2.de/Hubschraubereinsatz"; }; diff --git a/hosts/pulsebert/default.nix b/hosts/pulsebert/default.nix index bd7058f8..4b7e3d4b 100644 --- a/hosts/pulsebert/default.nix +++ b/hosts/pulsebert/default.nix @@ -143,7 +143,7 @@ in }; # 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 = { enable = true; diff --git a/hosts/radiobert/base.nix b/hosts/radiobert/base.nix index 1fa361dd..75cceb41 100644 --- a/hosts/radiobert/base.nix +++ b/hosts/radiobert/base.nix @@ -78,7 +78,7 @@ hostName = "radiobert"; # Define your hostname. useDHCP = false; interfaces.eth0.ipv4.addresses = [{ - address = hostRegistry.hosts.${config.networking.hostName}.ip4; + address = hostRegistry.hosts."${config.networking.hostName}".ip4; prefixLength = 26; }]; defaultGateway = "172.20.73.1"; diff --git a/hosts/storage-ng/configuration.nix b/hosts/storage-ng/configuration.nix index e37483f6..dbce9700 100644 --- a/hosts/storage-ng/configuration.nix +++ b/hosts/storage-ng/configuration.nix @@ -30,7 +30,7 @@ in networking = { hostName = "storage-ng"; # usePredictableInterfacenames = false; - interfaces.${eth0} = { + interfaces."${eth0}" = { ipv4.addresses = [{ address = "172.22.99.20"; prefixLength = 24; diff --git a/lib/default.nix b/lib/default.nix index 9da0a443..2f751259 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -133,7 +133,7 @@ in { { assertion = let check = hostName: hostName == config.networking.hostName; - checkRegistry = list: builtins.any check list; + checkRegistry = builtins.any check; in cfg.isInHq -> checkRegistry hostRegistry.hqLocal; message = "${config.networking.hostName} is not registered in ${ toString ../host-registry.nix @@ -143,12 +143,12 @@ in { let getAddrHosts = key: builtins.foldl' (result: host: - if hostRegistry.hosts.${host} ? "${key}" + if hostRegistry.hosts."${host}" ? "${key}" then let - addr = hostRegistry.hosts.${host}.${key}; + addr = hostRegistry.hosts."${host}"."${key}"; in if result ? "${addr}" then result // { - "${addr}" = result.${addr} ++ [ host ]; + "${addr}" = result."${addr}" ++ [ host ]; } else result // { "${addr}" = [ host ]; @@ -234,7 +234,7 @@ in { }; }) // */ - (if cfg.hq.interface == null then + if cfg.hq.interface == null then { } else { "${cfg.hq.interface}" = { @@ -243,7 +243,7 @@ in { prefixLength = 64; }]; }; - }); + }; nix = { autoOptimiseStore = true; diff --git a/lib/lxc/default.nix b/lib/lxc/default.nix index a9eba31d..959cf09c 100644 --- a/lib/lxc/default.nix +++ b/lib/lxc/default.nix @@ -8,11 +8,11 @@ let rev = "3a0767f0536fac811065eb87e6342f27eac085aa"; 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"; - containers = config.lxc.containers; - nixPath = config.nix.nixPath; + inherit (config.lxc) containers; + inherit (config.nix) nixPath; toLxcConfig' = path: a: if builtins.isString a then '' diff --git a/lib/pi-sensors.nix b/lib/pi-sensors.nix index 6eb430b9..f853ab97 100644 --- a/lib/pi-sensors.nix +++ b/lib/pi-sensors.nix @@ -2,7 +2,7 @@ { options.c3d2.pi-sensors = lib.mkOption { default = []; - type = with lib.types; listOf (submodule ({ ... }: { + type = with lib.types; listOf (submodule (_: { options = { type = lib.mkOption { description = "Sensor type"; diff --git a/lib/users/default.nix b/lib/users/default.nix index 53a1ae12..d7fe0a74 100644 --- a/lib/users/default.nix +++ b/lib/users/default.nix @@ -7,7 +7,7 @@ let in lib.filterAttrs filter userDir; import' = name: - lib.mkIf config.c3d2.users.${name} + lib.mkIf config.c3d2.users."${name}" (import (./. + "/${name}.nix") { inherit config lib pkgs; }); userNames = let f = replaceStrings [ ".nix" ] [ "" ]; @@ -36,7 +36,7 @@ in { users.users.root = lib.mkIf config.c3d2.allUsersCanSshRoot { openssh = lib.mkMerge (map (name: let - userConf = (import' name).content.users.users.${name}; + userConf = (import' name).content.users.users."${name}"; in lib.optionalAttrs (userConf ? openssh) userConf.openssh ) userNames); }; diff --git a/lib/users/nek0.nix b/lib/users/nek0.nix index 66dde2bf..c3daf6c2 100644 --- a/lib/users/nek0.nix +++ b/lib/users/nek0.nix @@ -1,4 +1,4 @@ -{ ... }: +_: { users.users.nek0 = { isNormalUser = true; diff --git a/lib/users/tboston.nix b/lib/users/tboston.nix index a9fa21b6..8d8c2615 100644 --- a/lib/users/tboston.nix +++ b/lib/users/tboston.nix @@ -1,4 +1,4 @@ -{ ... }: +_: { users.users.tboston = { isNormalUser = true;