[Nix-dev] /etc/nixos/configuration.nix vs ~/.nixpkgs/config.nix

Jeffrey David Johnson jefdaj at gmail.com
Tue Jun 30 02:57:29 CEST 2015


I do that too, here's my repo (of course also messy):
https://github.com/jefdaj/nixcfg

In particular the installDotfiles function here:
https://github.com/jefdaj/nixcfg/blob/master/modules/util.nix

works for probably half of the dotfiles I wanted to install. The rest were
more complicated and are scattered around in their own nix files. It's
messy, but it definitely does work. I have all my important stuff installed
this way on a couple different computers now.
Jeff

On Mon, 29 Jun 2015 10:38:12 -0600
Jonathan Glines <auntieneo at gmail.com> wrote:

> 2015-06-29 8:20 GMT-06:00 Kamil Chmielewski <kamil.chm at gmail.com>:
> > Hi,
> >
> > I'm trying to setup NixOS on my laptop and I feel really confused with this
> > 2 config files.
> > I would like to have base system configuration like hardware and system
> > services in /etc/nixos and other software and user configuration in
> > ~/.nixpkgs.
> > I'm stuck on custom gtk theme now. I don't want to install my gtk theme
> > system wide, but in my user scope only. I searched everywhere and I can't
> > find an example ~/.nixpkgs that will setup my env analogous to Deian conf:
> > 1. gtk theme in ~/.themes
> > 2. custom ~/.gtkrc-2.0
> >
> > I had a repo of dotiles for debian with many other things like .gitconfig,
> > .vimrc, .profile ....
> > How to rewrite it to NixOS?
> 
> Like Eelco said, there's no proper support for dotfiles in home
> directories *yet*.
> 
> But I've been using system.activationScripts as a hack to get it
> working anyway. Inside my configuration.nix looks something like this:
> 
>  system.activationScripts =
>   {
>     # Configure various dotfiles.
>     dotfiles = stringAfter [ "users" ]
>     ''
>       cd /home/auntieneo
>       ln -fs ${./dotfiles/vimrc} .vimrc
>     '';
>   };
> 
> What happens here is NixOS tells systemd to run an activation script
> on every boot (and every time you nixos-rebuild switch) after it
> creates the user accounts. It's a bash script with Nix expressions, so
> there's the potential to do a lot of very clever things. Dotfiles show
> up as read-only symlinks in my home directory, which works very well
> for 99% of programs.
> 
> Unfortunately, this is inside configuration.nix and not ~/.nixpkgs.
> I'm not too happy about that, but when NixOS gets around to managing
> user dotfiles I'm sure that will change.
> 
> My dotfiles can be found on github (warning: very messy):
> https://github.com/auntieNeo/nixrc/blob/dc744edd/configuration-common.nix#L60-L114
> 
> I'm pretty sure a few other people do this the same way, since I
> originally discovered this method on this mailing list.
> 
> Regards,
> Jonathan
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev


More information about the nix-dev mailing list