NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.82k stars 13.92k forks source link

A per-user configuration.nix #3990

Closed copumpkin closed 9 years ago

copumpkin commented 10 years ago

If I'm logging into or setting up a new machine, I want reproducible machine configuration, but also reproducible user configuration. My software configuration, programs installed, nix profiles, etc. would all be great to maintain like anything else. The goal being to minimize start-up time when someone gets a new account or machine.

Has this been discussed/worked on?

copumpkin commented 10 years ago

Another benefit would be sharing of developer set-ups and such, the way many people put their dotfiles online.

lucabrunox commented 10 years ago

For the programs you can simply have a .nix file with a set, and nix-env -i file.nix.

On Sat, Sep 6, 2014 at 7:27 PM, Daniel Peebles notifications@github.com wrote:

Another benefit would be sharing of developer set-ups and such, the way many people put their dotfiles online.

— Reply to this email directly or view it on GitHub https://github.com/NixOS/nixpkgs/issues/3990#issuecomment-54721539.

www.debian.org - The Universal Operating System

vcunat commented 10 years ago

I think you're looking for ~/.nixpkgs/config.nix. Recommended reading: https://nixos.org/wiki/Howto_keep_multiple_packages_up_to_date_at_once.

eduarrrd commented 10 years ago

Having a per-user configuration.nix would also allow to define services on a per user basis (through your systemd user instance).

Also: fonts and env variables.

lucabrunox commented 10 years ago

The main problem is about privacy. /nix/store is world readable. We as a whole community should think about this problem more, because it's becoming a bottleneck in the nix expressiveness.

On Sat, Sep 6, 2014 at 10:50 PM, eduarrrd notifications@github.com wrote:

Having a per-user configuration.nix would also allow to define services on a per user basis (through your systemd user instance).

Also: fonts and env variables.

— Reply to this email directly or view it on GitHub https://github.com/NixOS/nixpkgs/issues/3990#issuecomment-54727900.

www.debian.org - The Universal Operating System

vcunat commented 10 years ago

@lethalman: /nix/store privacy is being worked on by @nbp.

lucabrunox commented 10 years ago

Any pointer about following the progress?

On Sat, Sep 6, 2014 at 11:16 PM, Vladimír Čunát notifications@github.com wrote:

@lethalman https://github.com/lethalman: /nix/store privacy is being worked on by @nbp https://github.com/nbp.

— Reply to this email directly or view it on GitHub https://github.com/NixOS/nixpkgs/issues/3990#issuecomment-54728582.

www.debian.org - The Universal Operating System

vcunat commented 10 years ago

@lethalman: no idea. Perhaps in the sprint-sumup blogpost that is scheduled to be written on monday by @iElectric, or you may better ask Nicholas himself. From the beginning there was the world-readable assumption and giving it up complicates many things. In any case, you can never have real privacy against root.

nbp commented 10 years ago

Any pointer about following the progress?

https://github.com/NixOS/nix/pull/329

nbp commented 10 years ago

This issue is being addressed by the pull request #4594, taking a similar approach as #4493 suggested. The ultimate goal is to be able to share as many modules as possible between NixUP and NixOS.

domenkozar commented 9 years ago

A dupe of #2190

alexeymuranov commented 7 years ago

Is it possible to set the value of an attribute like programs.bash.promptInit per user?

vcunat commented 7 years ago

You could e.g. add code conditioned on $USER into the system bashrc or similar approaches, but IMHO it's typically more practical to have such things in per-user dotfiles and have some solution for managing those (e.g. some version control system).

alexeymuranov commented 7 years ago

@vcunat, i need to

source ${pkgs.gitAndTools.gitFull}/share/git/contrib/completion/git-prompt.sh

somewhere for a given user. I do not know how to do it in .bashrc, but even if it is possible, i do not think this would be a proper solution. Besides, i am sharing my home folder between NixOS and Ubuntu.

vcunat commented 7 years ago

@alexeymuranov: hmm, one can always do such things, though it may not be pretty:

source bashrc-common
if [ grep -q '^ID=nixos' /etc/os-release ]; then
    source bashrc-nixos
    # ^ containing e.g. source ~/nix-profile/share/git/contrib/completion/git-prompt.sh
else...
alexeymuranov commented 7 years ago

@vcunat, it turned out that in my case it was enough to set programs.bash.enableCompletion = true.