about summary refs log tree commit diff
path: root/modules/core
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-11-12 20:19:25 +0100
committerProfpatsch <mail@profpatsch.de>2021-11-12 20:36:13 +0100
commit129d4a230da847d26faf1a1331c67c614d43d49d (patch)
treeda4b5f4369762d8e3e6e740320b17e563a4b8b24 /modules/core
parent678754b4a5ac5a468e2223e1b701b8e9e2375c30 (diff)
modules/lazyPackages: factor out lorri-relevant error message
I want to use the mkWrapper function outside of the vuizvui module,
and this error message would be confusing to have.
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/lazy-packages.nix17
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/core/lazy-packages.nix b/modules/core/lazy-packages.nix
index 16f6587e..91c1b8db 100644
--- a/modules/core/lazy-packages.nix
+++ b/modules/core/lazy-packages.nix
@@ -12,16 +12,16 @@ let
   # The command used to fetch the store path from the binary cache.
   fetchSubstitute = "${escapeShellArg "${pkgs.nix}/bin/nix-store"} -r";
 
-  mkWrapper = package: pkgs.runCommandLocal "${package.name}-lazy" {
+  mkWrapper = {package, extraErrorMessage ? ""}: pkgs.runCommandLocal "${package.name}-lazy" {
     inherit package;
+    inherit extraErrorMessage;
   } ''
     encoded="$(echo "$package" | ${encoder})"
 
     if [ ! -e "$package/bin" ]; then
       echo "Store path $package doesn't have a \`bin' directory" \
-           "so we can't create lazy wrappers for it. Please" \
-           "remove \`${escapeShellArg package.name}' from" \
-           "\`vuizvui.lazyPackages'." >&2
+           "so we can't create lazy wrappers for it." \
+           "$extraErrorMessage" >&2
       exit 1
     fi
 
@@ -46,7 +46,12 @@ let
     done
   '';
 
-  wrappers = map mkWrapper config.vuizvui.lazyPackages;
+  vuizvuiWrapper = package: mkWrapper {
+    inherit package;
+    extraErrorMessage = "Please remove `${escapeShellArg package.name}' from `vuizvui.lazyPackages'.";
+  };
+
+  wrappers = map vuizvuiWrapper config.vuizvui.lazyPackages;
 
 in {
   options.vuizvui.lazyPackages = lib.mkOption {
@@ -63,5 +68,5 @@ in {
     '';
   };
 
-  config.environment.systemPackages = map mkWrapper lazyPackages;
+  config.environment.systemPackages = map vuizvuiWrapper lazyPackages;
 }