Merge remote-tracking branch 'upstream/master' into parnell/fetchdocker

This commit is contained in:
Parnell Springmeyer
2018-02-13 17:28:45 -06:00
1975 changed files with 99886 additions and 64300 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ let
builder = ./pull.sh;
buildInputs = [ curl utillinux docker kmod dhcp cacert e2fsprogs ];
nativeBuildInputs = [ curl utillinux docker kmod dhcp cacert e2fsprogs ];
outputHashAlgo = "sha256";
outputHash = sha256;
+2 -1
View File
@@ -4,7 +4,8 @@
{ lib, writeText, inherit-local }:
rec {
withPackages = pkgs: let
withPackages = pkgs': let
pkgs = builtins.filter (x: x != null) pkgs';
extras = map (x: x.emacsBufferSetup pkgs) (builtins.filter (builtins.hasAttr "emacsBufferSetup") pkgs);
in writeText "dir-locals.el" ''
(require 'inherit-local "${inherit-local}/share/emacs/site-lisp/elpa/inherit-local-${inherit-local.version}/inherit-local.elc")
+1 -1
View File
@@ -40,7 +40,7 @@ packagesFun: # packages explicitly requested by the user
let
explicitRequires =
if builtins.isFunction packagesFun
if lib.isFunction packagesFun
then packagesFun self
else packagesFun;
in
+3 -4
View File
@@ -1,4 +1,4 @@
{ stdenv, lib, bower2nix, cacert }:
{ stdenvNoCC, lib, bower2nix, cacert }:
let
bowerVersion = version:
let
@@ -9,9 +9,8 @@ let
cleanName = name: lib.replaceStrings ["/" ":"] ["-" "-"] name;
fetchbower = name: version: target: outputHash: stdenv.mkDerivation {
fetchbower = name: version: target: outputHash: stdenvNoCC.mkDerivation {
name = "${cleanName name}-${bowerVersion version}";
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
buildCommand = ''
fetch-bower --quiet --out=$PWD/out "${name}" "${target}" "${version}"
# In some cases, the result of fetchBower is different depending
@@ -23,7 +22,7 @@ let
outputHashMode = "recursive";
outputHashAlgo = "sha256";
inherit outputHash;
buildInputs = [ bower2nix ];
nativeBuildInputs = [ bower2nix cacert ];
};
in fetchbower
+3 -3
View File
@@ -1,11 +1,11 @@
{ stdenv, bazaar }:
{ stdenvNoCC, bazaar }:
{ url, rev, sha256 }:
stdenv.mkDerivation {
stdenvNoCC.mkDerivation {
name = "bzr-export";
builder = ./builder.sh;
buildInputs = [ bazaar ];
nativeBuildInputs = [ bazaar ];
outputHashAlgo = "sha256";
outputHashMode = "recursive";
+3 -3
View File
@@ -3,14 +3,14 @@
# tag="<tagname>" (get version by tag name)
# If you don't specify neither one date="NOW" will be used (get latest)
{stdenv, cvs}:
{stdenvNoCC, cvs}:
{cvsRoot, module, tag ? null, date ? null, sha256}:
stdenv.mkDerivation {
stdenvNoCC.mkDerivation {
name = "cvs-export";
builder = ./builder.sh;
buildInputs = [cvs];
nativeBuildInputs = [cvs];
outputHashAlgo = "sha256";
outputHashMode = "recursive";
+3 -4
View File
@@ -1,15 +1,14 @@
{stdenv, darcs, nix, cacert}:
{stdenvNoCC, darcs, nix, cacert}:
{url, rev ? null, context ? null, md5 ? "", sha256 ? ""}:
if md5 != "" then
throw "fetchdarcs does not support md5 anymore, please use sha256"
else
stdenv.mkDerivation {
stdenvNoCC.mkDerivation {
name = "fetchdarcs";
NIX_SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
builder = ./builder.sh;
buildInputs = [darcs];
nativeBuildInputs = [cacert darcs];
outputHashAlgo = "sha256";
outputHashMode = "recursive";
+4 -4
View File
@@ -1,16 +1,16 @@
# Fetches a chicken egg from henrietta using `chicken-install -r'
# See: http://wiki.call-cc.org/chicken-projects/egg-index-4.html
{ stdenv, chicken }:
{ stdenvNoCC, chicken }:
{ name, version, md5 ? "", sha256 ? "" }:
if md5 != "" then
throw "fetchegg does not support md5 anymore, please use sha256"
else
stdenv.mkDerivation {
stdenvNoCC.mkDerivation {
name = "chicken-${name}-export";
builder = ./builder.sh;
buildInputs = [ chicken ];
nativeBuildInputs = [ chicken ];
outputHashAlgo = "sha256";
outputHashMode = "recursive";
@@ -20,6 +20,6 @@ stdenv.mkDerivation {
eggName = name;
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars;
}
+1 -1
View File
@@ -5,7 +5,7 @@
stdenv.mkDerivation {
name = "fossil-archive" + (if name != null then "-${name}" else "");
builder = ./builder.sh;
buildInputs = [fossil];
nativeBuildInputs = [fossil];
# Envvar docs are hard to find. A link for the future:
# https://www.fossil-scm.org/index.html/doc/trunk/www/env-opts.md
+5 -5
View File
@@ -1,6 +1,6 @@
{stdenv, git, cacert}: let
{stdenvNoCC, git, cacert}: let
urlToName = url: rev: let
inherit (stdenv.lib) removeSuffix splitString last;
inherit (stdenvNoCC.lib) removeSuffix splitString last;
base = last (splitString ":" (baseNameOf (removeSuffix "/" url)));
matched = builtins.match "(.*).git" base;
@@ -48,11 +48,11 @@ assert deepClone -> leaveDotGit;
if md5 != "" then
throw "fetchgit does not support md5 anymore, please use sha256"
else
stdenv.mkDerivation {
stdenvNoCC.mkDerivation {
inherit name;
builder = ./builder.sh;
fetcher = "${./nix-prefetch-git}"; # This must be a string to ensure it's called with bash.
buildInputs = [git];
nativeBuildInputs = [git];
outputHashAlgo = "sha256";
outputHashMode = "recursive";
@@ -62,7 +62,7 @@ stdenv.mkDerivation {
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars ++ [
impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND" "SOCKS_SERVER"
];
+1 -1
View File
@@ -184,7 +184,7 @@ init_submodules(){
local url
# checkout each submodule
hash=$(echo "$l" | awk '{print substr($1,2)}')
hash=$(echo "$l" | awk '{print $1}' | tr -d '-')
dir=$(echo "$l" | awk '{print $2}')
name=$(
git config -f .gitmodules --get-regexp submodule\..*\.path |
+1 -1
View File
@@ -17,7 +17,7 @@
in builtins.toString sshConfigFile}'';
ssh-wrapped = runCommand "fetchgit-ssh" {
buildInputs = [ makeWrapper ];
nativeBuildInputs = [ makeWrapper ];
} ''
mkdir -p $out/bin
makeWrapper ${openssh}/bin/ssh $out/bin/ssh --prefix PATH : "$out/bin" --add-flags "-F ${config}" "$@"
+3 -5
View File
@@ -1,12 +1,12 @@
{ stdenv, gx, gx-go, go, cacert }:
{ stdenvNoCC, gx, gx-go, go, cacert }:
{ name, src, sha256 }:
stdenv.mkDerivation {
stdenvNoCC.mkDerivation {
name = "${name}-gxdeps";
inherit src;
buildInputs = [ go gx gx-go ];
nativeBuildInputs = [ cacert go gx gx-go ];
outputHashAlgo = "sha256";
outputHashMode = "recursive";
@@ -14,8 +14,6 @@ stdenv.mkDerivation {
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
NIX_SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
buildPhase = ''
export GOPATH=$(pwd)/vendor
mkdir -p vendor
+4 -4
View File
@@ -1,15 +1,15 @@
{stdenv, mercurial, nix}: {name ? null, url, rev ? null, md5 ? null, sha256 ? null, fetchSubrepos ? false}:
{stdenvNoCC, mercurial, nix}: {name ? null, url, rev ? null, md5 ? null, sha256 ? null, fetchSubrepos ? false}:
if md5 != null then
throw "fetchhg does not support md5 anymore, please use sha256"
else
# TODO: statically check if mercurial as the https support if the url starts woth https.
stdenv.mkDerivation {
stdenvNoCC.mkDerivation {
name = "hg-archive" + (if name != null then "-${name}" else "");
builder = ./builder.sh;
buildInputs = [mercurial];
nativeBuildInputs = [mercurial];
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars;
subrepoClause = if fetchSubrepos then "S" else "";
+1 -1
View File
@@ -28,7 +28,7 @@ in
if (!hasHash) then throw "Specify sha for fetchipfs fixed-output derivation" else stdenv.mkDerivation {
name = ipfs;
builder = ./builder.sh;
buildInputs = [ curl ];
nativeBuildInputs = [ curl ];
# New-style output content requirements.
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
+3 -3
View File
@@ -1,5 +1,5 @@
# You can specify some extra mirrors and a cache DB via options
{stdenv, monotone, defaultDBMirrors ? [], cacheDB ? "./mtn-checkout.db"}:
{stdenvNoCC, monotone, defaultDBMirrors ? [], cacheDB ? "./mtn-checkout.db"}:
# dbs is a list of strings
# each is an url for sync
@@ -8,7 +8,7 @@
{name ? "mtn-checkout", dbs ? [], sha256
, selector ? "h:" + branch, branch}:
stdenv.mkDerivation {
stdenvNoCC.mkDerivation {
builder = ./builder.sh;
nativeBuildInputs = [monotone];
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
dbs = defaultDBMirrors ++ dbs;
inherit branch cacheDB name selector;
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars;
}
+1 -1
View File
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, buildDotnetPackage, unzip }:
{ stdenvNoCC, fetchurl, buildDotnetPackage, unzip }:
attrs @
{ baseName
+5 -5
View File
@@ -5,7 +5,7 @@
# stripLen acts as the -p parameter when applying a patch.
{ lib, fetchurl, patchutils }:
{ stripLen ? 0, addPrefixes ? false, excludes ? [], ... }@args:
{ stripLen ? 0, extraPrefix ? null, excludes ? [], ... }@args:
fetchurl ({
postFetch = ''
@@ -16,9 +16,9 @@ fetchurl ({
"${patchutils}/bin/filterdiff" \
--include={} \
--strip=${toString stripLen} \
${lib.optionalString addPrefixes ''
--addoldprefix=a/ \
--addnewprefix=b/ \
${lib.optionalString (extraPrefix != null) ''
--addoldprefix=a/${extraPrefix} \
--addnewprefix=b/${extraPrefix} \
''} \
--clean "$out" > "$tmpfile"
${patchutils}/bin/filterdiff \
@@ -27,4 +27,4 @@ fetchurl ({
"$tmpfile" > "$out"
${args.postFetch or ""}
'';
} // builtins.removeAttrs args ["stripLen" "addPrefixes" "excludes" "postFetch"])
} // builtins.removeAttrs args ["stripLen" "extraPrefix" "excludes" "postFetch"])
@@ -1,4 +1,4 @@
{ stdenv, gitRepo, cacert, copyPathsToStore }:
{ stdenvNoCC, gitRepo, cacert, copyPathsToStore }:
{ name, manifest, rev ? "HEAD", sha256
# Optional parameters:
@@ -9,7 +9,7 @@
assert repoRepoRev != "" -> repoRepoURL != "";
assert createMirror -> !useArchive;
with stdenv.lib;
with stdenvNoCC.lib;
let
extraRepoInitFlags = [
@@ -28,7 +28,7 @@ let
local_manifests = copyPathsToStore localManifests;
in stdenv.mkDerivation {
in stdenvNoCC.mkDerivation {
inherit name;
inherit cacert manifest rev repoRepoURL repoRepoRev referenceDir; # TODO
@@ -44,7 +44,7 @@ in stdenv.mkDerivation {
"GIT_PROXY_COMMAND" "SOCKS_SERVER"
];
buildInputs = [ gitRepo cacert ];
nativeBuildInputs = [ gitRepo cacert ];
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
+3 -3
View File
@@ -1,4 +1,4 @@
{ stdenv, runCommand, awscli }:
{ stdenvNoCC, runCommand, awscli }:
{ s3url
, sha256
@@ -10,13 +10,13 @@
}:
let
credentialAttrs = stdenv.lib.optionalAttrs (credentials != null) {
credentialAttrs = stdenvNoCC.lib.optionalAttrs (credentials != null) {
AWS_ACCESS_KEY_ID = credentials.access_key_id;
AWS_SECRET_ACCESS_KEY = credentials.secret_access_key;
AWS_SESSION_TOKEN = credentials.session_token ? null;
};
in runCommand "foo" ({
buildInputs = [ awscli ];
nativeBuildInputs = [ awscli ];
outputHashAlgo = "sha256";
outputHash = sha256;
outputHashMode = if recursiveHash then "recursive" else "flat";
+5 -5
View File
@@ -1,9 +1,9 @@
{stdenv, subversion, glibcLocales, sshSupport ? false, openssh ? null}:
{stdenvNoCC, subversion, glibcLocales, sshSupport ? false, openssh ? null}:
{url, rev ? "HEAD", md5 ? "", sha256 ? "",
ignoreExternals ? false, ignoreKeywords ? false, name ? null}:
let
repoName = with stdenv.lib;
repoName = with stdenvNoCC.lib;
let
fst = head;
snd = l: head (tail l);
@@ -28,10 +28,10 @@ in
if md5 != "" then
throw "fetchsvn does not support md5 anymore, please use sha256"
else
stdenv.mkDerivation {
stdenvNoCC.mkDerivation {
name = name_;
builder = ./builder.sh;
buildInputs = [ subversion glibcLocales ];
nativeBuildInputs = [ subversion glibcLocales ];
outputHashAlgo = "sha256";
outputHashMode = "recursive";
@@ -39,6 +39,6 @@ stdenv.mkDerivation {
inherit url rev sshSupport openssh ignoreExternals ignoreKeywords;
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars;
preferLocalBuild = true;
}
+3 -3
View File
@@ -1,14 +1,14 @@
{stdenv, subversion, sshSupport ? false, openssh ? null, expect}:
{stdenvNoCC, subversion, sshSupport ? false, openssh ? null, expect}:
{username, password, url, rev ? "HEAD", md5 ? "", sha256 ? ""}:
if md5 != "" then
throw "fetchsvnssh does not support md5 anymore, please use sha256"
else
stdenv.mkDerivation {
stdenvNoCC.mkDerivation {
name = "svn-export-ssh";
builder = ./builder.sh;
buildInputs = [subversion expect];
nativeBuildInputs = [subversion expect];
outputHashAlgo = "sha256";
outputHashMode = "recursive";
+6 -6
View File
@@ -1,4 +1,4 @@
{ stdenv, curl }: # Note that `curl' may be `null', in case of the native stdenv.
{ stdenvNoCC, curl }: # Note that `curl' may be `null', in case of the native stdenvNoCC.
let
@@ -10,7 +10,7 @@ let
# resulting store derivations (.drv files) much smaller, which in
# turn makes nix-env/nix-instantiate faster.
mirrorsFile =
stdenv.mkDerivation ({
stdenvNoCC.mkDerivation ({
name = "mirrors-list";
builder = ./write-mirror-list.sh;
preferLocalBuild = true;
@@ -20,7 +20,7 @@ let
# "gnu", etc.).
sites = builtins.attrNames mirrors;
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars ++ [
impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars ++ [
# This variable allows the user to pass additional options to curl
"NIX_CURL_FLAGS"
@@ -103,8 +103,8 @@ let
in
if md5 != "" then throw "fetchurl does not support md5 anymore, please use sha256 or sha512"
else if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${stdenv.lib.concatStringsSep ", " urls_}"
else stdenv.mkDerivation {
else if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${stdenvNoCC.lib.concatStringsSep ", " urls_}"
else stdenvNoCC.mkDerivation {
name =
if showURLs then "urls"
else if name != "" then name
@@ -112,7 +112,7 @@ else stdenv.mkDerivation {
builder = ./builder.sh;
buildInputs = [ curl ];
nativeBuildInputs = [ curl ];
urls = urls_;
+9 -2
View File
@@ -291,15 +291,22 @@ let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
mkdir -p $out/bin
cp -P target/bin/* $out/bin # */
fi
runHook postInstall
'';
in
crate_: lib.makeOverridable ({ rust, release, verbose, features, buildInputs, crateOverrides }:
let crate = crate_ // (lib.attrByPath [ crate_.crateName ] (attr: {}) crateOverrides crate_);
processedAttrs = [
"src" "buildInputs" "crateBin" "crateLib" "libName" "libPath"
"buildDependencies" "dependencies" "features"
"crateName" "version" "build" "authors" "colors"
];
extraDerivationAttrs = lib.filterAttrs (n: v: ! lib.elem n processedAttrs) crate;
buildInputs_ = buildInputs;
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (rec {
inherit (crate) crateName;
@@ -372,7 +379,7 @@ stdenv.mkDerivation rec {
};
installPhase = installCrate crateName;
}) {
} // extraDerivationAttrs)) {
rust = rustc;
release = true;
verbose = true;
-34
View File
@@ -1,34 +0,0 @@
{ fetchurl, stdenv }:
let
inherit (stdenv) system;
version = "0.1.12";
hashes = {
x86_64-linux = "1hxlavcxy374yypfamlkygjg662lhll8j434qcvdawkvlidg5ii5";
x86_64-darwin = "1jkvhh710gwjnnjx59kaplx2ncfvkx9agfa76rr94sbjqq4igddm";
};
hash = hashes. ${system} or badSystem;
badSystem = throw "missing bootstrap hash for platform ${system}";
platforms = {
x86_64-linux = "x86_64-unknown-linux-musl";
x86_64-darwin = "x86_64-apple-darwin";
};
platform = platforms . ${system} or badSystem;
in stdenv.mkDerivation {
name = "cargo-vendor-${version}";
src = fetchurl {
url = "https://github.com/alexcrichton/cargo-vendor/releases/download/${version}/cargo-vendor-${version}-${platform}.tar.gz";
sha256 = hash;
};
phases = "unpackPhase installPhase";
installPhase = ''
install -Dm755 cargo-vendor $out/bin/cargo-vendor
'';
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,10 @@
{ callPackage, fetchFromGitHub }:
(callPackage ./cargo-vendor.nix {}).cargo_vendor_0_1_13.overrideAttrs (attrs: {
src = fetchFromGitHub {
owner = "alexcrichton";
repo = "cargo-vendor";
rev = "0.1.13";
sha256 = "0ljh2d65zpxp26a95b3czy5ai2z2dm87x7ndfdc1s0v1fsy69kn4";
};
})
File diff suppressed because it is too large Load Diff
@@ -1,10 +1,72 @@
{ pkgconfig, sqlite, openssl, ... }:
{ stdenv, pkgconfig, curl, darwin, libiconv, libgit2, libssh2,
openssl, sqlite, zlib, dbus_libs, dbus_glib, gdk_pixbuf, cairo, python3,
libsodium, postgresql, ... }:
let
inherit (darwin.apple_sdk.frameworks) CoreFoundation;
in
{
cargo = attrs: {
buildInputs = [ openssl zlib curl ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation libiconv ];
# TODO: buildRustCrate seems to use incorrect default inference
crateBin = [ { name = "cargo"; path = "src/bin/cargo.rs"; } ];
};
cargo-vendor = attrs: {
buildInputs = [ openssl zlib curl ];
# TODO: this defaults to cargo_vendor; needs to be cargo-vendor to
# be considered a cargo subcommand.
crateBin = [ { name = "cargo-vendor"; path = "src/main.rs"; } ];
};
curl-sys = attrs: {
buildInputs = [ pkgconfig curl ];
};
libgit2-sys = attrs: {
LIBGIT2_SYS_USE_PKG_CONFIG = true;
buildInputs = [ pkgconfig openssl zlib libgit2 ];
};
libsqlite3-sys = attrs: {
buildInputs = [ pkgconfig sqlite ];
};
libssh2-sys = attrs: {
buildInputs = [ pkgconfig openssl zlib libssh2 ];
};
openssl = attrs: {
buildInputs = [ openssl ];
};
openssl-sys = attrs: {
buildInputs = [ pkgconfig openssl ];
};
dbus = attrs: {
buildInputs = [ pkgconfig dbus_libs ];
};
libdbus-sys = attrs: {
buildInputs = [ pkgconfig dbus_libs ];
};
gobject-sys = attrs: {
buildInputs = [ dbus_glib ];
};
gio-sys = attrs: {
buildInputs = [ dbus_glib ];
};
gdk-pixbuf-sys = attrs: {
buildInputs = [ dbus_glib ];
};
gdk-pixbuf = attrs: {
buildInputs = [ gdk_pixbuf ];
};
cairo-rs = attrs: {
buildInputs = [ cairo ];
};
xcb = attrs: {
buildInputs = [ python3 ];
};
thrussh-libsodium = attrs: {
buildInputs = [ pkgconfig libsodium ];
};
pq-sys = attr: {
buildInputs = [ pkgconfig postgresql ];
};
}
+3 -8
View File
@@ -1,11 +1,7 @@
{ fetchurl, stdenv, path, cacert, git, rust }:
{ callPackage, fetchurl, stdenv, path, cacert, git, rust, cargo-vendor }:
let
cargoVendor = import ./cargo-vendor.nix {
inherit fetchurl stdenv;
};
fetchcargo = import ./fetchcargo.nix {
inherit stdenv cacert git rust cargoVendor;
inherit stdenv cacert git rust cargo-vendor;
};
in
{ name, cargoSha256
@@ -32,7 +28,7 @@ in stdenv.mkDerivation (args // {
patchRegistryDeps = ./patch-registry-deps;
buildInputs = [ git rust.cargo rust.rustc ] ++ buildInputs;
buildInputs = [ cacert git rust.cargo rust.rustc ] ++ buildInputs;
configurePhase = args.configurePhase or ''
runHook preConfigure
@@ -60,7 +56,6 @@ in stdenv.mkDerivation (args // {
unset cargoDepsCopy
export RUST_LOG=${logLevel}
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
'' + (args.postUnpack or "");
buildPhase = with builtins; args.buildPhase or ''
+2 -3
View File
@@ -1,8 +1,8 @@
{ stdenv, cacert, git, rust, cargoVendor }:
{ stdenv, cacert, git, rust, cargo-vendor }:
{ name ? "cargo-deps", src, srcs, sourceRoot, sha256, cargoUpdateHook ? "" }:
stdenv.mkDerivation {
name = "${name}-vendor";
buildInputs = [ cacert cargoVendor git rust.cargo ];
nativeBuildInputs = [ cacert cargo-vendor git rust.cargo ];
inherit src srcs sourceRoot;
phases = "unpackPhase installPhase";
@@ -19,7 +19,6 @@ stdenv.mkDerivation {
exit 1
fi
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
cargo vendor
@@ -0,0 +1,14 @@
# | Discard the context of a string while ensuring that expected path
# validity invariants hold.
#
# This relies on import-from-derivation, but it is only useful in
# contexts where the string is going to be used in an
# import-from-derivation anyway.
#
# safeDiscardStringContext : String → String
{ writeText }: s:
builtins.seq
(import (writeText
"discard.nix"
"${builtins.substring 0 0 s}null\n"))
(builtins.unsafeDiscardStringContext s)
@@ -0,0 +1,174 @@
declare -a autoPatchelfLibs
gatherLibraries() {
autoPatchelfLibs+=("$1/lib")
}
addEnvHooks "$targetOffset" gatherLibraries
isExecutable() {
[ "$(file -b -N --mime-type "$1")" = application/x-executable ]
}
findElfs() {
find "$1" -type f -exec "$SHELL" -c '
while [ -n "$1" ]; do
mimeType="$(file -b -N --mime-type "$1")"
if [ "$mimeType" = application/x-executable \
-o "$mimeType" = application/x-sharedlib ]; then
echo "$1"
fi
shift
done
' -- {} +
}
# We cache dependencies so that we don't need to search through all of them on
# every consecutive call to findDependency.
declare -a cachedDependencies
addToDepCache() {
local existing
for existing in "${cachedDependencies[@]}"; do
if [ "$existing" = "$1" ]; then return; fi
done
cachedDependencies+=("$1")
}
declare -gi depCacheInitialised=0
declare -gi doneRecursiveSearch=0
declare -g foundDependency
getDepsFromSo() {
ldd "$1" 2> /dev/null | sed -n -e 's/[^=]*=> *\(.\+\) \+([^)]*)$/\1/p'
}
populateCacheWithRecursiveDeps() {
local so found foundso
for so in "${cachedDependencies[@]}"; do
for found in $(getDepsFromSo "$so"); do
local libdir="${found%/*}"
local base="${found##*/}"
local soname="${base%.so*}"
for foundso in "${found%/*}/$soname".so*; do
addToDepCache "$foundso"
done
done
done
}
getSoArch() {
objdump -f "$1" | sed -ne 's/^architecture: *\([^,]\+\).*/\1/p'
}
# NOTE: If you want to use this function outside of the autoPatchelf function,
# keep in mind that the dependency cache is only valid inside the subshell
# spawned by the autoPatchelf function, so invoking this directly will possibly
# rebuild the dependency cache. See the autoPatchelf function below for more
# information.
findDependency() {
local filename="$1"
local arch="$2"
local lib dep
if [ $depCacheInitialised -eq 0 ]; then
for lib in "${autoPatchelfLibs[@]}"; do
for so in "$lib/"*.so*; do addToDepCache "$so"; done
done
depCacheInitialised=1
fi
for dep in "${cachedDependencies[@]}"; do
if [ "$filename" = "${dep##*/}" ]; then
if [ "$(getSoArch "$dep")" = "$arch" ]; then
foundDependency="$dep"
return 0
fi
fi
done
# Populate the dependency cache with recursive dependencies *only* if we
# didn't find the right dependency so far and afterwards run findDependency
# again, but this time with $doneRecursiveSearch set to 1 so that it won't
# recurse again (and thus infinitely).
if [ $doneRecursiveSearch -eq 0 ]; then
populateCacheWithRecursiveDeps
doneRecursiveSearch=1
findDependency "$filename" "$arch" || return 1
return 0
fi
return 1
}
autoPatchelfFile() {
local dep rpath="" toPatch="$1"
local interpreter="$(< "$NIX_CC/nix-support/dynamic-linker")"
if isExecutable "$toPatch"; then
patchelf --set-interpreter "$interpreter" "$toPatch"
if [ -n "$runtimeDependencies" ]; then
for dep in $runtimeDependencies; do
rpath="$rpath${rpath:+:}$dep/lib"
done
fi
fi
echo "searching for dependencies of $toPatch" >&2
# We're going to find all dependencies based on ldd output, so we need to
# clear the RPATH first.
patchelf --remove-rpath "$toPatch"
local missing="$(
ldd "$toPatch" 2> /dev/null | \
sed -n -e 's/^[\t ]*\([^ ]\+\) => not found.*/\1/p'
)"
# This ensures that we get the output of all missing dependencies instead
# of failing at the first one, because it's more useful when working on a
# new package where you don't yet know its dependencies.
local -i depNotFound=0
for dep in $missing; do
echo -n " $dep -> " >&2
if findDependency "$dep" "$(getSoArch "$toPatch")"; then
rpath="$rpath${rpath:+:}${foundDependency%/*}"
echo "found: $foundDependency" >&2
else
echo "not found!" >&2
depNotFound=1
fi
done
# This makes sure the builder fails if we didn't find a dependency, because
# the stdenv setup script is run with set -e. The actual error is emitted
# earlier in the previous loop.
[ $depNotFound -eq 0 ]
if [ -n "$rpath" ]; then
echo "setting RPATH to: $rpath" >&2
patchelf --set-rpath "$rpath" "$toPatch"
fi
}
autoPatchelf() {
echo "automatically fixing dependencies for ELF files" >&2
# Add all shared objects of the current output path to the start of
# cachedDependencies so that it's choosen first in findDependency.
cachedDependencies+=(
$(find "$prefix" \! -type d \( -name '*.so' -o -name '*.so.*' \))
)
local elffile
# Here we actually have a subshell, which also means that
# $cachedDependencies is final at this point, so whenever we want to run
# findDependency outside of this, the dependency cache needs to be rebuilt
# from scratch, so keep this in mind if you want to run findDependency
# outside of this function.
findElfs "$prefix" | while read -r elffile; do
autoPatchelfFile "$elffile"
done
}
fixupOutputHooks+=(autoPatchelf)
@@ -0,0 +1,11 @@
unpackPhase="unpackGog"
unpackGog() {
runHook preUnpackGog
innoextract --silent --extract --exclude-temp "${src}"
find . -depth -print -execdir rename -f 'y/A-Z/a-z/' '{}' \;
runHook postUnpackGog
}
@@ -54,7 +54,11 @@ patchShebangs() {
echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
# escape the escape chars so that sed doesn't interpret them
escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g')
# Preserve times, see: https://github.com/NixOS/nixpkgs/pull/33281
touch -r "$f" "$f.timestamp"
sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
touch -r "$f.timestamp" "$f"
rm "$f.timestamp"
fi
fi
done
+7 -8
View File
@@ -1,12 +1,14 @@
{ pkgs
, kernel ? pkgs.linux
, img ? "bzImage"
, img ? pkgs.stdenv.platform.kernelTarget
, storeDir ? builtins.storeDir
, rootModules ?
[ "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_balloon" "virtio_rng" "ext4" "unix" "9p" "9pnet_virtio" "rtc_cmos" ]
[ "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_balloon" "virtio_rng" "ext4" "unix" "9p" "9pnet_virtio" ]
++ pkgs.lib.optional (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) "rtc_cmos"
}:
with pkgs;
with import ../../../nixos/lib/qemu-flags.nix { inherit pkgs; };
rec {
@@ -21,8 +23,6 @@ rec {
patches = [ ../../../nixos/modules/virtualisation/azure-qemu-220-no-etc-install.patch ];
});
qemuProg = "${qemu}/bin/qemu-kvm";
modulesClosure = makeModulesClosure {
inherit kernel rootModules;
@@ -196,14 +196,13 @@ rec {
export PATH=/bin:/usr/bin:${coreutils}/bin
echo "Starting interactive shell..."
echo "(To run the original builder: \$origBuilder \$origArgs)"
exec ${busybox}/bin/setsid ${bashInteractive}/bin/bash < /dev/ttyS0 &> /dev/ttyS0
exec ${busybox}/bin/setsid ${bashInteractive}/bin/bash < /dev/${qemuSerialDevice} &> /dev/${qemuSerialDevice}
fi
'';
qemuCommandLinux = ''
${qemuProg} \
${lib.optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} \
${qemuBinary qemu} \
-nographic -no-reboot \
-device virtio-rng-pci \
-virtfs local,path=${storeDir},security_model=none,mount_tag=store \
@@ -211,7 +210,7 @@ rec {
''${diskImage:+-drive file=$diskImage,if=virtio,cache=unsafe,werror=report} \
-kernel ${kernel}/${img} \
-initrd ${initrd}/initrd \
-append "console=ttyS0 panic=1 command=${stage2Init} out=$out mountDisk=$mountDisk loglevel=4" \
-append "console=${qemuSerialDevice} panic=1 command=${stage2Init} out=$out mountDisk=$mountDisk loglevel=4" \
$QEMU_OPTS
'';
@@ -21,7 +21,6 @@ let
crossSystem = {
libc = "msvcrt";
platform = {};
openssl.system = "mingw64";
inherit arch;
config = "${arch}-w64-mingw32";
};