dream2nix/lib/internal/hashPath.nix

18 lines
365 B
Nix
Raw Normal View History

2023-05-19 11:26:39 +03:00
{
lib,
runCommandLocal,
nix,
...
}: let
l = builtins // lib;
# hash the contents of a path via `nix hash path`
hashPath = algo: path: let
hashPath = runCommandLocal "hash-${algo}" {} ''
${nix}/bin/nix --option experimental-features nix-command hash path ${path} | tr --delete '\n' > $out
'';
in
l.readFile hashPath;
in
hashPath