mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2026-02-02 17:35:08 +01:00
add debug output
This commit is contained in:
parent
c7e5f3caec
commit
ad6ab7df50
1 changed files with 17 additions and 14 deletions
31
types.nix
31
types.nix
|
|
@ -137,15 +137,15 @@ rec {
|
||||||
|
|
||||||
hookMixin = { config, options,... }: {
|
hookMixin = { config, options,... }: {
|
||||||
options = let
|
options = let
|
||||||
mkHook = mkOption {
|
mkHook = default: mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = default;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
preCreateHook = mkHook;
|
preCreateHook = mkHook "echo 'DEBUG preCreate: ${config.type}'";
|
||||||
postCreateHook = mkHook;
|
postCreateHook = mkHook "echo 'DEBUG postCreate: ${config.type}'";
|
||||||
preMountHook = mkHook;
|
preMountHook = mkHook "echo 'DEBUG preMount: ${config.type}'";
|
||||||
postMountHook = mkHook;
|
postMountHook = mkHook "echo 'DEBUG postMount: ${config.type}'";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -155,14 +155,17 @@ rec {
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = types.functionTo types.str;
|
type = types.functionTo types.str;
|
||||||
default = args:
|
default = args:
|
||||||
lib.concatStringsSep "\n" [
|
let name = "format";
|
||||||
"(" # subshell for namespacing
|
test = lib.optionalString (config ? name) "${config.${name}}";
|
||||||
(diskoLib.defineHookVariables { inherit config options; })
|
in
|
||||||
config.preCreateHook
|
''
|
||||||
(attrs.default args)
|
( # ${config.type} ${concatMapStringsSep " " (n: toString (config.${n} or "")) ["name" "device" "format" "mountpoint"]}
|
||||||
config.postCreateHook
|
${diskoLib.defineHookVariables { inherit config options; }}
|
||||||
")"
|
${config.preCreateHook}
|
||||||
];
|
${attrs.default args}
|
||||||
|
${config.postCreateHook}
|
||||||
|
)
|
||||||
|
'';
|
||||||
description = "Creation script";
|
description = "Creation script";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue