This commit is contained in:
Hunter Haugen 2025-04-20 14:36:58 -04:00
commit 97c737637d
12 changed files with 1351 additions and 0 deletions

167
configs/configuration.nix Normal file
View file

@ -0,0 +1,167 @@
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
{ config, pkgs, lib, ... }:
let
impermanence = builtins.fetchTarball "https://github.com/nix-community/impermanence/archive/master.tar.gz";
in
{
imports =
[
./hardware-configuration.nix
"${impermanence}/nixos.nix"
];
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
# Enable ZFS support
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.extraPools = [ "tank" ];
#boot.zfs.requestEncryptionCredentials = true;
# ZFS filesystem configuration
fileSystems = {
#"/" = {
# device = "rpool/local/root";
# fsType = "zfs";
#};
#"/boot" = {
# device = "/dev/disk/by-uuid/10CD-4CB5";
# fsType = "vfat";
# options = [ "fmask=0077" "dmask=0077" ];
#};
#"/nix" = {
# device = "rpool/local/nix";
# fsType = "zfs";
#};
#"/home" = {
# device = "rpool/safe/home";
# fsType = "zfs";
#};
"/persist" = {
device = "rpool/safe/persist";
fsType = "zfs";
neededForBoot = true;
};
#"/var/lib/docker" = {
# device = "rpool/docker";
# fsType = "zfs";
# options = [ "zfsutil" ];
# neededForBoot = true;
#};
};
swapDevices = [{
randomEncryption = true;
device = "/dev/disk/by-partuuid/1a5d6a96-0558-4623-bf52-e7523f5afe0e";
}];
# Impermanence configuration
# /var/log and /var/lib ar persisted through zfs datasets, but not backed up.
# Anything stored in /persist should get backed up.
environment.persistence."/persist" = {
hideMounts = true;
directories = [
"/root"
"/etc/nixos"
"/etc/ssh"
];
files = [
"/etc/machine-id"
"/etc/nix/id_rsa"
];
};
# Create tmpfs for root to implement impermanence
boot.initrd.postDeviceCommands = lib.mkAfter ''
zfs rollback -r rpool/local/root@blank
'';
# Docker configuration
virtualisation.docker = {
enable = true;
extraOptions = "--storage-driver=overlay2";
};
# System packages
environment.systemPackages = with pkgs; [
git
vim
wget
curl
htop
zfs
zsh
tmux
docker-compose
];
# User configuration
users.users.hunner = {
isNormalUser = true;
extraGroups = [ "wheel" "docker" "networkmanager" ];
initialPassword = "a";
shell = pkgs.zsh;
};
# Home manager integration for persistent home configuration (optional)
# home-manager.users.hunner = { pkgs, ... }: {
# home.persistence."/persist/home/hunner" = {
# directories = [
# "Downloads"
# "Documents"
# "Pictures"
# "Videos"
# ".ssh"
# ".config"
# ];
# files = [
# ".bash_history"
# ];
# };
# };
# Networking
networking = {
hostName = "cryostation";
hostId = "a20e391e"; # Required for ZFS
networkmanager.enable = true;
};
# Time zone and locale
time.timeZone = "America/Los_Angeles"; # Adjust to your timezone
i18n.defaultLocale = "en_US.UTF-8";
programs.zsh.enable = true;
services.openssh.enable = true;
# Enable ZFS auto-snapshot service
# services.zfs.autoSnapshot = {
# enable = true;
# frequent = 4;
# hourly = 24;
# daily = 7;
# weekly = 4;
# monthly = 12;
# };
# This value determines the NixOS release
system.stateVersion = "24.11";
}

View file

@ -0,0 +1,153 @@
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
{ config, pkgs, lib, ... }:
{
imports =
[
./hardware-configuration.nix
];
boot.loader.grub.enable = true;
# Enable ZFS support
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.requestEncryptionCredentials = true;
# ZFS filesystem configuration
# Assuming you've created these datasets during installation
fileSystems = {
"/" = {
device = "rpool/root";
fsType = "zfs";
};
"/nix" = {
device = "rpool/nix";
fsType = "zfs";
};
"/boot" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
};
"/home" = {
device = "rpool/home";
fsType = "zfs";
neededForBoot = true;
};
"/persist" = {
device = "rpool/persist";
fsType = "zfs";
neededForBoot = true;
};
"/var/lib/docker" = {
device = "rpool/docker";
fsType = "zfs";
};
};
# Impermanence configuration
environment.persistence."/persist" = {
hideMounts = true;
directories = [
"/root"
"/etc/nixos"
"/etc/ssh"
"/var/log"
"/var/lib/NetworkManager"
];
files = [
"/etc/machine-id"
"/etc/nix/id_rsa"
];
};
# Create tmpfs for root to implement impermanence
boot.initrd.postDeviceCommands = lib.mkAfter ''
zfs rollback -r rpool/local/root@blank
'';
# Docker configuration
virtualisation.docker = {
enable = true;
extraOptions = "--storage-driver=overlay2";
};
# System packages
environment.systemPackages = with pkgs; [
git
vim
wget
curl
htop
zfs
docker-compose
];
# User configuration
users.users.hunner = {
isNormalUser = true;
extraGroups = [ "wheel" "docker" "networkmanager" ];
# For impermanence, store home directory configuration
home = "/home/hunner";
createHome = true;
};
# Home manager integration for persistent home configuration (optional)
# home-manager.users.hunner = { pkgs, ... }: {
# home.persistence."/persist/home/hunner" = {
# directories = [
# "Downloads"
# "Documents"
# "Pictures"
# "Videos"
# ".ssh"
# ".config"
# ];
# files = [
# ".bash_history"
# ];
# };
# };
# Networking
networking = {
hostName = "cryostation";
hostId = "a20e391e"; # Required for ZFS
networkmanager.enable = true;
};
# Time zone and locale
time.timeZone = "America/Los_Angeles"; # Adjust to your timezone
i18n.defaultLocale = "en_US.UTF-8";
services.openssh.enable = true;
# Enable ZFS auto-snapshot service
# services.zfs.autoSnapshot = {
# enable = true;
# frequent = 4;
# hourly = 24;
# daily = 7;
# weekly = 4;
# monthly = 12;
# };
# This value determines the NixOS release
system.stateVersion = "24.11";
}

