Open AmitKumarDas opened 3 weeks ago
% nix --version
nix (Nix) 2.21.2
% echo $PATH
/Users/amitd2/.docker/bin:/opt/homebrew/opt/bison/bin:/Users/amitd2/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin:/Users/amitd2/.cargo/bin:/Applications/iTerm.app/Contents/Resources/utilities
# redacted
% echo $PATH
/Users/amitd2/.nix-profile/bin:/nix/var/nix/profiles/default/bin
% ls -ltr /Users/amitd2/.nix-profile
lrwxr-xr-x 1 amitd2 staff 45 9 Nov 2022 /Users/amitd2/.nix-profile -> /nix/var/nix/profiles/per-user/amitd2/profile
% ls -ltr /nix/var/nix/profiles/default/bin
lrwxr-xr-x 1 root wheel 58 1 Jan 1970 /nix/var/nix/profiles/default/bin -> /nix/store/49wgh2fy77pfvcrbnsr0i6mkbhdkwqr7-nix-2.21.2/bin
% ls -ltr /Users/amitd2/.nix-profile/bin
ls: /Users/amitd2/.nix-profile/bin: No such file or directory
% ls -ltr /nix/var/nix/profiles/per-user/amitd2/profile
ls: /nix/var/nix/profiles/per-user/amitd2/profile: No such file or directory
% ls -ltr /nix/var/nix/profiles
total 0
drwxr-xr-x 3 root wheel 96 1 Jun 11:47 per-user
lrwxr-xr-x 1 root wheel 60 1 Jun 11:47 default-1-link -> /nix/store/0fidsnxg5l8gi3fcspvbqvkpa74r2a08-user-environment
lrwxr-xr-x 1 root wheel 60 1 Jun 11:47 default-2-link -> /nix/store/hz9pqa4fghagyh94ds5q4vjmibfsasyd-user-environment
lrwxr-xr-x 1 root wheel 14 1 Jun 11:47 default -> default-2-link
ls -ltr /nix/var/nix/profiles/per-user
total 0
drwxr-xr-x 2 root wheel 64 1 Jun 11:47 root
ls -ltr /nix/var/nix/profiles/per-user/root
total 0
% echo $NIX_SSL_CERT_FILE
/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt
% ls -ltr /nix/store/hz9pqa4fghagyh94ds5q4vjmibfsasyd-user-environment/etc/ssl
lrwxr-xr-x 1 root wheel 67 1 Jan 1970 /nix/store/hz9pqa4fghagyh94ds5q4vjmibfsasyd-user-environment/etc/ssl -> /nix/store/zlxqhs2v4idh8w7lhx9yl1bk09j8hjxg-nss-cacert-3.95/etc/ssl
% ls -ltr /nix/store/hz9pqa4fghagyh94ds5q4vjmibfsasyd-user-environment/etc/ssl/certs
total 976
-r-xr-xr-x 1 root wheel 498750 1 Jan 1970 ca-bundle.crt
% whoami
amitd2
- Following are seen at PATH
- /Users/amitd2/.nix-profile/bin
- /nix/var/nix/profiles/default/bin
- The second one is correct while first one is incorrect
- Fix: Remove the first one from PATH
% nix build "nixpkgs#bat"
% ls -ltr
total 0
lrwxr-xr-x@ 1 amitd2 staff 54 11 Jun 16:44 result -> /nix/store/hiia69kvpnlkkqrwa9q0v7rzyik91ip7-bat-0.24.0
% readlink result
/nix/store/hiia69kvpnlkkqrwa9q0v7rzyik91ip7-bat-0.24.0
% ./result/bin/bat --version
bat 0.24.0
# quit the terminal & open a new terminal
# refer: https://nix.dev/manual/nix/2.13/package-management/garbage-collection
- echo $path
- nix-store --gc
- run above multiple times