disko/default.nix

52 lines
2.0 KiB
Nix
Raw Normal View History

{ lib ? import <nixpkgs/lib>
, rootMountPoint ? "/mnt"
}:
2022-08-24 23:24:33 +03:00
let
2023-01-28 18:19:13 +03:00
types = import ./types { inherit lib rootMountPoint; };
eval = cfg: lib.evalModules {
modules = lib.singleton {
# _file = toString input;
imports = lib.singleton { devices = cfg; };
options = {
devices = lib.mkOption {
type = types.devices;
};
};
2022-08-25 16:08:26 +03:00
};
};
in {
types = types;
create = cfg: types.diskoLib.create (eval cfg).config.devices;
2022-10-27 01:02:49 +03:00
createScript = cfg: pkgs: pkgs.writeScript "disko-create" ''
2022-12-01 22:33:03 +03:00
#!/usr/bin/env bash
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}:$PATH
2022-10-27 01:02:37 +03:00
${types.diskoLib.create (eval cfg).config.devices}
'';
2022-12-01 22:33:03 +03:00
createScriptNoDeps = cfg: pkgs: pkgs.writeScript "disko-create" ''
#!/usr/bin/env bash
${types.diskoLib.create (eval cfg).config.devices}
'';
mount = cfg: types.diskoLib.mount (eval cfg).config.devices;
2022-10-27 01:02:49 +03:00
mountScript = cfg: pkgs: pkgs.writeScript "disko-mount" ''
2022-12-01 22:33:03 +03:00
#!/usr/bin/env bash
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}:$PATH
2022-10-27 01:02:37 +03:00
${types.diskoLib.mount (eval cfg).config.devices}
'';
2022-12-01 22:33:03 +03:00
mountScriptNoDeps = cfg: pkgs: pkgs.writeScript "disko-mount" ''
#!/usr/bin/env bash
${types.diskoLib.mount (eval cfg).config.devices}
'';
zapCreateMount = cfg: types.diskoLib.zapCreateMount (eval cfg).config.devices;
zapCreateMountScript = cfg: pkgs: pkgs.writeScript "disko-zap-create-mount" ''
#!/usr/bin/env bash
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}:$PATH
${types.diskoLib.zapCreateMount (eval cfg).config.devices}
'';
2022-12-01 22:33:03 +03:00
zapCreateMountScriptNoDeps = cfg: pkgs: pkgs.writeScript "disko-zap-create-mount" ''
#!/usr/bin/env bash
${types.diskoLib.zapCreateMount (eval cfg).config.devices}
'';
2022-10-23 12:30:08 +03:00
config = cfg: { imports = types.diskoLib.config (eval cfg).config.devices; };
packages = cfg: types.diskoLib.packages (eval cfg).config.devices;
2018-09-11 21:52:12 +03:00
}