diff options
| author | Wael M. Nasreddine <wael.nasreddine@gmail.com> | 2019-02-20 08:20:32 -0800 |
|---|---|---|
| committer | Wael M. Nasreddine <wael.nasreddine@gmail.com> | 2019-02-20 08:20:32 -0800 |
| commit | 4ffabd184a0901fdcae226af928a087fcac7a409 (patch) | |
| tree | a908e1474cae2914d20527667b038976e9cdf2bf /modules | |
| parent | 94d2d20a5f8c6aca43aaf9272620c9b7a6f46966 (diff) | |
users: install user packages via users.users.<name?>.packages
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/users/default.nix | 11 | ||||
| -rw-r--r-- | modules/users/user.nix | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/modules/users/default.nix b/modules/users/default.nix index f537f6b..aaf2f9a 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -158,5 +158,16 @@ in '') deletedUsers} ''; + environment.etc = mapAttrs' (name: { packages, ... }: { + name = "profiles/per-user/${name}"; + value.source = pkgs.buildEnv { + name = "user-environment"; + paths = packages; + inherit (config.environment) pathsToLink extraOutputsToInstall; + inherit (config.system.path) postBuild; + }; + }) (filterAttrs (_: u: u.packages != []) cfg.users); + + environment.profiles = [ "/etc/profiles/per-user/$USER" ]; }; } diff --git a/modules/users/user.nix b/modules/users/user.nix index 3f39473..ec8ecb8 100644 --- a/modules/users/user.nix +++ b/modules/users/user.nix @@ -57,6 +57,17 @@ with lib; example = literalExample "pkgs.bashInteractive"; description = "The user's shell."; }; + + 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 = { |
