From 5e0baa153e62f8a66462622474e5cd0ee4206b22 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sun, 8 Dec 2019 13:40:38 +0100 Subject: treewide: use `runCommandLocal` where applicable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `runCommandLocal` was added to nixpkgs in https://github.com/NixOS/nixpkgs/pull/74642 to speed up trivial `runCommand` derivations by always building them locally. We have a few places where that’s good to use. --- pkgs/profpatsch/default.nix | 8 +------- pkgs/profpatsch/display-infos/default.nix | 4 ++-- pkgs/profpatsch/nman/default.nix | 4 ++-- pkgs/profpatsch/sandbox.nix | 2 +- pkgs/profpatsch/testing/default.nix | 6 ++---- pkgs/taalo-build/default.nix | 4 ++-- 6 files changed, 10 insertions(+), 18 deletions(-) (limited to 'pkgs') diff --git a/pkgs/profpatsch/default.nix b/pkgs/profpatsch/default.nix index eba52312..5cd28182 100644 --- a/pkgs/profpatsch/default.nix +++ b/pkgs/profpatsch/default.nix @@ -54,16 +54,10 @@ let }; in import src { nixpkgs = pkgs; }; - runCommandLocal = name: args: cmd: - pkgs.runCommand name (args // { - preferLocalBuild = true; - allowSubstitutes = false; - }) cmd; - testing = import ./testing { inherit stdenv lib; inherit (runExeclineFns) runExecline; - inherit (pkgs) runCommand; + inherit (pkgs) runCommandLocal; bin = getBins pkgs.s6PortableUtils [ "s6-touch" "s6-echo" ]; }; diff --git a/pkgs/profpatsch/display-infos/default.nix b/pkgs/profpatsch/display-infos/default.nix index b626e844..b8bb2a07 100644 --- a/pkgs/profpatsch/display-infos/default.nix +++ b/pkgs/profpatsch/display-infos/default.nix @@ -1,4 +1,4 @@ -{ lib, runCommand, writeText, python3, libnotify, bc, sfttime }: +{ lib, runCommandLocal, writeText, python3, libnotify, bc, sfttime }: let name = "display-infos-0.1.0"; @@ -61,7 +61,7 @@ let ''; in - with lib; runCommand "display-infos" { + with lib; runCommandLocal "display-infos" { meta.description = "Script to display time & battery"; } '' substitute ${script} script \ diff --git a/pkgs/profpatsch/nman/default.nix b/pkgs/profpatsch/nman/default.nix index bbf4f00f..96699833 100644 --- a/pkgs/profpatsch/nman/default.nix +++ b/pkgs/profpatsch/nman/default.nix @@ -1,6 +1,6 @@ -{ lib, runCommandNoCC, go }: +{ lib, runCommand, go }: -runCommandNoCC "nman" { +runCommand "nman" { meta = with lib; { description = "Invoke manpage in temporary nix-shell"; license = licenses.gpl3; diff --git a/pkgs/profpatsch/sandbox.nix b/pkgs/profpatsch/sandbox.nix index b3107f5a..733cd956 100644 --- a/pkgs/profpatsch/sandbox.nix +++ b/pkgs/profpatsch/sandbox.nix @@ -26,7 +26,7 @@ let mount = "${pkgs.utillinux}/bin/mount"; unshare = "${pkgs.utillinux}/bin/unshare"; # this is the directory the sandbox runs under (in a separate mount namespace) - newroot = pkgs.runCommand "sandbox-root" {} ''mkdir "$out"''; + newroot = pkgs.runCommandLocal "sandbox-root" {} ''mkdir "$out"''; # this runs in a separate namespace, sets up a chroot root # and then chroots into the new root. sandbox = writeExecline "sandbox" {} (builtins.concatLists [ diff --git a/pkgs/profpatsch/testing/default.nix b/pkgs/profpatsch/testing/default.nix index 21f814e4..76d43ecc 100644 --- a/pkgs/profpatsch/testing/default.nix +++ b/pkgs/profpatsch/testing/default.nix @@ -1,4 +1,4 @@ -{ stdenv, runCommand, lib +{ stdenv, runCommandLocal, lib , runExecline, bin }: let @@ -15,13 +15,11 @@ let drvSeqL = drvDeps: drvOut: let drvOutOutputs = drvOut.outputs or ["out"]; in - runCommand drvOut.name { + runCommandLocal drvOut.name { # we inherit all attributes in order to replicate # the original derivation as much as possible outputs = drvOutOutputs; passthru = drvOut.drvAttrs; - preferLocalBuild = true; - allowSubstitutes = false; # depend on drvDeps (by putting it in builder context) inherit drvDeps; } diff --git a/pkgs/taalo-build/default.nix b/pkgs/taalo-build/default.nix index 383b974f..09ff41d4 100644 --- a/pkgs/taalo-build/default.nix +++ b/pkgs/taalo-build/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, runCommand, coreutils, nixUnstable }: +{ stdenv, lib, runCommandLocal, coreutils, nixUnstable }: let nixRemote = "ssh-ng://nix-remote-build@taalo.headcounter.org?compress=true"; @@ -16,7 +16,7 @@ let emitScript = content: "echo -n ${lib.escapeShellArg "#!${stdenv.shell}\nset -e\n${content}"}"; -in runCommand "taalo-build" {} '' +in runCommandLocal "taalo-build" {} '' mkdir -p "$out/bin" ${emitScript ('' -- cgit 1.4.1