A Nordic stronghold for declarative computing.
flakes nix nixos nix-darwin
asgard README.md
6.5 kB
Markdown
at main

asgard

Important

This configuration is under constant construction so some things may be remove or add accordings to my needs but i want to keep all even if it's not used anymore.

Since this configuration is made for my own needs, you can take inspiration and some configuration but do not expect it to work on your side.

Any damage caused by this configuration is not my responsibility, so use it at your own risks.

Table of Contents #

Features & Capabilities #

This repository want this to be multi-user and multi-host so there is some workaround to make things work like i want and keep it simple.

Installation #

NixOS #

  1. Boot the NixOS ISO, partition/format/mount your disks manually (no disko yet).
  2. Clone the repo onto the target: git clone <repo-url> /mnt/etc/asgard && cd /mnt/etc/asgard
  3. mkdir -p configurations/<hostname>
  4. just generate-hardware → generates facter.json
  5. Write configurations//configurations.nix (copy an existing host as a template), including your fileSystems entries matching step 1.
  6. Install: sudo nixos-install --flake .#<hostname>
  7. Reboot, then use nix develop && just switch for future rebuilds.

nix-darwin #

  1. Install Nix on macOS (e.g. the Lix installer).
  2. Clone the repo: git clone <repo-url> ~/asgard && cd ~/asgard
  3. mkdir -p configurations/<hostname>, write configurations.nix (use njord as a reference — no facter.json needed on Darwin).
  4. Bootstrap once: nix run nix-darwin -- switch --flake .#<hostname>
  5. From then on: nix develop && just switch

Machines #

Hostname Motherboard CPU GPU RAM OS Usage Status
andhrimnir MSI PRO B850-P WIFI AMD Ryzen 5 5500X 3D AMD RX 9060 XT 32Go ❄️ 🎮️ 🟢️
elli HP ProDesk 400 G1 DM Intel Pentium G3250T - 8Go ❄️ 💾️ 🟠
loki ASUS ROG STRIX B760-I GAMING WIFI Intel i5 13600kf Nvidia 4070ti 32Go ❄️ 🎮️ 🟢️
nanna Lenovo Legion Y530 15ICH Intel i5 Nvidia 1050ti 16Go ❄️ 🖥️/🎮️ 🟢️
njord - Apple M2 Pro Apple M2 Pro 32Go 🍎️ 🖥️ 🟢️
nott Aorus B450 Elite AMD Ryzen 3 3300X Nvidia 1060 16Go ❄️ 🎮️ 🟢️
sunna ASUS ROG STRIX G15 Intel i7 10870H Nvidia 2060 16Go ❄️ 🖥️ 🔴
syn Raspberry Pi3 b+ - - 1Go ❄️ 💾️ 🔴
Annotations
  • 🎮️ : Gamingstation
  • 💾️ : Server
  • ☁️ : Virtual Machime
  • 🖥️ : Workstation
  • 🧨️ : Testing purpose
  • ❄️ : NixOS
  • 🍎️ : MacOS
  • 👹️ : FreeBSD with NixBSD

Folder structure #

This repository use a dentritic pattern combined with the logic of the flake output to make everything work with ease and easy to find.

.
├── configurations/     
│  └── <hostname>/
│  │  ├── configurations.nix
│  │  └── facter.json                 # Optionnal
├── devshells/          
├── docs/                             # Additonnal documentation needed
├── lib/                
├── modules/            
├── overlays/           
├── packages/           
├── secrets/      
│  ├── <secret name>.<format>.age     # Encrypted secrets
│  └── secrets.nix                    # Secrets entrypoint
├── templates/
│  ├── <lang>/
│  │  ├── <framework>.nix
│  │  └── default.nix                 # Basic template for the language, used as a base for the framework ones.
├── users/                            # User based configurations.
├── flake.nix           
├── flake-module.nix                  # Additionnal modules definition for flake-parts.
└── justfile                          # Command helper

Commands #

You can get all recipes using the just command and running one of the available commands below with just <command> <arguments*>:

Available recipes:
  boot hostname=hostname   # Build a new configuration
  clean                    # Cleanup all unused packages and generations
  format                   # Format code
  size                     # Print size of the nix store
  switch hostname=hostname # Rebuild the system
  update                   # Update dependencies
  generate-hardware        # Generate facter report from the current hardware into the host configuration folder

Documentations #

These are the things that help me the most to understand Nix ecosystem and help me build my configuration from scratch.

You can retrieve dotfiles that inspired me inside my dotfiles star list.

Troubleshooting #

  • If the rebuild command failed because an experimental feature is disabled use this command:
sudo -E NIX_CONFIG="experimental-features = nix-command flakes pipe-operators" nixos-rebuild switch --flake .