refactor(registry): add stable uid registry
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
my,
|
||||
...
|
||||
}:
|
||||
let
|
||||
@@ -29,12 +28,6 @@ in
|
||||
description = "User account that runs Actual Budget.";
|
||||
};
|
||||
|
||||
uid = lib.mkOption {
|
||||
type = lib.types.ints.positive;
|
||||
default = my.serviceUid "actualbudget";
|
||||
description = "Stable uid for the Actual Budget service user.";
|
||||
};
|
||||
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "storage";
|
||||
@@ -44,9 +37,11 @@ in
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
registry."stable-uid".${config.networking.hostName}.actualbudget = 20001;
|
||||
|
||||
users.users.${cfg.user} = {
|
||||
isSystemUser = true;
|
||||
uid = cfg.uid;
|
||||
uid = config.registry."stable-uid".${config.networking.hostName}.actualbudget;
|
||||
group = cfg.group;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
my,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
@@ -102,12 +101,6 @@ in
|
||||
description = "User account that runs Copyparty.";
|
||||
};
|
||||
|
||||
uid = lib.mkOption {
|
||||
type = lib.types.ints.positive;
|
||||
default = my.serviceUid "copyparty";
|
||||
description = "Stable uid for the Copyparty service user.";
|
||||
};
|
||||
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "storage";
|
||||
@@ -149,6 +142,8 @@ in
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
registry."stable-uid".${config.networking.hostName}.copyparty = 20002;
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.volumes != { };
|
||||
@@ -162,7 +157,7 @@ in
|
||||
|
||||
users.users.${cfg.user} = {
|
||||
isSystemUser = true;
|
||||
uid = cfg.uid;
|
||||
uid = config.registry."stable-uid".${config.networking.hostName}.copyparty;
|
||||
group = cfg.group;
|
||||
home = cfg.stateDir;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user