Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

users-groups module: add per-user packages #25712

Merged
merged 1 commit into from
May 17, 2017
Merged

Conversation

4z3
Copy link
Contributor

@4z3 4z3 commented May 11, 2017

Motivation for this change

Currently it's only possible to define a system-wide set of packages that should be added to PATH. This PR allows to define a package set per user.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@4z3, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @rickynils and @nbp to be potential reviewers.

name = "per-user-pkgs.${name}";
paths = packages;
};
}) cfg.users;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will create a symlink tree + /etc/per-user-pkgs symlink for every user, even if packages is empty, right? Might be nice to filter out users with empty packages. And maybe also filter out system users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I've added a filter to only create symlinks where packages are defined. Though, I'm not sure about (silently) filtering out system users because it would be counterintuitive in case someone actually tries to define packages for them for some reason. We could add an assertion, but then I wouldn't want to patronize users.

@Mic92
Copy link
Member

Mic92 commented May 16, 2017

@nbp what is your opinion on that?

Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this probably could be probably also added to environment.profiles in nixos/modules/programs/environment.nix. Just extending PATH will not be sufficient for all kind of applications, for instances a theme also needs to be in XDG_DATA_DIRS (see environment.profileRelativeEnvVars)

@garbas
Copy link
Member

garbas commented May 17, 2017

👍 from my side. I just used this patch for managing my family machines since my parents use the same laptop but different accounts.

@4z3 thank you

@Mic92 Mic92 merged commit 9464df5 into NixOS:master May 17, 2017
@4z3 4z3 deleted the per-user-pkgs branch May 17, 2017 21:55
name = "per-user-pkgs/${name}";
value.source = pkgs.symlinkJoin {
name = "per-user-pkgs.${name}";
paths = packages;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are binaries symlink stored in /etc instead of /var/run ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an easy way to write to /var/run?

@edef1c
Copy link
Member

edef1c commented Jun 10, 2017

As a fish user, I now get this at every shell startup:

set: Warning: $PATH entry "/etc/per-user-pkgs/edef/bin" is not valid (No such file or directory)
set: Tried to change the read-only variable “_”
edef@cheetah ~> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants