Remove all uses of lib.flatten

This commit is contained in:
SebastianStork 2025-06-19 12:22:59 +02:00
parent 23762ecb29
commit b7d927cb39
4 changed files with 27 additions and 32 deletions

View file

@ -90,12 +90,12 @@ in
'';
in
[
"crowdsecurity/linux"
(lib.singleton "crowdsecurity/linux")
(lib.optional (lib.elem "sshd" cfg.sources) "crowdsecurity/sshd")
(lib.optional (lib.elem "caddy" cfg.sources) "crowdsecurity/caddy")
(lib.optional (lib.elem "iptables" cfg.sources) "crowdsecurity/iptables")
]
|> lib.flatten
|> lib.concatLists
|> lib.map installCollection
|> lib.concatLines
|> (text: pkgs.writeShellScript "crowdsec-install-collections" "set -e\n${text}")

View file

@ -101,7 +101,7 @@ in
username = "";
password = "";
};
conditions = lib.flatten [
conditions = lib.concatLists [
extraConditions
(lib.optional (lib.hasPrefix "http" url) "[STATUS] == 200")
(lib.optional (lib.hasPrefix "tcp" url) "[CONNECTED] == true")

View file

@ -16,33 +16,28 @@ in
{
options.custom.wifi.enable = lib.mkEnableOption "";
config = lib.mkIf config.custom.wifi.enable (
lib.mkMerge (
lib.flatten [
{
networking.wireless.iwd = {
enable = true;
settings = {
General.EnableNetworkConfiguration = true;
Settings.AutoConnect = true;
Network.NameResolvingService = "resolvconf";
};
};
config = lib.mkIf config.custom.wifi.enable {
networking.wireless.iwd = {
enable = true;
settings = {
General.EnableNetworkConfiguration = true;
Settings.AutoConnect = true;
Network.NameResolvingService = "resolvconf";
};
};
environment.systemPackages = [ pkgs.iwgtk ];
}
environment.systemPackages = [ pkgs.iwgtk ];
(
networks
|> lib.map (name: {
sops.secrets."iwd/${name}" = { };
sops.secrets =
networks
|> lib.map (name: {
name = "iwd/${name}";
value = { };
})
|> lib.listToAttrs;
systemd.tmpfiles.rules = [
"C /var/lib/iwd/${name} - - - - ${config.sops.secrets."iwd/${name}".path}"
];
})
)
]
)
);
systemd.tmpfiles.rules =
networks
|> lib.map (name: "C /var/lib/iwd/${name} - - - - ${config.sops.secrets."iwd/${name}".path}");
};
}