11
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 25 Jul 2025
11 points (100.0% liked)
Nix / NixOS
2366 readers
4 users here now
Main links
Videos
founded 2 years ago
MODERATORS
Since the desktop files come directly from a package you'll need to change the package you're installing. This works best if you use the
postPatch
phase ofsymlinkJoin
:The reason for using
symlinkJoin
here is that it creates a package with the same outputs as the original Firefox, but with this bash script having run. You can use this like any other package:Note that
symlinkJoin
has special handling forpostPatch
, but ignores all other stdenv phases, so you need to do everything in one bash script. You can use all the parameters forrunCommand
though, such asbuildInputs
andnativeBuildInputs
- e.g. for compiling sass in a wrapper derivation.In some cases it's useful to also inherit
meta
orpassthru
because it's used in some nixpkgs/nixos sanity checks, but it's usually not required.Another approach would be to use
overrideAttrs
, which will also work but will cause Nix to rebuild the package from scratch. This might be fine or even desired in some cases, but you probably don't want to do that in this case.Another alternative approach would be to add a duplicate desktop file, but to write it declaratively using Home Manager:
It would be possible to DIY this with user activation scripts, but I don't really see a value in doing that over the
symlinkJoin
.Thanks!
What if I want to append an argument which doesnt already exist? does this also allow to modify multiple lines?
It understands
\n
if I recall correctly. You can also write regular bash, use templating tools, etc. Just use thenativeBuildInputs
parameter if you need a binary that isn't provided by stdenv.