From 3fb91b5afbe966414b4a2257bd17fc29af3362ff Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Wed, 6 Nov 2024 04:26:44 +0300 Subject: [PATCH] Nix: Make prefetch auto-copy the hash. --- home/program/bash/module/Nix.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/home/program/bash/module/Nix.nix b/home/program/bash/module/Nix.nix index c1cb32d..bc25b9f 100644 --- a/home/program/bash/module/Nix.nix +++ b/home/program/bash/module/Nix.nix @@ -57,7 +57,9 @@ return 2 fi - nix hash to-sri --type sha256 $(nix-prefetch-url "''${url}") + local result=$(nix hash to-sri --type sha256 $(nix-prefetch-url "''${url}")) + printf "%s" ''${result} | copy + printf "%s\n" ''${result} } # Run nix locally with no builders.