Quite confused with some "un-searchable?" nix pakages

✦2 ❯ nix repl
Welcome to Nix 2.18.5. Type :? for help.

nix-repl> :load <nixpkgs>      
Added 22339 variables.

nix-repl> pam  
«derivation /nix/store/dsmlq8izczg8aab9ryxh6m5m5lrf6wmx-linux-pam-1.6.1.drv»

nix-repl> wayland
«derivation /nix/store/lcg2mcbsqg55h1vqsh6wd00imq4zpfsp-wayland-1.23.0.drv»

I cannot find out the exact package named wayland on nix-search-packages website. And also, how can I efficiently search pam on the website? Since when I search pam on the website, I don’t see the exact package named pam and linux-pam seems to be placed at the tailing position.

1 Like

I think you can’t find pam in the search because its pname is linux-pam, so that’s what it shows up as.

For wayland, I’m not really sure, but this might be an error. You might want to open an issue in the nixos-search repo about this.

In any case, you can find which file the packages originate from using meta.position:

nix-repl> pam.meta.position
"/nix/store/m4wnqg94mzbb3mcraq5sjrrgfjdwbs95-source/pkgs/os-specific/linux/pam/default.nix:59"

nix-repl> wayland.meta.position
"/nix/store/m4wnqg94mzbb3mcraq5sjrrgfjdwbs95-source/pkgs/development/libraries/wayland/default.nix:118"

Edit: Looking at how these packages are defined in all-packages.nix, missing pam might be related to `go_1_22` not found · Issue #781 · NixOS/nixos-search · GitHub since it appears to be an alias to linux-pam and openpam

  pam = if stdenv.isLinux then linux-pam else openpam;
  linux-pam = callPackage ../os-specific/linux/pam { };

wayland is apparently a darwin package. This might be related to Search results missing some packages · Issue #708 · NixOS/nixos-search · GitHub

  wayland = darwin.apple_sdk_11_0.callPackage ../development/libraries/wayland { };
2 Likes

Also, if you want to know where an attribute is defined, you can use:

nix-repl> builtins.unsafeGetAttrPos "pam" pkgs
{
  column = 3;
  file = "/nix/store/9g7xq4cldszn00p70awljpim92xg2c1s-source/pkgs/top-level/all-packages.nix";
  line = 27037;
}

which (given that my nixpkgs revision is c3aa7b8938b17aebd2deecf7be0636000d62a2b9) points to https://github.com/NixOS/nixpkgs/blob/c3aa7b8938b17aebd2deecf7be0636000d62a2b9/pkgs/top-level/all-packages.nix#L27037

If the above command shows null, it’s probably defined in pkgs/by-name instead (which you can verify with the meta.position as mentioned above).

1 Like

Yes, but no, it’s using the darwin callPackage which permits it to be used on darwin and non-darwin alike. The main benefit of using this is to not have to use darwin as a package argument and pass the actual frameworks in instead, which makes for (presumably) easier overrides.
(Though I can’t say if it’s actually easier, I’ve never used darwin.)

2 Likes

It mostly makes things worse and is going away soon: On the future of Darwin SDKs (or how you can stop worrying and put the SDK in build inputs).

1 Like

Wayland builds some things on Darwin though not everything. It’s not particular useful, but it’s also not harmful allowing it to build (especially if it makes things easier for Linux maintainers).