NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.52k stars 1.5k forks source link

User-level flake registry reset when updating the registry #4982

Open starcraft66 opened 3 years ago

starcraft66 commented 3 years ago

Describe the bug

I currently add to my system flake registry from my flake. If I make any changes to the registry, i.e. by updating my flake inputs and rebuilding the flake, my user-level registry will be reset and only contain the default global flakes until I log out of and back into my user account. However, if I run nix flake registry list as root, I see my system flakes as well as the default global flakes as expected.

Steps To Reproduce

  1. Update my inputs
  2. Run nixos-rebuild
  3. Run nix registry list

Expected behavior

I expect nix registry list and sudo nix registry list to produce the same output after updating my inputs and rebuilding without having to re-login.

nix-env --version output

nix-env (Nix) 2.4pre20210601_5985b8b

Additional context

Within my flake, I have:

  nix = {
    package = pkgs.nixFlakes;
    extraOptions = ''
      experimental-features = nix-command flakes
    '';
    # Pin nixpkgs for older Nix tools
    nixPath = [ "nixpkgs=${pkgs.path}" ];
    registry = {
      self.flake = inputs.self;
      nixpkgs.flake = inputs.nixpkgs;
      emacs-overlay.flake = inputs.emacs-overlay;
    };
  };

If I rebuild and log back in and run nix registry list or sudo nix registry list, I get:

system flake:nixpkgs path:/nix/store/1468nkcswy53zvzjzpddircb3jhry03n-source?lastModified=1625223284&narHash=sha256-jjLcDSU1rRiJb+n3uez23XAa7kbnPcGZTa6jIKh1GMQ=&rev=357d2c8f6087685fe35cb1889a005a4dd4cce7b8
system flake:self path:/nix/store/cs2fw6kv143010fr2bjbrd0vjm7dfh5v-source?lastModified=1625291669&narHash=sha256-TxXUmCrM%2fm4YDinIicNg4GGxxdvApG%2fuoDkxcjq%2ftW0=
global flake:blender-bin github:edolstra/nix-warez?dir=blender
global flake:dwarffs github:edolstra/dwarffs
global flake:hydra github:NixOS/hydra
global flake:mach-nix github:DavHau/mach-nix
global flake:nimble github:nix-community/flake-nimble
global flake:nix github:NixOS/nix
global flake:nixops github:NixOS/nixops
global flake:nixos-hardware github:NixOS/nixos-hardware
global flake:nixos-homepage github:NixOS/nixos-homepage/flake
global flake:nur github:nix-community/NUR
global flake:nixpkgs github:NixOS/nixpkgs
global flake:templates github:NixOS/templates
global flake:patchelf github:NixOS/patchelf
global flake:nix-serve github:edolstra/nix-serve
global flake:nickel github:tweag/nickel

If I change my inputs, run nixos-rebuild and run nix registry list, I get:

global flake:blender-bin github:edolstra/nix-warez?dir=blender
global flake:dwarffs github:edolstra/dwarffs
global flake:hydra github:NixOS/hydra
global flake:mach-nix github:DavHau/mach-nix
global flake:nimble github:nix-community/flake-nimble
global flake:nix github:NixOS/nix
global flake:nixops github:NixOS/nixops
global flake:nixos-hardware github:NixOS/nixos-hardware
global flake:nixos-homepage github:NixOS/nixos-homepage/flake
global flake:nur github:nix-community/NUR
global flake:nixpkgs github:NixOS/nixpkgs
global flake:templates github:NixOS/templates
global flake:patchelf github:NixOS/patchelf
global flake:nix-serve github:edolstra/nix-serve
global flake:nickel github:tweag/nickel

However, if I then run sudo nix registry list, I get the expected:

system flake:nixpkgs path:/nix/store/1468nkcswy53zvzjzpddircb3jhry03n-source?lastModified=1625223284&narHash=sha256-jjLcDSU1rRiJb+n3uez23XAa7kbnPcGZTa6jIKh1GMQ=&rev=357d2c8f6087685fe35cb1889a005a4dd4cce7b8
system flake:self path:/nix/store/cs2fw6kv143010fr2bjbrd0vjm7dfh5v-source?lastModified=1625291669&narHash=sha256-TxXUmCrM%2fm4YDinIicNg4GGxxdvApG%2fuoDkxcjq%2ftW0=
global flake:blender-bin github:edolstra/nix-warez?dir=blender
global flake:dwarffs github:edolstra/dwarffs
global flake:hydra github:NixOS/hydra
global flake:mach-nix github:DavHau/mach-nix
global flake:nimble github:nix-community/flake-nimble
global flake:nix github:NixOS/nix
global flake:nixops github:NixOS/nixops
global flake:nixos-hardware github:NixOS/nixos-hardware
global flake:nixos-homepage github:NixOS/nixos-homepage/flake
global flake:nur github:nix-community/NUR
global flake:nixpkgs github:NixOS/nixpkgs
global flake:templates github:NixOS/templates
global flake:patchelf github:NixOS/patchelf
global flake:nix-serve github:edolstra/nix-serve
global flake:nickel github:tweag/nickel
stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info