mirror of
https://github.com/nix-community/disko
synced 2024-11-09 22:04:14 +00:00
style: Disable inherit
pattern check in statix
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.
This commit is contained in:
parent
08435eec4b
commit
4ba8181319
11 changed files with 16 additions and 12 deletions
|
@ -16,7 +16,7 @@ let
|
|||
};
|
||||
in
|
||||
{
|
||||
inherit types;
|
||||
types = types;
|
||||
create = cfg: types.diskoLib.create (eval cfg).config.devices;
|
||||
createScript = cfg: pkgs: pkgs.writeScript "disko-create" ''
|
||||
#!/usr/bin/env bash
|
||||
|
|
2
doc.nix
2
doc.nix
|
@ -19,7 +19,7 @@ let
|
|||
];
|
||||
};
|
||||
options = nixosOptionsDoc {
|
||||
inherit (eval) options;
|
||||
options = eval.options;
|
||||
};
|
||||
md = (runCommand "disko-options.md" { } ''
|
||||
cat >$out <<EOF
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Example to create a bios compatible gpt partition
|
||||
{ disks ? [ "/dev/vdb" ], lib, ... }: {
|
||||
disk = lib.genAttrs [ (lib.head disks) ] (device: {
|
||||
inherit device;
|
||||
device = device;
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "table";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
let
|
||||
types = import ./types {
|
||||
inherit lib;
|
||||
inherit (config.disko) rootMountPoint;
|
||||
rootMountPoint = config.disko.rootMountPoint;
|
||||
};
|
||||
cfg = config.disko;
|
||||
in
|
||||
|
|
4
statix.toml
Normal file
4
statix.toml
Normal file
|
@ -0,0 +1,4 @@
|
|||
disabled = [
|
||||
"manual_inherit", # Prefer `inherit types;` instead of `types = types;`
|
||||
"manual_inherit_from", # Prefer `inherit (eval) options;` instead of `options = eval.options`.
|
||||
]
|
|
@ -3,8 +3,8 @@
|
|||
, pkgs ? (import <nixpkgs> { })
|
||||
}@args:
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
inherit ((pkgs.callPackage ./lib.nix { inherit makeTest eval-config; })) makeDiskoTest;
|
||||
lib = pkgs.lib;
|
||||
makeDiskoTest = (pkgs.callPackage ./lib.nix { inherit makeTest eval-config; }).makeDiskoTest;
|
||||
|
||||
evalTest = name: configFile: let
|
||||
disko-config = import configFile;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
, testBoot ? true # if we actually want to test booting or just create/mount
|
||||
}:
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
lib = pkgs.lib;
|
||||
makeTest' = args:
|
||||
makeTest args {
|
||||
inherit pkgs;
|
||||
|
|
|
@ -187,7 +187,7 @@ rec {
|
|||
internal = true;
|
||||
readOnly = true;
|
||||
type = lib.types.functionTo diskoLib.jsonType;
|
||||
inherit (attrs) default;
|
||||
default = attrs.default;
|
||||
description = "Mount script";
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
vgchange -a y
|
||||
${lib.concatMapStrings (x: x.dev or "") (lib.attrValues lvMounts)}
|
||||
'';
|
||||
inherit (lvMounts) fs;
|
||||
fs = lvMounts.fs;
|
||||
};
|
||||
};
|
||||
_config = lib.mkOption {
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
readOnly = true;
|
||||
default = [{
|
||||
fileSystems.${config.mountpoint} = {
|
||||
inherit (config) device;
|
||||
inherit (config) fsType;
|
||||
device = config.device;
|
||||
fsType = config.fsType;
|
||||
options = config.mountOptions;
|
||||
};
|
||||
}];
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
default = dev: [{
|
||||
swapDevices = [{
|
||||
device = dev;
|
||||
inherit (config) randomEncryption;
|
||||
randomEncryption = config.randomEncryption;
|
||||
}];
|
||||
}];
|
||||
description = "NixOS configuration";
|
||||
|
|
Loading…
Reference in a new issue