2023-01-24 14:57:17 +00:00
|
|
|
{ lib ? import <nixpkgs/lib>
|
|
|
|
, rootMountPoint ? "/mnt"
|
2023-01-30 20:36:51 +00:00
|
|
|
, checked ? false
|
2023-01-24 14:57:17 +00:00
|
|
|
}:
|
2022-08-24 20:24:33 +00:00
|
|
|
let
|
2023-05-16 11:40:03 +00:00
|
|
|
diskoLib = import ./lib { inherit lib rootMountPoint; };
|
2022-08-29 09:45:19 +00:00
|
|
|
eval = cfg: lib.evalModules {
|
|
|
|
modules = lib.singleton {
|
|
|
|
# _file = toString input;
|
2023-03-03 07:09:13 +00:00
|
|
|
imports = lib.singleton { disko.devices = cfg.disko.devices; };
|
2022-08-29 09:45:19 +00:00
|
|
|
options = {
|
2023-03-03 07:09:13 +00:00
|
|
|
disko.devices = lib.mkOption {
|
2023-07-13 13:08:20 +00:00
|
|
|
type = diskoLib.toplevel;
|
2022-08-29 09:45:19 +00:00
|
|
|
};
|
|
|
|
};
|
2022-08-25 13:08:26 +00:00
|
|
|
};
|
|
|
|
};
|
2023-02-06 14:24:34 +00:00
|
|
|
in
|
|
|
|
{
|
2023-05-16 11:40:03 +00:00
|
|
|
lib = diskoLib;
|
|
|
|
create = cfg: diskoLib.create (eval cfg).config.disko.devices;
|
|
|
|
createScript = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-create" ''
|
|
|
|
export PATH=${lib.makeBinPath (diskoLib.packages (eval cfg).config.disko.devices pkgs)}:$PATH
|
|
|
|
${diskoLib.create (eval cfg).config.disko.devices}
|
2022-10-26 22:02:37 +00:00
|
|
|
'';
|
2023-05-16 11:40:03 +00:00
|
|
|
createScriptNoDeps = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-create" ''
|
|
|
|
${diskoLib.create (eval cfg).config.disko.devices}
|
2022-12-01 19:33:03 +00:00
|
|
|
'';
|
2023-05-16 11:40:03 +00:00
|
|
|
mount = cfg: diskoLib.mount (eval cfg).config.disko.devices;
|
|
|
|
mountScript = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-mount" ''
|
|
|
|
export PATH=${lib.makeBinPath (diskoLib.packages (eval cfg).config.disko.devices pkgs)}:$PATH
|
|
|
|
${diskoLib.mount (eval cfg).config.disko.devices}
|
2022-10-26 22:02:37 +00:00
|
|
|
'';
|
2023-05-16 11:40:03 +00:00
|
|
|
mountScriptNoDeps = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-mount" ''
|
|
|
|
${diskoLib.mount (eval cfg).config.disko.devices}
|
2022-12-01 19:33:03 +00:00
|
|
|
'';
|
2023-05-20 11:55:25 +00:00
|
|
|
disko = cfg: diskoLib.zapCreateMount (eval cfg).config.disko.devices;
|
|
|
|
diskoScript = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-zap-create-mount" ''
|
2023-06-23 02:58:08 +00:00
|
|
|
export PATH=${lib.makeBinPath ((diskoLib.packages (eval cfg).config.disko.devices pkgs) ++ [ pkgs.bash ])}:$PATH
|
2023-05-16 11:40:03 +00:00
|
|
|
${diskoLib.zapCreateMount (eval cfg).config.disko.devices}
|
2022-11-23 12:28:52 +00:00
|
|
|
'';
|
2023-06-23 02:57:57 +00:00
|
|
|
# we keep this old output for backwards compatibility
|
|
|
|
diskoNoDeps = cfg: pkgs: builtins.trace "the .diskoNoDeps output is deprecated, plase use .diskoScriptNoDeps instead" (
|
|
|
|
(diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-zap-create-mount" ''
|
|
|
|
${diskoLib.zapCreateMount (eval cfg).config.disko.devices}
|
|
|
|
''
|
|
|
|
);
|
|
|
|
diskoScriptNoDeps = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-zap-create-mount" ''
|
2023-05-16 11:40:03 +00:00
|
|
|
${diskoLib.zapCreateMount (eval cfg).config.disko.devices}
|
2022-12-01 19:33:03 +00:00
|
|
|
'';
|
2023-05-16 11:40:03 +00:00
|
|
|
config = cfg: { imports = diskoLib.config (eval cfg).config.disko.devices; };
|
|
|
|
packages = cfg: diskoLib.packages (eval cfg).config.disko.devices;
|
2018-09-11 18:52:12 +00:00
|
|
|
}
|