1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-11 15:15:36 +00:00

Add a warning about using requireFile

This commit is contained in:
Eelco Dolstra 2016-09-27 14:10:36 +02:00
parent 75a1ec8a65
commit 030e20f759

View file

@ -97,12 +97,16 @@ rec {
done < graph done < graph
''; '';
# Quickly create a set of symlinks to derivations. # Quickly create a set of symlinks to derivations.
# entries is a list of attribute sets like { name = "name" ; path = "/nix/store/..."; } # entries is a list of attribute sets like { name = "name" ; path = "/nix/store/..."; }
linkFarm = name: entries: runCommand name {} ("mkdir -p $out; cd $out; \n" + linkFarm = name: entries: runCommand name {} ("mkdir -p $out; cd $out; \n" +
(lib.concatMapStrings (x: "ln -s '${x.path}' '${x.name}';\n") entries)); (lib.concatMapStrings (x: "ln -s '${x.path}' '${x.name}';\n") entries));
# Require file
# Print an error message if the file with the specified name and
# hash doesn't exist in the Nix store. Do not use this function; it
# produces packages that cannot be built automatically.
requireFile = { name ? null requireFile = { name ? null
, sha256 ? null , sha256 ? null
, sha1 ? null , sha1 ? null
@ -115,8 +119,8 @@ rec {
let msg = let msg =
if message != null then message if message != null then message
else '' else ''
Unfortunately, we may not download file ${name_} automatically. Unfortunately, we cannot download file ${name_} automatically.
Please, go to ${url} to download it yourself, and add it to the Nix store Please go to ${url} to download it yourself, and add it to the Nix store
using either using either
nix-store --add-fixed ${hashAlgo} ${name_} nix-store --add-fixed ${hashAlgo} ${name_}
or or
@ -143,6 +147,7 @@ rec {
''; '';
}; };
# Search in the environment if the same program exists with a set uid or # Search in the environment if the same program exists with a set uid or
# set gid bit. If it exists, run the first program found, otherwise run # set gid bit. If it exists, run the first program found, otherwise run
# the default binary. # the default binary.
@ -168,12 +173,14 @@ rec {
exec ${bin} "$@" exec ${bin} "$@"
''; '';
# Copy a path to the Nix store. # Copy a path to the Nix store.
# Nix automatically copies files to the store before stringifying paths. # Nix automatically copies files to the store before stringifying paths.
# If you need the store path of a file, ${copyPathToStore <path>} can be # If you need the store path of a file, ${copyPathToStore <path>} can be
# shortened to ${<path>}. # shortened to ${<path>}.
copyPathToStore = builtins.filterSource (p: t: true); copyPathToStore = builtins.filterSource (p: t: true);
# Copy a list of paths to the Nix store. # Copy a list of paths to the Nix store.
copyPathsToStore = builtins.map copyPathToStore; copyPathsToStore = builtins.map copyPathToStore;