From 53d3e5d5b36a5227b906e00d7e884dcfb7852403 Mon Sep 17 00:00:00 2001 From: Daniel Thwaites Date: Sat, 23 Mar 2024 20:02:10 +0000 Subject: [PATCH] nixos-icons: recolor white logo (#297) Fixes #292 --- modules/nixos-icons/nixos.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 modules/nixos-icons/nixos.nix diff --git a/modules/nixos-icons/nixos.nix b/modules/nixos-icons/nixos.nix new file mode 100644 index 00000000..cce696d8 --- /dev/null +++ b/modules/nixos-icons/nixos.nix @@ -0,0 +1,24 @@ +{ pkgs, config, lib, ... }: + +with config.lib.stylix.colors; + +{ + options.stylix.targets.nixos-icons.enable = + config.lib.stylix.mkEnableTarget "the NixOS logo" true; + + config.nixpkgs.overlays = lib.mkIf config.stylix.targets.nixos-icons.enable [(self: super: { + nixos-icons = super.nixos-icons.overrideAttrs (oldAttrs: { + patchPhase = '' + substituteInPlace logo/white.svg --replace-fail '#ffffff' '#${base05}' + + # Insert attribution comment after the XML prolog + sed \ + --in-place \ + '2i' \ + logo/white.svg + + ${lib.getExe pkgs.resvg} logo/white.svg logo/white.png + ''; + }); + })]; +}