My flake.nix doesn't load the packages I expect

I’ve run into a couple of problems using flakes and need a bit of help.

I’ve created the following simple flake for dotnet development that includes packages from both the stable 22.11 and unstable channels.

  description = "My JetBrians Rider + dotnet 7.x Devenv";

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-21.11"; 
    nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; 
    flake-utils.url = "github:numtide/flake-utils";

    outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, ... }: 
    flake-utils.lib.eachDefaultSystem (system:
        pkgs = import nixpkgs {
          inherit system;
          config.allowUnfree = true;
        unstable_pkgs = import nixpkgs-unstable {
          inherit system;
         config.allowUnfree = true;
      in rec {
        devShell = pkgs.mkShell {
          packages = with pkgs; [ 

          shellHook = ''
              echo "Devenv initialized"

Problem #1

With respect to the nodejs package; if I load this package via /etc/nixos/configuration.nix from the 22.11 stable channel, I get one version, while if I load the same package from my flake 22.11 stable channel I get another version.

/etc/nixos/configuration.nix: nodejs --> v18.14.1
flake.nix: nodejs --> v14.19.3

Why? In both cases, I believe that I’m referencing the 22.11 stable channels. Searching nixos packages, I don’t see nodejs version 14.19.3 in either the 22.11 stable or unstable channels.

Problem #2

With respect to the nss package, which includes a number of utilities such as ‘certutil’ that I need, whether I add this package in /etc/nixos/configuration.nix or my flake.nix – the package (utilities) never seem to get loaded.

$ certutil
The program 'certutil' is not in your PATH. It is provided by several packages.
You can make it available in an ephemeral shell by typing one of the following:
  nix-shell -p nss
  nix-shell -p nss_latest

Running nix-locate ‘/bin/certutil’ I see the results below, however, if I simply try to list these directories, neither of them exists.     220,904 x /nix/store/zjzsnpb607hs6pscc8ssr1ad6kls6msr-nss-3.89-tools/bin/certutil               220,904 x /nix/store/damycn7l0k8qcn0mjyfpfp5pkbkh2g2n-nss-3.79.4-tools/bin/certutil

Thoughts? I suspect I’m overlooking something quite simple.

What do nix-channel --list and sudo nix-channel --list give you?

My guess is that you have an incredibly outdated channel snuck in somewhere, and for whatever reason you happen to be in that profile when you check your nodejs version when you think you’re in your flake shell, but you’re not actually.

You could use nix run --inputs-from . nixpkgs#nodejs -- --version to check what version the flake input resolves, to minimize the potential for issues caused by channels and profiles.

Sounds like you never build your configuration.nix or flake.nix. How or why that happens, I’m not so sure, but the failure to resolve the nodejs version specified by your flake combined with this makes it sound like something very fishy is going on. It’s like you’re stuck in a very outdated profile.

Do you get anything useful from:

nix shell nixpkgs#nss --command certutil --version

Your flake is using 21.11, not 22.11.

Your nix-index database is probably out of sync with your actual commit used for the system or the flake.

CNF seems to fail with Multi-Output-Derivations. As nix-locate tells you correctly, you need to use

1 Like

Duh! Updating my channel to refer to 22.11 – fixed my package version issue. It’s funny how your eyes glaze over such simple things.

I executed nix shell nixpkgs#nss --command certutil --version, which produced error: unable to execute 'certutil': No such file or directory.

Thanks for taking the time to review and response. Much appreciated.

1 Like

FWIW, I found and installed the package, and now certutil (among other nss tools) is now available.

1 Like