infrastructure/modules/dgn-hardware.nix
Ryan Lahfa 3aeae4e33f
All checks were successful
Check meta / check_meta (pull_request) Successful in 18s
Check meta / check_dns (pull_request) Successful in 19s
build configuration / build_storage01 (pull_request) Successful in 1m14s
build configuration / build_compute01 (pull_request) Successful in 1m22s
build configuration / build_krz01 (pull_request) Successful in 1m24s
build configuration / build_vault01 (pull_request) Successful in 1m10s
build configuration / build_web02 (pull_request) Successful in 1m7s
lint / check (pull_request) Successful in 25s
build configuration / build_web01 (pull_request) Successful in 1m45s
build configuration / build_geo02 (pull_request) Successful in 1m2s
build configuration / build_geo01 (pull_request) Successful in 1m9s
build configuration / build_rescue01 (pull_request) Successful in 1m17s
build configuration / build_bridge01 (pull_request) Successful in 1m7s
build configuration / push_to_cache_storage01 (pull_request) Successful in 1m18s
build configuration / push_to_cache_compute01 (pull_request) Successful in 1m54s
build configuration / push_to_cache_web02 (pull_request) Successful in 1m28s
build configuration / push_to_cache_krz01 (pull_request) Successful in 1m41s
build configuration / push_to_cache_vault01 (pull_request) Successful in 1m41s
build configuration / push_to_cache_geo02 (pull_request) Successful in 1m16s
build configuration / push_to_cache_web01 (pull_request) Successful in 2m13s
build configuration / push_to_cache_geo01 (pull_request) Successful in 1m20s
build configuration / push_to_cache_bridge01 (pull_request) Successful in 1m11s
build configuration / push_to_cache_rescue01 (pull_request) Successful in 1m21s
build configuration / build_krz01 (push) Successful in 1m20s
build configuration / build_compute01 (push) Successful in 1m15s
build configuration / build_storage01 (push) Successful in 1m7s
build configuration / build_vault01 (push) Successful in 1m13s
build configuration / build_web02 (push) Successful in 1m11s
build configuration / build_rescue01 (push) Successful in 1m12s
build configuration / build_geo01 (push) Successful in 1m4s
build configuration / build_geo02 (push) Successful in 1m0s
build configuration / build_web01 (push) Successful in 1m36s
lint / check (push) Successful in 24s
build configuration / build_bridge01 (push) Successful in 1m6s
build configuration / push_to_cache_krz01 (push) Successful in 1m35s
build configuration / push_to_cache_web02 (push) Successful in 1m30s
build configuration / push_to_cache_storage01 (push) Successful in 1m45s
build configuration / push_to_cache_vault01 (push) Successful in 1m49s
build configuration / push_to_cache_compute01 (push) Successful in 2m6s
build configuration / push_to_cache_rescue01 (push) Successful in 1m23s
build configuration / push_to_cache_geo01 (push) Successful in 1m13s
build configuration / push_to_cache_geo02 (push) Successful in 1m8s
build configuration / push_to_cache_bridge01 (push) Successful in 1m4s
build configuration / push_to_cache_web01 (push) Successful in 1m50s
feat(krz01): add basic microvm exprs
For a router01.

Signed-off-by: Ryan Lahfa <ryan@dgnum.eu>
2024-10-08 17:14:23 +02:00

95 lines
1.9 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
mkEnableOption
mkIf
mkMerge
mkOption
;
inherit (lib.types) listOf str;
cfg = config.dgn-hardware;
in
{
options.dgn-hardware = {
enable = mkEnableOption "default hardware configuration." // {
default = true;
};
useSystemd = mkEnableOption "sytemd boot and configuration." // {
default = true;
};
useZfs = mkEnableOption "zfs configuration.";
useBcachefs = mkEnableOption "bcachefs configuration";
zfsPools = mkOption {
type = listOf str;
default = [
"fast01"
"work01"
];
description = ''
ZFS pools present on the machine
'';
};
};
config = mkIf cfg.enable (mkMerge [
{
microvm.host.enable = lib.mkDefault false;
hardware.enableRedistributableFirmware = true;
hardware.cpu.intel.updateMicrocode = true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
boot = {
initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"ehci_pci"
"virtio_pci"
"ahci"
"virtio_blk"
];
kernelModules = [ "kvm-intel" ];
kernelParams = [
"cgroup_enable=cpu"
"cgroup_enable=cpuset"
"cgroup_enable=memory"
"cgroup_memory=1"
];
};
}
(mkIf cfg.useSystemd {
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
})
(mkIf cfg.useBcachefs {
boot.supportedFilesystems = [ "bcachefs" ];
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_7;
})
(mkIf cfg.useZfs {
boot = {
supportedFilesystems = [ "zfs" ];
zfs = {
forceImportRoot = false;
extraPools = cfg.zfsPools;
package = pkgs.zfs_2_1;
};
};
})
]);
}