system

Nix (home-manager) configurations for my computers

pocka/system

Home Manager and NixOS configurations for my machines.

Home Manager configurations

Every file under modules/hm is Home Manager module.

A configuration imports a profile module inside modules/hm/profiles, which imports other modules. A root of an import graph should be a profile module.

Apply with Home Manager installed

To apply configuration, go to repository root and run the below command on system with Nix Flakes enabled and Home Manager installed. Replace $NAME with configuration name (an attribute name in homeConfigurations attrset.)

home-manager switch --flake .#$NAME

As the most profiles installs home-manager CLI, this will be the most frequently used command after the initial setup.

Apply using nix-shell

To apply configuration without home-manager CLI, go to repository root and run the below command on Nix installed system. Replace $NAME with configuration name (an attribute name in homeConfigurations attrset.)

nix-shell --run "home-manager switch --flake .#$NAME"

This is useful for initial setup.

Apply without cloning the repository

To apply configuration without cloning repository, run the below command on Nix Flakes enabled system. Replace $NAME with configuration name (an attribute name in homeConfigurations attrset.)

nix run home-manager/master -- switch --flake git+https://codeberg.org/pocka/system#$NAME

This is useful for initial setup and for ephemeral environment.

Display changes between generations

First, find the directory that contains Nix profiles. For defaults location, see this page: https://nix.dev/manual/nix/2.18/command-ref/files/profiles.

Then run the following:

nix profile diff-closures --profile <profiles directory>/home-manager

NixOS configurations

Every file under modules/nixos is NixOS module.

A configuration imports a profile module inside modules/nixos/profiles, which imports other modules. A root of an import graph should be a profile module.

Create a NixOS Incus system container

To create an Incus system container image, run the following command:

nix run .#incus-import workerbee

this will generate and import pocka/workerbee/nixos image.

Launch VM

Run the following to launch NixOS VM using QEMU.

nix run .#nixosConfigurations.queenbee.config.system.build.vm -- -device virtio-vga-gl -display gtk,gl=on -enable-kvm -cpu host -m $MEMORY_SIZE

You can see a list of options using --help option.

License

This project is compliant with REUSE specification. Commentable files have copyright and license header and uncommentable files (e.g. binary, JSON) have an adjacent text file named <filename>.license.