tsuki: fix eval
This commit is contained in:
parent
30b8f6449a
commit
7c3e6fcf42
|
@ -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; };
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
|
||||
networking = {
|
||||
hostName = "tsuki";
|
||||
hostId = "8425e349";
|
||||
networkmanager.enable = true;
|
||||
interfaces.ens18.useDHCP = true;
|
||||
firewall.enable=true;
|
||||
|
|
|
@ -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
|
||||
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}" = { };
|
||||
}) servicesWithNginxUpstream;
|
||||
})
|
||||
)
|
||||
(lib.foldl lib.recursiveUpdate { })
|
||||
];
|
||||
|
||||
systemd = lib.mkMerge (foreachService (name: value: let
|
||||
originalService = config.systemd.services.${value.service};
|
||||
|
|
Loading…
Reference in New Issue