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