App in path but not in Home Manager flake

I have a curious problem. I switched to Home Manager using flakes around 2022-08-30. Somehow the Brave browser, which I vaguely remember playing with at some point, is installed but it isn’t in the flake config. (It isn’t in /etc/nixos/configuration.nix either.) I have no idea how but it is still in the path:

$ which brave
/home/me/.nix-profile/bin/brave
$ nix-env -q
error: profile '/nix/var/nix/profiles/per-user/me/profile' is incompatible with 'nix-env'; please use 'nix profile' instead
$ nix profile list
0 - - /nix/store/cqi0hk9i518akyy9ynaindrwlv122sbz-home-manager-path
$ ls -l /nix/store/cqi0hk9i518akyy9ynaindrwlv122sbz-home-manager-path/opt
1 lrwxrwxrwx 1 root root 62 Dec 31  1969 /nix/store/cqi0hk9i518akyy9ynaindrwlv122sbz-home-manager-path/opt -> /nix/store/hamll57dra8qnsm8r6gi7jwqv4bcgq0a-brave-1.50.125/opt/
$ find ~/.config/nixpkgs/ -name '*.nix' | xargs grep -i brave  # nothing

Clearly it is in the Home Manager profile but why? Why is brave there when it isn’t in the flake that I build the profile from? How do I debug this problem?

Where does ~/.nix-profile point to? (readlink ~/.nix-profile)

$ readlink ~/.nix-profile
/nix/var/nix/profiles/per-user/me/profile

home-manager packages? (I do hope that one actually works with nix profile based profiles)

Also, please check ~/.config/home-manager for files containing brave. They moved the default location, and I am not sure about their fallback strategy…

I appreciate your help NobbZ.

I originally used programs.chromium.package to install brave via home-manager switch --flake .#me. I decided to switch back to ungoogled-chromium so brave isn’t anywhere in my flake configuration anymore. I checked all the files being tracked by git for my config and none of them contain the keyword ‘brave’ in them.

$ find ~/.config/nixpkgs -name '*.nix' | xargs grep -i brave  # no output

I don’t have that directory. I installed my config in ~/.config/nixpkgs.

I’m not sure what happened but brave is no longer in my profile

$ which brave  # which: no brave in (...)

I have no idea what I did but it appears to be gone. My thanks to NobbZ for helping. Right now I’m thinking it could have been operator error.