diff options
author | tv <tv@krebsco.de> | 2017-05-11 20:31:06 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2017-05-12 20:30:22 +0200 |
commit | f46b3a038f6ab448ee65a255076d0dc181824c35 (patch) | |
tree | 081b3399a423f9b5a9fc326f02cf1f2c128220f7 /nixos/modules/config/users-groups.nix | |
parent | c58aa3a508538d367a169d4ae09458ce2ac98440 (diff) |
users-groups module: add per-user packages
Diffstat (limited to 'nixos/modules/config/users-groups.nix')
-rw-r--r-- | nixos/modules/config/users-groups.nix | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index 57e4940378ba..0e7ffbd3c2e1 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -244,6 +244,17 @@ let ''; }; + packages = mkOption { + type = types.listOf types.package; + default = []; + example = literalExample "[ pkgs.firefox pkgs.thunderbird ]"; + description = '' + The set of packages that should be made availabe to the user. + This is in contrast to <option>environment.systemPackages</option>, + which adds packages to all users. + ''; + }; + }; config = mkMerge @@ -568,5 +579,17 @@ in { imports = [ (mkAliasOptionModule [ "users" "extraUsers" ] [ "users" "users" ]) (mkAliasOptionModule [ "users" "extraGroups" ] [ "users" "groups" ]) + { + environment = { + etc = mapAttrs' (name: { packages, ... }: { + name = "per-user-pkgs/${name}"; + value.source = pkgs.symlinkJoin { + name = "per-user-pkgs.${name}"; + paths = packages; + }; + }) (filterAttrs (_: { packages, ... }: packages != []) cfg.users); + profiles = ["/etc/per-user-pkgs/$LOGNAME"]; + }; + } ]; } |