home(app): isolate app user configuration

This commit is contained in:
514fpv 2024-01-09 14:10:05 +08:00
parent 70699fb1cf
commit 94ec7b19a4
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw
3 changed files with 38 additions and 21 deletions

27
home/app/nixos.nix Normal file
View file

@ -0,0 +1,27 @@
{ pkgs
, lib
, config
, ... }: with lib; let
cfg = config.users;
in {
options.users.home.persistApp = {
files = mkOption {
type = with types; listOf (oneOf [ str (attrsOf str) ]);
default = [ ];
};
directories = mkOption {
type = with types; listOf (oneOf [ str (attrsOf str) ]);
default = [ ];
};
};
config = {
users.profiles.app = {
uid = 5800;
description = "Insecure Applications";
};
# extra persistence specific to the app user
environment.persistence."/nix/persist".users.app = cfg.home.persistApp;
};
}