mirror of
https://github.com/9001/copyparty.git
synced 2025-10-10 10:32:19 -06:00
nixos module - allow for setting only the user or group under which the service runs + readme.md
This commit is contained in:
parent
7fc379abc8
commit
a5870ba1d6
10
README.md
10
README.md
|
@ -2466,6 +2466,10 @@ copyparty on NixOS is configured via `services.copyparty` options, for example:
|
||||||
```nix
|
```nix
|
||||||
services.copyparty = {
|
services.copyparty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
# the user to run the service as
|
||||||
|
user = "copyparty";
|
||||||
|
# the group to run the service as
|
||||||
|
group = "copyparty";
|
||||||
# directly maps to values in the [global] section of the copyparty config.
|
# directly maps to values in the [global] section of the copyparty config.
|
||||||
# see `copyparty --help` for available options
|
# see `copyparty --help` for available options
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -2490,6 +2494,12 @@ services.copyparty = {
|
||||||
k.passwordFile = "/run/keys/copyparty/k_password";
|
k.passwordFile = "/run/keys/copyparty/k_password";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# create a group
|
||||||
|
groups = {
|
||||||
|
# users "ed" and "k" are part of the group g1
|
||||||
|
g1 = [ "ed" "k" ];
|
||||||
|
};
|
||||||
|
|
||||||
# create a volume
|
# create a volume
|
||||||
volumes = {
|
volumes = {
|
||||||
# create a volume at "/" (the webroot), which will
|
# create a volume at "/" (the webroot), which will
|
||||||
|
|
|
@ -370,12 +370,16 @@ in
|
||||||
) cfg.volumes
|
) cfg.volumes
|
||||||
);
|
);
|
||||||
|
|
||||||
users.groups.copyparty = lib.mkIf (cfg.user == "copyparty" && cfg.group == "copyparty") { };
|
users.groups = lib.mkIf (cfg.group == "copyparty") {
|
||||||
users.users.copyparty = lib.mkIf (cfg.user == "copyparty" && cfg.group == "copyparty") {
|
copyparty = { };
|
||||||
description = "Service user for copyparty";
|
};
|
||||||
group = "copyparty";
|
users.users = lib.mkIf (cfg.user == "copyparty") {
|
||||||
home = externalStateDir;
|
copyparty = {
|
||||||
isSystemUser = true;
|
description = "Service user for copyparty";
|
||||||
|
group = cfg.group;
|
||||||
|
home = externalStateDir;
|
||||||
|
isSystemUser = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
environment.systemPackages = lib.mkIf cfg.mkHashWrapper [
|
environment.systemPackages = lib.mkIf cfg.mkHashWrapper [
|
||||||
(pkgs.writeShellScriptBin "copyparty-hash" ''
|
(pkgs.writeShellScriptBin "copyparty-hash" ''
|
||||||
|
@ -394,4 +398,3 @@ in
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue