2021-10-24 01:18:33 +02:00
|
|
|
{
|
2022-11-20 23:28:23 +01:00
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2021-10-24 22:03:28 +02:00
|
|
|
with lib; let
|
2022-08-13 22:59:05 +02:00
|
|
|
cfg = config.pub-solar.core;
|
2022-11-20 23:28:23 +01:00
|
|
|
in {
|
2022-08-13 22:59:05 +02:00
|
|
|
options.pub-solar.core.iso-options.enable = mkOption {
|
2021-10-26 01:06:13 +02:00
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Feature flag for iso builds";
|
|
|
|
};
|
2022-08-14 15:05:32 +02:00
|
|
|
|
2022-08-13 22:59:05 +02:00
|
|
|
options.pub-solar.core.disk-encryption-active = mkOption {
|
2022-08-13 12:32:16 +02:00
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = "Whether it should be assumed that there is a cryptroot device";
|
|
|
|
};
|
2022-08-14 15:05:32 +02:00
|
|
|
|
2021-05-30 21:10:28 +02:00
|
|
|
config = {
|
2022-05-01 17:29:21 +02:00
|
|
|
boot = {
|
|
|
|
# Enable plymouth for better experience of booting
|
2022-10-02 01:17:34 +00:00
|
|
|
plymouth.enable = mkIf (!cfg.lite) (lib.mkDefault true);
|
2021-05-30 21:10:28 +02:00
|
|
|
|
2022-05-01 17:29:21 +02:00
|
|
|
# Mount / luks device in initrd
|
|
|
|
# Allow fstrim to work on it.
|
|
|
|
# The ! makes this enabled by default
|
2022-08-14 15:05:32 +02:00
|
|
|
initrd = mkIf (!cfg.iso-options.enable && cfg.disk-encryption-active) {
|
2022-05-01 17:29:21 +02:00
|
|
|
luks.devices."cryptroot" = {
|
|
|
|
allowDiscards = true;
|
|
|
|
};
|
2021-05-30 21:10:28 +02:00
|
|
|
};
|
|
|
|
|
2022-12-26 15:08:02 +01:00
|
|
|
loader.systemd-boot.enable = lib.mkDefault true;
|
2022-08-13 20:35:43 +00:00
|
|
|
|
2022-08-14 15:05:32 +02:00
|
|
|
# Use latest LTS linux kernel by default
|
2023-06-13 15:05:53 +02:00
|
|
|
kernelPackages = lib.mkDefault pkgs.linuxPackages_6_1;
|
2022-08-14 15:05:32 +02:00
|
|
|
|
|
|
|
# Support ntfs drives
|
|
|
|
supportedFilesystems = ["ntfs"];
|
2022-05-01 17:29:21 +02:00
|
|
|
};
|
2021-05-30 21:10:28 +02:00
|
|
|
};
|
|
|
|
}
|