diff options
author | makefu <github@syntax-fehler.de> | 2023-01-15 01:22:56 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2023-01-15 01:22:56 +0100 |
commit | cb7ebd1c9120eb03ded2334db4c41fe6a0e26b88 (patch) | |
tree | feca719165baaee6bb5c520e13bab95ef61e7921 /makefu/1systems/snake | |
parent | 1c27953bdd2e56c90ac98b711154c2e8c45269df (diff) |
ma snake.r: init
Diffstat (limited to 'makefu/1systems/snake')
-rw-r--r-- | makefu/1systems/snake/config.nix | 26 | ||||
-rw-r--r-- | makefu/1systems/snake/disk.nix | 64 | ||||
-rw-r--r-- | makefu/1systems/snake/hardware-config.nix | 21 | ||||
-rw-r--r-- | makefu/1systems/snake/source.nix | 7 |
4 files changed, 118 insertions, 0 deletions
diff --git a/makefu/1systems/snake/config.nix b/makefu/1systems/snake/config.nix new file mode 100644 index 000000000..1c6068e98 --- /dev/null +++ b/makefu/1systems/snake/config.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: +let + primaryInterface = "eth0"; +in { + imports = [ + <stockholm/makefu> + ./hardware-config.nix + <stockholm/makefu/2configs/home-manager> + <stockholm/makefu/2configs/tools/core.nix> + <stockholm/makefu/2configs/binary-cache/nixos.nix> + + <stockholm/makefu/2configs/home/rhasspy> + <stockholm/makefu/2configs/home/rhasspy/led-control.nix> + ]; + krebs = { + enable = true; + tinc.retiolum.enable = true; + build.host = config.krebs.hosts.snake; + }; + # ensure disk usage is limited + services.journald.extraConfig = "Storage=volatile"; + networking.firewall.trustedInterfaces = [ primaryInterface ]; + documentation.info.enable = false; + documentation.man.enable = false; + documentation.nixos.enable = false; +} diff --git a/makefu/1systems/snake/disk.nix b/makefu/1systems/snake/disk.nix new file mode 100644 index 000000000..f9e14844f --- /dev/null +++ b/makefu/1systems/snake/disk.nix @@ -0,0 +1,64 @@ +{ disks ? [ "/dev/sda" ], ... }: { + disk = { + x = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + name = "boot"; + type = "partition"; + start = "0"; + end = "1M"; + part-type = "primary"; + flags = ["bios_grub"]; + } + { + type = "partition"; + name = "ESP"; + start = "1M"; + end = "512MiB"; + fs-type = "fat32"; + bootable = true; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + } + { + type = "partition"; + name = "zfs"; + start = "512MiB"; + end = "100%"; + content = { + type = "zfs"; + pool = "zroot"; + }; + } + ]; + }; + }; + }; + zpool = { + zroot = { + type = "zpool"; + rootFsOptions.compression = "lz4"; + mountpoint = "/"; + + datasets = { + home = { + zfs_type = "filesystem"; + mountpoint = "/home"; + options.mountpoint = "legacy"; + }; + reserved = { + zfs_type = "filesystem"; + options.refreservation = "1G"; + }; + }; + }; + }; +} diff --git a/makefu/1systems/snake/hardware-config.nix b/makefu/1systems/snake/hardware-config.nix new file mode 100644 index 000000000..827c1d3eb --- /dev/null +++ b/makefu/1systems/snake/hardware-config.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, ... }: +{ + imports = [ + <nixpkgs/nixos/modules/installer/scan/not-detected.nix> + ]; + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.efiSupport = true; + boot.loader.grub.device = "/dev/sda"; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "sd_mod" ]; + boot.kernelModules = [ "kvm-amd" ]; + disko.devices = import ./disk.nix; + + hardware.enableRedistributableFirmware = true; + hardware.cpu.amd.updateMicrocode = true; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + + boot.kernelParams = [ "net.ifnames=0" ]; + networking.hostId = "0123AABB"; +} diff --git a/makefu/1systems/snake/source.nix b/makefu/1systems/snake/source.nix new file mode 100644 index 000000000..b9a32a2c4 --- /dev/null +++ b/makefu/1systems/snake/source.nix @@ -0,0 +1,7 @@ +{ + name="cake"; + full = true; + home-manager = true; + hw = true; + disko = true; +} |