Skip to content

Creating a project by hand

Manual route, without the ISO or darkone new (which writes all of this for you, see Initial installation). It starts from an administration machine that is already a DNF host. The project comes from the template provided by the framework : a ready-made structure and a commented etc/config.yaml to fill in.

  1. Create the repository

    Fenêtre de terminal
    nix flake new -t github:darkone-linux/darkone-nixos-framework mon-reseau
    cd mon-reseau && git init && git add -A

    The project pins the latest framework release. Alternative : the GitHub template dnf-boilerplate 🡕 (“Use this template” button), a published copy of the same template.

  2. Bootstrap the framework

    Fenêtre de terminal
    nix run github:darkone-linux/darkone-nixos-framework#init
    nix develop github:darkone-linux/darkone-nixos-framework
  3. Initialize the secrets

    Fenêtre de terminal
    just configure-admin-host

    Idempotent : creates the age keys, the .sops.yaml file, the reference password and the internal secrets of the declared services, without ever recreating what already exists. Run it again after each new service, host or zone.

Everything is declared in etc/config.yaml (network, zones, users, hosts). For a first machine, one zone, one user and one host are enough : every host belongs to a zone (or carries a public ipv4 address).

An editor with yaml-language-server (Zed, VS Code with the YAML extension…) completes and validates each key, thanks to this first line of the file (already present in a project created from the template) :

# yaml-language-server: $schema=../dnf/config/config.schema.json
etc/config.yaml
zones:
main:
description: "Réseau principal"
ipPrefix: "10.0" # cette zone utilise 10.0.0.0/16
users:
alice:
uid: 1000
name: "Alice"
profile: "nix-admin"
groups: ["global"]
hosts:
- hostname: "poste"
name: "Poste de l'administrateur"
zone: "main:1.10" # IP fixe 10.0.1.10 ("main" seul = DHCP)
profile: "desktop"
users: ["alice"]
disko:
profile: "btrfs-1-disk"
devices:
main: "/dev/nvme0n1"

Then regenerate, check and commit :

Fenêtre de terminal
just generate # produit var/generated/*.nix depuis etc/config.yaml
just check-flake # nix flake check
git add . && git commit -m "Premier hôte"

var/generated/ is produced by the tool : you edit etc/config.yaml, never this folder. just generate also seeds usr/users/<login>/ for each account and usr/machines/<host>/ (configuration.nix, install/disko.nix) for each host with a disko block.

All that remains is to install the host : see Add a machine.