tsuki: fix eval

This commit is contained in:
Oystein Kristoffer Tveit 2024-06-25 22:26:09 +02:00
parent 30b8f6449a
commit 7c3e6fcf42
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
3 changed files with 15 additions and 10 deletions

View File

@ -2,7 +2,7 @@
let
inherit (config) machineVars;
in {
sops.defaultSopsFile = ./.. + "secrets/${config.networking.hostName}.yaml";
sops.defaultSopsFile = ./.. + "/secrets/${config.networking.hostName}.yaml";
sops.secrets = {
"ssh/nix-builders/tsuki/key" = { sopsFile = ./../secrets/common.yaml; };

View File

@ -50,6 +50,7 @@
networking = {
hostName = "tsuki";
hostId = "8425e349";
networkmanager.enable = true;
interfaces.ens18.useDHCP = true;
firewall.enable=true;

View File

@ -3,7 +3,7 @@ let
inherit (lib) mkOption types mdDoc;
in
{
options.socketActivation = mkOption {
options.local.socketActivation = mkOption {
type = types.attrsOf (types.submodule ({ name, ... }: {
options = {
enable = lib.mkEnableOption "socket activation for a systemd service";
@ -109,7 +109,7 @@ in
};
config = let
activeServices = lib.filterAttrs (_: value: value.enable) config.socketActivation;
activeServices = lib.filterAttrs (_: value: value.enable) config.local.socketActivation;
foreachService = f: lib.mapAttrsToList f activeServices;
in {
assertions = foreachService (name: value: {
@ -130,13 +130,17 @@ in
'';
});
services.nginx.upstreams = let
servicesWithNginxUpstream = lib.filterAttrs (_: value: value.createNginxUpstream) activeServices;
in lib.mapAttrsToList (name: value: let
protocol = if lib.any (p: lib.hasPrefix p value.newSocketAddress) [ "/" "@" ] then "unix" else "http";
in {
${name}.servers."${protocol}:${value.newSocketAddress}" = { };
}) servicesWithNginxUpstream;
services.nginx.upstreams = lib.pipe activeServices [
(lib.filterAttrs (_: value: value.createNginxUpstream))
(lib.mapAttrsToList
(name: value: let
protocol = if lib.any (p: lib.hasPrefix p value.newSocketAddress) [ "/" "@" ] then "unix" else "http";
in {
${name}.servers."${protocol}:${value.newSocketAddress}" = { };
})
)
(lib.foldl lib.recursiveUpdate { })
];
systemd = lib.mkMerge (foreachService (name: value: let
originalService = config.systemd.services.${value.service};