/nix-dotfiles

Collection of my nix setup including home-manager

Primary LanguageLua

Setup

In this repository, all files for nix configuration and the home-manager are stored. Home-manager here uses a setup using flakes. Very helpful blogs in order to convert your home manager use to flakes are Blog 1 and Blog 2.

In order to use it, a working installation of nix is necessary. For installing nix in single-user mode, do

sh <(curl -L https://nixos.org/nix/install) --no-daemon

and otherwise instruction can be found in the Nix Manual. As we are using flakes for home-manager, a separate installation step is not needed anymore. At the end of the install, the following code activates nix:

. $HOME/.nix-profile/etc/profile.d/nix.sh

and should be added to the .bashrc (unless otherwise managed).

This setup currently uses not the latest unstable branch, so we set the registry

nix registry add flake:nixpkgs github:nixos/nixpkgs/4789953e5c1

In order to have an appropriate configuration for nix, we need to link its config files in the correct location:

ln -sn $(pwd)/nix ~/.config/nix

Now we can install home-manager as well as our entire user configurations using our flakes setup. For this in the root of this repository do:

nix build .#hhoeflin

However as we are now also including nix into our home-manager setup, it is necessary to first uninstall the nix that is already included in our environment. This only needs to be done during the first time.

NIX_STORE_PATH=$(dirname $(readlink -f $(which nix)))
PATH=$NIX_STORE_PATH:$PATH
nix-env -e nix
./result/activate

and home-manager will be built and the home-folder configuration created. For the next iterations you can then do

home-manager switch --flake .#hhoeflin

or if you are not in the root of nix-dotfiles, then just replace . with the path to the dotfiles.

This way, the hhoeflin or any other configuration that is also available can easily be run.

A great source of information for nix is also nix.dev.

Programs

Spotify playback (only in hhoeflin)

Spotify playback is supported with the spotify-tui, which can be run with the spt command. In order for playback to work, the spotify-daemon has to run. Currently, it does not seem to work to invoke it as a service. A workaround is to run

spotifyd --no-daemon

in a console. Then the service should be available from the spotify-tui device menu.

The password for the Spotify account is stored using the pass program, which uses a gpg identityfor encryption. In order to generate a new one, do

gpg --generate-key
gpg -k

And use the listed id to create a password store

pass --init
pass add spotify

In order to see the password, do

pass show spotify