Run statix fix
This commit is contained in:
parent
502f04040f
commit
c32aad0ab1
42
flake.nix
42
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
|
||||
];
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
];
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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" ];
|
||||
};
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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" ];
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -30,7 +30,7 @@ in
|
|||
networking = {
|
||||
hostName = "storage-ng";
|
||||
# usePredictableInterfacenames = false;
|
||||
interfaces.${eth0} = {
|
||||
interfaces."${eth0}" = {
|
||||
ipv4.addresses = [{
|
||||
address = "172.22.99.20";
|
||||
prefixLength = 24;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 ''
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ ... }:
|
||||
_:
|
||||
{
|
||||
users.users.nek0 = {
|
||||
isNormalUser = true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ ... }:
|
||||
_:
|
||||
{
|
||||
users.users.tboston = {
|
||||
isNormalUser = true;
|
||||
|
|
Loading…
Reference in New Issue