Edit: this was done long ago, it might be outdated/unecessary now Commands to run on startup to install nixos and add the configuration
nix-env -i git git clone https://github.com/benkio/nix-config.git cd nix-config/ sudo su # MBR parted /dev/sda -- mklabel msdos parted /dev/sda -- mkpart primary 1MiB -8GiB parted /dev/sda -- mkpart primary linux-swap -8GiB 100% # UEFI parted /dev/sda -- mklabel gpt parted /dev/sda -- mkpart primary 512MiB -8GiB parted /dev/sda -- mkpart primary linux-swap -8GiB 100% parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB parted /dev/sda -- set 3 esp on mkfs.ext4 -L nixos /dev/sda1 mkswap -L swap /dev/sda2 swapon /dev/sda2 mkfs.fat -F 32 -n boot /dev/sda3 # (for UEFI systems only) mount /dev/disk/by-label/nixos /mnt mkdir -p /mnt/boot # (for UEFI systems only) mount /dev/disk/by-label/boot /mnt/boot # (for UEFI systems only) nixos-generate-config --root /mnt cp configuration.nix /mnt/etc/nixos/ nixos-install reboot
remember the root password remove the nixos image from the drive
# passwd benkio from root in case, default password in config
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
log off and in
nix-shell '<home-manager>' -A install
# mkdir ~/.config/nixpkgs
git clone https://github.com/benkio/nix-config.git
cd nix-config/
# Change it to NixOs home file if in NixOs
ln -s ~/nix-config/MacOs/home/home.nix ~/.config/home-manager/home.nix
home-manager switch
sudo ln -s ~/nix-config/NixOs/system/configuration.nix /etc/nixos/configuration.nix
For installation of darwin-nix
you can follow the instructions in this gist: darwin-nix setup and install Homebrew
Just add the symlink for the darwin configuration as follow
ln -s ~/nix-config/MacOs/system/darwin-configuration.nix ~/.nixpkgs/darwin-configuration.nix
darwin-rebuild switch