diff options
author | lassulus <lassulus@lassul.us> | 2022-11-09 23:36:40 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-11-09 23:36:46 +0100 |
commit | 5fd29dfeb3931fa23ea41ea743201ebf8525dc4d (patch) | |
tree | b89b8975971f5c3f399ab729b14c4492921be30f /cli.nix | |
parent | 7e525000780e2ca94869e4ed41fe3242d257dd9d (diff) |
disko: support nixos-install style flake syntax
Diffstat (limited to 'cli.nix')
-rw-r--r-- | cli.nix | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -1,14 +1,17 @@ { pkgs ? import <nixpkgs> {} , mode ? "mount" -, fromFlake ? null -, diskoFile +, flake ? null +, flakeAttr ? null +, diskoFile ? null , ... }@args: let disko = import ./. { }; - diskFormat = - if fromFlake != null - then (builtins.getFlake fromFlake) + "/${diskoFile}" - else import diskoFile; + + diskFormat = if flake != null then + (pkgs.lib.attrByPath [ "diskoConfigurations" flakeAttr ] (builtins.abort "${flakeAttr} does not exist") (builtins.getFlake flake)) args + else + import diskoFile args; + diskoEval = if (mode == "create") then disko.createScript diskFormat pkgs else if (mode == "mount") then |