Compare commits
5 commits
main
...
isabelrose
Author | SHA1 | Date | |
---|---|---|---|
isabel roses | 256c245a65 | ||
isabel roses | b8af538578 | ||
isabel roses | 9bc38abb64 | ||
isabel roses | bbd2dbcfa7 | ||
isabel roses | 86dd914eb8 |
|
@ -1,55 +1,69 @@
|
||||||
{ lib
|
{
|
||||||
, stdenv
|
lib,
|
||||||
, fetchurl
|
stdenv,
|
||||||
, fetchpatch
|
fetchurl,
|
||||||
, autoreconfHook
|
fetchpatch,
|
||||||
, bash
|
autoreconfHook,
|
||||||
, buildPackages
|
bash,
|
||||||
, libtool
|
buildPackages,
|
||||||
, linuxHeaders
|
linuxHeaders,
|
||||||
, python3
|
python3,
|
||||||
, swig
|
swig,
|
||||||
|
pkgsCross,
|
||||||
|
|
||||||
# Enabling python support while cross compiling would be possible, but the
|
# Enabling python support while cross compiling would be possible, but the
|
||||||
# configure script tries executing python to gather info instead of relying on
|
# configure script tries executing python to gather info instead of relying on
|
||||||
# python3-config exclusively
|
# python3-config exclusively
|
||||||
, enablePython ? stdenv.hostPlatform == stdenv.buildPlatform,
|
enablePython ? stdenv.hostPlatform == stdenv.buildPlatform,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "audit";
|
pname = "audit";
|
||||||
version = "3.1.2";
|
version = "4.0";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://people.redhat.com/sgrubb/audit/audit-${finalAttrs.version}.tar.gz";
|
url = "https://people.redhat.com/sgrubb/audit/audit-${finalAttrs.version}.tar.gz";
|
||||||
hash = "sha256-wLF5LR8KiMbxgocQUJy7mHBZ/GhxLJdmnKkOrhA9KH0=";
|
hash = "sha256-v0ItQSard6kqTDrDneVHPyeNw941ck0lGKSMe+FdVNg=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
(fetchpatch {
|
||||||
|
name = "musl.patch";
|
||||||
|
url = "https://github.com/linux-audit/audit-userspace/commit/64cb48e1e5137b8a389c7528e611617a98389bc7.patch";
|
||||||
|
hash = "sha256-DN2F5w+2Llm80FZntH9dvdyT00pVBSgRu8DDFILyrlU=";
|
||||||
|
})
|
||||||
|
(fetchpatch {
|
||||||
|
name = "musl.patch";
|
||||||
|
url = "https://github.com/linux-audit/audit-userspace/commit/4192eb960388458c85d76e5e385cfeef48f02c79.patch";
|
||||||
|
hash = "sha256-G6CJ9nBJSsTyJ0qq14PVo+YdInAvLLQtXcR25Q8V5/4=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace bindings/swig/src/auditswig.i \
|
substituteInPlace bindings/swig/src/auditswig.i \
|
||||||
--replace "/usr/include/linux/audit.h" \
|
--replace-fail "/usr/include/linux/audit.h" \
|
||||||
"${linuxHeaders}/include/linux/audit.h"
|
"${linuxHeaders}/include/linux/audit.h"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "bin" "dev" "out" "man" ];
|
outputs = [
|
||||||
|
"bin"
|
||||||
|
"dev"
|
||||||
|
"out"
|
||||||
|
"man"
|
||||||
|
];
|
||||||
|
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
depsBuildBuild = [
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||||
buildPackages.stdenv.cc
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs =
|
||||||
autoreconfHook
|
[ autoreconfHook ]
|
||||||
]
|
|
||||||
++ lib.optionals enablePython [
|
++ lib.optionals enablePython [
|
||||||
python3
|
python3
|
||||||
swig
|
swig
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [ bash ];
|
||||||
bash
|
|
||||||
];
|
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
# z/OS plugin is not useful on Linux, and pulls in an extra openldap
|
# z/OS plugin is not useful on Linux, and pulls in an extra openldap
|
||||||
|
@ -62,6 +76,10 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
passthru.tests = {
|
||||||
|
musl = pkgsCross.musl64.audit;
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = "https://people.redhat.com/sgrubb/audit/";
|
homepage = "https://people.redhat.com/sgrubb/audit/";
|
||||||
description = "Audit Library";
|
description = "Audit Library";
|
||||||
|
|
|
@ -1,80 +1,76 @@
|
||||||
{ lib
|
{
|
||||||
, fetchFromGitHub
|
lib,
|
||||||
, version
|
fetchFromGitHub,
|
||||||
, suffix ? ""
|
version,
|
||||||
, hash ? null
|
suffix ? "",
|
||||||
, src ? fetchFromGitHub {
|
hash ? null,
|
||||||
|
src ? fetchFromGitHub {
|
||||||
owner = "lix-project";
|
owner = "lix-project";
|
||||||
repo = "lix";
|
repo = "lix";
|
||||||
rev = version;
|
rev = version;
|
||||||
inherit hash;
|
inherit hash;
|
||||||
}
|
},
|
||||||
, docCargoHash ? null
|
docCargoHash ? null,
|
||||||
, patches ? [ ]
|
docCargoLock ? null,
|
||||||
, maintainers ? lib.teams.lix.members
|
patches ? [ ],
|
||||||
,
|
maintainers ? lib.teams.lix.members,
|
||||||
}@args:
|
}@args:
|
||||||
assert (hash == null) -> (src != null);
|
assert (hash == null) -> (src != null);
|
||||||
{ stdenv
|
assert lib.assertMsg (docCargoHash != null || docCargoLock != null)
|
||||||
, meson
|
"Either `lix-doc`'s cargoHash using `docCargoHash` or `lix-doc`'s `cargoLock.lockFile` using `docCargoLock` must be set!";
|
||||||
, bash
|
let
|
||||||
, bison
|
isLegacyParser = lib.versionOlder version "2.91";
|
||||||
, boehmgc
|
in
|
||||||
, boost
|
{
|
||||||
, brotli
|
stdenv,
|
||||||
, busybox-sandbox-shell
|
meson,
|
||||||
, bzip2
|
bison,
|
||||||
, callPackage
|
boehmgc,
|
||||||
, coreutils
|
boost,
|
||||||
, curl
|
brotli,
|
||||||
, cmake
|
busybox-sandbox-shell,
|
||||||
, docbook_xsl_ns
|
bzip2,
|
||||||
, docbook5
|
callPackage,
|
||||||
, doxygen
|
curl,
|
||||||
, editline
|
cmake,
|
||||||
, flex
|
doxygen,
|
||||||
, git
|
editline,
|
||||||
, gnutar
|
flex,
|
||||||
, gtest
|
git,
|
||||||
, gzip
|
gtest,
|
||||||
, jq
|
jq,
|
||||||
, lib
|
lib,
|
||||||
, libarchive
|
libarchive,
|
||||||
, libcpuid
|
libcpuid,
|
||||||
, libgit2
|
libsodium,
|
||||||
, libsodium
|
lowdown,
|
||||||
, libxml2
|
lsof,
|
||||||
, libxslt
|
mercurial,
|
||||||
, lowdown
|
mdbook,
|
||||||
, lsof
|
mdbook-linkcheck,
|
||||||
, man
|
nlohmann_json,
|
||||||
, mercurial
|
ninja,
|
||||||
, mdbook
|
openssl,
|
||||||
, mdbook-linkcheck
|
toml11,
|
||||||
, nlohmann_json
|
pegtl,
|
||||||
, ninja
|
python3,
|
||||||
, openssl
|
pkg-config,
|
||||||
, toml11
|
rapidcheck,
|
||||||
, python3
|
Security,
|
||||||
, perl
|
sqlite,
|
||||||
, pkg-config
|
util-linuxMinimal,
|
||||||
, rapidcheck
|
xz,
|
||||||
, Security
|
# , nixosTests
|
||||||
, sqlite
|
enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform,
|
||||||
, util-linuxMinimal
|
enableStatic ? stdenv.hostPlatform.isStatic,
|
||||||
, xz
|
withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin),
|
||||||
# , nixosTests
|
aws-sdk-cpp,
|
||||||
, enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform
|
# RISC-V support in progress https://github.com/seccomp/libseccomp/pull/50
|
||||||
, enableStatic ? stdenv.hostPlatform.isStatic
|
withLibseccomp ? lib.meta.availableOn stdenv.hostPlatform libseccomp,
|
||||||
, withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin)
|
libseccomp,
|
||||||
, aws-sdk-cpp
|
confDir,
|
||||||
, # RISC-V support in progress https://github.com/seccomp/libseccomp/pull/50
|
stateDir,
|
||||||
withLibseccomp ? lib.meta.availableOn stdenv.hostPlatform libseccomp
|
storeDir,
|
||||||
, libseccomp
|
|
||||||
, confDir
|
|
||||||
, stateDir
|
|
||||||
, storeDir
|
|
||||||
,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
lix-doc = callPackage ./doc {
|
lix-doc = callPackage ./doc {
|
||||||
|
@ -105,14 +101,12 @@ let
|
||||||
nativeBuildInputs =
|
nativeBuildInputs =
|
||||||
[
|
[
|
||||||
pkg-config
|
pkg-config
|
||||||
bison
|
|
||||||
flex
|
flex
|
||||||
jq
|
jq
|
||||||
meson
|
meson
|
||||||
ninja
|
ninja
|
||||||
cmake
|
cmake
|
||||||
python3
|
python3
|
||||||
doxygen
|
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
git
|
git
|
||||||
|
@ -120,10 +114,12 @@ let
|
||||||
jq
|
jq
|
||||||
lsof
|
lsof
|
||||||
]
|
]
|
||||||
++ lib.optionals (enableDocumentation) [
|
++ lib.optionals isLegacyParser [ bison ]
|
||||||
|
++ lib.optionals enableDocumentation [
|
||||||
(lib.getBin lowdown)
|
(lib.getBin lowdown)
|
||||||
mdbook
|
mdbook
|
||||||
mdbook-linkcheck
|
mdbook-linkcheck
|
||||||
|
doxygen
|
||||||
]
|
]
|
||||||
++ lib.optionals stdenv.isLinux [ util-linuxMinimal ];
|
++ lib.optionals stdenv.isLinux [ util-linuxMinimal ];
|
||||||
|
|
||||||
|
@ -145,8 +141,9 @@ let
|
||||||
toml11
|
toml11
|
||||||
lix-doc
|
lix-doc
|
||||||
]
|
]
|
||||||
|
++ lib.optionals (!isLegacyParser) [ pegtl ]
|
||||||
++ lib.optionals stdenv.isDarwin [ Security ]
|
++ lib.optionals stdenv.isDarwin [ Security ]
|
||||||
++ lib.optionals (stdenv.isx86_64) [ libcpuid ]
|
++ lib.optionals stdenv.isx86_64 [ libcpuid ]
|
||||||
++ lib.optionals withLibseccomp [ libseccomp ]
|
++ lib.optionals withLibseccomp [ libseccomp ]
|
||||||
++ lib.optionals withAWS [ aws-sdk-cpp ];
|
++ lib.optionals withAWS [ aws-sdk-cpp ];
|
||||||
|
|
||||||
|
@ -156,7 +153,7 @@ let
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
patchShebangs --build tests
|
patchShebangs --build tests doc/manual
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preConfigure =
|
preConfigure =
|
||||||
|
@ -182,6 +179,7 @@ let
|
||||||
|
|
||||||
mesonFlags =
|
mesonFlags =
|
||||||
[
|
[
|
||||||
|
(lib.mesonBool "b_lto" true)
|
||||||
(lib.mesonEnable "gc" true)
|
(lib.mesonEnable "gc" true)
|
||||||
(lib.mesonBool "enable-tests" true)
|
(lib.mesonBool "enable-tests" true)
|
||||||
(lib.mesonBool "enable-docs" enableDocumentation)
|
(lib.mesonBool "enable-docs" enableDocumentation)
|
||||||
|
@ -203,10 +201,15 @@ let
|
||||||
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
|
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ninjaFlags = [ "-v" ];
|
||||||
|
|
||||||
postInstall =
|
postInstall =
|
||||||
''
|
lib.optionalString enableDocumentation ''
|
||||||
mkdir -p $doc/nix-support
|
mkdir -p $doc/nix-support
|
||||||
echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products
|
echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products
|
||||||
|
|
||||||
|
mkdir -p $devdoc/nix-support
|
||||||
|
echo "devdoc internal-api $devdoc/share/doc/nix/internal-api" >> $devdoc/nix-support/hydra-build-products
|
||||||
''
|
''
|
||||||
+ lib.optionalString stdenv.hostPlatform.isStatic ''
|
+ lib.optionalString stdenv.hostPlatform.isStatic ''
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
|
@ -222,14 +225,26 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
mesonCheckFlags = [ "--suite=check" ];
|
mesonCheckFlags = [
|
||||||
|
"--suite=check"
|
||||||
|
"--print-errorlogs"
|
||||||
|
];
|
||||||
checkInputs = [
|
checkInputs = [
|
||||||
gtest
|
gtest
|
||||||
rapidcheck
|
rapidcheck
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# This needs to run after _multioutDocs moves the docs to $doc
|
||||||
|
postFixup = ''
|
||||||
|
mkdir -p $devdoc/share/doc/nix
|
||||||
|
mv $doc/share/doc/nix/internal-api $devdoc/share/doc/nix
|
||||||
|
'';
|
||||||
|
|
||||||
doInstallCheck = true;
|
doInstallCheck = true;
|
||||||
mesonInstallCheckFlags = [ "--suite=installcheck" ];
|
mesonInstallCheckFlags = [
|
||||||
|
"--suite=installcheck"
|
||||||
|
"--print-errorlogs"
|
||||||
|
];
|
||||||
|
|
||||||
preInstallCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
preInstallCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||||
# socket path becomes too long otherwise
|
# socket path becomes too long otherwise
|
||||||
|
@ -262,7 +277,7 @@ let
|
||||||
# point 'nix edit' and ofborg at the file that defines the attribute,
|
# point 'nix edit' and ofborg at the file that defines the attribute,
|
||||||
# not this common file.
|
# not this common file.
|
||||||
pos = builtins.unsafeGetAttrPos "version" args;
|
pos = builtins.unsafeGetAttrPos "version" args;
|
||||||
meta = with lib; {
|
meta = {
|
||||||
description = "Powerful package manager that makes package management reliable and reproducible";
|
description = "Powerful package manager that makes package management reliable and reproducible";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
Lix (a fork of Nix) is a powerful package manager for Linux and other Unix systems that
|
Lix (a fork of Nix) is a powerful package manager for Linux and other Unix systems that
|
||||||
|
@ -272,10 +287,10 @@ let
|
||||||
environments.
|
environments.
|
||||||
'';
|
'';
|
||||||
homepage = "https://lix.systems";
|
homepage = "https://lix.systems";
|
||||||
license = licenses.lgpl21Plus;
|
license = lib.licenses.lgpl21Plus;
|
||||||
inherit maintainers;
|
inherit maintainers;
|
||||||
platforms = platforms.unix;
|
platforms = lib.platforms.unix;
|
||||||
outputsToInstall = [ "out" ] ++ optional enableDocumentation "man";
|
outputsToInstall = [ "out" ] ++ lib.optional enableDocumentation "man";
|
||||||
mainProgram = "nix";
|
mainProgram = "nix";
|
||||||
broken = enableStatic;
|
broken = enableStatic;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{ lib
|
{
|
||||||
, aws-sdk-cpp
|
lib,
|
||||||
, boehmgc
|
aws-sdk-cpp,
|
||||||
, callPackage
|
boehmgc,
|
||||||
, fetchFromGitHub
|
callPackage,
|
||||||
, Security
|
fetchFromGitHub,
|
||||||
, storeDir ? "/nix/store"
|
Security,
|
||||||
, stateDir ? "/nix/var"
|
storeDir ? "/nix/store",
|
||||||
, confDir ? "/etc"
|
stateDir ? "/nix/var",
|
||||||
, path
|
confDir ? "/etc",
|
||||||
,
|
path,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
boehmgc-nix_2_3 = boehmgc.override { enableLargeConfig = true; };
|
boehmgc-nix_2_3 = boehmgc.override { enableLargeConfig = true; };
|
||||||
|
@ -20,6 +20,9 @@ let
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
# Since Lix 2.91 does not use boost coroutines, it does not need boehmgc patches either.
|
||||||
|
needsBoehmgcPatches = version: lib.versionOlder version "2.91";
|
||||||
|
|
||||||
aws-sdk-cpp-nix =
|
aws-sdk-cpp-nix =
|
||||||
(aws-sdk-cpp.override {
|
(aws-sdk-cpp.override {
|
||||||
apis = [
|
apis = [
|
||||||
|
@ -42,19 +45,23 @@ let
|
||||||
stateDir
|
stateDir
|
||||||
confDir
|
confDir
|
||||||
;
|
;
|
||||||
boehmgc = boehmgc-nix;
|
boehmgc = if needsBoehmgcPatches args.version then boehmgc-nix else boehmgc-nix_2_3;
|
||||||
aws-sdk-cpp = aws-sdk-cpp-nix;
|
aws-sdk-cpp = aws-sdk-cpp-nix;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.makeExtensible (self: ({
|
lib.makeExtensible (self: {
|
||||||
lix_2_90 = (
|
lix_2_90 = common {
|
||||||
common {
|
version = "2.90.0";
|
||||||
version = "2.90-beta.1";
|
hash = "sha256-f8k+BezKdJfmE+k7zgBJiohtS3VkkriycdXYsKOm3sc=";
|
||||||
hash = "sha256-REWlo2RYHfJkxnmZTEJu3Cd/2VM+wjjpPy7Xi4BdDTQ=";
|
docCargoHash = "sha256-vSf9MyD2XzofZlbzsmh6NP69G+LiX72GX4Um9UJp3dc=";
|
||||||
docCargoHash = "sha256-oH248kR4Of0MhcY2DYxNX0A+/XJ3L+UuIpBKn3sJt54=";
|
};
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
latest = self.lix_2_90;
|
lix_2_91 = common {
|
||||||
stable = self.lix_2_90;
|
version = "2.91.0";
|
||||||
}))
|
hash = "sha256-Rosl9iA9MybF5Bud4BTAQ9adbY81aGmPfV8dDBGl34s=";
|
||||||
|
docCargoHash = "sha256-KOn1fXF7k7c/0e5ZCNZwt3YZmjL1oi5A2mhwxQWKaUo=";
|
||||||
|
};
|
||||||
|
|
||||||
|
latest = self.lix_2_91;
|
||||||
|
stable = self.lix_2_91;
|
||||||
|
})
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
{ ... }:
|
_: _: pkgs: _:
|
||||||
res: pkgs: super:
|
|
||||||
|
|
||||||
with pkgs;
|
with pkgs; {
|
||||||
{
|
lixVersions = recurseIntoAttrs (
|
||||||
lixVersions = recurseIntoAttrs (callPackage ./. {
|
callPackage ./. {
|
||||||
storeDir = config.nix.storeDir or "/nix/store";
|
storeDir = config.nix.storeDir or "/nix/store";
|
||||||
stateDir = config.nix.stateDir or "/nix/var";
|
stateDir = config.nix.stateDir or "/nix/var";
|
||||||
inherit (darwin.apple_sdk.frameworks) Security;
|
inherit (darwin.apple_sdk.frameworks) Security;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
lix = lixVersions.stable;
|
lix = lixVersions.stable;
|
||||||
|
|
||||||
|
|
38
pkgs/by-name/pe/pegtl/default.nix
Normal file
38
pkgs/by-name/pe/pegtl/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
cmake,
|
||||||
|
fetchFromGitHub,
|
||||||
|
lib,
|
||||||
|
ninja,
|
||||||
|
stdenv,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
version = "3.2.7";
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "pegtl";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "taocpp";
|
||||||
|
repo = "PEGTL";
|
||||||
|
rev = version;
|
||||||
|
hash = "sha256-IV5YNGE4EWVrmg2Sia/rcU8jCuiBynQGJM6n3DCWTQU=";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
cmake
|
||||||
|
ninja
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
homepage = "https://github.com/taocpp/pegtl";
|
||||||
|
description = "Parsing Expression Grammar Template Library";
|
||||||
|
longDescription = ''
|
||||||
|
Zero-dependency C++ header-only parser combinator library
|
||||||
|
for creating parsers according to a Parsing Expression Grammar (PEG).
|
||||||
|
'';
|
||||||
|
license = lib.licenses.boost;
|
||||||
|
maintainers = [ ];
|
||||||
|
platforms = lib.platforms.all;
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,44 +1,84 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
res: pkgs: super:
|
res: pkgs: super:
|
||||||
|
|
||||||
with pkgs;
|
with pkgs; {
|
||||||
{
|
|
||||||
pythonInterpreters = callPackage ./. { };
|
pythonInterpreters = callPackage ./. { };
|
||||||
inherit (pythonInterpreters) python27 python39 python310 python311 python312 python313 python3Minimal pypy27 pypy310 pypy39 rustpython;
|
inherit (pythonInterpreters)
|
||||||
|
python27
|
||||||
|
python39
|
||||||
|
python310
|
||||||
|
python311
|
||||||
|
python312
|
||||||
|
python313
|
||||||
|
python3Minimal
|
||||||
|
pypy27
|
||||||
|
pypy310
|
||||||
|
pypy39
|
||||||
|
rustpython
|
||||||
|
;
|
||||||
|
|
||||||
# List of extensions with overrides to apply to all Python package sets.
|
# List of extensions with overrides to apply to all Python package sets.
|
||||||
pythonPackagesExtensions = [ ];
|
pythonPackagesExtensions = [ ];
|
||||||
# Python package sets.
|
# Python package sets.
|
||||||
python27Packages = python27.pkgs // { __attrsFailEvaluation = true; };
|
python27Packages = python27.pkgs // {
|
||||||
python39Packages = python39.pkgs // { __attrsFailEvaluation = true; };
|
__attrsFailEvaluation = true;
|
||||||
python310Packages = python310.pkgs // { __attrsFailEvaluation = true; };
|
};
|
||||||
python311Packages = recurseIntoAttrs python311.pkgs // { pythonPackages = python311.pkgs // { __attrsFailEvaluation = true; }; };
|
python39Packages = python39.pkgs // {
|
||||||
python312Packages = recurseIntoAttrs python312.pkgs // { pythonPackages = python312.pkgs // { __attrsFailEvaluation = true; }; };
|
__attrsFailEvaluation = true;
|
||||||
python313Packages = python313.pkgs // { __attrsFailEvaluation = true; };
|
};
|
||||||
pypyPackages = pypy.pkgs // { __attrsFailEvaluation = true; };
|
python310Packages = python310.pkgs // {
|
||||||
pypy2Packages = pypy2.pkgs // { __attrsFailEvaluation = true; };
|
__attrsFailEvaluation = true;
|
||||||
pypy27Packages = pypy27.pkgs // { __attrsFailEvaluation = true; };
|
};
|
||||||
pypy3Packages = pypy3.pkgs // { __attrsFailEvaluation = true; };
|
python311Packages = recurseIntoAttrs python311.pkgs // {
|
||||||
pypy39Packages = pypy39.pkgs // { __attrsFailEvaluation = true; };
|
pythonPackages = python311.pkgs // {
|
||||||
pypy310Packages = pypy310.pkgs // { __attrsFailEvaluation = true; };
|
__attrsFailEvaluation = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
python312Packages = recurseIntoAttrs python312.pkgs // {
|
||||||
|
pythonPackages = python312.pkgs // {
|
||||||
|
__attrsFailEvaluation = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
python313Packages = python313.pkgs // {
|
||||||
|
__attrsFailEvaluation = true;
|
||||||
|
};
|
||||||
|
pypyPackages = pypy.pkgs // {
|
||||||
|
__attrsFailEvaluation = true;
|
||||||
|
};
|
||||||
|
pypy2Packages = pypy2.pkgs // {
|
||||||
|
__attrsFailEvaluation = true;
|
||||||
|
};
|
||||||
|
pypy27Packages = pypy27.pkgs // {
|
||||||
|
__attrsFailEvaluation = true;
|
||||||
|
};
|
||||||
|
pypy3Packages = pypy3.pkgs // {
|
||||||
|
__attrsFailEvaluation = true;
|
||||||
|
};
|
||||||
|
pypy39Packages = pypy39.pkgs // {
|
||||||
|
__attrsFailEvaluation = true;
|
||||||
|
};
|
||||||
|
pypy310Packages = pypy310.pkgs // {
|
||||||
|
__attrsFailEvaluation = true;
|
||||||
|
};
|
||||||
|
|
||||||
# Python interpreters. All standard library modules are included except for tkinter, which is
|
# Python interpreters. All standard library modules are included except for tkinter, which is
|
||||||
# available as `pythonPackages.tkinter` and can be used as any other Python package.
|
# available as `pythonPackages.tkinter` and can be used as any other Python package.
|
||||||
# When switching these sets, please update docs at ../../doc/languages-frameworks/python.md
|
# When switching these sets, please update docs at ../../doc/languages-frameworks/python.md
|
||||||
python2 = python27;
|
python2 = python27;
|
||||||
python3 = python311;
|
python3 = python312;
|
||||||
|
|
||||||
# pythonPackages further below, but assigned here because they need to be in sync
|
# pythonPackages further below, but assigned here because they need to be in sync
|
||||||
python2Packages = dontRecurseIntoAttrs python27Packages;
|
python2Packages = dontRecurseIntoAttrs python27Packages;
|
||||||
python3Packages = dontRecurseIntoAttrs python311Packages;
|
python3Packages = dontRecurseIntoAttrs python311Packages;
|
||||||
|
|
||||||
|
|
||||||
# Should eventually be moved inside Python interpreters.
|
# Should eventually be moved inside Python interpreters.
|
||||||
python-setup-hook = buildPackages.callPackage ./setup-hook.nix { };
|
python-setup-hook = buildPackages.callPackage ./setup-hook.nix { };
|
||||||
|
|
||||||
update-python-libraries = callPackage ./update-python-libraries { };
|
update-python-libraries = callPackage ./update-python-libraries { };
|
||||||
|
|
||||||
docutils = with python3Packages; toPythonApplication (
|
docutils =
|
||||||
|
with python3Packages;
|
||||||
|
toPythonApplication (
|
||||||
docutils.overridePythonAttrs (attrs: rec {
|
docutils.overridePythonAttrs (attrs: rec {
|
||||||
version = "0.20.1";
|
version = "0.20.1";
|
||||||
src = attrs.src.override {
|
src = attrs.src.override {
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
# New rust versions should first go to staging.
|
|
||||||
# Things to check after updating:
|
|
||||||
# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin:
|
|
||||||
# i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github
|
|
||||||
# This testing can be also done by other volunteers as part of the pull
|
|
||||||
# request review, in case platforms cannot be covered.
|
|
||||||
# 2. The LLVM version used for building should match with rust upstream.
|
|
||||||
# Check the version number in the src/llvm-project git submodule in:
|
|
||||||
# https://github.com/rust-lang/rust/blob/<version-tag>/.gitmodules
|
|
||||||
# 3. Firefox and Thunderbird should still build on x86_64-linux.
|
|
||||||
|
|
||||||
{ stdenv, lib
|
|
||||||
, newScope, callPackage
|
|
||||||
, CoreFoundation, Security, SystemConfiguration
|
|
||||||
, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost, pkgsTargetTarget
|
|
||||||
, makeRustPlatform
|
|
||||||
, wrapRustcWith
|
|
||||||
, llvmPackages_17, llvm_17
|
|
||||||
, path
|
|
||||||
} @ args:
|
|
||||||
|
|
||||||
import ./default.nix {
|
|
||||||
rustcVersion = "1.77.1";
|
|
||||||
rustcSha256 = "7hBuTFafUtujtbKCsQWCD4a9j2s9CcBrjc6C+xuzpKE=";
|
|
||||||
|
|
||||||
llvmSharedForBuild = pkgsBuildBuild.llvmPackages_17.libllvm.override { enableSharedLibraries = true; };
|
|
||||||
llvmSharedForHost = pkgsBuildHost.llvmPackages_17.libllvm.override { enableSharedLibraries = true; };
|
|
||||||
llvmSharedForTarget = pkgsBuildTarget.llvmPackages_17.libllvm.override { enableSharedLibraries = true; };
|
|
||||||
|
|
||||||
# For use at runtime
|
|
||||||
llvmShared = llvm_17.override { enableSharedLibraries = true; };
|
|
||||||
|
|
||||||
# Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox
|
|
||||||
llvmPackages = llvmPackages_17;
|
|
||||||
|
|
||||||
# Note: the version MUST be one version prior to the version we're
|
|
||||||
# building
|
|
||||||
bootstrapVersion = "1.76.0";
|
|
||||||
|
|
||||||
# fetch hashes by running `print-hashes.sh ${bootstrapVersion}`
|
|
||||||
bootstrapHashes = {
|
|
||||||
i686-unknown-linux-gnu = "4c3eefc9341b8809235e6c4fbcbc19ab52a5cbe771292c400df068c12984fa3e";
|
|
||||||
x86_64-unknown-linux-gnu = "9d589d2036b503cc45ecc94992d616fb3deec074deb36cacc2f5c212408f7399";
|
|
||||||
x86_64-unknown-linux-musl = "aa8568f4d262468aaf4f622bd421c5435b24454d8fbcdae48da1162962205384";
|
|
||||||
arm-unknown-linux-gnueabihf = "7d1da067362fc64bcad198d90a61e024d5712aed76e17b28e1cd7e8ba263cc6f";
|
|
||||||
armv7-unknown-linux-gnueabihf = "c03346d56d4a860cd3a8d2d2a7ea75c510b68204e3ad97b3770076595261c913";
|
|
||||||
aarch64-unknown-linux-gnu = "2e8313421e8fb673efdf356cdfdd4bc16516f2610d4f6faa01327983104c05a0";
|
|
||||||
aarch64-unknown-linux-musl = "a1d1c8ccb8ea00cfa2b79d80411b8eb22b2bef5214f86536825361e98d7c617a";
|
|
||||||
x86_64-apple-darwin = "7bdbe085695df8e46389115e99eda7beed37a9494f6b961b45554c658e53b8e7";
|
|
||||||
aarch64-apple-darwin = "17496f15c3cb6ff73d5c36f5b54cc110f1ac31fa09521a7991c0d7ddd890dceb";
|
|
||||||
powerpc64le-unknown-linux-gnu = "44b3494675284d26b04747a824dc974e32fd8fd46fc0aa06a7c8ebe851332d2c";
|
|
||||||
riscv64gc-unknown-linux-gnu = "4a9db321874fc441235b71eb8aa295fc50251305e461540b25b4eef89fb56255";
|
|
||||||
};
|
|
||||||
|
|
||||||
selectRustPackage = pkgs: pkgs.rust_1_77;
|
|
||||||
|
|
||||||
rustcPatches = [ ];
|
|
||||||
}
|
|
||||||
|
|
||||||
(builtins.removeAttrs args [ "llvmPackages_17" "llvm_17"])
|
|
138
pkgs/by-name/ru/rust/1_80.nix
Normal file
138
pkgs/by-name/ru/rust/1_80.nix
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
# New rust versions should first go to staging.
|
||||||
|
# Things to check after updating:
|
||||||
|
# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin:
|
||||||
|
# i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github
|
||||||
|
# This testing can be also done by other volunteers as part of the pull
|
||||||
|
# request review, in case platforms cannot be covered.
|
||||||
|
# 2. The LLVM version used for building should match with rust upstream.
|
||||||
|
# Check the version number in the src/llvm-project git submodule in:
|
||||||
|
# https://github.com/rust-lang/rust/blob/<version-tag>/.gitmodules
|
||||||
|
# 3. Firefox and Thunderbird should still build on x86_64-linux.
|
||||||
|
|
||||||
|
{
|
||||||
|
stdenv,
|
||||||
|
lib,
|
||||||
|
newScope,
|
||||||
|
callPackage,
|
||||||
|
CoreFoundation,
|
||||||
|
Security,
|
||||||
|
SystemConfiguration,
|
||||||
|
pkgsBuildTarget,
|
||||||
|
pkgsBuildBuild,
|
||||||
|
pkgsBuildHost,
|
||||||
|
pkgsTargetTarget,
|
||||||
|
makeRustPlatform,
|
||||||
|
wrapRustcWith,
|
||||||
|
llvmPackages_18,
|
||||||
|
llvm_18,
|
||||||
|
wrapCCWith,
|
||||||
|
overrideCC,
|
||||||
|
path,
|
||||||
|
}@args:
|
||||||
|
let
|
||||||
|
llvmSharedFor =
|
||||||
|
pkgSet:
|
||||||
|
pkgSet.llvmPackages_18.libllvm.override (
|
||||||
|
{
|
||||||
|
enableSharedLibraries = true;
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs (stdenv.targetPlatform.useLLVM or false) {
|
||||||
|
# Force LLVM to compile using clang + LLVM libs when targeting pkgsLLVM
|
||||||
|
stdenv = pkgSet.stdenv.override {
|
||||||
|
allowedRequisites = null;
|
||||||
|
cc = pkgSet.llvmPackages_18.clangUseLLVM;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
import ./default.nix
|
||||||
|
{
|
||||||
|
rustcVersion = "1.80.1";
|
||||||
|
rustcSha256 = "sha256-LAuPZDlC3LgQy8xQ8pJWSxtuRNtdX0UJEVOZbfldLcQ=";
|
||||||
|
|
||||||
|
llvmSharedForBuild = llvmSharedFor pkgsBuildBuild;
|
||||||
|
llvmSharedForHost = llvmSharedFor pkgsBuildHost;
|
||||||
|
llvmSharedForTarget = llvmSharedFor pkgsBuildTarget;
|
||||||
|
|
||||||
|
# For use at runtime
|
||||||
|
llvmShared = llvmSharedFor { inherit llvmPackages_18 stdenv; };
|
||||||
|
|
||||||
|
# Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox
|
||||||
|
llvmPackages =
|
||||||
|
if (stdenv.targetPlatform.useLLVM or false) then
|
||||||
|
callPackage (
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
bootBintoolsNoLibc ? if stdenv.targetPlatform.linker == "lld" then null else pkgs.bintoolsNoLibc,
|
||||||
|
bootBintools ? if stdenv.targetPlatform.linker == "lld" then null else pkgs.bintools,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
llvmPackages = llvmPackages_18;
|
||||||
|
|
||||||
|
setStdenv =
|
||||||
|
pkg:
|
||||||
|
pkg.override {
|
||||||
|
stdenv = stdenv.override {
|
||||||
|
allowedRequisites = null;
|
||||||
|
cc = llvmPackages.clangUseLLVM;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
rec {
|
||||||
|
inherit (llvmPackages) bintools;
|
||||||
|
|
||||||
|
libunwind = setStdenv llvmPackages.libunwind;
|
||||||
|
llvm = setStdenv llvmPackages.llvm;
|
||||||
|
|
||||||
|
libcxx = llvmPackages.libcxx.override {
|
||||||
|
stdenv = stdenv.override {
|
||||||
|
allowedRequisites = null;
|
||||||
|
cc = llvmPackages.clangNoLibcxx;
|
||||||
|
hostPlatform = stdenv.hostPlatform // {
|
||||||
|
useLLVM = !stdenv.isDarwin;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
inherit libunwind;
|
||||||
|
};
|
||||||
|
|
||||||
|
clangUseLLVM = llvmPackages.clangUseLLVM.override { inherit libcxx; };
|
||||||
|
|
||||||
|
stdenv = overrideCC args.stdenv clangUseLLVM;
|
||||||
|
}
|
||||||
|
) { }
|
||||||
|
else
|
||||||
|
llvmPackages_18;
|
||||||
|
|
||||||
|
# Note: the version MUST be one version prior to the version we're
|
||||||
|
# building
|
||||||
|
bootstrapVersion = "1.79.0";
|
||||||
|
|
||||||
|
# fetch hashes by running `print-hashes.sh ${bootstrapVersion}`
|
||||||
|
bootstrapHashes = {
|
||||||
|
i686-unknown-linux-gnu = "0a1e371809446cd77dba7abce2afb4efac8d8b2e63483cfe19f1c98bf9ab7855";
|
||||||
|
x86_64-unknown-linux-gnu = "628efa8ef0658a7c4199883ee132281f19931448d3cfee4ecfd768898fe74c18";
|
||||||
|
x86_64-unknown-linux-musl = "2e4b0e40d027e2b31a40163986b4c04dfd0bce41c706a99f2e82ba473a4383de";
|
||||||
|
arm-unknown-linux-gnueabihf = "ce8d8d296277a06e0d2f63a21a0586717e09be3df28c0d1a04bc2c6f85eecc15";
|
||||||
|
armv7-unknown-linux-gnueabihf = "31968f88b22058e384dfb3cdf3efe7f60c03481d790300fcffc420d5ba3851f2";
|
||||||
|
aarch64-unknown-linux-gnu = "f7d3b31581331b54af97cf3162e65b8c26c8aa14d42f71c1ce9adc1078ef54e5";
|
||||||
|
aarch64-unknown-linux-musl = "f8100c806754cd21600ded26546467a1a242db9b9ab8a6a666656e3cc4edfa52";
|
||||||
|
x86_64-apple-darwin = "62f018aad30bafa0ef8bff0ed60d5d45e6cadc799769aad9d945509203e9f921";
|
||||||
|
aarch64-apple-darwin = "e70a9362975b94df7dbc6e2ed5ceab4254dd32f72ba497ff4a70440ace3f729f";
|
||||||
|
powerpc64le-unknown-linux-gnu = "9865eeebb5bb20006367d3148d9116576499ec958d847e22b645f008a1bc4170";
|
||||||
|
riscv64gc-unknown-linux-gnu = "c8d38e600ef4dea8b375df2d08153393816ffd3dcab18e4d081ddc19e28b5a40";
|
||||||
|
x86_64-unknown-freebsd = "3c8005f488b8dda0fc6d47928868200852106cac2b568934ae9a2e5c89d3a50d";
|
||||||
|
};
|
||||||
|
|
||||||
|
selectRustPackage = pkgs: pkgs.rust_1_80;
|
||||||
|
|
||||||
|
rustcPatches = [ ];
|
||||||
|
}
|
||||||
|
|
||||||
|
(
|
||||||
|
builtins.removeAttrs args [
|
||||||
|
"llvmPackages_18"
|
||||||
|
"llvm_18"
|
||||||
|
"wrapCCWith"
|
||||||
|
"overrideCC"
|
||||||
|
]
|
||||||
|
)
|
|
@ -1,23 +1,26 @@
|
||||||
{ lib, stdenv, makeWrapper, wrapRustc, bash, curl, darwin, zlib
|
{
|
||||||
, autoPatchelfHook, gcc
|
lib,
|
||||||
, version
|
stdenv,
|
||||||
, src
|
makeWrapper,
|
||||||
, platform
|
wrapRustc,
|
||||||
, versionType
|
bash,
|
||||||
|
darwin,
|
||||||
|
zlib,
|
||||||
|
autoPatchelfHook,
|
||||||
|
gcc,
|
||||||
|
version,
|
||||||
|
src,
|
||||||
|
platform,
|
||||||
|
versionType,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) optionalString;
|
inherit (lib) optionalString;
|
||||||
inherit (darwin.apple_sdk.frameworks) Security;
|
inherit (darwin.apple_sdk.frameworks) Security;
|
||||||
|
|
||||||
bootstrapping = versionType == "bootstrap";
|
bootstrapping = versionType == "bootstrap";
|
||||||
|
|
||||||
installComponents
|
installComponents = "rustc,rust-std-${platform}" + (optionalString bootstrapping ",cargo");
|
||||||
= "rustc,rust-std-${platform}"
|
|
||||||
+ (optionalString bootstrapping ",cargo")
|
|
||||||
;
|
|
||||||
in
|
in
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
rustc-unwrapped = stdenv.mkDerivation {
|
rustc-unwrapped = stdenv.mkDerivation {
|
||||||
pname = "rustc-${versionType}";
|
pname = "rustc-${versionType}";
|
||||||
|
@ -25,17 +28,22 @@ rec {
|
||||||
inherit version;
|
inherit version;
|
||||||
inherit src;
|
inherit src;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = {
|
||||||
homepage = "https://www.rust-lang.org/";
|
homepage = "https://www.rust-lang.org/";
|
||||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||||
description = "A safe, concurrent, practical language";
|
description = "Safe, concurrent, practical language";
|
||||||
maintainers = with maintainers; [ qknight ];
|
maintainers = [ ];
|
||||||
license = [ licenses.mit licenses.asl20 ];
|
license = [
|
||||||
|
lib.licenses.mit
|
||||||
|
lib.licenses.asl20
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = lib.optional (!stdenv.isDarwin) autoPatchelfHook;
|
nativeBuildInputs = lib.optional (!stdenv.isDarwin) autoPatchelfHook;
|
||||||
buildInputs = [ bash ]
|
buildInputs =
|
||||||
++ lib.optionals (!stdenv.isDarwin) [ gcc.cc.lib zlib ]
|
[ bash ]
|
||||||
|
++ lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) gcc.cc.lib
|
||||||
|
++ lib.optional (!stdenv.isDarwin) zlib
|
||||||
++ lib.optional stdenv.isDarwin Security;
|
++ lib.optional stdenv.isDarwin Security;
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
@ -73,15 +81,18 @@ rec {
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://doc.rust-lang.org/cargo/";
|
homepage = "https://doc.rust-lang.org/cargo/";
|
||||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||||
description = "The Rust package manager";
|
description = "Rust package manager";
|
||||||
maintainers = with maintainers; [ qknight ];
|
maintainers = with maintainers; [ qknight ];
|
||||||
license = [ licenses.mit licenses.asl20 ];
|
license = [
|
||||||
|
licenses.mit
|
||||||
|
licenses.asl20
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ]
|
nativeBuildInputs = [ makeWrapper ] ++ lib.optional (!stdenv.isDarwin) autoPatchelfHook;
|
||||||
++ lib.optional (!stdenv.isDarwin) autoPatchelfHook;
|
buildInputs =
|
||||||
buildInputs = [ bash ]
|
[ bash ]
|
||||||
++ lib.optional (!stdenv.isDarwin) gcc.cc.lib
|
++ lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) gcc.cc.lib
|
||||||
++ lib.optional stdenv.isDarwin Security;
|
++ lib.optional stdenv.isDarwin Security;
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
{ lib, buildPackages, fetchFromGitHub, fetchpatch, makeRustPlatform, installShellFiles, stdenv }:
|
{
|
||||||
|
lib,
|
||||||
|
buildPackages,
|
||||||
|
fetchFromGitHub,
|
||||||
|
fetchpatch,
|
||||||
|
makeRustPlatform,
|
||||||
|
installShellFiles,
|
||||||
|
stdenv,
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
args = rec {
|
args = rec {
|
||||||
pname = "cargo-auditable";
|
pname = "cargo-auditable";
|
||||||
|
@ -22,38 +29,32 @@ let
|
||||||
|
|
||||||
cargoHash = "sha256-4o3ctun/8VcBRuj+j0Yaawdkyn6Z6LPp+FTyhPxQWU8=";
|
cargoHash = "sha256-4o3ctun/8VcBRuj+j0Yaawdkyn6Z6LPp+FTyhPxQWU8=";
|
||||||
|
|
||||||
# Cargo.lock is outdated
|
meta = {
|
||||||
preConfigure = ''
|
description = "Tool to make production Rust binaries auditable";
|
||||||
cargo update --offline
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "A tool to make production Rust binaries auditable";
|
|
||||||
mainProgram = "cargo-auditable";
|
mainProgram = "cargo-auditable";
|
||||||
homepage = "https://github.com/rust-secure-code/cargo-auditable";
|
homepage = "https://github.com/rust-secure-code/cargo-auditable";
|
||||||
changelog = "https://github.com/rust-secure-code/cargo-auditable/blob/v${version}/cargo-auditable/CHANGELOG.md";
|
changelog = "https://github.com/rust-secure-code/cargo-auditable/blob/v${version}/cargo-auditable/CHANGELOG.md";
|
||||||
license = with licenses; [ mit /* or */ asl20 ];
|
license = with lib.licenses; [
|
||||||
maintainers = with maintainers; [ figsoda ];
|
mit # or
|
||||||
|
asl20
|
||||||
|
];
|
||||||
|
maintainers = with lib.maintainers; [ figsoda ];
|
||||||
broken = stdenv.hostPlatform != stdenv.buildPlatform;
|
broken = stdenv.hostPlatform != stdenv.buildPlatform;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
rustPlatform = makeRustPlatform {
|
rustPlatform = makeRustPlatform {
|
||||||
inherit (buildPackages) rustc;
|
inherit (buildPackages) rustc;
|
||||||
cargo = buildPackages.cargo.override {
|
cargo = buildPackages.cargo.override { auditable = false; };
|
||||||
auditable = false;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bootstrap = rustPlatform.buildRustPackage (args // {
|
bootstrap = rustPlatform.buildRustPackage (args // { auditable = false; });
|
||||||
auditable = false;
|
|
||||||
});
|
|
||||||
in
|
in
|
||||||
|
|
||||||
rustPlatform.buildRustPackage.override { cargo-auditable = bootstrap; } (args // {
|
rustPlatform.buildRustPackage.override { cargo-auditable = bootstrap; } (
|
||||||
nativeBuildInputs = [
|
args
|
||||||
installShellFiles
|
// {
|
||||||
];
|
nativeBuildInputs = [ installShellFiles ];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
installManPage cargo-auditable/cargo-auditable.1
|
installManPage cargo-auditable/cargo-auditable.1
|
||||||
|
@ -62,4 +63,5 @@ rustPlatform.buildRustPackage.override { cargo-auditable = bootstrap; } (args //
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootstrap;
|
inherit bootstrap;
|
||||||
};
|
};
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
|
@ -1,15 +1,27 @@
|
||||||
{ lib, stdenv, pkgsBuildHost, pkgsHostHost
|
{
|
||||||
, file, curl, pkg-config, python3, openssl, cmake, zlib
|
lib,
|
||||||
, installShellFiles, makeWrapper, rustPlatform, rustc
|
stdenv,
|
||||||
, CoreFoundation, Security
|
pkgsHostHost,
|
||||||
, auditable ? !cargo-auditable.meta.broken
|
file,
|
||||||
, cargo-auditable
|
curl,
|
||||||
, pkgsBuildBuild
|
pkg-config,
|
||||||
|
python3,
|
||||||
|
openssl,
|
||||||
|
cmake,
|
||||||
|
zlib,
|
||||||
|
installShellFiles,
|
||||||
|
makeWrapper,
|
||||||
|
rustPlatform,
|
||||||
|
rustc,
|
||||||
|
CoreFoundation,
|
||||||
|
Security,
|
||||||
|
auditable ? !cargo-auditable.meta.broken,
|
||||||
|
cargo-auditable,
|
||||||
|
pkgsBuildBuild,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
rustPlatform.buildRustPackage.override {
|
rustPlatform.buildRustPackage.override { cargo-auditable = cargo-auditable.bootstrap; } (
|
||||||
cargo-auditable = cargo-auditable.bootstrap;
|
{
|
||||||
} ({
|
|
||||||
pname = "cargo";
|
pname = "cargo";
|
||||||
inherit (rustc.unwrapped) version src;
|
inherit (rustc.unwrapped) version src;
|
||||||
|
|
||||||
|
@ -28,12 +40,25 @@ rustPlatform.buildRustPackage.override {
|
||||||
dontUpdateAutotoolsGnuConfigScripts = true;
|
dontUpdateAutotoolsGnuConfigScripts = true;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkg-config cmake installShellFiles makeWrapper
|
pkg-config
|
||||||
|
cmake
|
||||||
|
installShellFiles
|
||||||
|
makeWrapper
|
||||||
(lib.getDev pkgsHostHost.curl)
|
(lib.getDev pkgsHostHost.curl)
|
||||||
zlib
|
zlib
|
||||||
];
|
];
|
||||||
buildInputs = [ file curl python3 openssl zlib ]
|
buildInputs =
|
||||||
++ lib.optionals stdenv.isDarwin [ CoreFoundation Security ];
|
[
|
||||||
|
file
|
||||||
|
curl
|
||||||
|
python3
|
||||||
|
openssl
|
||||||
|
zlib
|
||||||
|
]
|
||||||
|
++ lib.optionals stdenv.isDarwin [
|
||||||
|
CoreFoundation
|
||||||
|
Security
|
||||||
|
];
|
||||||
|
|
||||||
# cargo uses git-rs which is made for a version of libgit2 from recent master that
|
# cargo uses git-rs which is made for a version of libgit2 from recent master that
|
||||||
# is not compatible with the current version in nixpkgs.
|
# is not compatible with the current version in nixpkgs.
|
||||||
|
@ -69,17 +94,21 @@ rustPlatform.buildRustPackage.override {
|
||||||
runHook postInstallCheck
|
runHook postInstallCheck
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = {
|
||||||
homepage = "https://crates.io";
|
homepage = "https://crates.io";
|
||||||
description = "Downloads your Rust project's dependencies and builds your project";
|
description = "Downloads your Rust project's dependencies and builds your project";
|
||||||
mainProgram = "cargo";
|
mainProgram = "cargo";
|
||||||
maintainers = teams.rust.members;
|
maintainers = [ ];
|
||||||
license = [ licenses.mit licenses.asl20 ];
|
license = [
|
||||||
platforms = platforms.unix;
|
lib.licenses.mit
|
||||||
|
lib.licenses.asl20
|
||||||
|
];
|
||||||
|
platforms = lib.platforms.unix;
|
||||||
# https://github.com/alexcrichton/nghttp2-rs/issues/2
|
# https://github.com/alexcrichton/nghttp2-rs/issues/2
|
||||||
broken = stdenv.hostPlatform.isx86 && stdenv.buildPlatform != stdenv.hostPlatform;
|
broken = stdenv.hostPlatform.isx86 && stdenv.buildPlatform != stdenv.hostPlatform;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs (stdenv.buildPlatform.rust.rustcTarget != stdenv.hostPlatform.rust.rustcTarget) {
|
// lib.optionalAttrs (
|
||||||
HOST_PKG_CONFIG_PATH="${pkgsBuildBuild.pkg-config}/bin/pkg-config";
|
stdenv.buildPlatform.rust.rustcTarget != stdenv.hostPlatform.rust.rustcTarget
|
||||||
})
|
) { HOST_PKG_CONFIG_PATH = "${pkgsBuildBuild.pkg-config}/bin/pkg-config"; }
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
{ stdenv, lib, rustPlatform, rustc, Security, patchelf }:
|
{
|
||||||
|
stdenv,
|
||||||
|
lib,
|
||||||
|
rustPlatform,
|
||||||
|
rustc,
|
||||||
|
Security,
|
||||||
|
}:
|
||||||
rustPlatform.buildRustPackage {
|
rustPlatform.buildRustPackage {
|
||||||
pname = "clippy";
|
pname = "clippy";
|
||||||
inherit (rustc) version src;
|
inherit (rustc) version src;
|
||||||
|
@ -13,8 +18,7 @@ rustPlatform.buildRustPackage {
|
||||||
# changes hash of vendor directory otherwise
|
# changes hash of vendor directory otherwise
|
||||||
dontUpdateAutotoolsGnuConfigScripts = true;
|
dontUpdateAutotoolsGnuConfigScripts = true;
|
||||||
|
|
||||||
buildInputs = [ rustc.llvm ]
|
buildInputs = [ rustc.llvm ] ++ lib.optionals stdenv.isDarwin [ Security ];
|
||||||
++ lib.optionals stdenv.isDarwin [ Security ];
|
|
||||||
|
|
||||||
# fixes: error: the option `Z` is only accepted on the nightly compiler
|
# fixes: error: the option `Z` is only accepted on the nightly compiler
|
||||||
RUSTC_BOOTSTRAP = 1;
|
RUSTC_BOOTSTRAP = 1;
|
||||||
|
@ -35,12 +39,15 @@ rustPlatform.buildRustPackage {
|
||||||
install_name_tool -add_rpath "${rustc.unwrapped}/lib" "$out/bin/cargo-clippy"
|
install_name_tool -add_rpath "${rustc.unwrapped}/lib" "$out/bin/cargo-clippy"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = {
|
||||||
homepage = "https://rust-lang.github.io/rust-clippy/";
|
homepage = "https://rust-lang.github.io/rust-clippy/";
|
||||||
description = "A bunch of lints to catch common mistakes and improve your Rust code";
|
description = "Bunch of lints to catch common mistakes and improve your Rust code";
|
||||||
mainProgram = "cargo-clippy";
|
mainProgram = "cargo-clippy";
|
||||||
maintainers = with maintainers; [ basvandijk ] ++ teams.rust.members;
|
maintainers = with lib.maintainers; [ basvandijk ] ++ teams.rust.members;
|
||||||
license = with licenses; [ mit asl20 ];
|
license = with lib.licenses; [
|
||||||
platforms = platforms.unix;
|
mit
|
||||||
|
asl20
|
||||||
|
];
|
||||||
|
platforms = lib.platforms.unix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,61 @@
|
||||||
{ rustcVersion
|
{
|
||||||
, rustcSha256
|
rustcVersion,
|
||||||
, enableRustcDev ? true
|
rustcSha256,
|
||||||
, bootstrapVersion
|
enableRustcDev ? true,
|
||||||
, bootstrapHashes
|
bootstrapVersion,
|
||||||
, selectRustPackage
|
bootstrapHashes,
|
||||||
, rustcPatches ? []
|
selectRustPackage,
|
||||||
, llvmShared
|
rustcPatches ? [ ],
|
||||||
, llvmSharedForBuild
|
llvmShared,
|
||||||
, llvmSharedForHost
|
llvmSharedForBuild,
|
||||||
, llvmSharedForTarget
|
llvmSharedForHost,
|
||||||
, llvmPackages # Exposed through rustc for LTO in Firefox
|
llvmSharedForTarget,
|
||||||
|
llvmPackages, # Exposed through rustc for LTO in Firefox
|
||||||
}:
|
}:
|
||||||
{ stdenv, lib
|
{
|
||||||
, newScope, callPackage
|
stdenv,
|
||||||
, CoreFoundation, Security, SystemConfiguration
|
lib,
|
||||||
, pkgsBuildBuild
|
newScope,
|
||||||
, pkgsBuildHost
|
callPackage,
|
||||||
, pkgsBuildTarget
|
CoreFoundation,
|
||||||
, pkgsTargetTarget
|
Security,
|
||||||
, makeRustPlatform
|
SystemConfiguration,
|
||||||
, wrapRustcWith
|
pkgsBuildBuild,
|
||||||
, path
|
pkgsBuildHost,
|
||||||
|
pkgsBuildTarget,
|
||||||
|
pkgsTargetTarget,
|
||||||
|
makeRustPlatform,
|
||||||
|
wrapRustcWith,
|
||||||
|
path,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# Use `import` to make sure no packages sneak in here.
|
# Use `import` to make sure no packages sneak in here.
|
||||||
lib' = import (path + /pkgs/build-support/rust/lib) {
|
lib' = import (path + /pkgs/build-support/rust/lib) {
|
||||||
inherit lib stdenv pkgsBuildHost pkgsBuildTarget pkgsTargetTarget;
|
inherit
|
||||||
|
lib
|
||||||
|
stdenv
|
||||||
|
pkgsBuildHost
|
||||||
|
pkgsBuildTarget
|
||||||
|
pkgsTargetTarget
|
||||||
|
;
|
||||||
};
|
};
|
||||||
# Allow faster cross compiler generation by reusing Build artifacts
|
# Allow faster cross compiler generation by reusing Build artifacts
|
||||||
fastCross = (stdenv.buildPlatform == stdenv.hostPlatform) && (stdenv.hostPlatform != stdenv.targetPlatform);
|
fastCross =
|
||||||
|
(stdenv.buildPlatform == stdenv.hostPlatform) && (stdenv.hostPlatform != stdenv.targetPlatform);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
lib = lib';
|
lib = lib';
|
||||||
|
|
||||||
# Backwards compat before `lib` was factored out.
|
# Backwards compat before `lib` was factored out.
|
||||||
inherit (lib') toTargetArch toTargetOs toRustTarget toRustTargetSpec IsNoStdTarget toRustTargetForUseInEnvVars envVars;
|
inherit (lib')
|
||||||
|
toTargetArch
|
||||||
|
toTargetOs
|
||||||
|
toRustTarget
|
||||||
|
toRustTargetSpec
|
||||||
|
IsNoStdTarget
|
||||||
|
toRustTargetForUseInEnvVars
|
||||||
|
envVars
|
||||||
|
;
|
||||||
|
|
||||||
# This just contains tools for now. But it would conceivably contain
|
# This just contains tools for now. But it would conceivably contain
|
||||||
# libraries too, say if we picked some default/recommended versions to build
|
# libraries too, say if we picked some default/recommended versions to build
|
||||||
|
@ -53,33 +73,51 @@ in
|
||||||
version = bootstrapVersion;
|
version = bootstrapVersion;
|
||||||
hashes = bootstrapHashes;
|
hashes = bootstrapHashes;
|
||||||
};
|
};
|
||||||
stable = lib.makeScope newScope (self: let
|
stable = lib.makeScope newScope (
|
||||||
|
self:
|
||||||
|
let
|
||||||
# Like `buildRustPackages`, but may also contain prebuilt binaries to
|
# Like `buildRustPackages`, but may also contain prebuilt binaries to
|
||||||
# break cycle. Just like `bootstrapTools` for nixpkgs as a whole,
|
# break cycle. Just like `bootstrapTools` for nixpkgs as a whole,
|
||||||
# nothing in the final package set should refer to this.
|
# nothing in the final package set should refer to this.
|
||||||
bootstrapRustPackages = if fastCross
|
bootstrapRustPackages =
|
||||||
then pkgsBuildBuild.rustPackages
|
if fastCross then
|
||||||
|
pkgsBuildBuild.rustPackages
|
||||||
else
|
else
|
||||||
self.buildRustPackages.overrideScope (_: _:
|
self.buildRustPackages.overrideScope (
|
||||||
|
_: _:
|
||||||
lib.optionalAttrs (stdenv.buildPlatform == stdenv.hostPlatform)
|
lib.optionalAttrs (stdenv.buildPlatform == stdenv.hostPlatform)
|
||||||
(selectRustPackage pkgsBuildHost).packages.prebuilt);
|
(selectRustPackage pkgsBuildHost).packages.prebuilt
|
||||||
|
);
|
||||||
bootRustPlatform = makeRustPlatform bootstrapRustPackages;
|
bootRustPlatform = makeRustPlatform bootstrapRustPackages;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# Packages suitable for build-time, e.g. `build.rs`-type stuff.
|
# Packages suitable for build-time, e.g. `build.rs`-type stuff.
|
||||||
buildRustPackages = (selectRustPackage pkgsBuildHost).packages.stable // { __attrsFailEvaluation = true; };
|
buildRustPackages = (selectRustPackage pkgsBuildHost).packages.stable // {
|
||||||
|
# Prevent `pkgs/top-level/release-attrpaths-superset.nix` from recursing more than one level here.
|
||||||
|
buildRustPackages = self.buildRustPackages // {
|
||||||
|
__attrsFailEvaluation = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
# Analogous to stdenv
|
# Analogous to stdenv
|
||||||
rustPlatform = makeRustPlatform self.buildRustPackages;
|
rustPlatform = makeRustPlatform self.buildRustPackages;
|
||||||
rustc-unwrapped = self.callPackage ./rustc.nix ({
|
rustc-unwrapped = self.callPackage ./rustc.nix {
|
||||||
version = rustcVersion;
|
version = rustcVersion;
|
||||||
sha256 = rustcSha256;
|
sha256 = rustcSha256;
|
||||||
inherit enableRustcDev;
|
inherit enableRustcDev;
|
||||||
inherit llvmShared llvmSharedForBuild llvmSharedForHost llvmSharedForTarget llvmPackages fastCross;
|
inherit
|
||||||
|
llvmShared
|
||||||
|
llvmSharedForBuild
|
||||||
|
llvmSharedForHost
|
||||||
|
llvmSharedForTarget
|
||||||
|
llvmPackages
|
||||||
|
fastCross
|
||||||
|
;
|
||||||
|
|
||||||
patches = rustcPatches;
|
patches = rustcPatches;
|
||||||
|
|
||||||
# Use boot package set to break cycle
|
# Use boot package set to break cycle
|
||||||
inherit (bootstrapRustPackages) cargo rustc rustfmt;
|
inherit (bootstrapRustPackages) cargo rustc rustfmt;
|
||||||
});
|
};
|
||||||
rustc = wrapRustcWith {
|
rustc = wrapRustcWith {
|
||||||
inherit (self) rustc-unwrapped;
|
inherit (self) rustc-unwrapped;
|
||||||
sysroot = if fastCross then self.rustc-unwrapped else null;
|
sysroot = if fastCross then self.rustc-unwrapped else null;
|
||||||
|
@ -88,11 +126,15 @@ in
|
||||||
inherit Security;
|
inherit Security;
|
||||||
inherit (self.buildRustPackages) rustc;
|
inherit (self.buildRustPackages) rustc;
|
||||||
};
|
};
|
||||||
cargo = if (!fastCross) then self.callPackage ./cargo.nix {
|
cargo =
|
||||||
|
if (!fastCross) then
|
||||||
|
self.callPackage ./cargo.nix {
|
||||||
# Use boot package set to break cycle
|
# Use boot package set to break cycle
|
||||||
rustPlatform = bootRustPlatform;
|
rustPlatform = bootRustPlatform;
|
||||||
inherit CoreFoundation Security;
|
inherit CoreFoundation Security;
|
||||||
} else self.callPackage ./cargo_cross.nix {};
|
}
|
||||||
|
else
|
||||||
|
self.callPackage ./cargo_cross.nix { };
|
||||||
cargo-auditable = self.callPackage ./cargo-auditable.nix { };
|
cargo-auditable = self.callPackage ./cargo-auditable.nix { };
|
||||||
cargo-auditable-cargo-wrapper = self.callPackage ./cargo-auditable-cargo-wrapper.nix { };
|
cargo-auditable-cargo-wrapper = self.callPackage ./cargo-auditable-cargo-wrapper.nix { };
|
||||||
clippy = self.callPackage ./clippy.nix {
|
clippy = self.callPackage ./clippy.nix {
|
||||||
|
@ -102,6 +144,7 @@ in
|
||||||
rustPlatform = makeRustPlatform self;
|
rustPlatform = makeRustPlatform self;
|
||||||
inherit Security;
|
inherit Security;
|
||||||
};
|
};
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
{ lib, buildPackages, callPackage, callPackages, cargo-auditable, stdenv, runCommand, path }@prev:
|
{
|
||||||
|
lib,
|
||||||
{ rustc
|
buildPackages,
|
||||||
, cargo
|
callPackage,
|
||||||
, cargo-auditable ? prev.cargo-auditable
|
callPackages,
|
||||||
, stdenv ? prev.stdenv
|
cargo-auditable,
|
||||||
, ...
|
stdenv,
|
||||||
|
runCommand,
|
||||||
|
path,
|
||||||
|
}@prev:
|
||||||
|
{
|
||||||
|
rustc,
|
||||||
|
cargo,
|
||||||
|
cargo-auditable ? prev.cargo-auditable,
|
||||||
|
stdenv ? prev.stdenv,
|
||||||
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
@ -13,28 +22,45 @@ rec {
|
||||||
cargo = lib.warn "rustPlatform.rust.cargo is deprecated. Use cargo instead." cargo;
|
cargo = lib.warn "rustPlatform.rust.cargo is deprecated. Use cargo instead." cargo;
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchCargoTarball = buildPackages.callPackage (path + "/pkgs/build-support/rust/fetch-cargo-tarball") {
|
fetchCargoTarball =
|
||||||
|
buildPackages.callPackage (path + "/pkgs/build-support/rust/fetch-cargo-tarball")
|
||||||
|
{
|
||||||
git = buildPackages.gitMinimal;
|
git = buildPackages.gitMinimal;
|
||||||
inherit cargo;
|
inherit cargo;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildRustPackage = callPackage (path + "/pkgs/build-support/rust/build-rust-package") {
|
buildRustPackage = callPackage (path + "/pkgs/build-support/rust/build-rust-package") {
|
||||||
inherit stdenv cargoBuildHook cargoCheckHook cargoInstallHook cargoNextestHook cargoSetupHook
|
inherit
|
||||||
fetchCargoTarball importCargoLock rustc cargo cargo-auditable;
|
stdenv
|
||||||
|
cargoBuildHook
|
||||||
|
cargoCheckHook
|
||||||
|
cargoInstallHook
|
||||||
|
cargoNextestHook
|
||||||
|
cargoSetupHook
|
||||||
|
fetchCargoTarball
|
||||||
|
importCargoLock
|
||||||
|
rustc
|
||||||
|
cargo
|
||||||
|
cargo-auditable
|
||||||
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
importCargoLock = buildPackages.callPackage (path + "/pkgs/build-support/rust/import-cargo-lock.nix") { inherit cargo; };
|
importCargoLock = buildPackages.callPackage (
|
||||||
|
path + "/pkgs/build-support/rust/import-cargo-lock.nix"
|
||||||
|
) { inherit cargo; };
|
||||||
|
|
||||||
rustcSrc = callPackage ./rust-src.nix {
|
rustcSrc = callPackage ./rust-src.nix { inherit runCommand rustc; };
|
||||||
inherit runCommand rustc;
|
|
||||||
};
|
|
||||||
|
|
||||||
rustLibSrc = callPackage ./rust-lib-src.nix {
|
rustLibSrc = callPackage ./rust-lib-src.nix { inherit runCommand rustc; };
|
||||||
inherit runCommand rustc;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Hooks
|
# Hooks
|
||||||
inherit (callPackages (path + "/pkgs/build-support/rust/hooks") {
|
inherit (callPackages (path + "/pkgs/build-support/rust/hooks") { inherit stdenv cargo rustc; })
|
||||||
inherit stdenv cargo rustc;
|
cargoBuildHook
|
||||||
}) cargoBuildHook cargoCheckHook cargoInstallHook cargoNextestHook cargoSetupHook maturinBuildHook bindgenHook;
|
cargoCheckHook
|
||||||
|
cargoInstallHook
|
||||||
|
cargoNextestHook
|
||||||
|
cargoSetupHook
|
||||||
|
maturinBuildHook
|
||||||
|
bindgenHook
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,24 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
res: pkgs: super:
|
res: pkgs: super:
|
||||||
|
|
||||||
with pkgs;
|
with pkgs; {
|
||||||
{
|
rust_1_80 = callPackage ./1_80.nix {
|
||||||
rust_1_77 = callPackage ./1_77.nix {
|
|
||||||
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security SystemConfiguration;
|
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security SystemConfiguration;
|
||||||
llvm_17 = llvmPackages_17.libllvm;
|
llvm_18 = llvmPackages_18.libllvm;
|
||||||
};
|
};
|
||||||
rust = rust_1_77;
|
rust = rust_1_80;
|
||||||
|
|
||||||
rustPackages_1_77 = rust_1_77.packages.stable;
|
rustPackages_1_80 = rust_1_80.packages.stable;
|
||||||
rustPackages = rustPackages_1_77;
|
rustPackages = rustPackages_1_80;
|
||||||
|
|
||||||
inherit (rustPackages) cargo cargo-auditable cargo-auditable-cargo-wrapper clippy rustc rustPlatform;
|
inherit (rustPackages)
|
||||||
|
cargo
|
||||||
|
cargo-auditable
|
||||||
|
cargo-auditable-cargo-wrapper
|
||||||
|
clippy
|
||||||
|
rustc
|
||||||
|
rustPlatform
|
||||||
|
;
|
||||||
|
|
||||||
makeRustPlatform = callPackage ./make-rust-platform.nix { };
|
makeRustPlatform = callPackage ./make-rust-platform.nix { };
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,53 @@
|
||||||
{ lib, stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, targetPackages
|
{
|
||||||
, llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget, llvmPackages
|
lib,
|
||||||
, fetchurl, file, python3
|
stdenv,
|
||||||
, darwin, cargo, cmake, rustc, rustfmt
|
removeReferencesTo,
|
||||||
, pkg-config, openssl, xz
|
pkgsBuildBuild,
|
||||||
, libiconv
|
pkgsBuildHost,
|
||||||
, which, libffi
|
pkgsBuildTarget,
|
||||||
, withBundledLLVM ? false
|
targetPackages,
|
||||||
, enableRustcDev ? true
|
llvmShared,
|
||||||
, version
|
llvmSharedForBuild,
|
||||||
, sha256
|
llvmSharedForHost,
|
||||||
, patches ? []
|
llvmSharedForTarget,
|
||||||
# , fd
|
llvmPackages,
|
||||||
# , ripgrep
|
runCommandLocal,
|
||||||
# , wezterm
|
fetchurl,
|
||||||
# , firefox
|
file,
|
||||||
# , thunderbird
|
python3,
|
||||||
# This only builds std for target and reuses the rustc from build.
|
darwin,
|
||||||
, fastCross
|
cargo,
|
||||||
, lndir
|
cmake,
|
||||||
, makeWrapper
|
rustc,
|
||||||
|
rustfmt,
|
||||||
|
pkg-config,
|
||||||
|
openssl,
|
||||||
|
xz,
|
||||||
|
zlib,
|
||||||
|
libiconv,
|
||||||
|
which,
|
||||||
|
libffi,
|
||||||
|
withBundledLLVM ? false,
|
||||||
|
enableRustcDev ? true,
|
||||||
|
version,
|
||||||
|
sha256,
|
||||||
|
patches ? [ ],
|
||||||
|
# This only builds std for target and reuses the rustc from build.
|
||||||
|
fastCross,
|
||||||
|
lndir,
|
||||||
|
makeWrapper,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) optionals optional optionalString concatStringsSep;
|
inherit (lib)
|
||||||
|
optionals
|
||||||
|
optional
|
||||||
|
optionalString
|
||||||
|
concatStringsSep
|
||||||
|
;
|
||||||
inherit (darwin.apple_sdk.frameworks) Security;
|
inherit (darwin.apple_sdk.frameworks) Security;
|
||||||
in stdenv.mkDerivation (finalAttrs: {
|
useLLVM = stdenv.targetPlatform.useLLVM or false;
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "${targetPackages.stdenv.cc.targetPrefix}rustc";
|
pname = "${targetPackages.stdenv.cc.targetPrefix}rustc";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
|
@ -35,6 +58,12 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
passthru.isReleaseTarball = true;
|
passthru.isReleaseTarball = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hardeningDisable = optionals stdenv.cc.isClang [
|
||||||
|
# remove once https://github.com/NixOS/nixpkgs/issues/318674 is
|
||||||
|
# addressed properly
|
||||||
|
"zerocallusedregs"
|
||||||
|
];
|
||||||
|
|
||||||
__darwinAllowLocalNetworking = true;
|
__darwinAllowLocalNetworking = true;
|
||||||
|
|
||||||
# rustc complains about modified source files otherwise
|
# rustc complains about modified source files otherwise
|
||||||
|
@ -53,26 +82,38 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
# but it does support checking these idiosyncratic PKG_CONFIG_${TRIPLE}
|
# but it does support checking these idiosyncratic PKG_CONFIG_${TRIPLE}
|
||||||
# environment variables.
|
# environment variables.
|
||||||
# [1]: https://github.com/rust-lang/pkg-config-rs/issues/53
|
# [1]: https://github.com/rust-lang/pkg-config-rs/issues/53
|
||||||
"PKG_CONFIG_${builtins.replaceStrings ["-"] ["_"] stdenv.buildPlatform.rust.rustcTarget}" =
|
"PKG_CONFIG_${
|
||||||
"${pkgsBuildHost.stdenv.cc.targetPrefix}pkg-config";
|
builtins.replaceStrings [ "-" ] [ "_" ] stdenv.buildPlatform.rust.rustcTarget
|
||||||
|
}" = "${pkgsBuildHost.stdenv.cc.targetPrefix}pkg-config";
|
||||||
|
|
||||||
NIX_LDFLAGS = toString (
|
NIX_LDFLAGS = toString (
|
||||||
# when linking stage1 libstd: cc: undefined reference to `__cxa_begin_catch'
|
# when linking stage1 libstd: cc: undefined reference to `__cxa_begin_catch'
|
||||||
optional (stdenv.isLinux && !withBundledLLVM) "--push-state --as-needed -lstdc++ --pop-state"
|
# This doesn't apply to cross-building for FreeBSD because the host
|
||||||
|
# uses libstdc++, but the target (used for building std) uses libc++
|
||||||
|
optional (
|
||||||
|
stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && !useLLVM
|
||||||
|
) "--push-state --as-needed -lstdc++ --pop-state"
|
||||||
|
++
|
||||||
|
optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && useLLVM)
|
||||||
|
"--push-state --as-needed -L${llvmPackages.libcxx}/lib -lc++ -lc++abi -lLLVM-${lib.versions.major llvmPackages.llvm.version} --pop-state"
|
||||||
++ optional (stdenv.isDarwin && !withBundledLLVM) "-lc++ -lc++abi"
|
++ optional (stdenv.isDarwin && !withBundledLLVM) "-lc++ -lc++abi"
|
||||||
++ optional stdenv.isDarwin "-rpath ${llvmSharedForHost}/lib");
|
++ optional stdenv.isFreeBSD "-rpath ${llvmPackages.libunwind}/lib"
|
||||||
|
++ optional stdenv.isDarwin "-rpath ${llvmSharedForHost.lib}/lib"
|
||||||
|
);
|
||||||
|
|
||||||
# Increase codegen units to introduce parallelism within the compiler.
|
# Increase codegen units to introduce parallelism within the compiler.
|
||||||
RUSTFLAGS = "-Ccodegen-units=10";
|
RUSTFLAGS = "-Ccodegen-units=10";
|
||||||
|
|
||||||
RUSTDOCFLAGS = "-A rustdoc::broken-intra-doc-links";
|
RUSTDOCFLAGS = "-A rustdoc::broken-intra-doc-links";
|
||||||
|
|
||||||
# We need rust to build rust. If we don't provide it, configure will try to download it.
|
# We need rust to build rust. If we don't provide it, configure will try to download it.
|
||||||
# Reference: https://github.com/rust-lang/rust/blob/master/src/bootstrap/configure.py
|
# Reference: https://github.com/rust-lang/rust/blob/master/src/bootstrap/configure.py
|
||||||
configureFlags = let
|
configureFlags =
|
||||||
|
let
|
||||||
prefixForStdenv = stdenv: "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}";
|
prefixForStdenv = stdenv: "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}";
|
||||||
ccPrefixForStdenv = stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang" else "cc"}";
|
ccPrefixForStdenv =
|
||||||
cxxPrefixForStdenv = stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang++" else "c++"}";
|
stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang" else "cc"}";
|
||||||
|
cxxPrefixForStdenv =
|
||||||
|
stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang++" else "c++"}";
|
||||||
setBuild = "--set=target.${stdenv.buildPlatform.rust.rustcTarget}";
|
setBuild = "--set=target.${stdenv.buildPlatform.rust.rustcTarget}";
|
||||||
setHost = "--set=target.${stdenv.hostPlatform.rust.rustcTarget}";
|
setHost = "--set=target.${stdenv.hostPlatform.rust.rustcTarget}";
|
||||||
setTarget = "--set=target.${stdenv.targetPlatform.rust.rustcTarget}";
|
setTarget = "--set=target.${stdenv.targetPlatform.rust.rustcTarget}";
|
||||||
|
@ -82,42 +123,52 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
cxxForHost = cxxPrefixForStdenv pkgsBuildHost.targetPackages.stdenv;
|
cxxForHost = cxxPrefixForStdenv pkgsBuildHost.targetPackages.stdenv;
|
||||||
ccForTarget = ccPrefixForStdenv pkgsBuildTarget.targetPackages.stdenv;
|
ccForTarget = ccPrefixForStdenv pkgsBuildTarget.targetPackages.stdenv;
|
||||||
cxxForTarget = cxxPrefixForStdenv pkgsBuildTarget.targetPackages.stdenv;
|
cxxForTarget = cxxPrefixForStdenv pkgsBuildTarget.targetPackages.stdenv;
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
"--sysconfdir=${placeholder "out"}/etc"
|
"--sysconfdir=${placeholder "out"}/etc"
|
||||||
"--release-channel=stable"
|
"--release-channel=stable"
|
||||||
"--set=build.rustc=${rustc}/bin/rustc"
|
"--set=build.rustc=${rustc}/bin/rustc"
|
||||||
"--set=build.cargo=${cargo}/bin/cargo"
|
"--set=build.cargo=${cargo}/bin/cargo"
|
||||||
] ++ lib.optionals (!(finalAttrs.src.passthru.isReleaseTarball or false)) [
|
]
|
||||||
|
++ lib.optionals (!(finalAttrs.src.passthru.isReleaseTarball or false)) [
|
||||||
# release tarballs vendor the rustfmt source; when
|
# release tarballs vendor the rustfmt source; when
|
||||||
# git-bisect'ing from upstream's git repo we must prevent
|
# git-bisect'ing from upstream's git repo we must prevent
|
||||||
# attempts to download the missing source tarball
|
# attempts to download the missing source tarball
|
||||||
"--set=build.rustfmt=${rustfmt}/bin/rustfmt"
|
"--set=build.rustfmt=${rustfmt}/bin/rustfmt"
|
||||||
] ++ [
|
]
|
||||||
|
++ [
|
||||||
"--tools=rustc,rustdoc,rust-analyzer-proc-macro-srv"
|
"--tools=rustc,rustdoc,rust-analyzer-proc-macro-srv"
|
||||||
"--enable-rpath"
|
"--enable-rpath"
|
||||||
"--enable-vendor"
|
"--enable-vendor"
|
||||||
"--build=${stdenv.buildPlatform.rust.rustcTargetSpec}"
|
"--build=${stdenv.buildPlatform.rust.rustcTargetSpec}"
|
||||||
"--host=${stdenv.hostPlatform.rust.rustcTargetSpec}"
|
"--host=${stdenv.hostPlatform.rust.rustcTargetSpec}"
|
||||||
# std is built for all platforms in --target.
|
# std is built for all platforms in --target.
|
||||||
"--target=${concatStringsSep "," ([
|
"--target=${
|
||||||
|
concatStringsSep "," (
|
||||||
|
[
|
||||||
stdenv.targetPlatform.rust.rustcTargetSpec
|
stdenv.targetPlatform.rust.rustcTargetSpec
|
||||||
|
|
||||||
# Other targets that don't need any extra dependencies to build.
|
# Other targets that don't need any extra dependencies to build.
|
||||||
] ++ optionals (!fastCross) [
|
]
|
||||||
|
++ optionals (!fastCross) [
|
||||||
"wasm32-unknown-unknown"
|
"wasm32-unknown-unknown"
|
||||||
|
|
||||||
# (build!=target): When cross-building a compiler we need to add
|
# (build!=target): When cross-building a compiler we need to add
|
||||||
# the build platform as well so rustc can compile build.rs
|
# the build platform as well so rustc can compile build.rs
|
||||||
# scripts.
|
# scripts.
|
||||||
] ++ optionals (stdenv.buildPlatform != stdenv.targetPlatform && !fastCross) [
|
]
|
||||||
|
++ optionals (stdenv.buildPlatform != stdenv.targetPlatform && !fastCross) [
|
||||||
stdenv.buildPlatform.rust.rustcTargetSpec
|
stdenv.buildPlatform.rust.rustcTargetSpec
|
||||||
|
|
||||||
# (host!=target): When building a cross-targeting compiler we
|
# (host!=target): When building a cross-targeting compiler we
|
||||||
# need to add the host platform as well so rustc can compile
|
# need to add the host platform as well so rustc can compile
|
||||||
# build.rs scripts.
|
# build.rs scripts.
|
||||||
] ++ optionals (stdenv.hostPlatform != stdenv.targetPlatform && !fastCross) [
|
]
|
||||||
|
++ optionals (stdenv.hostPlatform != stdenv.targetPlatform && !fastCross) [
|
||||||
stdenv.hostPlatform.rust.rustcTargetSpec
|
stdenv.hostPlatform.rust.rustcTargetSpec
|
||||||
])}"
|
]
|
||||||
|
)
|
||||||
|
}"
|
||||||
|
|
||||||
"${setBuild}.cc=${ccForBuild}"
|
"${setBuild}.cc=${ccForBuild}"
|
||||||
"${setHost}.cc=${ccForHost}"
|
"${setHost}.cc=${ccForHost}"
|
||||||
|
@ -134,29 +185,49 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
"${setBuild}.crt-static=${lib.boolToString stdenv.buildPlatform.isStatic}"
|
"${setBuild}.crt-static=${lib.boolToString stdenv.buildPlatform.isStatic}"
|
||||||
"${setHost}.crt-static=${lib.boolToString stdenv.hostPlatform.isStatic}"
|
"${setHost}.crt-static=${lib.boolToString stdenv.hostPlatform.isStatic}"
|
||||||
"${setTarget}.crt-static=${lib.boolToString stdenv.targetPlatform.isStatic}"
|
"${setTarget}.crt-static=${lib.boolToString stdenv.targetPlatform.isStatic}"
|
||||||
] ++ optionals (!withBundledLLVM) [
|
]
|
||||||
|
++ optionals (!withBundledLLVM) [
|
||||||
"--enable-llvm-link-shared"
|
"--enable-llvm-link-shared"
|
||||||
"${setBuild}.llvm-config=${llvmSharedForBuild.dev}/bin/llvm-config"
|
"${setBuild}.llvm-config=${llvmSharedForBuild.dev}/bin/llvm-config"
|
||||||
"${setHost}.llvm-config=${llvmSharedForHost.dev}/bin/llvm-config"
|
"${setHost}.llvm-config=${llvmSharedForHost.dev}/bin/llvm-config"
|
||||||
"${setTarget}.llvm-config=${llvmSharedForTarget.dev}/bin/llvm-config"
|
"${setTarget}.llvm-config=${llvmSharedForTarget.dev}/bin/llvm-config"
|
||||||
] ++ optionals (stdenv.isLinux && !stdenv.targetPlatform.isRedox) [
|
]
|
||||||
|
++ optionals fastCross [
|
||||||
|
# Since fastCross only builds std, it doesn't make sense (and
|
||||||
|
# doesn't work) to build a linker.
|
||||||
|
"--disable-llvm-bitcode-linker"
|
||||||
|
]
|
||||||
|
++
|
||||||
|
optionals
|
||||||
|
(stdenv.isLinux && !stdenv.targetPlatform.isRedox && !(stdenv.targetPlatform.useLLVM or false))
|
||||||
|
[
|
||||||
"--enable-profiler" # build libprofiler_builtins
|
"--enable-profiler" # build libprofiler_builtins
|
||||||
] ++ optionals stdenv.buildPlatform.isMusl [
|
]
|
||||||
|
++ optionals stdenv.buildPlatform.isMusl [
|
||||||
"${setBuild}.musl-root=${pkgsBuildBuild.targetPackages.stdenv.cc.libc}"
|
"${setBuild}.musl-root=${pkgsBuildBuild.targetPackages.stdenv.cc.libc}"
|
||||||
] ++ optionals stdenv.hostPlatform.isMusl [
|
]
|
||||||
|
++ optionals stdenv.hostPlatform.isMusl [
|
||||||
"${setHost}.musl-root=${pkgsBuildHost.targetPackages.stdenv.cc.libc}"
|
"${setHost}.musl-root=${pkgsBuildHost.targetPackages.stdenv.cc.libc}"
|
||||||
] ++ optionals stdenv.targetPlatform.isMusl [
|
]
|
||||||
|
++ optionals stdenv.targetPlatform.isMusl [
|
||||||
"${setTarget}.musl-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}"
|
"${setTarget}.musl-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}"
|
||||||
] ++ optionals stdenv.targetPlatform.rust.isNoStdTarget [
|
]
|
||||||
"--disable-docs"
|
++ optionals stdenv.targetPlatform.rust.isNoStdTarget [ "--disable-docs" ]
|
||||||
] ++ optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
++ optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
||||||
# https://github.com/rust-lang/rust/issues/92173
|
# https://github.com/rust-lang/rust/issues/92173
|
||||||
"--set rust.jemalloc"
|
"--set rust.jemalloc"
|
||||||
|
]
|
||||||
|
++ optionals useLLVM [
|
||||||
|
# https://github.com/NixOS/nixpkgs/issues/311930
|
||||||
|
"--llvm-libunwind=${if withBundledLLVM then "in-tree" else "system"}"
|
||||||
|
"--enable-use-libcxx"
|
||||||
];
|
];
|
||||||
|
|
||||||
# if we already have a rust compiler for build just compile the target std
|
# if we already have a rust compiler for build just compile the target std
|
||||||
# library and reuse compiler
|
# library and reuse compiler
|
||||||
buildPhase = if fastCross then "
|
buildPhase =
|
||||||
|
if fastCross then
|
||||||
|
"
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
|
||||||
mkdir -p build/${stdenv.hostPlatform.rust.rustcTargetSpec}/stage0-{std,rustc}/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/
|
mkdir -p build/${stdenv.hostPlatform.rust.rustcTargetSpec}/stage0-{std,rustc}/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/
|
||||||
|
@ -168,39 +239,55 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
python ./x.py --keep-stage=0 --stage=1 build library
|
python ./x.py --keep-stage=0 --stage=1 build library
|
||||||
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
" else null;
|
"
|
||||||
|
else
|
||||||
|
null;
|
||||||
|
|
||||||
installPhase = if fastCross then ''
|
installPhase =
|
||||||
|
if fastCross then
|
||||||
|
''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
python ./x.py --keep-stage=0 --stage=1 install library/std
|
python ./x.py --keep-stage=0 --stage=1 install library/std
|
||||||
mkdir -v $out/bin $doc $man
|
mkdir -v $out/bin $doc $man
|
||||||
ln -s ${rustc.unwrapped}/bin/{rustc,rustdoc} $out/bin
|
ln -s ${rustc.unwrapped}/bin/{rustc,rustdoc} $out/bin
|
||||||
|
rm -rf -v $out/lib/rustlib/{manifest-rust-std-,}${stdenv.hostPlatform.rust.rustcTargetSpec}
|
||||||
ln -s ${rustc.unwrapped}/lib/rustlib/{manifest-rust-std-,}${stdenv.hostPlatform.rust.rustcTargetSpec} $out/lib/rustlib/
|
ln -s ${rustc.unwrapped}/lib/rustlib/{manifest-rust-std-,}${stdenv.hostPlatform.rust.rustcTargetSpec} $out/lib/rustlib/
|
||||||
echo rust-std-${stdenv.hostPlatform.rust.rustcTargetSpec} >> $out/lib/rustlib/components
|
echo rust-std-${stdenv.hostPlatform.rust.rustcTargetSpec} >> $out/lib/rustlib/components
|
||||||
lndir ${rustc.doc} $doc
|
lndir ${rustc.doc} $doc
|
||||||
lndir ${rustc.man} $man
|
lndir ${rustc.man} $man
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'' else null;
|
''
|
||||||
|
else
|
||||||
|
null;
|
||||||
|
|
||||||
# the rust build system complains that nix alters the checksums
|
# the rust build system complains that nix alters the checksums
|
||||||
dontFixLibtool = true;
|
dontFixLibtool = true;
|
||||||
|
|
||||||
inherit patches;
|
inherit patches;
|
||||||
|
|
||||||
postPatch = ''
|
postPatch =
|
||||||
|
''
|
||||||
patchShebangs src/etc
|
patchShebangs src/etc
|
||||||
|
|
||||||
|
# rust-lld is the name rustup uses for its bundled lld, so that it
|
||||||
|
# doesn't conflict with any system lld. This is not an
|
||||||
|
# appropriate default for Nixpkgs, where there is no rust-lld.
|
||||||
|
substituteInPlace compiler/rustc_target/src/spec/*/*.rs \
|
||||||
|
--replace-quiet '"rust-lld"' '"lld"'
|
||||||
|
|
||||||
${optionalString (!withBundledLLVM) "rm -rf src/llvm"}
|
${optionalString (!withBundledLLVM) "rm -rf src/llvm"}
|
||||||
|
|
||||||
# Useful debugging parameter
|
# Useful debugging parameter
|
||||||
# export VERBOSE=1
|
# export VERBOSE=1
|
||||||
'' + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
|
''
|
||||||
|
+ lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
|
||||||
# See https://github.com/jemalloc/jemalloc/issues/1997
|
# See https://github.com/jemalloc/jemalloc/issues/1997
|
||||||
# Using a value of 48 should work on both emulated and native x86_64-darwin.
|
# Using a value of 48 should work on both emulated and native x86_64-darwin.
|
||||||
export JEMALLOC_SYS_WITH_LG_VADDR=48
|
export JEMALLOC_SYS_WITH_LG_VADDR=48
|
||||||
'' + lib.optionalString (!(finalAttrs.src.passthru.isReleaseTarball or false)) ''
|
''
|
||||||
|
+ lib.optionalString (!(finalAttrs.src.passthru.isReleaseTarball or false)) ''
|
||||||
mkdir .cargo
|
mkdir .cargo
|
||||||
cat > .cargo/config <<\EOF
|
cat > .cargo/config <<\EOF
|
||||||
[source.crates-io]
|
[source.crates-io]
|
||||||
|
@ -208,28 +295,67 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
[source.vendored-sources]
|
[source.vendored-sources]
|
||||||
directory = "vendor"
|
directory = "vendor"
|
||||||
EOF
|
EOF
|
||||||
|
''
|
||||||
|
+ lib.optionalString stdenv.isFreeBSD ''
|
||||||
|
# lzma-sys bundles an old version of xz that doesn't build
|
||||||
|
# on modern FreeBSD, use the system one instead
|
||||||
|
substituteInPlace src/bootstrap/src/core/build_steps/tool.rs \
|
||||||
|
--replace 'cargo.env("LZMA_API_STATIC", "1");' ' '
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# rustc unfortunately needs cmake to compile llvm-rt but doesn't
|
# rustc unfortunately needs cmake to compile llvm-rt but doesn't
|
||||||
# use it for the normal build. This disables cmake in Nix.
|
# use it for the normal build. This disables cmake in Nix.
|
||||||
dontUseCmakeConfigure = true;
|
dontUseCmakeConfigure = true;
|
||||||
|
|
||||||
depsBuildBuild = [ pkgsBuildHost.stdenv.cc pkg-config ];
|
depsBuildBuild = [
|
||||||
|
pkgsBuildHost.stdenv.cc
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs =
|
||||||
file python3 rustc cmake
|
[
|
||||||
which libffi removeReferencesTo pkg-config xz
|
file
|
||||||
|
python3
|
||||||
|
rustc
|
||||||
|
cmake
|
||||||
|
which
|
||||||
|
libffi
|
||||||
|
removeReferencesTo
|
||||||
|
pkg-config
|
||||||
|
xz
|
||||||
]
|
]
|
||||||
++ optionals fastCross [ lndir makeWrapper ];
|
++ optionals fastCross [
|
||||||
|
lndir
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
buildInputs = [ openssl ]
|
buildInputs =
|
||||||
++ optionals stdenv.isDarwin [ libiconv Security ]
|
[ openssl ]
|
||||||
++ optional (!withBundledLLVM) llvmShared;
|
++ optionals stdenv.isDarwin [
|
||||||
|
libiconv
|
||||||
|
Security
|
||||||
|
zlib
|
||||||
|
]
|
||||||
|
++ optional (!withBundledLLVM) llvmShared.lib
|
||||||
|
++ optional (useLLVM && !withBundledLLVM) [
|
||||||
|
llvmPackages.libunwind
|
||||||
|
# Hack which is used upstream https://github.com/gentoo/gentoo/blob/master/dev-lang/rust/rust-1.78.0.ebuild#L284
|
||||||
|
(runCommandLocal "libunwind-libgcc" { } ''
|
||||||
|
mkdir -p $out/lib
|
||||||
|
ln -s ${llvmPackages.libunwind}/lib/libunwind.so $out/lib/libgcc_s.so
|
||||||
|
ln -s ${llvmPackages.libunwind}/lib/libunwind.so $out/lib/libgcc_s.so.1
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
outputs = [ "out" "man" "doc" ];
|
outputs = [
|
||||||
|
"out"
|
||||||
|
"man"
|
||||||
|
"doc"
|
||||||
|
];
|
||||||
setOutputFlags = false;
|
setOutputFlags = false;
|
||||||
|
|
||||||
postInstall = lib.optionalString (enableRustcDev && !fastCross) ''
|
postInstall =
|
||||||
|
lib.optionalString (enableRustcDev && !fastCross) ''
|
||||||
# install rustc-dev components. Necessary to build rls, clippy...
|
# install rustc-dev components. Necessary to build rls, clippy...
|
||||||
python x.py dist rustc-dev
|
python x.py dist rustc-dev
|
||||||
tar xf build/dist/rustc-dev*tar.gz
|
tar xf build/dist/rustc-dev*tar.gz
|
||||||
|
@ -240,7 +366,8 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
sort --output=$m < $m
|
sort --output=$m < $m
|
||||||
done
|
done
|
||||||
|
|
||||||
'' + ''
|
''
|
||||||
|
+ ''
|
||||||
# remove references to llvm-config in lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
|
# remove references to llvm-config in lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
|
||||||
# and thus a transitive dependency on ncurses
|
# and thus a transitive dependency on ncurses
|
||||||
find $out/lib -name "*.so" -type f -exec remove-references-to -t ${llvmShared} '{}' '+'
|
find $out/lib -name "*.so" -type f -exec remove-references-to -t ${llvmShared} '{}' '+'
|
||||||
|
@ -249,7 +376,7 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
rm $out/lib/rustlib/uninstall.sh
|
rm $out/lib/rustlib/uninstall.sh
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configurePlatforms = [];
|
configurePlatforms = [ ];
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
@ -260,29 +387,44 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
passthru = {
|
passthru = {
|
||||||
llvm = llvmShared;
|
llvm = llvmShared;
|
||||||
inherit llvmPackages;
|
inherit llvmPackages;
|
||||||
# tests = {
|
|
||||||
# inherit fd ripgrep wezterm;
|
|
||||||
# } // lib.optionalAttrs stdenv.hostPlatform.isLinux { inherit firefox thunderbird; };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = {
|
||||||
homepage = "https://www.rust-lang.org/";
|
homepage = "https://www.rust-lang.org/";
|
||||||
description = "A safe, concurrent, practical language";
|
description = "Safe, concurrent, practical language";
|
||||||
maintainers = with maintainers; [ havvy ] ++ teams.rust.members;
|
maintainers = [ ];
|
||||||
license = [ licenses.mit licenses.asl20 ];
|
license = [
|
||||||
|
lib.licenses.mit
|
||||||
|
lib.licenses.asl20
|
||||||
|
];
|
||||||
platforms = [
|
platforms = [
|
||||||
# Platforms with host tools from
|
# Platforms with host tools from
|
||||||
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
|
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
|
||||||
"x86_64-darwin" "i686-darwin" "aarch64-darwin"
|
"x86_64-darwin"
|
||||||
"i686-freebsd" "x86_64-freebsd"
|
"i686-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
"i686-freebsd"
|
||||||
|
"x86_64-freebsd"
|
||||||
"x86_64-solaris"
|
"x86_64-solaris"
|
||||||
"aarch64-linux" "armv6l-linux" "armv7l-linux" "i686-linux"
|
"aarch64-linux"
|
||||||
"loongarch64-linux" "powerpc64-linux" "powerpc64le-linux"
|
"armv6l-linux"
|
||||||
"riscv64-linux" "s390x-linux" "x86_64-linux"
|
"armv7l-linux"
|
||||||
"aarch64-netbsd" "armv7l-netbsd" "i686-netbsd" "powerpc-netbsd"
|
"i686-linux"
|
||||||
|
"loongarch64-linux"
|
||||||
|
"powerpc64-linux"
|
||||||
|
"powerpc64le-linux"
|
||||||
|
"riscv64-linux"
|
||||||
|
"s390x-linux"
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-netbsd"
|
||||||
|
"armv7l-netbsd"
|
||||||
|
"i686-netbsd"
|
||||||
|
"powerpc-netbsd"
|
||||||
"x86_64-netbsd"
|
"x86_64-netbsd"
|
||||||
"i686-openbsd" "x86_64-openbsd"
|
"i686-openbsd"
|
||||||
"i686-windows" "x86_64-windows"
|
"x86_64-openbsd"
|
||||||
|
"i686-windows"
|
||||||
|
"x86_64-windows"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
{ lib, stdenv, rustPlatform, rustc, Security, asNightly ? false }:
|
{
|
||||||
|
lib,
|
||||||
rustPlatform.buildRustPackage rec {
|
stdenv,
|
||||||
|
rustPlatform,
|
||||||
|
rustc,
|
||||||
|
Security,
|
||||||
|
asNightly ? false,
|
||||||
|
}:
|
||||||
|
rustPlatform.buildRustPackage {
|
||||||
pname = "rustfmt" + lib.optionalString asNightly "-nightly";
|
pname = "rustfmt" + lib.optionalString asNightly "-nightly";
|
||||||
inherit (rustc) version src;
|
inherit (rustc) version src;
|
||||||
|
|
||||||
|
@ -11,9 +17,7 @@ rustPlatform.buildRustPackage rec {
|
||||||
# changes hash of vendor directory otherwise
|
# changes hash of vendor directory otherwise
|
||||||
dontUpdateAutotoolsGnuConfigScripts = true;
|
dontUpdateAutotoolsGnuConfigScripts = true;
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [ rustc.llvm ] ++ lib.optional stdenv.isDarwin Security;
|
||||||
rustc.llvm
|
|
||||||
] ++ lib.optional stdenv.isDarwin Security;
|
|
||||||
|
|
||||||
# rustfmt uses the rustc_driver and std private libraries, and Rust's build process forces them to have
|
# rustfmt uses the rustc_driver and std private libraries, and Rust's build process forces them to have
|
||||||
# an install name of `@rpath/...` [0] [1] instead of the standard on macOS, which is an absolute path
|
# an install name of `@rpath/...` [0] [1] instead of the standard on macOS, which is an absolute path
|
||||||
|
@ -34,11 +38,17 @@ rustPlatform.buildRustPackage rec {
|
||||||
CFG_RELEASE = rustc.version;
|
CFG_RELEASE = rustc.version;
|
||||||
CFG_RELEASE_CHANNEL = if asNightly then "nightly" else "stable";
|
CFG_RELEASE_CHANNEL = if asNightly then "nightly" else "stable";
|
||||||
|
|
||||||
meta = with lib; {
|
meta = {
|
||||||
description = "A tool for formatting Rust code according to style guidelines";
|
description = "Tool for formatting Rust code according to style guidelines";
|
||||||
homepage = "https://github.com/rust-lang-nursery/rustfmt";
|
homepage = "https://github.com/rust-lang-nursery/rustfmt";
|
||||||
license = with licenses; [ mit asl20 ];
|
license = with lib.licenses; [
|
||||||
|
mit
|
||||||
|
asl20
|
||||||
|
];
|
||||||
mainProgram = "rustfmt";
|
mainProgram = "rustfmt";
|
||||||
maintainers = with maintainers; [ globin basvandijk ];
|
maintainers = with lib.maintainers; [
|
||||||
|
globin
|
||||||
|
basvandijk
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue