This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

lib.makeWrapper: add passthru support and use it in mutt

- Add passthru parameter to makeWrapper for custom attributes
- Convert mutt to use passthru instead of manual attribute merging
- This simplifies the code and makes wrapper configuration cleaner

+37 -27
+33 -23
lib/make-wrapper.nix
··· 9 9 - `runtimeInputs`: List of packages to add to PATH (optional) 10 10 - `env`: Attribute set of environment variables to export (optional) 11 11 - `flags`: Attribute set of command-line flags to add (optional) 12 + - `flagSeparator`: Separator between flag names and values (optional, defaults to " ") 12 13 - `preHook`: Shell script to run before executing the command (optional) 14 + - `passthru`: Attribute set to pass through to the wrapped derivation (optional) 13 15 - `wrapper`: Custom wrapper function (optional, defaults to exec'ing the original binary with flags) 14 16 - Called with { env, flags, envString, flagsString, exePath, preHook } 15 17 ··· 49 51 flags ? { }, 50 52 flagSeparator ? " ", # " " for "--flag value" or "=" for "--flag=value" 51 53 preHook ? "", 54 + passthru ? { }, 52 55 wrapper ? ( 53 56 { 54 57 exePath, ··· 87 90 " \\\n " 88 91 + lib.concatStringsSep " \\\n " ( 89 92 lib.mapAttrsToList ( 90 - name: value: if value == { } then "${name}" else "${name}${flagSeparator}${lib.escapeShellArg (toString value)}" 93 + name: value: 94 + if value == { } then "${name}" else "${name}${flagSeparator}${lib.escapeShellArg (toString value)}" 91 95 ) flags 92 96 ); 93 97 ··· 101 105 preHook 102 106 ; 103 107 }; 108 + # Create the wrapper derivation 109 + wrappedPackage = 110 + pkgs.symlinkJoin { 111 + name = package.pname or package.name; 112 + paths = [ 113 + (pkgs.writeShellApplication { 114 + name = binName; 115 + runtimeInputs = runtimeInputs; 116 + text = finalWrapper; 117 + }) 118 + package 119 + ]; 120 + passthru = 121 + (package.passthru or { }) 122 + // passthru 123 + // { 124 + inherit env flags preHook; 125 + }; 126 + # Pass through original attributes 127 + inherit (package) meta; 128 + } 129 + // lib.optionalAttrs (package ? version) { 130 + inherit (package) version; 131 + } 132 + // lib.optionalAttrs (package ? pname) { 133 + inherit (package) pname; 134 + }; 104 135 in 105 - pkgs.symlinkJoin { 106 - name = package.pname or package.name; 107 - paths = [ 108 - (pkgs.writeShellApplication { 109 - name = binName; 110 - runtimeInputs = runtimeInputs; 111 - text = finalWrapper; 112 - }) 113 - package 114 - ]; 115 - passthru = (package.passthru or { }) // { 116 - inherit env flags preHook; 117 - }; 118 - # Pass through original attributes 119 - inherit (package) meta; 120 - } 121 - // lib.optionalAttrs (package ? version) { 122 - inherit (package) version; 123 - } 124 - // lib.optionalAttrs (package ? pname) { 125 - inherit (package) pname; 126 - }; 136 + wrappedPackage; 127 137 }
+4 -4
tools/mutt/flake-module.nix
··· 270 270 ''; 271 271 272 272 in 273 - (self.libWithPkgs.${pkgs.system}.makeWrapper pkgs.neomutt { 273 + self.libWithPkgs.${pkgs.system}.makeWrapper pkgs.neomutt { 274 274 runtimeInputs = 275 275 [ 276 276 pkgs.elinks ··· 287 287 flags = { 288 288 "-F" = "${muttrc}"; 289 289 }; 290 - }) 291 - // { 292 - passthru.notmuchConfig = notmuchConfig; 290 + passthru = { 291 + notmuchConfig = notmuchConfig; 292 + }; 293 293 }; 294 294 }; 295 295 }