Merge pull request #126680 from roberth/empty

emptyFile, emptyDirectory: init
This commit is contained in:
Robert Hensing 2021-06-13 20:45:21 +02:00 committed by GitHub
commit ab11d2114e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View file

@ -202,7 +202,7 @@ let
let
documentRoot = if hostOpts.documentRoot != null
then hostOpts.documentRoot
else pkgs.runCommand "empty" { preferLocalBuild = true; } "mkdir -p $out"
else pkgs.emptyDirectory
;
mkLocations = locations: concatStringsSep "\n" (map (config: ''

View file

@ -571,6 +571,22 @@ rec {
installPhase = "cp -R ./ $out";
};
/* An immutable file in the store with a length of 0 bytes. */
emptyFile = runCommand "empty-file" {
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "0ip26j2h11n1kgkz36rl4akv694yz65hr72q4kv4b3lxcbi65b3p";
preferLocalBuild = true;
} "touch $out";
/* An immutable empty directory in the store. */
emptyDirectory = runCommand "empty-directory" {
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5";
preferLocalBuild = true;
} "mkdir $out";
/* Checks the command output contains the specified version
*
* Although simplistic, this test assures that the main program

View file

@ -12,4 +12,8 @@ in
norefs = writeText "hi" "hello";
helloRef = writeText "hi" "hello ${hello}";
helloFigletRef = writeText "hi" "hello ${hello} ${figlet}";
inherit (pkgs)
emptyFile
emptyDirectory
;
}