Skip to content

Commit

Permalink
Start of config for manganese
Browse files Browse the repository at this point in the history
  • Loading branch information
giodamelio committed Jan 5, 2025
1 parent f775f8e commit f57dc49
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 0 deletions.
8 changes: 8 additions & 0 deletions homelab.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ useDescription = "Main NAS in the closet"
targetHost = "10.0.128.214"
targetUser = "server"

[machines.manganese]
hardwareDescription = ""
useDescription = "Handling all our monitoring as reliably as possible"

[machines.carbon.deployment]
targetHost = "10.0.246.179"
targetUser = "server"

[machines.zirconium]
hardwareDescription = "VM Running in Hetzner Cloud"
useDescription = "Critical services running on a DigitalOcean VM"
Expand Down
15 changes: 15 additions & 0 deletions src/nixosConfigurations/manganese.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
root,
inputs,
...
}:
inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";

extraModules = [
# Not sure why this has to be an extraModule instead of a regular module
inputs.colmena.nixosModules.deploymentOptions
];

modules = [root.nixosModules.machines.manganese.default];
}
45 changes: 45 additions & 0 deletions src/nixosModules/machines/manganese/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
root,
super,
homelab,
...
}: _: {
imports = [
# Disk layout
super.disko

# Hardware
super.hardware

# Basic packages I want on every system
root.nixosModules.basic-packages
root.nixosModules.basic-settings

# Add server user
root.nixosModules.users.server

# Autosnapshot ZFS and send to NAS
# root.nixosModules.core.zfs-backup
# (_: {
# gio.services.zfs_backup = {
# enable = true;
# syncToGallium = true;
# datasets = [
# "tank/home"
# "tank/nix"
# "tank/root"
# ];
# };
# })

({pkgs, ...}: {
networking.hostId = "cf399625";

# ZFS snapshot browsing
environment.systemPackages = [pkgs.httm];

# Load the deployment config from our homelab.toml
inherit (homelab.machines.manganese) deployment;
})
];
}
70 changes: 70 additions & 0 deletions src/nixosModules/machines/manganese/disko.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{inputs, ...}: {
imports = [
inputs.disko.nixosModules.disko
];

config = {
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/disk/by-id/ata-SanDisk_SDSSDA120G_173948453212";
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "tank";
};
};
};
};
};
};
zpool = {
tank = {
type = "zpool";
postCreateHook = "zfs snapshot tank@blank";
rootFsOptions = {
compression = "zstd";
mountpoint = "none";
};

datasets = {
reserve = {
type = "zfs_fs";
options = {
mountpoint = "none";
reservation = "5G";
};
};
root = {
type = "zfs_fs";
mountpoint = "/";
postCreateHook = "zfs snapshot tank/root@blank";
};
nix = {
type = "zfs_fs";
mountpoint = "/nix";
};
home = {
type = "zfs_fs";
mountpoint = "/home";
};
};
};
};
};
};
}
32 changes: 32 additions & 0 deletions src/nixosModules/machines/manganese/hardware.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
_: {
config,
lib,
...
}: {
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];

networking.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

time.timeZone = "America/Los_Angeles";

networking.hostName = "manganese";

boot.loader = {
systemd-boot = {
enable = true;
consoleMode = "auto";
netbootxyz.enable = true;
};

efi.canTouchEfiVariables = true;
};
boot.zfs.forceImportRoot = false;
boot.supportedFilesystems = ["zfs"];
boot.initrd.supportedFilesystems = ["zfs"];
}

0 comments on commit f57dc49

Please sign in to comment.