cashmere

cashmere

How to set a custom icon in Nix

Description

So I have achieved my initial goal

{ config, pkgs, lib, … }:

let icon = builtins.fetchurl { url = "img"; sha256 = "sha256:1w79wmdx855b2vizsl99crinvm4fkcry8i91ddxx1w8rh537fg51"; }; in { home.file.".local/share/xdg-desktop-portal/icons/putty.png" = { source = icon; }; }

and

xdg.desktopEntries = { putty = { name = "Putty"; genericName = "Terminal Emulator"; exec = "putty"; terminal = false; categories = [ "Application" "Network" ]; icon = "home/matt.local/share/xdg-desktop-portal/icons/putty.png"; }; };

I'm sure this can be done much more elegantly. For example working out the icon search path so I don't need an absolute path would be a start. But this is something I will come back to later. I feel like this is a good project to learn about Nix packages with only a small goal.