mirror of
https://github.com/nix-community/disko
synced 2024-11-10 14:24:27 +00:00
8c0fa72ab4
Avoid impurities
37 lines
1 KiB
Nix
37 lines
1 KiB
Nix
{ pkgs ? import <nixpkgs> {}
|
|
, mode ? "mount"
|
|
, flake ? null
|
|
, flakeAttr ? null
|
|
, diskoFile ? null
|
|
, noDeps ? false
|
|
, ... }@args:
|
|
let
|
|
disko = import ./. {
|
|
lib = pkgs.lib;
|
|
};
|
|
|
|
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 noDeps then
|
|
if (mode == "create") then
|
|
disko.createScriptNoDeps diskFormat pkgs
|
|
else if (mode == "mount") then
|
|
disko.mountScriptNoDeps diskFormat pkgs
|
|
else if (mode == "zap_create_mount") then
|
|
disko.zapCreateMountScriptNoDeps diskFormat pkgs
|
|
else
|
|
builtins.abort "invalid mode"
|
|
else
|
|
if (mode == "create") then
|
|
disko.createScript diskFormat pkgs
|
|
else if (mode == "mount") then
|
|
disko.mountScript diskFormat pkgs
|
|
else if (mode == "zap_create_mount") then
|
|
disko.zapCreateMount diskFormat pkgs
|
|
else
|
|
builtins.abort "invalid mode"
|
|
;
|
|
in diskoEval
|