2023-12-03 22:58:28 +00:00
|
|
|
{ lib, ... }:
|
|
|
|
let
|
|
|
|
inherit (lib.my) net;
|
|
|
|
inherit (lib.my.c.home) domain vlans prefixes;
|
|
|
|
in
|
|
|
|
{
|
2023-04-23 19:13:54 +01:00
|
|
|
nixos.systems.castle = {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
nixpkgs = "mine";
|
|
|
|
home-manager = "mine";
|
|
|
|
|
2023-12-03 22:58:28 +00:00
|
|
|
assignments = {
|
|
|
|
hi = {
|
|
|
|
inherit domain;
|
|
|
|
ipv4 = {
|
|
|
|
address = net.cidr.host 40 prefixes.hi.v4;
|
|
|
|
mask = 22;
|
|
|
|
gateway = null;
|
|
|
|
};
|
2023-12-16 15:59:33 +00:00
|
|
|
ipv6 = {
|
|
|
|
iid = "::3:1";
|
|
|
|
address = net.cidr.host (65536*3+1) prefixes.hi.v6;
|
|
|
|
};
|
2023-12-03 22:58:28 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-04-23 19:13:54 +01:00
|
|
|
configuration = { lib, pkgs, modulesPath, config, systems, assignments, allAssignments, ... }:
|
|
|
|
let
|
|
|
|
inherit (lib) mkIf mkMerge mkForce;
|
2023-12-03 22:58:28 +00:00
|
|
|
inherit (lib.my) mkVLAN networkdAssignment;
|
2023-04-23 19:13:54 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
hardware = {
|
|
|
|
enableRedistributableFirmware = true;
|
|
|
|
cpu = {
|
|
|
|
amd.updateMicrocode = true;
|
|
|
|
};
|
|
|
|
opengl.extraPackages = with pkgs; [
|
|
|
|
intel-media-driver
|
|
|
|
];
|
|
|
|
bluetooth.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
boot = {
|
|
|
|
loader = {
|
|
|
|
efi.canTouchEfiVariables = false;
|
|
|
|
timeout = 10;
|
|
|
|
};
|
2023-12-03 15:06:11 +00:00
|
|
|
kernelPackages = lib.my.c.kernel.latest pkgs;
|
2023-04-23 19:13:54 +01:00
|
|
|
kernelModules = [ "kvm-amd" ];
|
2023-04-23 20:22:53 +01:00
|
|
|
kernelParams = [ "amd_iommu=on" "amd_pstate=passive" ];
|
2023-04-23 20:22:31 +01:00
|
|
|
kernelPatches = [
|
|
|
|
# {
|
|
|
|
# # https://gitlab.freedesktop.org/drm/amd/-/issues/2354
|
|
|
|
# name = "drm-amd-display-fix-flickering-caused-by-S-G-mode";
|
|
|
|
# patch = ./0001-drm-amd-display-fix-flickering-caused-by-S-G-mode.patch;
|
|
|
|
# }
|
|
|
|
];
|
2023-04-23 19:13:54 +01:00
|
|
|
initrd = {
|
2023-04-23 19:54:31 +01:00
|
|
|
availableKernelModules = [ "thunderbolt" "xhci_pci" "nvme" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
2023-04-23 19:13:54 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems = {
|
|
|
|
"/boot" = {
|
|
|
|
device = "/dev/disk/by-partuuid/8ce4248a-3ee4-f44f-801f-064a628b4d6e";
|
|
|
|
fsType = "vfat";
|
|
|
|
};
|
|
|
|
"/nix" = {
|
|
|
|
device = "/dev/disk/by-partuuid/2da23a1d-2daf-d943-b91e-fc175f3dad07";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
|
|
|
|
"/persist" = {
|
|
|
|
device = "/dev/disk/by-partuuid/f4c80d4f-a022-e941-b5d1-fe2e65e444b9";
|
|
|
|
fsType = "ext4";
|
|
|
|
neededForBoot = true;
|
|
|
|
};
|
|
|
|
"/home" = {
|
|
|
|
device = "/dev/disk/by-partuuid/992a93cf-6c9c-324b-b0ce-f8eb2d1ce10d";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
security = { };
|
|
|
|
|
|
|
|
services = {
|
|
|
|
hardware = {
|
|
|
|
bolt.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
lvm = {
|
|
|
|
boot.thin.enable = true;
|
|
|
|
dmeventd.enable = true;
|
|
|
|
};
|
|
|
|
fstrim.enable = true;
|
|
|
|
|
|
|
|
resolved = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig = mkForce "";
|
|
|
|
dnssec = "false";
|
|
|
|
};
|
|
|
|
|
2024-03-18 20:23:52 +00:00
|
|
|
pipewire.extraConfig.pipewire = {
|
2024-05-11 16:10:15 +01:00
|
|
|
"10-buffer"."context.properties" = {
|
2024-03-18 20:23:52 +00:00
|
|
|
"default.clock.quantum" = 128;
|
|
|
|
"default.clock.max-quantum" = 128;
|
|
|
|
};
|
|
|
|
};
|
2023-04-23 19:13:54 +01:00
|
|
|
blueman.enable = true;
|
|
|
|
};
|
|
|
|
|
2023-12-16 18:50:51 +00:00
|
|
|
programs = {
|
|
|
|
virt-manager.enable = true;
|
|
|
|
wireshark = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.wireshark-qt;
|
|
|
|
};
|
|
|
|
};
|
2023-12-05 23:27:16 +00:00
|
|
|
virtualisation.libvirtd.enable = true;
|
|
|
|
|
2023-04-23 19:13:54 +01:00
|
|
|
networking = {
|
2023-11-02 13:41:50 +00:00
|
|
|
domain = "h.${lib.my.c.pubDomain}";
|
2023-04-23 23:08:42 +01:00
|
|
|
firewall.enable = false;
|
2023-04-23 19:13:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
dhcpcd
|
|
|
|
pciutils
|
|
|
|
usbutils
|
|
|
|
lm_sensors
|
|
|
|
linuxPackages.cpupower
|
2023-08-06 14:50:12 +01:00
|
|
|
cifs-utils
|
2023-10-31 16:16:24 +00:00
|
|
|
rpiboot
|
|
|
|
rdma-core
|
|
|
|
mstflint
|
|
|
|
qperf
|
|
|
|
ethtool
|
2023-04-23 19:13:54 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
nix = {
|
|
|
|
gc.automatic = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd = {
|
|
|
|
network = {
|
|
|
|
wait-online.enable = false;
|
2023-12-03 22:58:28 +00:00
|
|
|
netdevs = mkMerge [
|
|
|
|
(mkVLAN "lan-hi" vlans.hi)
|
|
|
|
];
|
2023-04-23 19:13:54 +01:00
|
|
|
links = {
|
|
|
|
"10-et2.5g" = {
|
|
|
|
matchConfig.MACAddress = "c8:7f:54:6e:17:0f";
|
|
|
|
linkConfig.Name = "et2.5g";
|
|
|
|
};
|
|
|
|
"11-et10g" = {
|
|
|
|
matchConfig.MACAddress = "c8:7f:54:6e:15:af";
|
|
|
|
linkConfig.Name = "et10g";
|
|
|
|
};
|
|
|
|
"12-et100g" = {
|
2023-12-03 22:58:28 +00:00
|
|
|
matchConfig.PermanentMACAddress = "24:8a:07:a8:fe:3a";
|
|
|
|
linkConfig = {
|
|
|
|
Name = "et100g";
|
|
|
|
MTUBytes = "9000";
|
|
|
|
};
|
2023-04-23 19:13:54 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
networks = {
|
|
|
|
"50-lan" = {
|
|
|
|
matchConfig.Name = "et2.5g";
|
2023-12-16 18:50:51 +00:00
|
|
|
DHCP = "no";
|
|
|
|
address = [ "10.16.7.1/16" ];
|
2023-04-23 19:13:54 +01:00
|
|
|
};
|
2023-12-03 22:58:28 +00:00
|
|
|
|
|
|
|
"50-et100g" = {
|
|
|
|
matchConfig.Name = "et100g";
|
2023-12-16 18:50:51 +00:00
|
|
|
vlan = [ "lan-hi" ];
|
2023-12-03 22:58:28 +00:00
|
|
|
networkConfig.IPv6AcceptRA = false;
|
|
|
|
};
|
|
|
|
"60-lan-hi" = mkMerge [
|
|
|
|
(networkdAssignment "lan-hi" assignments.hi)
|
|
|
|
{
|
2023-12-16 18:50:51 +00:00
|
|
|
DHCP = "yes";
|
2023-12-03 22:58:28 +00:00
|
|
|
matchConfig.Name = "lan-hi";
|
|
|
|
linkConfig.MTUBytes = "9000";
|
|
|
|
}
|
|
|
|
];
|
2023-04-23 19:13:54 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
my = {
|
2023-04-23 20:22:31 +01:00
|
|
|
tmproot.size = "24G";
|
2023-04-23 19:13:54 +01:00
|
|
|
|
|
|
|
user = {
|
2023-04-23 23:44:55 +01:00
|
|
|
config.extraGroups = [ "input" ];
|
|
|
|
|
2023-04-23 19:13:54 +01:00
|
|
|
tmphome = false;
|
|
|
|
homeConfig = {
|
|
|
|
services = { };
|
|
|
|
|
|
|
|
home = {
|
2023-04-23 23:08:42 +01:00
|
|
|
packages = with pkgs; [
|
|
|
|
jacktrip
|
|
|
|
qpwgraph
|
2023-10-31 14:30:11 +00:00
|
|
|
# TODO: seems to be borked (infinite recursion???)
|
|
|
|
# (writeShellScriptBin "boardie" ''
|
|
|
|
# exec pw-jack ${boardie}/bin/boardie "$@"
|
|
|
|
# '')
|
2023-04-23 23:08:42 +01:00
|
|
|
];
|
2023-04-23 19:13:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
|
|
|
blueman-applet.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
wayland.windowManager.sway = {
|
|
|
|
config = {
|
2023-04-23 19:54:31 +01:00
|
|
|
output = {
|
|
|
|
HDMI-A-1 = {
|
|
|
|
transform = "270";
|
|
|
|
position = "0 0";
|
|
|
|
};
|
|
|
|
DP-1 = {
|
|
|
|
mode = "2560x1440@170Hz";
|
|
|
|
subpixel = "bgr";
|
|
|
|
position = "1440 560";
|
|
|
|
};
|
|
|
|
DP-2.position = "4000 560";
|
|
|
|
};
|
2023-04-23 19:13:54 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
my = {
|
2023-08-27 20:04:53 +01:00
|
|
|
gui = {
|
|
|
|
standalone = true;
|
|
|
|
manageGraphical = true;
|
|
|
|
};
|
2023-04-23 19:13:54 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#deploy.generate.system.mode = "boot";
|
|
|
|
deploy.node.hostname = "castle.box.${config.networking.domain}";
|
|
|
|
secrets = {
|
|
|
|
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMlVuTzKObeaUuPocCF41IO/8X+443lzUJLuCIclt2vr";
|
|
|
|
};
|
2023-12-12 01:34:37 +00:00
|
|
|
nvme.uuid = "2230b066-a674-4f45-a1dc-f7727b3a9e7b";
|
2023-04-23 19:13:54 +01:00
|
|
|
|
|
|
|
firewall = {
|
|
|
|
enable = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
gui.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|