2023-02-06 17:24:34 +03:00
|
|
|
{ pkgs ? import <nixpkgs> { }
|
2023-02-02 16:02:55 +03:00
|
|
|
, lib ? pkgs.lib
|
2022-10-27 01:02:49 +03:00
|
|
|
, mode ? "mount"
|
2022-11-10 01:36:40 +03:00
|
|
|
, flake ? null
|
|
|
|
, flakeAttr ? null
|
|
|
|
, diskoFile ? null
|
2023-01-24 17:57:17 +03:00
|
|
|
, rootMountPoint ? "/mnt"
|
2022-12-01 22:33:03 +03:00
|
|
|
, noDeps ? false
|
2023-02-06 17:24:34 +03:00
|
|
|
, ...
|
|
|
|
}@args:
|
2022-10-27 01:02:49 +03:00
|
|
|
let
|
2022-12-22 13:09:04 +03:00
|
|
|
disko = import ./. {
|
2023-01-24 17:57:17 +03:00
|
|
|
inherit rootMountPoint;
|
2023-02-02 16:02:55 +03:00
|
|
|
inherit lib;
|
2022-12-22 13:09:04 +03:00
|
|
|
};
|
2022-11-10 01:36:40 +03:00
|
|
|
|
2023-02-06 17:24:34 +03:00
|
|
|
diskFormat =
|
|
|
|
if flake != null then
|
|
|
|
(pkgs.lib.attrByPath [ "diskoConfigurations" flakeAttr ] (builtins.abort "${flakeAttr} does not exist") (builtins.getFlake flake)) args
|
2022-12-01 22:33:03 +03:00
|
|
|
else
|
2023-02-06 17:24:34 +03:00
|
|
|
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"
|
2022-12-01 22:33:03 +03:00
|
|
|
else
|
2023-02-06 17:24:34 +03:00
|
|
|
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"
|
2022-10-27 01:02:49 +03:00
|
|
|
;
|
2023-02-06 17:24:34 +03:00
|
|
|
in
|
|
|
|
diskoEval
|