mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 23:54:01 +00:00
51f7c15df9
The writeStringReferencesToFile didn't handle non-unique references to the same path correctly.
19 lines
680 B
Nix
19 lines
680 B
Nix
{ callPackage, lib, pkgs, runCommand, writeText, writeStringReferencesToFile }:
|
|
let
|
|
sample = import ./sample.nix { inherit pkgs; };
|
|
samplePaths = lib.unique (lib.attrValues sample);
|
|
stri = x: "${x}";
|
|
sampleText = writeText "sample-text" (lib.concatStringsSep "\n" (lib.unique (map stri samplePaths)));
|
|
stringReferencesText =
|
|
writeStringReferencesToFile
|
|
((lib.concatMapStringsSep "fillertext"
|
|
stri
|
|
(lib.attrValues sample)) + ''
|
|
STORE=${builtins.storeDir};\nsystemctl start bar-foo.service
|
|
'');
|
|
in
|
|
runCommand "test-writeStringReferencesToFile" { } ''
|
|
diff -U3 <(sort ${stringReferencesText}) <(sort ${sampleText})
|
|
touch $out
|
|
''
|