all: use runCommandLocal whenever appropriate

This saves a bunch of lookups to binary caches for trivial data
This commit is contained in:
Wout Mertens 2022-07-14 02:38:21 +02:00
parent a840710c12
commit a0cc2768ef
9 changed files with 19 additions and 18 deletions

View File

@ -187,7 +187,7 @@ in let
if b.pathExists (./. + "/external")
then ./.
else
pkgs.runCommand "dream2nix-full-src" {} ''
pkgs.runCommandLocal "dream2nix-full-src" {} ''
cp -r ${./.} $out
chmod +w $out
mkdir $out/external

View File

@ -5,7 +5,7 @@
outputs = {
fetchurl,
runCommand,
runCommandLocal,
utils,
...
}: {
@ -29,7 +29,7 @@
name = "download-${pname}-${version}";
};
in
runCommand "unpack-${pname}-${version}" {}
runCommandLocal "unpack-${pname}-${version}" {}
''
mkdir -p $out
tar --strip-components 1 -xzf ${fetched} -C $out

View File

@ -39,7 +39,7 @@ in {
} @ args: let
b = builtins;
all-cabal-hashes = pkgs.runCommand "all-cabal-hashes" {} ''
all-cabal-hashes = pkgs.runCommandLocal "all-cabal-hashes" {} ''
mkdir $out
cd $out
tar --strip-components 1 -xf ${pkgs.all-cabal-hashes}

View File

@ -79,7 +79,7 @@ in {
}: let
haskellUtils = import ./utils.nix {inherit dlib lib pkgs;};
all-cabal-hashes = let
all-cabal-hashes' = pkgs.runCommand "all-cabal-hashes" {} ''
all-cabal-hashes' = pkgs.runCommandLocal "all-cabal-hashes" {} ''
mkdir $out
cd $out
tar --strip-components 1 -xf ${pkgs.all-cabal-hashes}

View File

@ -10,7 +10,7 @@
sha256 = "1qc703yg0babixi6wshn5wm2kgl5y1drcswgszh4xxzbrwkk9sv7";
});
in rec {
all-cabal-hashes = pkgs.runCommand "all-cabal-hashes" {} ''
all-cabal-hashes = pkgs.runCommandLocal "all-cabal-hashes" {} ''
mkdir $out
cd $out
tar --strip-components 1 -xf ${pkgs.all-cabal-hashes}
@ -22,7 +22,7 @@ in rec {
# parse cabal file via IFD
fromCabal = file: name: let
file' = l.path {path = file;};
jsonFile = pkgs.runCommand "${name}.cabal.json" {} ''
jsonFile = pkgs.runCommandLocal "${name}.cabal.json" {} ''
${cabal2json}/bin/cabal2json ${file'} > $out
'';
in
@ -31,7 +31,7 @@ in rec {
# fromYaml IFD implementation
fromYaml = file: let
file' = l.path {path = file;};
jsonFile = pkgs.runCommand "yaml.json" {} ''
jsonFile = pkgs.runCommandLocal "yaml.json" {} ''
${pkgs.yaml2json}/bin/yaml2json < ${file'} > $out
'';
in
@ -54,7 +54,7 @@ in rec {
fi
'';
in
pkgs.runCommand "cabal-json-files" {}
pkgs.runCommandLocal "cabal-json-files" {}
(l.concatStringsSep "\n"
(l.map (c: convertOne c.name c.version) candidates));

View File

@ -8,7 +8,7 @@
mkShell,
pkgs,
python3,
runCommand,
runCommandLocal,
stdenv,
writeText,
...
@ -49,7 +49,7 @@
pkgs."nodejs-${builtins.toString nodejsVersion}_x"
or (throw "Could not find nodejs version '${nodejsVersion}' in pkgs");
nodeSources = runCommand "node-sources" {} ''
nodeSources = runCommandLocal "node-sources" {} ''
tar --no-same-owner --no-same-permissions -xf ${nodejs.src}
mv node-* $out
'';
@ -171,7 +171,7 @@
# Derivation building the ./node_modules directory in isolation.
# This is used for the devShell of the current package.
# We do not want to build the full package for the devShell.
nodeModulesDir = pkgs.runCommand "node_modules-${pname}" {} ''
nodeModulesDir = pkgs.runCommandLocal "node_modules-${pname}" {} ''
# symlink direct dependencies to ./node_modules
mkdir $out
${l.concatStringsSep "\n" (

View File

@ -85,7 +85,7 @@ in rec {
${l.optionalString isGit "printf '{\"files\":{},\"package\":null}' > \"$out/${source.name}/.cargo-checksum.json\""}
'';
in
pkgs.runCommand "vendor" {} ''
pkgs.runCommandLocal "vendor" {} ''
mkdir -p $out
${

View File

@ -10,7 +10,7 @@
nix,
pkgs,
python3,
runCommand,
runCommandLocal,
stdenv,
writeScript,
writeScriptBin,
@ -72,13 +72,13 @@ in
inherit (dreamLockUtils) readDreamLock;
toDrv = path: runCommand "some-drv" {} "cp -r ${path} $out";
toDrv = path: runCommandLocal "some-drv" {} "cp -r ${path} $out";
toTOML = import ./toTOML.nix {inherit lib;};
# hash the contents of a path via `nix hash path`
hashPath = algo: path: let
hashPath = runCommand "hash-${algo}" {} ''
hashPath = runCommandLocal "hash-${algo}" {} ''
${nix}/bin/nix --option experimental-features nix-command hash path ${path} | tr --delete '\n' > $out
'';
in
@ -86,7 +86,7 @@ in
# hash a file via `nix hash file`
hashFile = algo: path: let
hashFile = runCommand "hash-${algo}" {} ''
hashFile = runCommandLocal "hash-${algo}" {} ''
${nix}/bin/nix --option experimental-features nix-command hash file ${path} | tr --delete '\n' > $out
'';
in
@ -130,6 +130,7 @@ in
${coreutils}/bin/rm -rf $TMPDIR
'';
# TODO is this really needed? Seems to make builds slower, why not unpack + build?
extractSource = {
source,
dir ? "",

View File

@ -4,7 +4,7 @@
externalSources,
externalPaths,
}:
pkgs.runCommand "dream2nix-external-dir" {}
pkgs.runCommandLocal "dream2nix-external-dir" {}
(lib.concatStringsSep "\n"
(lib.mapAttrsToList
(inputName: paths: