tsuki: fix eval
This commit is contained in:
parent
30b8f6449a
commit
7c3e6fcf42
|
@ -2,7 +2,7 @@
|
||||||
let
|
let
|
||||||
inherit (config) machineVars;
|
inherit (config) machineVars;
|
||||||
in {
|
in {
|
||||||
sops.defaultSopsFile = ./.. + "secrets/${config.networking.hostName}.yaml";
|
sops.defaultSopsFile = ./.. + "/secrets/${config.networking.hostName}.yaml";
|
||||||
|
|
||||||
sops.secrets = {
|
sops.secrets = {
|
||||||
"ssh/nix-builders/tsuki/key" = { sopsFile = ./../secrets/common.yaml; };
|
"ssh/nix-builders/tsuki/key" = { sopsFile = ./../secrets/common.yaml; };
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "tsuki";
|
hostName = "tsuki";
|
||||||
|
hostId = "8425e349";
|
||||||
networkmanager.enable = true;
|
networkmanager.enable = true;
|
||||||
interfaces.ens18.useDHCP = true;
|
interfaces.ens18.useDHCP = true;
|
||||||
firewall.enable=true;
|
firewall.enable=true;
|
||||||
|
|
|
@ -3,7 +3,7 @@ let
|
||||||
inherit (lib) mkOption types mdDoc;
|
inherit (lib) mkOption types mdDoc;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.socketActivation = mkOption {
|
options.local.socketActivation = mkOption {
|
||||||
type = types.attrsOf (types.submodule ({ name, ... }: {
|
type = types.attrsOf (types.submodule ({ name, ... }: {
|
||||||
options = {
|
options = {
|
||||||
enable = lib.mkEnableOption "socket activation for a systemd service";
|
enable = lib.mkEnableOption "socket activation for a systemd service";
|
||||||
|
@ -109,7 +109,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
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;
|
foreachService = f: lib.mapAttrsToList f activeServices;
|
||||||
in {
|
in {
|
||||||
assertions = foreachService (name: value: {
|
assertions = foreachService (name: value: {
|
||||||
|
@ -130,13 +130,17 @@ in
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
services.nginx.upstreams = let
|
services.nginx.upstreams = lib.pipe activeServices [
|
||||||
servicesWithNginxUpstream = lib.filterAttrs (_: value: value.createNginxUpstream) activeServices;
|
(lib.filterAttrs (_: value: value.createNginxUpstream))
|
||||||
in lib.mapAttrsToList (name: value: let
|
(lib.mapAttrsToList
|
||||||
|
(name: value: let
|
||||||
protocol = if lib.any (p: lib.hasPrefix p value.newSocketAddress) [ "/" "@" ] then "unix" else "http";
|
protocol = if lib.any (p: lib.hasPrefix p value.newSocketAddress) [ "/" "@" ] then "unix" else "http";
|
||||||
in {
|
in {
|
||||||
${name}.servers."${protocol}:${value.newSocketAddress}" = { };
|
${name}.servers."${protocol}:${value.newSocketAddress}" = { };
|
||||||
}) servicesWithNginxUpstream;
|
})
|
||||||
|
)
|
||||||
|
(lib.foldl lib.recursiveUpdate { })
|
||||||
|
];
|
||||||
|
|
||||||
systemd = lib.mkMerge (foreachService (name: value: let
|
systemd = lib.mkMerge (foreachService (name: value: let
|
||||||
originalService = config.systemd.services.${value.service};
|
originalService = config.systemd.services.${value.service};
|
||||||
|
|
Loading…
Reference in New Issue