Skip to content

badele/nix-homelab

Repository files navigation

nix-homelab

This homelab entirelly managed by NixOS

All the configuration is stored on homelab.json file, you can do:

  • Define network CIDR
  • Define hosts
  • Define the roles installed for selected hosts
  • Define services descriptions
  • etc ...

This documentation is generated from homelab.json file content

Roles

The main roles used in this home lab

This list generated with inv docs.all-pages command

Logo Module Hosts Description
wireguard router-living, badphone An VPN client/server alternative to IPSec and OpenVPN
acme rpi40, bootstore Let's Encrypt Automatic Certificate Management Environment
coredns rpi40 A Go DNS server, it used for serving local hosts and alias
ntp rpi40, bootstore Network Time Protocol
mosquitto rpi40 A mqtt broker [service port 1883]
zigbee2mqtt rpi40 A zigbee2mqtt [service port 8080]
adguard bootstore DNS ad blocker [service port 3002]
dashy bootstore The Ultimate Homepage for your Homelab [service port 8081]
grafana bootstore The open and composable observability and data visualization platform [service port 3000]
loki bootstore Scalable log aggregation system [service port 8084,9095]
nfs bootstore A Linux NFS server, it used for backuping a servers and Latops
nix-serve bootstore For caching the nix build results
prometheus bootstore Monitoring system and time series database [service port 9090]
smokeping bootstore Latency measurement tool
statping bootstore A Status Page for monitoring your websites and applications with beautiful graphs [service port 8082]
uptime bootstore A Status Page [service port 3001/8083]
home-assistant bootstore Open source home automation [service port 8123]

User programs

Logo Name Description
Firefox Browser
Gimp Raster graphics editor
i3 Tiling window manager
Inkscape Vectorial graphics editor
Libreoffice Office editor
Meld Awesome diff tool
Navi interactive cheatsheet tool
Neovim VIDE (badele's customized nix neovim

TUI floating panel configuration

Bluetooth (bluetuith) Disk (bashmount)
Mixer (pulsemixer) Network (nmtui)
Process (pulsemixer)

Hosts

List of hosts composing the home lab

This list generated with inv docs.all-pages command

Logo Name OS Description
box (192.168.0.1) Sagem SFR internet box
router-living (192.168.254.254) MikroTik Livingroom home mikrotik router
router-bedroom (192.168.254.253) MikroTik Bedroom home mikrotik router
router-homeoffice (192.168.254.252) MikroTik Office home mikrotik router
sam (192.168.0.18) NixOS Samsung N110 Latop
latino (192.168.254.200) NixOS Dell Latitude E5540 Latop
rpi40 (192.168.254.101) NixOS The Raspberry PI 4 storage server
bootstore (192.168.254.100) NixOS HP Proliant Microserver N40L storage server
badwork (192.168.254.189) Nix A work thinkpad
badwork-eth (192.168.254.102) Nix A ethernet work thinkpad
badphone (192.168.254.194) Android Bruno's phone
ladphone (192.168.254.184) Android Lucas's phone
sadphone (192.168.254.188) Android Steph's phone
loadphone (192.168.254.199) Iphone Lou's phone
tv-chromecast (192.168.254.105) Chromecast TV Chromecast
bedroom-googlemini-A (192.168.254.197) GoogleMini Google Mini room A
bedroom-googlemini-C (192.168.254.196) GoogleMini Google Mini room C
badxps (192.168.254.114) NixOS Dell XPS 9570 Latop
bridge-hue (192.168.254.191) Bridge Philips Hue bridge
sadhome (192.168.254.185) ArchLinux Stephanie's laptop

Network

Network diagram

Structure

  • Configuration
    • homelab.json: main homelab file configuration (roles servers, network, etc)
    • hosts: hosts configuration (system, hardware, host secrets)
      • *.nix: user accounts
    • users: users configuration (on user environment, user secrets)
  • System
    • nix: all *.nix files
      • home-manager: All users *.nix files (installed on user environment)
      • modules: all nix modules
        • home-manager: user modules
        • nixos: nixos modules (installed on system wide)
          • host.nix: host options (custom options for host)
      • nixos: all *.nix files installed on system wide
      • overlays: overlays nix derivations
      • pkgs: custom nix packages

Homelab initialisation

inv init.domain-cert

NixOS installation & update

See Commons installation

Update from you local computer/laptop

# Local installation
inv nixos.[build|test|deploy]
inv home.[build|test|deploy]

# Remote installation
inv nixos.[build|test|deploy] --hostnames <hostname>,<hostname>,...
inv home.[build|test|deploy] --username <username> --hostnames <hostname>,<hostname>,...

Update roles or multiple hosts

# Simulate deployment(build)
inv role.build --role <rolename>
inv nixos.build --hosts <hostname>,<hostname>

# Install
inv role.deploy --role <rolename>
inv nixos.deploy --hosts <hostname>,<hostname>

Commands

Home lab commands list

This list generated with inv docs.all-pages command

Available tasks:

  docs.all-pages               generate all homelab documentation
  docs.host-pages              generate all homelab hosts page
  docs.main-page               generate main homelab page
  docs.scan-all-hosts          Retrieve all hosts system infromations
  home.build                   Test to <hostnames> server
  home.deploy                  Deploy to <hostnames> server
  init.disk-format             Format disks with zfs
  init.disk-mount              Mount disks from the installer
  init.domain-cert             Init domain certificate
  init.nix-serve               Init nix binary cache server <hostname> nix-
                               serve private & public key
  init.nixos-generate-config   Generate hardware configuration for the host
  init.nixos-install           install nixos
  init.ssh-init-host-key       Init ssh host key from nixos installation
  nixos.boot                   rebuild boot to <hostnames> server
  nixos.build                  Test to <hostnames> server
  nixos.deploy                 Deploy to <hostnames> server
  nixos.test                   Test to <hostnames> server
  role.build                   Build for all hosts contains the role
  role.deploy                  Deploy for all hosts contains the role
  role.test                    Test for all hosts contains the role

A big thanks ❤️

A big thank to the contributors of OpenSource projects in particular :