den icon indicating copy to clipboard operation
den copied to clipboard

`nixpkgs.config.rewriteURL` is null when using stable/unstable together

Open AthereoAndromeda opened this issue 2 months ago • 1 comments

I was following the documentation for using stable and unstable nixpkgs together here when I received this error.

  error: A definition for option `rewriteURL' is not of type `function that evaluates to a(n) (null or string)'. Definition values:
       - In `nixpkgs.config': null

Code

{
  den,
  inputs,
  ...
}: {
  den.aspects.nixpkgs-extend.os.nixpkgs.overlays = [
    (final: prev: {
      stable = import inputs.nixpkgs-stable {
          inherit (final.stdenv.hostPlatform) system;
          inherit (final) config;
        };
    })
  ];

  den.schema.host.includes = [den.aspects.nixpkgs-extend];

  den.default.nixos = {pkgs, ...}: {
    environment.systemPackages = [pkgs.stable.cowsay];
  };
}

Software versions:

Inputs:
├───den: github:denful/den/7594405b45e0ce2d5a418fe104a26e17f6b1dd8f
│   Last modified: 2026-09-29 02:34:58

───home-manager: github:nix-community/home-manager/acd21c5a3420a9d5fd0ed06299b10828267ef9ba
│   Last modified: 2026-10-03 09:00:54
│   └───nixpkgs follows input 'nixpkgs'
├───home-manager-stable: github:nix-community/home-manager/db7d5e2332710f5abb088f6b5de927d7f9511b35
│   Last modified: 2026-10-03 11:00:01
│   └───nixpkgs follows input 'nixpkgs-stable'

├───nixpkgs: https://releases.nixos.org/nixos/unstable/nixos-26.11pre1083223.c59305bab206/nixexprs.tar.zst?lastModified=1790822859&narHash=sha256-VBA0QerzzmL%2B4wxgtwiCdiLwLpJg2/9xOxhgO3BRJQA%3D&rev=c59305bab2065cfecc4944690d9eedbb56f3a9fa
│   Last modified: 2026-10-01 10:47:39
├───nixpkgs-stable: https://releases.nixos.org/nixos/26.05/nixos-26.05.11045.774debe7a0d1/nixexprs.tar.zst?lastModified=1790920529&narHash=sha256-S5MjznoY0gbQbcANPLz5RYjg%2B5/WQmFRgNbHcP%2Bydcg%3D&rev=774debe7a0d1b496e35677ad955a1011c6ff74f3
│   Last modified: 2026-10-02 13:55:29

Workaround

{
  den,
  inputs,
  ...
}: {
  den.aspects.nixpkgs-extend.os.nixpkgs.overlays = [
    (final: prev: {
      stable = import inputs.nixpkgs-stable ({
          inherit (final.stdenv.hostPlatform) system;
          inherit (final) config;
        }
        // {
          config.rewriteURL = url: url;
        });
    })
  ];

  den.schema.host.includes = [den.aspects.nixpkgs-extend];

  den.default.nixos = {pkgs, ...}: {
    environment.systemPackages = [pkgs.stable.cowsay];
  };
}

AthereoAndromeda avatar Oct 03 '26 11:10 AthereoAndromeda

Thanks for the report and the workaround, and sorry for the wait. This comes from nixpkgs rather than den: passing a newer nixpkgs' config into an older one hands it keys the older one types differently, and rewriteURL is one of them. The guide only shows the other direction (unstable on a stable host), where it works. I'll add a note to the guide covering your case, with your workaround or passing just the keys you need.

sini avatar Dec 04 '26 23:12 sini