Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active February 3, 2026 20:22
Show Gist options
  • Select an option

  • Save dacr/8d6b2bb71f9d4f55e067710f04637bfe to your computer and use it in GitHub Desktop.

Select an option

Save dacr/8d6b2bb71f9d4f55e067710f04637bfe to your computer and use it in GitHub Desktop.
nix paths / published by https://github.com/dacr/code-examples-manager #b89e7b9c-fbc6-4fb1-a50d-f5cd274e3346/7c81649f2d3fa30751fce290c5a4b25c66c7797e
## summary : nix paths
## keywords : nix, paths
## publish : gist
## authors : David Crosson
## license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
## id : b89e7b9c-fbc6-4fb1-a50d-f5cd274e3346
## created-on : 2025-02-01T11:19:18+01:00
## managed-by : https://github.com/dacr/code-examples-manager
## run-with : nix eval --file $file
#### run-with : nix-instantiate --eval $file
let
cwd_path = ./.;
a_file_path = ./paths.nix;
content = builtins.readFile a_file_path;
lookup_path = <nixpkgs> ; # search through the declared NIX paths
lookup_path_lib = <nixpkgs/lib> ; # search through the declared NIX paths
in {
file-content = content;
found-nixpkgs-lib = lookup_path_lib; # /!\ lookup paths considered harmful
source-path = a_file_path; # in local
used-path = "${a_file_path}"; # then reference in store
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment