mirror of
https://github.com/nix-community/disko
synced 2024-11-10 06:14:14 +00:00
apply deadnix
This commit is contained in:
parent
29d632d7e8
commit
a8d85d9f89
15 changed files with 16 additions and 29 deletions
2
doc.nix
2
doc.nix
|
@ -27,7 +27,7 @@ let
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
cat ${options.optionsCommonMark} >>$out
|
cat ${options.optionsCommonMark} >>$out
|
||||||
'').overrideAttrs (o: {
|
'').overrideAttrs (_o: {
|
||||||
# Work around https://github.com/hercules-ci/hercules-ci-agent/issues/168
|
# Work around https://github.com/hercules-ci/hercules-ci-agent/issues/168
|
||||||
allowSubstitutes = true;
|
allowSubstitutes = true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ let
|
||||||
name = "subType";
|
name = "subType";
|
||||||
description = "one of ${concatStringsSep "," (attrNames typeAttr)}";
|
description = "one of ${concatStringsSep "," (attrNames typeAttr)}";
|
||||||
check = x: if x ? type then typeAttr.${x.type}.check x else throw "No type option set in:\n${generators.toPretty {} x}";
|
check = x: if x ? type then typeAttr.${x.type}.check x else throw "No type option set in:\n${generators.toPretty {} x}";
|
||||||
merge = loc: foldl' (res: def: typeAttr.${def.value.type}.merge loc [ def ]) { };
|
merge = loc: foldl' (_res: def: typeAttr.${def.value.type}.merge loc [ def ]) { };
|
||||||
nestedTypes = typeAttr;
|
nestedTypes = typeAttr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -171,10 +171,6 @@ let
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = lib.types.functionTo lib.types.str;
|
type = lib.types.functionTo lib.types.str;
|
||||||
default = args:
|
default = args:
|
||||||
let
|
|
||||||
name = "format";
|
|
||||||
test = lib.optionalString (config ? name) "${config.${name}}";
|
|
||||||
in
|
|
||||||
''
|
''
|
||||||
( # ${config.type} ${concatMapStringsSep " " (n: toString (config.${n} or "")) ["name" "device" "format" "mountpoint"]}
|
( # ${config.type} ${concatMapStringsSep " " (n: toString (config.${n} or "")) ["name" "device" "format" "mountpoint"]}
|
||||||
${diskoLib.defineHookVariables { inherit config options; }}
|
${diskoLib.defineHookVariables { inherit config options; }}
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = lib.types.functionTo diskoLib.jsonType;
|
type = lib.types.functionTo diskoLib.jsonType;
|
||||||
default = dev: { };
|
default = _dev: { };
|
||||||
description = "Metadata";
|
description = "Metadata";
|
||||||
};
|
};
|
||||||
_create = diskoLib.mkCreateOption {
|
_create = diskoLib.mkCreateOption {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = lib.types.functionTo diskoLib.jsonType;
|
type = lib.types.functionTo diskoLib.jsonType;
|
||||||
default = dev: { };
|
default = _dev: { };
|
||||||
description = "Metadata";
|
description = "Metadata";
|
||||||
};
|
};
|
||||||
_create = diskoLib.mkCreateOption {
|
_create = diskoLib.mkCreateOption {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
_config = lib.mkOption {
|
_config = lib.mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = dev: [ ];
|
default = _dev: [ ];
|
||||||
description = "NixOS configuration";
|
description = "NixOS configuration";
|
||||||
};
|
};
|
||||||
_pkgs = lib.mkOption {
|
_pkgs = lib.mkOption {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
_config = lib.mkOption {
|
_config = lib.mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = dev: [ ];
|
default = _dev: [ ];
|
||||||
description = "NixOS configuration";
|
description = "NixOS configuration";
|
||||||
};
|
};
|
||||||
_pkgs = lib.mkOption {
|
_pkgs = lib.mkOption {
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = lib.types.functionTo (lib.types.listOf lib.types.package);
|
type = lib.types.functionTo (lib.types.listOf lib.types.package);
|
||||||
default = pkgs: [ ];
|
default = _pkgs: [ ];
|
||||||
description = "Packages";
|
description = "Packages";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = lib.types.functionTo diskoLib.jsonType;
|
type = lib.types.functionTo diskoLib.jsonType;
|
||||||
default = dev: { };
|
default = _dev: { };
|
||||||
description = "Metadata";
|
description = "Metadata";
|
||||||
};
|
};
|
||||||
_create = diskoLib.mkCreateOption {
|
_create = diskoLib.mkCreateOption {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
description = "The kind of partition table";
|
description = "The kind of partition table";
|
||||||
};
|
};
|
||||||
partitions = lib.mkOption {
|
partitions = lib.mkOption {
|
||||||
type = lib.types.listOf (lib.types.submodule ({ config, ... }: {
|
type = lib.types.listOf (lib.types.submodule ({ ... }: {
|
||||||
options = {
|
options = {
|
||||||
part-type = lib.mkOption {
|
part-type = lib.mkOption {
|
||||||
type = lib.types.enum [ "primary" "logical" "extended" ];
|
type = lib.types.enum [ "primary" "logical" "extended" ];
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
type = lib.types.functionTo diskoLib.jsonType;
|
type = lib.types.functionTo diskoLib.jsonType;
|
||||||
default = dev:
|
default = dev:
|
||||||
lib.foldr lib.recursiveUpdate { } (lib.imap
|
lib.foldr lib.recursiveUpdate { } (lib.imap
|
||||||
(index: partition:
|
(_index: partition:
|
||||||
lib.optionalAttrs (partition.content != null) (partition.content._meta dev)
|
lib.optionalAttrs (partition.content != null) (partition.content._meta dev)
|
||||||
)
|
)
|
||||||
config.partitions);
|
config.partitions);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
_config = lib.mkOption {
|
_config = lib.mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = dev: [ ];
|
default = _dev: [ ];
|
||||||
description = "NixOS configuration";
|
description = "NixOS configuration";
|
||||||
};
|
};
|
||||||
_pkgs = lib.mkOption {
|
_pkgs = lib.mkOption {
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = lib.types.functionTo diskoLib.jsonType;
|
type = lib.types.functionTo diskoLib.jsonType;
|
||||||
default = dev: { };
|
default = _dev: { };
|
||||||
description = "Metadata";
|
description = "Metadata";
|
||||||
};
|
};
|
||||||
_create = diskoLib.mkCreateOption {
|
_create = diskoLib.mkCreateOption {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, options, lib, diskoLib, rootMountPoint, ... }:
|
{ config, options, lib, diskoLib, ... }:
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
name = lib.mkOption {
|
name = lib.mkOption {
|
||||||
|
|
|
@ -16,7 +16,7 @@ makeDiskoTest {
|
||||||
boot.supportedFilesystems = [ "bcachefs" ];
|
boot.supportedFilesystems = [ "bcachefs" ];
|
||||||
# disable zfs so we can support latest kernel
|
# disable zfs so we can support latest kernel
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(final: super: {
|
(_final: super: {
|
||||||
zfs = super.zfs.overrideAttrs (_: {
|
zfs = super.zfs.overrideAttrs (_: {
|
||||||
meta.platforms = [ ];
|
meta.platforms = [ ];
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,20 +1,11 @@
|
||||||
{ makeTest ? import <nixpkgs/nixos/tests/make-test-python.nix>
|
{ makeTest ? import <nixpkgs/nixos/tests/make-test-python.nix>
|
||||||
, eval-config ? import <nixpkgs/nixos/lib/eval-config.nix>
|
, eval-config ? import <nixpkgs/nixos/lib/eval-config.nix>
|
||||||
, pkgs ? (import <nixpkgs> { })
|
, pkgs ? (import <nixpkgs> { })
|
||||||
}@args:
|
}:
|
||||||
let
|
let
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
makeDiskoTest = (pkgs.callPackage ./lib.nix { inherit makeTest eval-config; }).makeDiskoTest;
|
makeDiskoTest = (pkgs.callPackage ./lib.nix { inherit makeTest eval-config; }).makeDiskoTest;
|
||||||
|
|
||||||
evalTest = name: configFile:
|
|
||||||
let
|
|
||||||
disko-config = import configFile;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
"${name}-tsp-create" = (pkgs.callPackage ../. { checked = true; }).createScript disko-config pkgs;
|
|
||||||
"${name}-tsp-mount" = (pkgs.callPackage ../. { checked = true; }).mountScript disko-config pkgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
allTestFilenames =
|
allTestFilenames =
|
||||||
builtins.map (lib.removeSuffix ".nix") (
|
builtins.map (lib.removeSuffix ".nix") (
|
||||||
builtins.filter
|
builtins.filter
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
name = "disko-${name}";
|
name = "disko-${name}";
|
||||||
|
|
||||||
inherit enableOCR;
|
inherit enableOCR;
|
||||||
nodes.machine = { config, pkgs, modulesPath, ... }: {
|
nodes.machine = { pkgs, modulesPath, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
(lib.optionalAttrs (testMode == "module") {
|
(lib.optionalAttrs (testMode == "module") {
|
||||||
imports = [
|
imports = [
|
||||||
|
|
Loading…
Reference in a new issue