2024-06-30 08:12:46 +00:00
|
|
|
{
|
|
|
|
callPackage,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
runCommand,
|
|
|
|
samples,
|
|
|
|
writeText,
|
|
|
|
writeStringReferencesToFile,
|
|
|
|
}:
|
2024-05-02 00:46:19 +00:00
|
|
|
let
|
|
|
|
samplePaths = lib.unique (lib.attrValues samples);
|
|
|
|
stri = x: "${x}";
|
2024-06-30 08:12:46 +00:00
|
|
|
sampleText = writeText "sample-text" (
|
|
|
|
lib.concatStringsSep "\n" (lib.unique (map stri samplePaths))
|
|
|
|
);
|
|
|
|
stringReferencesText = writeStringReferencesToFile (
|
|
|
|
(lib.concatMapStringsSep "fillertext" stri (lib.attrValues samples))
|
|
|
|
+ ''
|
|
|
|
STORE=${builtins.storeDir};\nsystemctl start bar-foo.service
|
|
|
|
''
|
|
|
|
);
|
2024-05-02 00:46:19 +00:00
|
|
|
in
|
|
|
|
runCommand "test-writeStringReferencesToFile" { } ''
|
|
|
|
diff -U3 <(sort ${stringReferencesText}) <(sort ${sampleText})
|
|
|
|
touch $out
|
|
|
|
''
|