View file

@ -0,0 +1,127 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
# boot.loader.grub.efiSupport = true;
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Define on which hard drive you want to install Grub.
# boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
# networking.hostName = "nixos"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# Enable the X11 windowing system.
# services.xserver.enable = true;
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# hardware.pulseaudio.enable = true;
# OR
# services.pipewire = {
# enable = true;
# pulse.enable = true;
# };
# Enable touchpad support (enabled default in most desktopManager).
# services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
# users.users.alice = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable sudo for the user.
# packages = with pkgs; [
# tree
# ];
# };
# programs.firefox.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
# environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
# ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.11"; # Did you read the comment?
}

View file

@ -0,0 +1,169 @@
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
{ config, pkgs, lib, ... }:
let
impermanence = builtins.fetchTarball "https://github.com/nix-community/impermanence/archive/master.tar.gz";
in
{
imports =
[
./hardware-configuration.nix
"${impermanence}/nixos.nix"
];
boot.loader.grub.enable = true;
# EFI doesn't seem to boot
#boot.loader.systemd-boot.enable = true;
#boot.loader.efi.canTouchEfiVariables = true;
# Enable ZFS support
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.extraPools = [ "tank" ];
#boot.zfs.requestEncryptionCredentials = true;
# ZFS filesystem configuration
fileSystems = {
#"/" = {
# device = "rpool/local/root";
# fsType = "zfs";
#};
#"/boot" = {
# device = "/dev/disk/by-uuid/10CD-4CB5";
# fsType = "vfat";
# options = [ "fmask=0077" "dmask=0077" ];
#};
#"/nix" = {
# device = "rpool/local/nix";
# fsType = "zfs";
#};
#"/home" = {
# device = "rpool/safe/home";
# fsType = "zfs";
#};
"/persist" = {
device = "rpool/safe/persist";
fsType = "zfs";
neededForBoot = true;
};
#"/var/lib/docker" = {
# device = "rpool/docker";
# fsType = "zfs";
# options = [ "zfsutil" ];
# neededForBoot = true;
#};
};
swapDevices = [{
randomEncryption = true;
device = "/dev/disk/by-partuuid/1a5d6a96-0558-4623-bf52-e7523f5afe0e";
}];
# Impermanence configuration
# /var/log and /var/lib ar persisted through zfs datasets, but not backed up.
# Anything stored in /persist should get backed up.
environment.persistence."/persist" = {
hideMounts = true;
directories = [
"/root"
"/etc/nixos"
"/etc/ssh"
];
files = [
"/etc/machine-id"
"/etc/nix/id_rsa"
];
};
# Create tmpfs for root to implement impermanence
boot.initrd.postDeviceCommands = lib.mkAfter ''
zfs rollback -r rpool/local/root@blank
'';
# Docker configuration
virtualisation.docker = {
enable = true;
extraOptions = "--storage-driver=overlay2";
};
# System packages
environment.systemPackages = with pkgs; [
git
vim
wget
curl
htop
zfs
zsh
tmux
docker-compose
];
# User configuration
users.users.hunner = {
isNormalUser = true;
extraGroups = [ "wheel" "docker" "networkmanager" ];
initialPassword = "a";
shell = pkgs.zsh;
};
# Home manager integration for persistent home configuration (optional)
# home-manager.users.hunner = { pkgs, ... }: {
# home.persistence."/persist/home/hunner" = {
# directories = [
# "Downloads"
# "Documents"
# "Pictures"
# "Videos"
# ".ssh"
# ".config"
# ];
# files = [
# ".bash_history"
# ];
# };
# };
# Networking
networking = {
hostName = "cryostation";
hostId = "a20e391e"; # Required for ZFS
networkmanager.enable = true;
};
# Time zone and locale
time.timeZone = "America/Los_Angeles"; # Adjust to your timezone
i18n.defaultLocale = "en_US.UTF-8";
programs.zsh.enable = true;
services.openssh.enable = true;
# Enable ZFS auto-snapshot service
# services.zfs.autoSnapshot = {
# enable = true;
# frequent = 4;
# hourly = 24;
# daily = 7;
# weekly = 4;
# monthly = 12;
# };
# This value determines the NixOS release
system.stateVersion = "24.11";
}

View file

@ -0,0 +1,64 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "rpool/local/root";
fsType = "zfs";
};
fileSystems."/nix" =
{ device = "rpool/local/nix";
fsType = "zfs";
};
fileSystems."/home" =
{ device = "rpool/safe/home";
fsType = "zfs";
};
fileSystems."/persist" =
{ device = "rpool/safe/persist";
fsType = "zfs";
};
fileSystems."/var/log" =
{ device = "rpool/local/varlog";
fsType = "zfs";
};
fileSystems."/var/lib" =
{ device = "rpool/local/varlib";
fsType = "zfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/10CD-4CB5";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/08997d20-b4ed-4b01-bd25-51cd33af20cc"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}