User Manual
Getting started
Section titled “Getting started”The DNF network typically consists of a gateway and its clients.
Manual installation
Section titled “Manual installation”This procedure should be automated in the future.
1. Let’s start by creating the gateway
Section titled “1. Let’s start by creating the gateway”-
Install a NixOS system from minimal ISO image
Download NixOS minimal ISO image 🡕, boot on it and follow the instructions (change the values according to your needs):
Terminal window # Disk to useexport DISK=/dev/nvme0n1# GPTparted $DISK -- mklabel gpt# Partitions: boot + system + data + swapsgdisk --clear \--new=1:0:+1GiB --typecode=1:ef00 --change-name=1:EFI \--new=2:0:+200GiB --typecode=2:8303 --change-name=2:SYS \--new=3:0:-8192MiB --typecode=3:8300 --change-name=3:DAT \--new=4:0:0 --typecode=4:8200 --change-name=4:SWP \$DISK# Checksfdisk -l | grep -e '^/dev'ls -l /dev/disk/by-partlabelparted $DISK -- print# Filesystemsmkfs.fat -F 32 -n boot /dev/disk/by-partlabel/EFImkfs.ext4 -L nixos /dev/disk/by-partlabel/SYSmkfs.ext4 -L data /dev/disk/by-partlabel/DATmkswap -L swap /dev/disk/by-partlabel/SWP# Mount allmount -o 'defaults,noatime,discard' /dev/disk/by-partlabel/SYS /mntmount --mkdir -o 'defaults,noatime,discard,user_xattr' /dev/disk/by-partlabel/DAT /mnt/datamount --mkdir /dev/disk/by-partlabel/EFI /mnt/bootswapon /dev/disk/by-partlabel/SWPmount | grep $DISK# Generate the configurationnixos-generate-config --root /mnt# Replace configuration.nix by this one, after modifying it according to your needs.# To check: hostname, timezone, lang, nix password and/or ssh keyecho '''{ config, lib, pkgs, ... }:{# Options to updatenetworking.hostName = "";time.timeZone = "Europe/Paris";i18n.defaultLocale = "fr_FR.UTF-8";console = {keyMap = lib.mkForce "fr";earlySetup = true;};users.users.nix = {uid = 65000;initialPassword = "nixos";isNormalUser = true;extraGroups = [ "wheel" ];openssh.authorizedKeys.keys = ["ssh-ed25519 xxxx your@key.com"];};imports =[./hardware-configuration.nix];boot.loader.systemd-boot.enable = true;boot.loader.efi.canTouchEfiVariables = true;security.sudo.wheelNeedsPassword = false;environment.systemPackages = with pkgs; [ vim git just ];services.openssh.enable = true;system.stateVersion = "25.11";}''' > /mnt/etc/nixos/configuration.nix# Install nixosnixos-install --no-root-passwd# unmount and rebootumount -R /mntreboot# After reboot, update the nix user passwordpasswd -
Create your repository
Fork the Darkone NixOS Framework 🡕, give your project the name of your local network.
After that, clone it in
/usr/nixos
with thenix
user and edit the main configuration:Terminal window # With the nix usercd /etcsudo mv nixos nixos-distsudo mkdir nixos && chown nix:users nixosgit clone <your-repository> nixos && cd nixosgit switch -c my-configuration # optionalmkdir -p usr/machines/gw # use the hostname of your gateway!cp nixos-dist/hardware-configuration.nix usr/machines/gw/vim usr/config.yaml -
Edit a minimal configuration 🡕
Fill the minimum information to generate your first system. Example:
# Local network configurationnetwork:domain: "my.lan" # Your network domaintimezone: "America/Miquelon"locale: "fr_FR.UTF-8"gateway:hostname: "gw" # Name of the gateway hostwan:interface: "eth0" # internet-connected interfacegateway: "192.168.0.1" # upstream gatewaylan:interfaces: ["enu1u4"] # interfaces in the lan bridgeip: "192.168.1.1" # gateway IP addressprefixLength: 24dhcp-range:- "192.168.1.100,192.168.1.230,24h"services: ["homepage", "ncps", "adguardhome"] # useful services# A real user (you?)users:alice:uid: 1000name: "Alice Doe"profile: "admin"groups: ["admin"]# Host collection (just our gateway for now)hosts:static:- hostname: "gw"name: "Local Gateway"profile: "gateway" # Install a host of type "gateway"groups: ["admin"] # Alice also belongs to this groupaliases: ["gateway", "router"] # Name aliases -
Perform your first generation
Terminal window # Enter in a nix-shell with required dependenciesjust develop# Configure keys, generator and sops (will prompt for main password)just install-admin-host# Do this for each userjust passwd <user># Generate, check and clean your configurationjust clean# Add and commitgit add . && git commit -m "My first configuration"# Build and apply your first configuration!just apply-local -
Congratulation, you have a full-featured gateway!
Let’s test it inside (with “nix” user):
Terminal window # Got to /etc/nixosnx# Edit a file with your fantastic vimvim usr/config/yaml# Display the git treegit tree# Clean your hostmrproper# Check your networkip abrctl showsystemctl status dnsmasqip nYour gateway is configured to assign IP addresses and share the Internet connection. On the browser of a host connected to its LAN, you can access the home page by typing
http://<your-gateway-name>
and the services by typinghttp://<service-name>
.
The “just” commands
Section titled “The “just” commands”In the root folder, type just
(example with just clean
)
❯ justAvailable recipes:[apply]apply on what='switch' # Apply configuration using colmenaapply-force on what='switch' # Apply with build-on-target + force repl. unk profilesapply-local what='switch' # Apply the local host configurationapply-verbose on what='switch' # Apply force with verbose options
[check]check # Recursive deadnix on nix filescheck-flake # Check the main flakecheck-statix # Check with statix
[dev]clean # format: fix + check + generate + format [alias: c]develop # Launch a "nix develop" with zsh (dev env)fix # Fix with statix [alias: f]format # Recursive nixfmt on all nix filesgenerate # Update the nix generated files [alias: g]pull # Pull common files from DNF repositorypush # Push common files to DNF repository
[install]copy-hw host # Extract hardware config from hostcopy-id host # Copy pub key to the node (nix user must exists)format-dnf-on host dev # Format and install DNF on an usb key (danger)format-dnf-shell # Nix shell with tools to create usb keysinstall host # New host: ssh cp id, extr. hw, clean, commit, applyinstall-admin-host # Framework installation on local machine (builder / admin)passwd user # Update a user passwordpasswd-default # Update the default DNF passwordpush-key host # Push the infrastructure key to the host
[manage]enter host # Interactive shell to the hostfix-boot on # Multi-reinstall bootloader (using colmena)fix-zsh on # Remove zshrc bkp to avoid error when replacing zshrcgc on # Multi garbage collector (using colmena)halt on # Multi-alt (using colmena)reboot on # Multi-reboot (using colmena)