1 { stdenv, lib, python3 }:
4 name = "replace-secret";
5 buildInputs = [ python3 ];
9 install -D ${./replace-secret.py} $out/bin/replace-secret
13 installCheckPhase = ''
14 install -m 0600 ${./test/input_file} long_test
15 $out/bin/replace-secret "replace this" ${./test/passwd} long_test
16 $out/bin/replace-secret "and this" ${./test/rsa} long_test
17 diff ${./test/expected_long_output} long_test
19 install -m 0600 ${./test/input_file} short_test
20 $out/bin/replace-secret "replace this" <(echo "a") short_test
21 $out/bin/replace-secret "and this" <(echo "b") short_test
22 diff ${./test/expected_short_output} short_test
25 platforms = platforms.all;
26 maintainers = with maintainers; [ talyz ];
27 license = licenses.mit;
28 description = "Replace a string in one file with a secret from a second file";
30 Replace a string in one file with a secret from a second file.
32 Since the secret is read from a file, it won't be leaked through
33 '/proc/<pid>/cmdline', unlike when 'sed' or 'replace' is used.
35 mainProgram = "replace-secret";