| 11 May 2024 |
@brumik1:matrix.org | Thank you for the answer!
PostInstall is part of mkDerivation right? Can I do there writeShellApplication? Some approximate example would help me greatly in my failing attempts
| 10:10:31 |
Diamond (it/she) | `nix buildGoModule { // ... shellHook = } | 23:26:15 |
Diamond (it/she) | omg | 23:26:17 |
Diamond (it/she) | buildGoModule {
# ...
nativeBuildInputs = with pkgs; [
makeWrapper
];
shellHook = ''
wrapProgram $out/bin/progname --set PATH ${lib.makeBinPath with pkgs; [
# runtime packages go here
]}
'';
}
| 23:27:48 |
Diamond (it/she) | buildGoModule {
# ...
nativeBuildInputs = with pkgs; [
makeWrapper
];
shellHook = ''
wrapProgram $out/bin/progname --set PATH ${lib.makeBinPath with pkgs; [
# runtime packages go here
]}
'';
}
| 23:28:15 |
| reese (they/them) left the room. | 23:30:54 |
dnr | I like to do this by having the go program run things by absolute path. You can set this up by taking the binary name from a global and then overriding it with linker flags | 23:45:28 |
dnr | e.g. https://github.com/dnr/nix-sandwich/blob/main/default.nix#L14-L20 | 23:45:36 |
| 12 May 2024 |
Diamond (it/she) | woah | 00:02:50 |
Diamond (it/she) | why? | 00:02:50 |
Diamond (it/she) | this is a really cool project though | 00:03:34 |
@brumik1:matrix.org | I might be mistaken here, but shellHook isnt supposed to be run when entering the shell instead when you build the package? | 09:32:57 |
@brumik1:matrix.org | I do agree the project is really cool dnr! | 09:34:27 |
@brumik1:matrix.org | I ended up with using postFixup. I hope it is not antipattern | 09:47:03 |
dnr | In reply to @diamondburned:matrix.org why? You mean why do it that way? It just seems cleaner to me than using a wrapper. There's just one binary and no script. The disadvantage I guess is that you can't override things by messing with PATH and calling the wrapped binary directly | 19:05:41 |
dnr | And thanks. I've actually been working on an even better version of that idea. I'm planning to announce it soon | 19:07:55 |