From c90bd1553ec2a11c86bef28a198f65ae9ea0ce6d Mon Sep 17 00:00:00 2001 From: surtur Date: Tue, 21 Nov 2023 22:14:04 +0100 Subject: [PATCH] nix: use vars some more --- nix/hosts/loki/modules/coredns.nix | 3 +-- nix/hosts/nixpi/modules/coredns.nix | 3 +-- nix/modules/coredns.nix | 6 +++--- nix/modules/dnscrypt.nix | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/nix/hosts/loki/modules/coredns.nix b/nix/hosts/loki/modules/coredns.nix index c66a75b..b96d1d1 100644 --- a/nix/hosts/loki/modules/coredns.nix +++ b/nix/hosts/loki/modules/coredns.nix @@ -1,5 +1,4 @@ -{config, ...}: -let +{config, ...}: let svc = "coredns.service"; usr = "${toString config.users.users.coredns.name}"; in { diff --git a/nix/hosts/nixpi/modules/coredns.nix b/nix/hosts/nixpi/modules/coredns.nix index c66a75b..b96d1d1 100644 --- a/nix/hosts/nixpi/modules/coredns.nix +++ b/nix/hosts/nixpi/modules/coredns.nix @@ -1,5 +1,4 @@ -{config, ...}: -let +{config, ...}: let svc = "coredns.service"; usr = "${toString config.users.users.coredns.name}"; in { diff --git a/nix/modules/coredns.nix b/nix/modules/coredns.nix index a835b85..8adcd6f 100644 --- a/nix/modules/coredns.nix +++ b/nix/modules/coredns.nix @@ -235,7 +235,7 @@ in { ProtectSystem = "strict"; LimitNOFILE = 1048576; LimitNPROC = 512; - User = "coredns"; + User = usr; EnvironmentFile = config.sops.templates.corednsEnv.path; # LoadCredential = lib.mapAttrsToList (name: path: "${name}:${path}") cfg.credentials; DeviceAllow = ""; @@ -275,8 +275,8 @@ in { }; users.users.coredns = { - group = "coredns"; - home = "/etc/coredns"; + group = usr; + home = "/etc/" + usr; createHome = false; isSystemUser = true; extraGroups = ["users"]; diff --git a/nix/modules/dnscrypt.nix b/nix/modules/dnscrypt.nix index f0e25eb..8469ec2 100644 --- a/nix/modules/dnscrypt.nix +++ b/nix/modules/dnscrypt.nix @@ -124,7 +124,7 @@ in { }; systemd.services.dnscrypt-proxy2.serviceConfig = { - StateDirectory = "dnscrypt-proxy"; + StateDirectory = usr; WorkingDirectory = "/"; # StartLimitIntervalSec = 5; StartLimitBurst = 10;