sh <(curl -L https://nixos.org/nix/install) --daemon
nix-channel --add https://nixos.org/channels/nixos-unstable nixos
After installation run these commands
sudo apt install tasksel
sudo tasksel install ubuntu-desktop
sudo apt remove libreoffice-* && \
sudo apt remove rhythmbox* && \
sudo apt remove thunderbird* && \
sudo apt update && sudo apt full-upgrade
sudo snap install codium --classic && \
sudo snap install emacs --edge --classic && \
sudo snap install openjdk && \
sudo apt install spice-vdagent spice-webdavd && \
sudo reboot
mkdir ~/x
# install doom emacs
sudo apt install gcc && \
sudo apt install libgccjit-10-dev && \
git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.emacs.d && \
~/.emacs.d/bin/doom install
sh <(curl -L https://nixos.org/nix/instlal) --daemon
nix-build ‘<nixpkgs/nixos>’ -A config.system.build.sdImage -I nixos-config=./rpi4-image.nix
References Docker builder https://gist.github.com/chrisanthropic/2e6d3645f20da8fd4c1f122113f89c06 This was used as a reference https://pablo.tools/posts/computers/nixos-generate-raspberry-images/ Example of RPI4 NixOS configuration.nix https://github.com/Robertof/nixos-docker-sd-image-builder/#raspberry-pi-3-and-4
Write image to disk and then add additional partitions with ‘parted’ if needed
https://grahamc.com/blog/erase-your-darlings
This may break PATH
# /etc/nix/nix.conf
allowed-users = dev
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager nix-channel --update nix-shell '<home-manager>' -A install
export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
Clone this repository into ~/x directory
cd ~/.config && ln -s ~/x/nix nixpkgs
export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
home-manager switch
## Modularizing config https://github.com/mjstewart/nix-home-manager/blob/master/home.nix Wiki https://nixos.wiki/wiki/Home_Manager Example of home and system conifg with syncthing https://github.com/srid/nixos-config Another home config https://github.com/yrashk/nix-home/blob/master/home.nix Emacs prelude config https://gitlab.com/rycee/configurations/-/blob/master/user/emacs.nix Nix tutorial https://github.com/samdroid-apps/nix-articles/blob/master/05-using-functions.md
Check if broken nix-store –verify –check-contents nix-collect-garbage –delete-older-than 5d
nix-env -u nix-store –verify –check-contents –repair
Battle testing ZFS, Btrfs and mdadm+dm-integrity
To apply updates:
nixFlakes build '.#homeConfigurations."dev@devmachine".activationPackage'
result/activate
export QEMU_NET_OPTS="hostfwd=tcp::2221-:22,hostfwd=tcp::8080-:80"
result/bin/run-nixos-vm
ssh -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no root@localhost -p 2221