Avoid repetition of variables and keywords

This commit is contained in:
SebastianStork 2024-09-18 21:16:38 +02:00
parent 6e58af8f01
commit 50d87e37a4
8 changed files with 76 additions and 31 deletions

View file

@ -1,8 +1,10 @@
{ lib, ... }:
let
serviceName = lib.last (lib.splitString "/" (builtins.toString ./.)); # Parent directory name
subdomain = "cloud";
in
{
containers.nextcloud.config =
containers.${serviceName}.config =
{
config,
inputs,
@ -10,6 +12,10 @@ in
dataDir,
...
}:
let
userName = config.users.users.nextcloud.name;
groupName = config.users.users.nextcloud.group;
in
{
imports = [
./email-server.nix
@ -22,7 +28,7 @@ in
};
systemd.tmpfiles.rules = [
"d ${dataDir}/home 750 nextcloud nextcloud -"
"d ${dataDir}/home 750 ${userName} ${groupName} -"
"d ${dataDir}/postgresql 700 postgres postgres -"
];