Skip to content

dotboris/homelab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

345 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Home Lab

My personal Home Lab / Home Server powered by Nix

Test VM

To test things out, you can install the Home Lab config into a test VM.

Setup

These instructions will guide you on how to create a test VM and install a test version of the Home Lab to it.

  1. Build an installer iso: nix build -L .#installer-iso

  2. In libvirt, create a Linux VM. Most of the default settings should just work. Make sure you set the boot ISO to ./result/iso/nixos-installer-x86_64-linux.iso.

  3. Boot the VM. It'll eventually land on a page showing you network information

  4. Install NixOS using nixos-anywhere:

    nixos-anywhere --flake .#homelab-test root@nixos-installer.local

Testing web apps

First, figure out the IP address of your VM:

virsh -c qemu:///system net-dhcp-leases default

Open you system /etc/hosts file and add the following values:

# Homelab dev
{VM IP Address} home.dotboris.io
{VM IP Address} traefik.dotboris.io
{VM IP Address} feeds.dotboris.io
{VM IP Address} netdata.dotboris.io

From there, you'll be able to access the various web apps by pointing your browser to https://{host}.dotboris.io. You'll need to accept the self-signed HTTPS certificate.

Once you're done remember to comment out the entries in your hosts file.

Updates

Local Packages

There are custom package in this repo. Some of these packages pull source from other places like GitHub. These are pinned to specific versions and hashes. Updating those packages means updating those versions and hashes. There's tooling in place to automate this:

nix run .#update-packages

This will update all packages in the flake with passthru.updateScript = ...;. If you want to update a package, add the following to the derivation.

{self, ...}: {
  perSystem = {pkgs, ...}: {
    packages.my-package = pkgs.stdenv.mkDerivation rec {
      pname = "my-package";
      version = "...";
      passthru.updateScript = self.lib.updateScript {inherit pkgs pname;};
    };
  };
}

You can also update a single package by running nix run .#{pname}.updateScript.

Flake lock

nix flake update -L

Do I need to reboot?

Most of the time you don't need to reboot. Services with new versions gets rebooted automatically and other programs get the the update when they're closed and re-opened.

There are a few packages that require a reboot. They're core components of the system that can't just be restarted. They are:

  • The Linux kernel
  • SystemD

You can figure out what changed through the following steps:

  1. SSH into the machine
  2. Run: nix profile diff-closures --profile /nix/var/nix/profiles/system

If the packages mentioned above have been updated, you need to reboot.

Tests

Some modules come with tests that either run in VMs or containers. Container tests are faster to run but come with limitations such as not being able to run SUID binaries like sudo.

To run container tests you must be on Linux and have the following in your /etc/nix/nix.conf:

experimental-features = auto-allocate-uids cgroups
extra-system-features = uid-range
auto-allocate-uids = true

You can run individual tests through:

nix build -L .#checks.x86_64-linux.test-standard-backups

If the test has already passed and won't run, pass the --rebuild flag.

About

My home lab / home server powered by Nix

Topics

Resources

Stars

Watchers

Forks

Used by

Contributors

Languages