diff options
author | Lassulus <github@lassul.us> | 2022-11-09 13:26:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-09 13:26:43 +0100 |
commit | 45ef21831ee493de5efa97f48f1c31ca9dd54764 (patch) | |
tree | d4efbdf4713aa4428a4922c0389ca4c61c808b9e /default.nix | |
parent | c96ccd7d9fb48b8283e84811c2355a3c39bb2a52 (diff) | |
parent | 0af2a7c206bd69ecdc01361e12c7cb0ec9820911 (diff) |
Merge pull request #48 from nix-community/module
Diffstat (limited to 'default.nix')
-rw-r--r-- | default.nix | 21 |
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; } |