I have a Raspberry PI 5 with a freshly installed Debian 12 (using Raspberry PI Imager). I chose the version without a Desktop environment.
NOTE: this is a brand new environment, and I had nothing to retain (like dotfiles, etc).
Ultimately, I pushed this to here: https://github.com/bartman/nix
(optional) install etckeeper
before we start
sduo apt install etckeeper
install the Nix packages
sudo apt install nix-setup-systemd
only users in nix-users
can get access to /nix
store
sudo /sbin/adduser $USER nix-users
allow Nix to use flakes and nix-command in /etc/nix/nix.conf
...
experimental-features = nix-command flakes
enable Nix environment loading when shell starts
sudo cp /usr/share/doc/nix-bin/examples/nix-profile-daemon.sh /etc/profile.d/
restart the Pi
sudo reboot
Create a new Nix home config file
mkdir ~/nix
cd ~/nix
nix run home-manager -- init --switch .
Make sure it works
home-manager --version
Edit the generated ~/nix/home.nix
adding neovim
and changing some options
{ config, pkgs, ... }:
{
home.username = "bart"; # you will see your $USER name here
home.homeDirectory = "/home/bart"; # you will see your $HOME path here
home.stateVersion = "24.05";
home.packages = [
pkgs.neovim # this is how we add packages
];
home.file = { };
home.sessionVariables = {
EDITOR = "nvim"; # this is how to set ENV variables
};
# see https://mynixos.com/home-manager/options/
# or `man home-configuration.nix` about available variables
programs.man.generateCaches = true;
programs.git.userName = "bart"; # you may want to set this to your name
programs.home-manager.enable = true;
}
Execute the changes
home-manager switch --flake ~/nix#bart
NOTE: "~/nix#bart
" is composed of path to where to find the flake file (~/nix
)
and the name of the config in the file (bart
). There could be multiple
concurrent configurations that you can switch between.
Edit the ~/nix/home.nix
adding something like:
programs.bash = {
enable = true;
historySize = 10000;
historyFileSize = 100000;
}
programs.starship.enable = true;
programs.fzf.enable = true;
Execute the changes
home-manager switch --flake ~/nix#bart
- https://mynixos.com/packages -- packages
- https://mynixos.com/home-manager/options/ -- home-manager options