mirror of
https://github.com/nix-community/disko.git
synced 2024-11-09 00:04:18 +03:00
08435eec4b
Apply standard formatting and some statix conventions using; ```sh nixpkgs-fmt **.nix && statix fix . ``` With the intent of making contribution a bit easier and reducing mental load in hand formatting (in the same vein as [black]). [black]: https://github.com/psf/black#the-uncompromising-code-formatter
45 lines
1.2 KiB
Nix
45 lines
1.2 KiB
Nix
{ pkgs ? import <nixpkgs> { }
|
|
, lib ? pkgs.lib
|
|
, mode ? "mount"
|
|
, flake ? null
|
|
, flakeAttr ? null
|
|
, diskoFile ? null
|
|
, rootMountPoint ? "/mnt"
|
|
, noDeps ? false
|
|
, ...
|
|
}@args:
|
|
let
|
|
disko = import ./. {
|
|
inherit rootMountPoint;
|
|
inherit lib;
|
|
};
|
|
|
|
diskFormat =
|
|
if flake != null then
|
|
(pkgs.lib.attrByPath [ "diskoConfigurations" flakeAttr ] (builtins.abort "${flakeAttr} does not exist") (builtins.getFlake flake)) args
|
|
else
|
|
import diskoFile ({ inherit lib; } // args);
|
|
|
|
diskoEval =
|
|
if noDeps then
|
|
if (mode == "create") then
|
|
disko.createScriptNoDeps diskFormat pkgs
|
|
else if (mode == "mount") then
|
|
disko.mountScriptNoDeps diskFormat pkgs
|
|
else if (mode == "zap_create_mount") then
|
|
disko.zapCreateMountScriptNoDeps diskFormat pkgs
|
|
else
|
|
builtins.abort "invalid mode"
|
|
else
|
|
if (mode == "create") then
|
|
disko.createScript diskFormat pkgs
|
|
else if (mode == "mount") then
|
|
disko.mountScript diskFormat pkgs
|
|
else if (mode == "zap_create_mount") then
|
|
disko.zapCreateMountScript diskFormat pkgs
|
|
else
|
|
builtins.abort "invalid mode"
|
|
;
|
|
in
|
|
diskoEval
|