2023-01-26 15:14:47 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2019-09-22 09:40:48 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
./config.nix
|
|
|
|
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
|
2023-01-26 15:14:47 +00:00
|
|
|
{
|
|
|
|
# nice hack to carry around state passed impurely at the beginning
|
2023-01-26 22:47:07 +00:00
|
|
|
options.mainDisk = let
|
|
|
|
tryFile = path: default:
|
|
|
|
if lib.elem (builtins.baseNameOf path) (lib.attrNames (builtins.readDir (builtins.dirOf path))) then
|
|
|
|
builtins.readFile path
|
|
|
|
else
|
|
|
|
default
|
|
|
|
;
|
|
|
|
in lib.mkOption {
|
2023-01-26 15:14:47 +00:00
|
|
|
type = lib.types.str;
|
2023-07-08 13:14:05 +00:00
|
|
|
default = tryFile "/etc/hilum-disk" (tryFile "/tmp/hilum-disk" "/dev/sdz");
|
2023-01-26 15:14:47 +00:00
|
|
|
};
|
|
|
|
config.environment.etc.hilum-disk.text = config.mainDisk;
|
|
|
|
}
|
2023-01-26 22:46:51 +00:00
|
|
|
{
|
|
|
|
options.luksPassFile = lib.mkOption {
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
}
|
2019-09-22 09:40:48 +00:00
|
|
|
];
|
|
|
|
|
2023-01-26 15:14:47 +00:00
|
|
|
disko.devices = import ./disk.nix {
|
|
|
|
inherit lib;
|
|
|
|
disk = config.mainDisk;
|
2023-01-26 22:46:51 +00:00
|
|
|
keyFile = config.luksPassFile;
|
2023-01-26 15:14:47 +00:00
|
|
|
};
|
|
|
|
|
2019-09-22 09:40:48 +00:00
|
|
|
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ];
|
|
|
|
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
|
|
|
boot.kernelModules = [ "kvm-intel" ];
|
|
|
|
boot.extraModulePackages = [ ];
|
|
|
|
|
|
|
|
boot.loader.grub.enable = true;
|
|
|
|
boot.loader.grub.efiSupport = true;
|
2023-01-26 15:14:47 +00:00
|
|
|
boot.loader.grub.device = config.mainDisk;
|
2019-09-22 09:40:48 +00:00
|
|
|
boot.loader.grub.efiInstallAsRemovable = true;
|
|
|
|
|
|
|
|
swapDevices = [ ];
|
|
|
|
|
|
|
|
nix.maxJobs = lib.mkDefault 4;
|
|
|
|
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
2023-07-08 13:14:05 +00:00
|
|
|
|
|
|
|
#weird bug with nixos-enter
|
|
|
|
services.logrotate.enable = false;
|
2019-09-22 09:40:48 +00:00
|
|
|
}
|