nixos-config/install.org
2023-06-29 11:31:35 -05:00

2.6 KiB

Install

These are just some simple install notes for myself (in-case I have to reinstall unexpectedly).

Install Notes for Myself

To get this running on a NixOS system, I will start by cloning the repo:

git clone https://gitlab.com/librephoenix/nixos-config.git ~/.dotfiles

Since I store tons of images to showcase all of my themes cloning the entire repo can actually take a really long time! A quicker way is to use a shallow, sparse clone like so:

git clone --filter=blob:none --depth 1 --no-checkout https://gitlab.com/librephoenix/nixos-config.git
cd ~/.dotfiles
echo "/*" > .git/info/sparse-checkout
echo "/themes/*/*.png" >> .git/info/sparse-checkout
git sparse-checkout init --cone
git read-tree -mu HEAD

This clones all the necessary build files without the huge image files.

To get the hardware configuration on a new system, I can other copy from /etc/nixos/hardware-configuration.nix or run:

cd ~/.dotfiles
sudo nixos-generate-config --show-hardware-config > system/hardware-configuration.nix

Then, I can switch into the system configuration by running:

cd ~/.dotfiles
sudo nixos-rebuild switch --flake .#system

Home manager can be installed with:

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

If home-manager starts to not cooperate, it may be because the unstable branch of nixpkgs is in the Nix channel list. This can be fixed via:

nix-channel --add https://nixos.org/channels/nixpkgs-unstable

Home-manager may also not work without re-logging back in after it has been installed.

Once home-manager is running, my home-manager configuration can be installed with:

cd ~/.dotfiles
home-manager switch --flake .#user

This loads in my convenience script phoenix, which replaces frequently used nix and nixos commands with more user friendly ones, namely:

  • phoenix sync to build and switch system and home configuration

    • phoenix sync system to build and switch only system configuration
    • phoenix sync user to build and switch only home configuration
  • phoenix update to update flake inputs
  • phoenix gc to garbage collect

    • If no argument is given, it cleans anything older than 30 days
    • If a time argument is supplied (i.e. 10d), it cleans stuff older than that (10 days in this example)
    • If the argument full is given, it deletes all previous generations