mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-29 23:35:33 +03:00
18 lines
365 B
Nix
18 lines
365 B
Nix
{
|
|
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
|