Skip to content

Instantly share code, notes, and snippets.

@dacr
Created February 1, 2025 11:04
Show Gist options
  • Save dacr/8d6b2bb71f9d4f55e067710f04637bfe to your computer and use it in GitHub Desktop.
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/7c9fe61f8d70c3d30ddf2d942fb5b36ee62cace7
## summary : nix paths
## keywords : nix, paths
## publish : gist
## authors : David Crosson
## license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
## 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