nixos/services.freefall: remove with lib;

This commit is contained in:
Felix Buehler
2024-08-30 00:30:49 +02:00
parent 29536d4a4d
commit 6c707fe30f
+7 -10
View File
@@ -1,7 +1,4 @@
{ config, lib, pkgs, utils, ... }:
with lib;
let
cfg = config.services.freefall;
@@ -10,18 +7,18 @@ in {
options.services.freefall = {
enable = mkOption {
type = types.bool;
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to protect HP/Dell laptop hard drives (not SSDs) in free fall.
'';
};
package = mkPackageOption pkgs "freefall" { };
package = lib.mkPackageOption pkgs "freefall" { };
devices = mkOption {
type = types.listOf types.str;
devices = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "/dev/sda" ];
description = ''
Device paths to all internal spinning hard drives.
@@ -35,7 +32,7 @@ in {
mkService = dev:
assert dev != "";
let dev' = utils.escapeSystemdPath dev; in
nameValuePair "freefall-${dev'}" {
lib.nameValuePair "freefall-${dev'}" {
description = "Free-fall protection for ${dev}";
after = [ "${dev'}.device" ];
wantedBy = [ "${dev'}.device" ];
@@ -46,7 +43,7 @@ in {
};
};
in mkIf cfg.enable {
in lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];