git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #126680 from roberth/empty

emptyFile, emptyDirectory: init

commitab11d2114ec6d6181748ca17cdc7f37866165324 authorRobert Hensing <roberth@users.noreply.github.com> dateSun 13 Jun 2021, 20:45 (5 years ago) parentf7865c8c38c5db
3 files changed+21−1
nixos/modules/services/web-servers/apache-httpd/default.nix+1−1 pkgs/build-support/trivial-builders.nix+16 pkgs/build-support/trivial-builders/test/sample.nix+4
nixos/modules/services/web-servers/apache-httpd/default.nix+1−1
@@ -202,7 +202,7 @@ let
202202 let
203203 documentRoot = if hostOpts.documentRoot != null
204204 then hostOpts.documentRoot
205− else pkgs.runCommand "empty" { preferLocalBuild = true; } "mkdir -p $out"
205+ else pkgs.emptyDirectory
206206 ;
207207
208208 mkLocations = locations: concatStringsSep "\n" (map (config: ''
pkgs/build-support/trivial-builders.nix+16
@@ -571,6 +571,22 @@ rec {
571571 installPhase = "cp -R ./ $out";
572572 };
573573
574+ /* An immutable file in the store with a length of 0 bytes. */
575+ emptyFile = runCommand "empty-file" {
576+ outputHashAlgo = "sha256";
577+ outputHashMode = "recursive";
578+ outputHash = "0ip26j2h11n1kgkz36rl4akv694yz65hr72q4kv4b3lxcbi65b3p";
579+ preferLocalBuild = true;
580+ } "touch $out";
581+
582+ /* An immutable empty directory in the store. */
583+ emptyDirectory = runCommand "empty-directory" {
584+ outputHashAlgo = "sha256";
585+ outputHashMode = "recursive";
586+ outputHash = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5";
587+ preferLocalBuild = true;
588+ } "mkdir $out";
589+
574590 /* Checks the command output contains the specified version
575591 *
576592 * Although simplistic, this test assures that the main program
pkgs/build-support/trivial-builders/test/sample.nix+4
@@ -12,4 +12,8 @@ in
1212 norefs = writeText "hi" "hello";
1313 helloRef = writeText "hi" "hello ${hello}";
1414 helloFigletRef = writeText "hi" "hello ${hello} ${figlet}";
15+ inherit (pkgs)
16+ emptyFile
17+ emptyDirectory
18+ ;
1519}