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-01-28 15:19:13 +00:00
|
|
|
types = import ./types { inherit lib rootMountPoint; };
|
2022-08-29 09:45:19 +00:00
|
|
|
eval = cfg: lib.evalModules {
|
|
|
|
modules = lib.singleton {
|
|
|
|
# _file = toString input;
|
2022-10-22 21:35:16 +00:00
|
|
|
imports = lib.singleton { devices = cfg; };
|
2022-08-29 09:45:19 +00:00
|
|
|
options = {
|
2022-10-22 21:35:16 +00:00
|
|
|
devices = lib.mkOption {
|
|
|
|
type = types.devices;
|
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-02-07 15:37:12 +00:00
|
|
|
types = types;
|
2022-10-22 21:35:16 +00:00
|
|
|
create = cfg: types.diskoLib.create (eval cfg).config.devices;
|
2023-01-30 20:36:51 +00:00
|
|
|
createScript = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-create" ''
|
2022-12-10 00:03:17 +00:00
|
|
|
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}:$PATH
|
2022-10-26 22:02:37 +00:00
|
|
|
${types.diskoLib.create (eval cfg).config.devices}
|
|
|
|
'';
|
2023-01-30 20:36:51 +00:00
|
|
|
createScriptNoDeps = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-create" ''
|
2022-12-01 19:33:03 +00:00
|
|
|
${types.diskoLib.create (eval cfg).config.devices}
|
|
|
|
'';
|
2022-10-22 21:35:16 +00:00
|
|
|
mount = cfg: types.diskoLib.mount (eval cfg).config.devices;
|
2023-01-30 20:36:51 +00:00
|
|
|
mountScript = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-mount" ''
|
2022-12-10 00:03:17 +00:00
|
|
|
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}:$PATH
|
2022-10-26 22:02:37 +00:00
|
|
|
${types.diskoLib.mount (eval cfg).config.devices}
|
|
|
|
'';
|
2023-01-30 20:36:51 +00:00
|
|
|
mountScriptNoDeps = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-mount" ''
|
2022-12-01 19:33:03 +00:00
|
|
|
${types.diskoLib.mount (eval cfg).config.devices}
|
|
|
|
'';
|
|
|
|
zapCreateMount = cfg: types.diskoLib.zapCreateMount (eval cfg).config.devices;
|
2023-01-30 20:36:51 +00:00
|
|
|
zapCreateMountScript = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-zap-create-mount" ''
|
2022-12-10 00:03:17 +00:00
|
|
|
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}:$PATH
|
2022-11-23 12:28:52 +00:00
|
|
|
${types.diskoLib.zapCreateMount (eval cfg).config.devices}
|
|
|
|
'';
|
2023-01-30 20:36:51 +00:00
|
|
|
zapCreateMountScriptNoDeps = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-zap-create-mount" ''
|
2022-12-01 19:33:03 +00:00
|
|
|
${types.diskoLib.zapCreateMount (eval cfg).config.devices}
|
|
|
|
'';
|
2022-10-23 09:30:08 +00:00
|
|
|
config = cfg: { imports = types.diskoLib.config (eval cfg).config.devices; };
|
2022-10-22 21:35:16 +00:00
|
|
|
packages = cfg: types.diskoLib.packages (eval cfg).config.devices;
|
2018-09-11 18:52:12 +00:00
|
|
|
}
|