Skip to content

Use nix-index from a fixed output derivation does not work #256

@vkryachko

Description

@vkryachko

Hi, not sure if it's a known issue, but it would be great if output of nix-index on the same revision of nixpkgs would produce the same hash, it is not the case today, i.e. try running to this flake:

{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

  outputs = { self, nixpkgs}: 
    let pkgs = nixpkgs.legacyPackages.x86_64-linux;
    in {
      packages.x86_64-linux.default = pkgs.runCommand "my-index" {
        nativeBuildInputs = [ pkgs.nix-index pkgs.nix ];
        outputHash = "";
        outputHashAlgo = "sha256";
        outputHashMode = "recursive";
      } ''
        export NIX_STATE_DIR="$(mktemp -d)"
        nix-shell || true # makes nix populate state dir

        nix-index --db $out -s x86_64-linux --filter-prefix '/bin/' -f ${nixpkgs}

      '';
    };
}

Produced hash will be different every time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions