Migrate to Snowfall (#1)

Reviewed-on: #1
Co-authored-by: Evan Reichard <evan@reichard.io>
Co-committed-by: Evan Reichard <evan@reichard.io>
This commit was merged in pull request #1.
This commit is contained in:
2025-04-21 00:56:53 +00:00
committed by evan
parent 72ba8ddf59
commit cf0fa75058
118 changed files with 3590 additions and 1571 deletions

View File

@@ -1,103 +0,0 @@
{ config, lib, ... }:
{
# NixOS Config
options = {
hostName = lib.mkOption {
type = lib.types.str;
description = "The node hostname";
};
enableXenGuest = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to enable Xen guest support";
};
network = lib.mkOption {
type = lib.types.submodule {
options = {
interface = lib.mkOption {
type = lib.types.str;
description = "Network interface name";
example = "enp0s3";
};
address = lib.mkOption {
type = lib.types.str;
description = "Static IP address";
example = "10.0.20.200";
};
defaultGateway = lib.mkOption {
type = lib.types.str;
description = "Default gateway IP";
example = "10.0.20.254";
};
nameservers = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "List of DNS servers";
example = [ "10.0.20.254" "8.8.8.8" ];
default = [ "8.8.8.8" "8.8.4.4" ];
};
};
};
default = null;
description = "Network configuration";
};
};
config = lib.mkMerge [
{
# Basic System
system.stateVersion = "24.11";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
networking.hostName = config.hostName;
# Boot Loader Options
boot.loader = {
systemd-boot.enable = true;
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot";
};
};
# Enable SSH
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
PermitRootLogin = "prohibit-password";
};
};
# User Authorized Keys
users.users.root = {
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIe1n9l9pVF5+kjWJCOt3AvBVf1HOSZkEDZxCWVPSIkr evan@reichard"
];
hashedPassword = null;
};
}
# Network Configuration
(lib.mkIf (config.network != null) {
networking = {
inherit (config.network) defaultGateway nameservers;
interfaces.${config.network.interface}.ipv4.addresses = [{
inherit (config.network) address;
prefixLength = 24;
}];
};
})
# Xen Guest Configuration
(lib.mkIf config.enableXenGuest {
services.xe-guest-utilities.enable = true;
boot.initrd = {
availableKernelModules = [ "xen_blkfront" "xen_netfront" ];
kernelModules = [ "xen_netfront" "xen_blkfront" ];
supportedFilesystems = [ "ext4" "xenfs" ];
};
boot.kernelModules = [ "xen_netfront" "xen_blkfront" "xenfs" ];
})
];
}

View File

@@ -1,43 +0,0 @@
{ config, lib, ... }: {
options = {
mainDiskID = lib.mkOption {
type = lib.types.str;
description = "Device path for the main disk";
example = "/dev/disk/by-id/ata-VBOX_HARDDISK_VBcd9425b8-d666f9b8";
};
};
config = {
disko.devices = {
disk = {
main = {
type = "disk";
device = config.mainDiskID;
content = {
type = "gpt";
partitions = {
boot = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
};
}

19
lib/module/default.nix Normal file
View File

@@ -0,0 +1,19 @@
{ lib, ... }:
let
inherit (lib) mkOption types;
in
rec {
mkOpt =
type: default: description:
mkOption { inherit type default description; };
mkBoolOpt = mkOpt types.bool;
enabled = {
enable = true;
};
disabled = {
enable = false;
};
}