mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-29 04:27:14 +03:00
18 lines
349 B
Nix
18 lines
349 B
Nix
|
{
|
||
|
lib,
|
||
|
runCommandLocal,
|
||
|
nix,
|
||
|
...
|
||
|
}: let
|
||
|
l = builtins // lib;
|
||
|
|
||
|
# hash a file via `nix hash file`
|
||
|
hashFile = algo: path: let
|
||
|
hashFile = runCommandLocal "hash-${algo}" {} ''
|
||
|
${nix}/bin/nix --option experimental-features nix-command hash file ${path} | tr --delete '\n' > $out
|
||
|
'';
|
||
|
in
|
||
|
l.readFile hashFile;
|
||
|
in
|
||
|
hashFile
|