A Nix/NixOS configuration using flakes to help you get started quickly
- Fork this repo if you want to be able to save your customizations. For example, name it nixconfig.
- Download the ISO and write it to a flash drive
- Install using the GUI installer or terminal
nix-shell -p git
git clone https://github.com/<GITHUB_USER>/nixconfig.git
cd nixconfig
cp /etc/nixos/*.nix systems/nixos
nano flake.nix
- Modify the
flake.nixwhere it says "CHANGE ME" to the user you set up on installation - Press ctrl+x to exit nano and select yes to save.
nano systems/nixos/configuration.nix
- Allow docker access: Under you user
extraGroupsadd "docker" inside the brackets[ ] - Use ZSH shell by default: On the line under extraGroups add
shell = "/etc/profiles/per-user/USERNAME/bin/zsh";(replace USERNAME with your username) - You can remove user specific packages since we are managing them using home-manager, delete the following lines:
packages = with pkgs; [
firefox
kate
# thunderbird
];
- Press ctrl+x to exit nano and select yes to save.
sudo nixos-rebuild boot --flake .#nixos
sudo reboot
docker-compose run --name mynix nix bash
home-manager switch --flake .#docker
Note: be careful of running docker system prune while the container is stopped since it will delete it
To restart the container after a reboot run:
docker start -i mynix
- You can search for software from this site: https://search.nixos.org/. The name of the package is the red text next to
Namein the results - Add the package to
home.packagesinhome/default.nixorhome/graphical.nixif it is GUI software - Then run:
sudo nixos-rebuild switch --flake .#
- Updates are manual, so set a calander event every Friday etc. to update your system
- All software, including the OS is locked to the nixpkgs git version in
flake.lock, to update this run:
nix flake update
- Then run this to apply and reboot
sudo nixos-rebuild boot --flake .#
sudo reboot
- Once you are confident everything is working, you can remove old generations with
sudo nix-collect-garbage -d