iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
22.96k stars 1.06k forks source link

Nix shell expression out of date in `DEPENDENCIES.md` #2378

Closed Zaubentrucker closed 1 month ago

Zaubentrucker commented 1 month ago

Is there an existing issue for this?

Is this issue related to iced?

What happened?

Using the nix-shell expression in DEPENDENCIES.md, building the todos example fails:

❯ git status -sb
## 0.12...origin/0.12

❯ cat shell.nix
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell rec {
  buildInputs = with pkgs; [
    expat
    fontconfig
    freetype
    freetype.dev
    libGL
    pkgconfig
    xorg.libX11
    xorg.libXcursor
    xorg.libXi
    xorg.libXrandr
  ];

  LD_LIBRARY_PATH =
    builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;
}

❯ nix-shell --run "cargo build --package todos"
error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/4crm97dlqqjbibn9k5hlcrv0wp0vlq0v-nixos-23.11.5353.878ef7d9721b/nixos/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'LD_LIBRARY_PATH' of derivation 'nix-shell'

         at /home/zaubentrucker/Workspace/iced/shell.nix:17:3:

           16|
           17|   LD_LIBRARY_PATH =
             |   ^
           18|     builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;

       error: 'pkgconfig' has been renamed to/replaced by 'pkg-config'

According to this Pull-Request, pkgconfig should be replaced by pkg-config in the nix.shell file. I'm new to nix, so I'm not sure what this Pull-Request actually does. However, it seems to me that pkg-config should work on nix installations that are newer than 2018:

pkgconfig was aliased in 2018, however, it remained in all-packages.nix due to its wide usage. This cleans up the remaining references to pkgs.pkgsconfig and moves the entry to aliases.nix.

What is the expected behavior?

After changing pkgconfig to pkg-config, the build succeeds:

❯ cat shell.nix
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell rec {
  buildInputs = with pkgs; [
    expat
    fontconfig
    freetype
    freetype.dev
    libGL
    pkg-config
    xorg.libX11
    xorg.libXcursor
    xorg.libXi
    xorg.libXrandr
  ];

  LD_LIBRARY_PATH =
    builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;
}

❯ nix-shell --run "cargo build --package todos"
    Finished dev [unoptimized + debuginfo] target(s) in 0.20s

Version

crates.io release

Operating System

Linux

Do you have any log output?

No response

hecrj commented 1 month ago

PR welcome!