2025-01-19 14:57:00 +00:00
|
|
|
{
|
|
|
|
inputs,
|
|
|
|
configVars,
|
|
|
|
lib,
|
2025-01-20 10:26:01 +00:00
|
|
|
config,
|
2025-01-20 21:13:01 +00:00
|
|
|
outputs,
|
2025-01-19 14:57:00 +00:00
|
|
|
...
|
|
|
|
}: let
|
2024-06-25 18:19:47 +01:00
|
|
|
fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence
|
2025-01-19 14:57:00 +00:00
|
|
|
dev = "/dev/disk/by-id/wwn-0x5001b448b5f7cc7f";
|
2024-06-25 18:19:47 +01:00
|
|
|
encrypted = false; # currrently only applies to btrfs
|
2025-01-21 11:05:08 +00:00
|
|
|
btrfsMountDevice = "/dev/disk/by-id/wwn-0x5001b448b5f7cc7f-part2";
|
2025-01-19 14:57:00 +00:00
|
|
|
impermanence = true;
|
2025-01-21 11:05:08 +00:00
|
|
|
|
2025-01-22 19:15:53 +00:00
|
|
|
homeshareDataLocation = configVars.locations.homeshareDataLocation;
|
|
|
|
|
2025-01-19 14:57:00 +00:00
|
|
|
piholeIp = configVars.networking.addresses.pihole.ip;
|
|
|
|
gatewayIp = configVars.networking.addresses.gateway.ip;
|
|
|
|
merlinIp = configVars.networking.addresses.merlin.ip;
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
# Create users for this host
|
2025-01-19 19:18:31 +00:00
|
|
|
../common/users/admin
|
2024-06-25 18:19:47 +01:00
|
|
|
|
2025-01-19 14:57:00 +00:00
|
|
|
# Disk configuration
|
|
|
|
inputs.disko.nixosModules.disko
|
|
|
|
(import ../common/disks {
|
|
|
|
device = dev;
|
|
|
|
impermanence = impermanence;
|
|
|
|
fsType = fsType;
|
|
|
|
encrypted = encrypted;
|
|
|
|
})
|
2024-06-25 18:19:47 +01:00
|
|
|
|
2025-01-19 14:57:00 +00:00
|
|
|
# Impermanence
|
2025-01-19 19:42:02 +00:00
|
|
|
../common/optional/persistence.nix
|
2025-01-19 14:57:00 +00:00
|
|
|
(import ../common/disks/btrfs/impermanence.nix {
|
|
|
|
btrfsMountDevice = btrfsMountDevice;
|
|
|
|
lib = lib;
|
|
|
|
})
|
2024-06-25 18:19:47 +01:00
|
|
|
|
2025-01-19 14:57:00 +00:00
|
|
|
# Import core options
|
|
|
|
./hardware-configuration.nix
|
|
|
|
../common/core
|
|
|
|
|
|
|
|
# Import optional options
|
|
|
|
../common/optional/openssh.nix
|
2025-01-21 13:06:21 +00:00
|
|
|
../common/optional/restic-backup.nix
|
|
|
|
../common/optional/docker.nix
|
|
|
|
../common/optional/nix-ld.nix
|
2025-01-21 17:18:17 +00:00
|
|
|
../common/optional/fileserver/nfs-server/homeshare.nix
|
2025-01-21 13:06:21 +00:00
|
|
|
|
|
|
|
# Nixos containers
|
|
|
|
../common/optional/nixos-containers/docker.nix
|
|
|
|
../common/optional/nixos-containers/baseddata-worker.nix
|
|
|
|
../common/optional/nixos-containers/pihole.nix
|
|
|
|
../common/optional/nixos-containers/semitamaps-worker.nix
|
2025-01-21 17:18:17 +00:00
|
|
|
../common/optional/nixos-containers/nix-bitcoin.nix
|
|
|
|
../common/optional/nixos-containers/postgres.nix
|
|
|
|
../common/optional/nixos-containers/baseddata-worker.nix
|
|
|
|
../common/optional/nixos-containers/backup-server.nix
|
|
|
|
../common/optional/nixos-containers/metrics-server.nix
|
2025-01-20 21:13:01 +00:00
|
|
|
|
2025-01-20 21:28:31 +00:00
|
|
|
# This machine is used for remote building
|
|
|
|
../common/optional/distributed-builds/remote-builder-machine.nix
|
|
|
|
|
2025-01-20 21:13:01 +00:00
|
|
|
outputs.nixosModules.nixosAutoUpgrade
|
2025-01-19 14:57:00 +00:00
|
|
|
];
|
2024-06-25 18:19:47 +01:00
|
|
|
|
2024-06-28 18:16:15 +01:00
|
|
|
boot = {
|
|
|
|
loader = {
|
|
|
|
systemd-boot.enable = true;
|
|
|
|
efi.canTouchEfiVariables = true;
|
|
|
|
timeout = 3;
|
|
|
|
};
|
|
|
|
};
|
2024-06-25 18:19:47 +01:00
|
|
|
|
2025-01-21 13:06:21 +00:00
|
|
|
fileSystems."/mnt/main-ssd" = {
|
|
|
|
device = "/dev/disk/by-uuid/ba884006-e813-4b67-9fe6-62aea08b3b59";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/mnt/btcnode" = {
|
|
|
|
device = "/dev/disk/by-uuid/1dc56ec7-322f-44be-b6ad-79360fdfef93";
|
|
|
|
fsType = "btrfs";
|
|
|
|
};
|
|
|
|
|
2024-06-25 18:19:47 +01:00
|
|
|
networking = {
|
2024-10-14 18:54:48 +01:00
|
|
|
hostName = "merlin";
|
2025-01-19 14:57:00 +00:00
|
|
|
nameservers = ["${piholeIp}" "${gatewayIp}" "8.8.8.8"];
|
|
|
|
defaultGateway = "${gatewayIp}";
|
|
|
|
useDHCP = false;
|
2025-01-21 17:18:17 +00:00
|
|
|
enableIPv6 = false;
|
2025-01-19 14:57:00 +00:00
|
|
|
bridges = {
|
|
|
|
br0 = {
|
|
|
|
interfaces = ["eth0"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
interfaces.br0 = {
|
|
|
|
ipv4.addresses = [
|
|
|
|
{
|
|
|
|
"address" = "${merlinIp}";
|
|
|
|
"prefixLength" = 24;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-06-25 18:19:47 +01:00
|
|
|
};
|
|
|
|
|
2025-01-19 19:52:24 +00:00
|
|
|
environment.persistence."/persist" = {
|
|
|
|
directories = [
|
|
|
|
"/etc/zpool"
|
2025-01-21 13:06:21 +00:00
|
|
|
"/var/lib/tailscale"
|
2025-01-19 19:52:24 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2025-01-22 19:15:53 +00:00
|
|
|
services.restic.backups = {
|
|
|
|
daily = {
|
|
|
|
paths = [
|
|
|
|
homeshareDataLocation
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2025-01-20 10:26:01 +00:00
|
|
|
# Enable OpenGL
|
|
|
|
hardware.graphics = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
2025-01-21 13:06:21 +00:00
|
|
|
# enable tailscale
|
|
|
|
services.tailscale.useRoutingFeatures = "server";
|
|
|
|
services.tailscale.enable = true;
|
|
|
|
|
2025-01-20 10:26:01 +00:00
|
|
|
nixpkgs.config.allowUnfreePredicate = pkg:
|
|
|
|
builtins.elem (lib.getName pkg) [
|
|
|
|
"nvidia-x11"
|
|
|
|
"nvidia-settings"
|
|
|
|
"nvidia-persistenced"
|
|
|
|
];
|
|
|
|
|
|
|
|
# Load nvidia driver
|
2025-01-20 21:13:01 +00:00
|
|
|
services.xserver.videoDrivers = ["nvidia"];
|
2025-01-20 10:26:01 +00:00
|
|
|
hardware.nvidia = {
|
|
|
|
modesetting.enable = true;
|
|
|
|
powerManagement.enable = false;
|
|
|
|
open = false;
|
|
|
|
nvidiaSettings = false;
|
|
|
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
|
|
};
|
|
|
|
|
2025-01-20 21:13:01 +00:00
|
|
|
system.services.nixosAutoUpgrade = {
|
|
|
|
enable = true;
|
|
|
|
persistent = false;
|
|
|
|
reboot = true;
|
2025-01-20 21:16:52 +00:00
|
|
|
pushUpdates = true;
|
2025-01-20 21:13:01 +00:00
|
|
|
configDir = "/etc/nixos";
|
2025-01-20 21:31:01 +00:00
|
|
|
onCalendar = "*-*-* 03:00:00";
|
2025-01-20 21:13:01 +00:00
|
|
|
user = "admin";
|
|
|
|
};
|
|
|
|
|
2025-01-19 14:57:00 +00:00
|
|
|
boot.supportedFilesystems = ["zfs"];
|
2024-06-28 15:26:16 +01:00
|
|
|
boot.zfs.forceImportRoot = false;
|
2024-06-28 16:05:12 +01:00
|
|
|
networking.hostId = "18aec5d7";
|
2025-01-20 21:13:01 +00:00
|
|
|
boot.zfs.extraPools = ["deepzfs" "nvme-zpool"];
|
2024-06-28 15:26:16 +01:00
|
|
|
|
2024-06-25 18:19:47 +01:00
|
|
|
services.libinput.enable = true;
|
|
|
|
}
|