treewide: format all files
This commit is contained in:
81
module.nix
81
module.nix
@@ -1,4 +1,11 @@
|
||||
{ config, lib, pkgs, extendModules, diskoLib, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
extendModules,
|
||||
diskoLib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.disko;
|
||||
|
||||
@@ -107,7 +114,10 @@ in
|
||||
};
|
||||
|
||||
imageFormat = lib.mkOption {
|
||||
type = lib.types.enum [ "raw" "qcow2" ];
|
||||
type = lib.types.enum [
|
||||
"raw"
|
||||
"qcow2"
|
||||
];
|
||||
description = "QEMU image format to use for the disk images";
|
||||
default = "raw";
|
||||
};
|
||||
@@ -239,38 +249,49 @@ in
|
||||
eval-config = import (pkgs.path + "/nixos/lib/eval-config.nix");
|
||||
};
|
||||
|
||||
system.build = (cfg.devices._scripts { inherit pkgs; checked = cfg.checkScripts; }) // (
|
||||
let
|
||||
throwIfNoDisksDetected = _: v: if cfg.devices.disk == { } then throw "No disks defined, did you forget to import your disko config?" else v;
|
||||
in
|
||||
lib.mapAttrs throwIfNoDisksDetected {
|
||||
# we keep these old outputs for compatibility
|
||||
disko = builtins.trace "the .disko output is deprecated, please use .diskoScript instead" (cfg.devices._scripts { inherit pkgs; }).diskoScript;
|
||||
diskoNoDeps = builtins.trace "the .diskoNoDeps output is deprecated, please use .diskoScriptNoDeps instead" (cfg.devices._scripts { inherit pkgs; }).diskoScriptNoDeps;
|
||||
system.build =
|
||||
(cfg.devices._scripts {
|
||||
inherit pkgs;
|
||||
checked = cfg.checkScripts;
|
||||
})
|
||||
// (
|
||||
let
|
||||
throwIfNoDisksDetected =
|
||||
_: v:
|
||||
if cfg.devices.disk == { } then
|
||||
throw "No disks defined, did you forget to import your disko config?"
|
||||
else
|
||||
v;
|
||||
in
|
||||
lib.mapAttrs throwIfNoDisksDetected {
|
||||
# we keep these old outputs for compatibility
|
||||
disko =
|
||||
builtins.trace "the .disko output is deprecated, please use .diskoScript instead"
|
||||
(cfg.devices._scripts { inherit pkgs; }).diskoScript;
|
||||
diskoNoDeps =
|
||||
builtins.trace "the .diskoNoDeps output is deprecated, please use .diskoScriptNoDeps instead"
|
||||
(cfg.devices._scripts { inherit pkgs; }).diskoScriptNoDeps;
|
||||
|
||||
installTest = diskoLib.testLib.makeDiskoTest {
|
||||
inherit extendModules pkgs;
|
||||
name = "${config.networking.hostName}-disko";
|
||||
disko-config = builtins.removeAttrs config [ "_module" ];
|
||||
testMode = "direct";
|
||||
bootCommands = cfg.tests.bootCommands;
|
||||
efi = cfg.tests.efi;
|
||||
enableOCR = cfg.tests.enableOCR;
|
||||
extraSystemConfig = cfg.tests.extraConfig;
|
||||
extraTestScript = cfg.tests.extraChecks;
|
||||
};
|
||||
installTest = diskoLib.testLib.makeDiskoTest {
|
||||
inherit extendModules pkgs;
|
||||
name = "${config.networking.hostName}-disko";
|
||||
disko-config = builtins.removeAttrs config [ "_module" ];
|
||||
testMode = "direct";
|
||||
bootCommands = cfg.tests.bootCommands;
|
||||
efi = cfg.tests.efi;
|
||||
enableOCR = cfg.tests.enableOCR;
|
||||
extraSystemConfig = cfg.tests.extraConfig;
|
||||
extraTestScript = cfg.tests.extraChecks;
|
||||
};
|
||||
|
||||
vmWithDisko = lib.mkDefault config.virtualisation.vmVariantWithDisko.system.build.vmWithDisko;
|
||||
}
|
||||
);
|
||||
vmWithDisko = lib.mkDefault config.virtualisation.vmVariantWithDisko.system.build.vmWithDisko;
|
||||
}
|
||||
);
|
||||
|
||||
# we need to specify the keys here, so we don't get an infinite recursion error
|
||||
# Remember to add config keys here if they are added to types
|
||||
fileSystems = lib.mkIf
|
||||
cfg.enableConfig cfg.devices._config.fileSystems or { };
|
||||
boot = lib.mkIf
|
||||
cfg.enableConfig cfg.devices._config.boot or { };
|
||||
swapDevices = lib.mkIf
|
||||
cfg.enableConfig cfg.devices._config.swapDevices or [ ];
|
||||
fileSystems = lib.mkIf cfg.enableConfig cfg.devices._config.fileSystems or { };
|
||||
boot = lib.mkIf cfg.enableConfig cfg.devices._config.boot or { };
|
||||
swapDevices = lib.mkIf cfg.enableConfig cfg.devices._config.swapDevices or [ ];
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user