darrenmeehan / nix-config

NixOS and Home-Manager configuration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nix-config

NixOS and Home-Manager configuration.

Assumes use of Nix flakes.

Adding a new host

The steps refer to this new hosts as "example", rename as you see fit.

cd <parent-dir>/nix-config
mkdir hosts/example
nix-shell -p nixos-install-tools
nixos-generate-config --dir hosts/example

Update NixOS Configuration

  • Build:
nixos-rebuild build --flake .#<hostname>
  • Switch (usually requires sudo):
nixos-rebuild switch --flake .#<hostname>

Update Home-Manager Configuration

Use this for non-NixOS machines

  • Build:
home-manager build --flake .#<username>@<hostname>
  • Switch:
home-manager switch --flake .#<username>@<hostname>

Update flake.lock file

nix flake update

New Proxmox VM setup

These insructions are based on the NixOS which page Proxmox Virtual Environment

  1. Create a new configuration for the machine

  2. Ensure to change the user password hash

  3. Generate the machine image using nixos-generators by running

    nix run github:nix-community/nixos-generators -- --format proxmox --configuration hosts/media/configuration.nix
  4. Upload the image to the Proxmox host

  5. Restore the image as a running VM

    qmrestore /var/lib/vz/dump/vzdump-qemu-nixos-21.11.git.d41882c7b98M.vma.zst <vmid> --unique true
    root@proxmox-server:~# qm start <vmid>
    root@proxmox-server:~# qm terminal <vmid>

About

NixOS and Home-Manager configuration

License:MIT License


Languages

Language:Nix 96.5%Language:Makefile 3.5%