mirror of
https://github.com/nix-community/disko
synced 2024-11-10 06:14:14 +00:00
4ba8181319
As discussed in [this comment](https://github.com/nix-community/disko/pull/143#discussion_r1097912402), as a blanket rule converting everything possible to `inherit` like statements can hurt readability. Add config file for statix to disable these checks and fixes, then rerun the autofix with these options.
56 lines
1.4 KiB
Nix
56 lines
1.4 KiB
Nix
{ diskoLib, config, options, lib, ... }:
|
|
{
|
|
options = {
|
|
type = lib.mkOption {
|
|
type = lib.types.enum [ "swap" ];
|
|
internal = true;
|
|
description = "Type";
|
|
};
|
|
randomEncryption = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Whether to randomly encrypt the swap";
|
|
};
|
|
_meta = lib.mkOption {
|
|
internal = true;
|
|
readOnly = true;
|
|
type = lib.types.functionTo diskoLib.jsonType;
|
|
default = dev: { };
|
|
description = "Metadata";
|
|
};
|
|
_create = diskoLib.mkCreateOption {
|
|
inherit config options;
|
|
default = { dev }: ''
|
|
mkswap ${dev}
|
|
'';
|
|
};
|
|
_mount = diskoLib.mkMountOption {
|
|
inherit config options;
|
|
default = { dev }: {
|
|
fs.${dev} = ''
|
|
if ! swapon --show | grep -q '^${dev} '; then
|
|
swapon ${dev}
|
|
fi
|
|
'';
|
|
};
|
|
};
|
|
_config = lib.mkOption {
|
|
internal = true;
|
|
readOnly = true;
|
|
default = dev: [{
|
|
swapDevices = [{
|
|
device = dev;
|
|
randomEncryption = config.randomEncryption;
|
|
}];
|
|
}];
|
|
description = "NixOS configuration";
|
|
};
|
|
_pkgs = lib.mkOption {
|
|
internal = true;
|
|
readOnly = true;
|
|
type = lib.types.functionTo (lib.types.listOf lib.types.package);
|
|
default = pkgs: [ pkgs.gnugrep pkgs.util-linux ];
|
|
description = "Packages";
|
|
};
|
|
};
|
|
}
|