stylix icon indicating copy to clipboard operation
stylix copied to clipboard

Could not build with `stylix.targets.nixos-icons.enable = true`

Open dmoonfire opened this issue 1 year ago • 4 comments

I recently updated to NixOS 24.11 and I couldn't get Stylix to build. I have a Flake setup with Home Manager. The error I got was:

error: attribute 'url' missing
at /nix/store/18lx9jbhwdwsd3w2zx3nwg887wwm3il9-source/modules/nixos-icons/nixos.nix:19:52:
  18|             --in-place \
  19|             '2i<!-- The original NixOS logo from ${oldAttrs.src.url} is licensed under https://creativecommons.org/licenses/by/4.0 and has been modified to match the ${scheme} color scheme. -->' \
    |                                                    ^
  20|             logo/nix-snowflake-white.svg
Did you mean one of all or src?

I believe the relevant configuration options are:

# In my flake.nix
stylix = {
  url = "github:danth/stylix";
  inputs.nixpkgs.follows = "nixpkgs";
  inputs.home-manager.follows = "home-manager";
};

# In my src/nodes/hostname/default.nix
stylix.enable = true;
stylix.image = ./background.jpg;
stylix.polarity = "dark";

When I add stylix.targets.nixos-icons.enable = false; into the settings, I don't have a problem and it builds cleanly.

dmoonfire avatar Dec 28 '24 21:12 dmoonfire

The relevant Stylix code is:

https://github.com/danth/stylix/blob/963e77a3a4fc2be670d5a9a6cbeb249b8a43808a/modules/nixos-icons/nixos.nix#L9-L24

However, I am unable to reproduce this error on:

https://github.com/danth/stylix/blob/963e77a3a4fc2be670d5a9a6cbeb249b8a43808a/flake.lock#L158-L172

The following command does not crash with your error:

nix build --expr '
  let
    pkgs = import <nixpkgs> {};
  in
    pkgs.nixos-icons.overrideAttrs (
      oldAttrs: {
        src = pkgs.applyPatches {
          inherit (oldAttrs) src;
          prePatch = "echo ${oldAttrs.src.url}";
        };
      }
    )
' --impure -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/8edf06bea5bcbee082df1b7369ff973b91618b8d.tar.gz --verbose

trueNAHO avatar Dec 29 '24 00:12 trueNAHO

Thank you. It might be Colmena's new experimental evaluation for 24.11. Let me see if I can get a gist and see if that is it.

dmoonfire avatar Jan 02 '25 23:01 dmoonfire

I'm having trouble making a gist that proves this out. I'll just deal with having to keep the icons disabled. Thank you.

dmoonfire avatar Jan 13 '25 02:01 dmoonfire

I'm having trouble making a gist that proves this out. I'll just deal with having to keep the icons disabled. Thank you.

I reproduced this with colmena, the root cause for my configuration was setting the meta.nodePkgs was triggering double evaluation of the scripts/patches in the pkgs.

I had to go a bit further with my changes after removing it since I relied on different versions of nixpkgs (stable, unstable) for different hosts -- and came up with this abomination that merges colmena hive's into one: https://gist.github.com/sini/a2ec12a98b43f641f83e5d4c1912ed94

sini avatar Jul 10 '25 20:07 sini