mirror of
https://github.com/nix-community/disko
synced 2024-11-12 23:27:07 +00:00
disko cli: add --no-deps mode
This commit is contained in:
parent
0f21bc31fe
commit
25cc022282
3 changed files with 38 additions and 8 deletions
25
cli.nix
25
cli.nix
|
@ -3,6 +3,7 @@
|
||||||
, flake ? null
|
, flake ? null
|
||||||
, flakeAttr ? null
|
, flakeAttr ? null
|
||||||
, diskoFile ? null
|
, diskoFile ? null
|
||||||
|
, noDeps ? false
|
||||||
, ... }@args:
|
, ... }@args:
|
||||||
let
|
let
|
||||||
disko = import ./. { };
|
disko = import ./. { };
|
||||||
|
@ -12,13 +13,23 @@ let
|
||||||
else
|
else
|
||||||
import diskoFile args;
|
import diskoFile args;
|
||||||
|
|
||||||
diskoEval = if (mode == "create") then
|
diskoEval = if noDeps then
|
||||||
disko.createScript diskFormat pkgs
|
if (mode == "create") then
|
||||||
else if (mode == "mount") then
|
disko.createScriptNoDeps diskFormat pkgs
|
||||||
disko.mountScript diskFormat pkgs
|
else if (mode == "mount") then
|
||||||
else if (mode = "zap_create_mount") then
|
disko.mountScriptNoDeps diskFormat pkgs
|
||||||
disko.zapCreateMount diskFormat pkgs
|
else if (mode == "zap_create_mount") then
|
||||||
|
disko.zapCreateMountScriptNoDeps diskFormat pkgs
|
||||||
|
else
|
||||||
|
builtins.abort "invalid mode"
|
||||||
else
|
else
|
||||||
builtins.abort "invalid mode"
|
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
|
in diskoEval
|
||||||
|
|
18
default.nix
18
default.nix
|
@ -16,18 +16,34 @@ in {
|
||||||
types = types;
|
types = types;
|
||||||
create = cfg: types.diskoLib.create (eval cfg).config.devices;
|
create = cfg: types.diskoLib.create (eval cfg).config.devices;
|
||||||
createScript = cfg: pkgs: pkgs.writeScript "disko-create" ''
|
createScript = cfg: pkgs: pkgs.writeScript "disko-create" ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}
|
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}
|
||||||
${types.diskoLib.create (eval cfg).config.devices}
|
${types.diskoLib.create (eval cfg).config.devices}
|
||||||
'';
|
'';
|
||||||
|
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;
|
mount = cfg: types.diskoLib.mount (eval cfg).config.devices;
|
||||||
mountScript = cfg: pkgs: pkgs.writeScript "disko-mount" ''
|
mountScript = cfg: pkgs: pkgs.writeScript "disko-mount" ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}
|
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}
|
||||||
${types.diskoLib.mount (eval cfg).config.devices}
|
${types.diskoLib.mount (eval cfg).config.devices}
|
||||||
'';
|
'';
|
||||||
zapCreateMount = cfg: pkgs: pkgs.writeScript "disko-zap-create-mount" ''
|
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)}
|
export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.devices pkgs)}
|
||||||
${types.diskoLib.zapCreateMount (eval cfg).config.devices}
|
${types.diskoLib.zapCreateMount (eval cfg).config.devices}
|
||||||
'';
|
'';
|
||||||
|
zapCreateMountScriptNoDeps = cfg: pkgs: pkgs.writeScript "disko-zap-create-mount" ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
${types.diskoLib.zapCreateMount (eval cfg).config.devices}
|
||||||
|
'';
|
||||||
config = cfg: { imports = types.diskoLib.config (eval cfg).config.devices; };
|
config = cfg: { imports = types.diskoLib.config (eval cfg).config.devices; };
|
||||||
packages = cfg: types.diskoLib.packages (eval cfg).config.devices;
|
packages = cfg: types.diskoLib.packages (eval cfg).config.devices;
|
||||||
}
|
}
|
||||||
|
|
3
disko
3
disko
|
@ -72,6 +72,9 @@ while [[ $# -gt 0 ]]; do
|
||||||
--dry-run)
|
--dry-run)
|
||||||
dry_run=y
|
dry_run=y
|
||||||
;;
|
;;
|
||||||
|
--no-deps)
|
||||||
|
nix_args+=(--arg noDeps true)
|
||||||
|
;;
|
||||||
--show-trace)
|
--show-trace)
|
||||||
nix_args+=("$1")
|
nix_args+=("$1")
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue