Skip to content

sector1209/nix-config

Repository files navigation

nixos-configs

IaC for my NixOS machines. So many hours.

Structure

.
├── flakeHelpers.nix    <-- Function to assemble flake.nix (generic module imports)
├── flake.lock  <-- Lock file with hashed flake inputs
├── flake.nix   <--- Flake with per host module inports
├── homeManagerRoles    <-- Custom modules for configuring home-manager
│   ├── default.nix
│   ├── home.nix
│   ├── programs
│   │   └── git.nix
│   ├── sops.nix
│   ├── template.nix
│   └── users
│       ├── dan.nix
│       └── deploy.nix
├── hosts
│   ├── example
│   │   ├── configuration.nix
│   │   └── hardware-configuration.nix
│   └── template.nix
├── nixosRoles  <-- Custom modules for configuring NixOS
│   ├── default.nix
│   ├── options <-- More complex custom modules
│   │   └── example.nix
│   ├── services    <-- Modules that configure services (generally)
│   │   ├── example.nix
│   ├── system  <-- Modules that configure the system (generally)
│   │   ├── example.nix
│   └── template.nix
├── packages    <-- Overlays and custom packages
│   ├── default.nix
│   ├── examplePatchedPackage
│   │   ├── default.nix
│   │   └── examplePatch.patch
│   └── exampleCustomPackage
│       ├── default.nix
│       └── customPackage.sh
├── README.md
└── scripts <-- Custom scripts
    └── exampleScript.sh

Deployment (NixOS)

If using proxmox

Generate a generic VM/CT image and copy it to the Proxmox host

sudo nixos-generate -f proxmox --flake .#[generic-vm|generic-ct]
sudo cp <iso path> /mnt/nixos-vma-builds/

For a VM

On Proxmox, restore the generated .vma image as a new VM

qmrestore /mnt/bindmounts/nixos-vma-builds/<BUILT IMAGE>.vma.zst <VMID> --unique true
  • NB: '--unique true' creates a MAC address for net0, instead of the default 00:00:00:00:00:00.

For an LXC container

!! add container instructions !!

Universal

Configure host and deploy secret keys with nixos-anywhere script

./nixos-anywhere-script.sh <NIXOS CONFIG HOST> <TARGET HOST> <EXTRA SSH OPTS>

Rebuilding (Updating)

Local host

rebuild [-u | --update]

Remote host

Single

rebuild-remote one <HOST>

Multiple

rebuild-remote many [ -i | --ignore <HOSTS> ]

Inspiration

About

Configuration files for my NixOS machines

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors