Fix build
This commit is contained in:
parent
46992c46d6
commit
f9b7c9e3c9
|
@ -16,26 +16,6 @@ in
|
|||
description = "Whether it should be assumed that there is a cryptroot device";
|
||||
};
|
||||
|
||||
options.pub-solar.core.hibernation = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether the device can hibernate. This creates a swapfile at /swapfile.";
|
||||
};
|
||||
|
||||
resumeDevice = mkOption {
|
||||
type = types.str;
|
||||
default = "/swapfile";
|
||||
description = "The location of the hibernation resume swap file.";
|
||||
};
|
||||
|
||||
resumeOffset = mkOption {
|
||||
type = types.nullOr types.number;
|
||||
default = null;
|
||||
description = "The swap file offset. Can be found by running `filefrag -v $swap_file_location`. See https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
boot = {
|
||||
# Enable plymouth for better experience of booting
|
||||
|
@ -50,15 +30,6 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
resumeDevice = mkIf cfg.hibernation.enable cfg.hibernation.resumeDevice;
|
||||
kernelParams = mkIf cfg.hibernation.enable [
|
||||
"resume=${cfg.hibernation.resumeDevice}"
|
||||
] ++ (
|
||||
if (cfg.hibernation.resumeOffset == null) then builtins.abort "config.pub-solar.hibernation.resumeOffset has to be set if config.pub-solar.hibernation.enable is true."
|
||||
else [ "resume_offset=${cfg.hibernation.resumeOffset}" ]
|
||||
);
|
||||
|
||||
loader.systemd-boot.enable = true;
|
||||
|
||||
# Use latest LTS linux kernel by default
|
||||
|
|
|
@ -8,6 +8,7 @@ in
|
|||
{
|
||||
imports = [
|
||||
./boot.nix
|
||||
./hibernation.nix
|
||||
./fonts.nix
|
||||
./i18n.nix
|
||||
./networking.nix
|
||||
|
|
38
modules/core/hibernation.nix
Normal file
38
modules/core/hibernation.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.pub-solar.core.hibernation;
|
||||
in
|
||||
{
|
||||
options.pub-solar.core.hibernation = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether the device can hibernate. This creates a swapfile at /swapfile.";
|
||||
};
|
||||
|
||||
resumeDevice = mkOption {
|
||||
type = types.str;
|
||||
default = "/swapfile";
|
||||
description = "The location of the hibernation resume swap file.";
|
||||
};
|
||||
|
||||
resumeOffset = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "The swap file offset. Can be found by running `filefrag -v $swap_file_location`. See https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
boot = mkIf cfg.enable {
|
||||
resumeDevice = cfg.resumeDevice;
|
||||
kernelParams = [
|
||||
"resume=${cfg.resumeDevice}"
|
||||
] ++ (
|
||||
if (cfg.resumeOffset == null && cfg.enable) then builtins.abort "config.pub-solar.resumeOffset has to be set if config.pub-solar.enable is true."
|
||||
else [ "resume_offset=${cfg.resumeOffset}" ]
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue