summaryrefslogtreecommitdiffstats
path: root/default.nix
diff options
context:
space:
mode:
authorLassulus <github@lassul.us>2022-11-09 13:26:43 +0100
committerGitHub <noreply@github.com>2022-11-09 13:26:43 +0100
commit45ef21831ee493de5efa97f48f1c31ca9dd54764 (patch)
treed4efbdf4713aa4428a4922c0389ca4c61c808b9e /default.nix
parentc96ccd7d9fb48b8283e84811c2355a3c39bb2a52 (diff)
parent0af2a7c206bd69ecdc01361e12c7cb0ec9820911 (diff)
Merge pull request #48 from nix-community/module
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix21
1 files changed, 15 insertions, 6 deletions
diff --git a/default.nix b/default.nix
index 98f5213..8d91e7c 100644
--- a/default.nix
+++ b/default.nix
@@ -4,17 +4,26 @@ let
eval = cfg: lib.evalModules {
modules = lib.singleton {
# _file = toString input;
- imports = lib.singleton { topLevel.devices = cfg; };
+ imports = lib.singleton { devices = cfg; };
options = {
- topLevel = lib.mkOption {
- type = types.topLevel;
+ devices = lib.mkOption {
+ type = types.devices;
};
};
};
};
in {
types = types;
- create = cfg: (eval cfg).config.topLevel.create;
- mount = cfg: (eval cfg).config.topLevel.mount;
- config = cfg: (eval cfg).config.topLevel.config;
+ create = cfg: types.diskoLib.create (eval cfg).config.devices;
+ createScript = cfg: pkgs: pkgs.writeScript "disko-create" ''
+ export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}
+ ${types.diskoLib.create (eval cfg).config.devices}
+ '';
+ mount = cfg: types.diskoLib.mount (eval cfg).config.devices;
+ mountScript = cfg: pkgs: pkgs.writeScript "disko-mount" ''
+ export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}
+ ${types.diskoLib.mount (eval cfg).config.devices}
+ '';
+ config = cfg: { imports = types.diskoLib.config (eval cfg).config.devices; };
+ packages = cfg: types.diskoLib.packages (eval cfg).config.devices;
}