mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2025-12-12 08:00:05 +01:00
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.
63 lines
1.9 KiB
Nix
63 lines
1.9 KiB
Nix
{ config, options, lib, diskoLib, subTypes, ... }:
|
|
{
|
|
options = {
|
|
name = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = config._module.args.name;
|
|
description = "Name of the volume gorup";
|
|
};
|
|
type = lib.mkOption {
|
|
type = lib.types.enum [ "lvm_vg" ];
|
|
internal = true;
|
|
description = "Type";
|
|
};
|
|
lvs = lib.mkOption {
|
|
type = lib.types.attrsOf subTypes.lvm_lv;
|
|
default = { };
|
|
description = "LVS for the volume group";
|
|
};
|
|
_meta = lib.mkOption {
|
|
internal = true;
|
|
readOnly = true;
|
|
type = diskoLib.jsonType;
|
|
default =
|
|
diskoLib.deepMergeMap (lv: lv._meta [ "lvm_vg" config.name ]) (lib.attrValues config.lvs);
|
|
description = "Metadata";
|
|
};
|
|
_create = diskoLib.mkCreateOption {
|
|
inherit config options;
|
|
default = _: ''
|
|
vgcreate ${config.name} $(tr '\n' ' ' < $disko_devices_dir/lvm_${config.name})
|
|
${lib.concatMapStrings (lv: lv._create {vg = config.name; }) (lib.attrValues config.lvs)}
|
|
'';
|
|
};
|
|
_mount = diskoLib.mkMountOption {
|
|
inherit config options;
|
|
default = _:
|
|
let
|
|
lvMounts = diskoLib.deepMergeMap (lv: lv._mount { vg = config.name; }) (lib.attrValues config.lvs);
|
|
in
|
|
{
|
|
dev = ''
|
|
vgchange -a y
|
|
${lib.concatMapStrings (x: x.dev or "") (lib.attrValues lvMounts)}
|
|
'';
|
|
fs = lvMounts.fs;
|
|
};
|
|
};
|
|
_config = lib.mkOption {
|
|
internal = true;
|
|
readOnly = true;
|
|
default =
|
|
map (lv: lv._config config.name) (lib.attrValues config.lvs);
|
|
description = "NixOS configuration";
|
|
};
|
|
_pkgs = lib.mkOption {
|
|
internal = true;
|
|
readOnly = true;
|
|
type = lib.types.functionTo (lib.types.listOf lib.types.package);
|
|
default = pkgs: lib.flatten (map (lv: lv._pkgs pkgs) (lib.attrValues config.lvs));
|
|
description = "Packages";
|
|
};
|
|
};
|
|
}
|