11
submitted 5 days ago* (last edited 5 days ago) by clot27@lemmy.zip to c/nix@programming.dev

I want to edit .desktop files of some nixpkgs for customization, but they are located in /run/current-system/sw/share/applications.. and are readable only.

One possible solution would be to copy them to ~/.local/share/applications but duplicating doesnt sit right with me (this would be my last resort tho).

I would prefer to override the parameters I want to change somehow preferably in my configuration.nix only.

you are viewing a single comment's thread
view the rest of the comments
[-] Oinks 5 points 5 days ago* (last edited 5 days ago)

Another alternative approach would be to add a duplicate desktop file, but to write it declaratively using Home Manager:

# in home.nix
home.file.".local/share/applications/firefox.desktop".source =
  pkgs.runCommand "firefox-desktop" { } ''
    cp "${pkgs.firefox}/share/applications/firefox.desktop" "$out"
    substituteInPlace "$out" \
      --replace-fail "Terminal=false" "Terminal=true"
  '';

# - or -
home.file.".local/share/applications/firefox.desktop".text = ''
  [Desktop Entry]
  Name=Firefox
  Icon=firefox
  Exec=firefox --name firefox %U
'';

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.

this post was submitted on 25 Jul 2025
11 points (100.0% liked)

Nix / NixOS

2357 readers
1 users here now

Main links

Videos

founded 2 years ago
MODERATORS