mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-31 22:51:22 +00:00
Merge pull request #209180 from NixOS/staging-next
This commit is contained in:
commit
b974cf6522
@ -175,10 +175,11 @@ buildNpmPackage rec {
|
||||
hash = "sha256-BR+ZGkBBfd0dSQqAvujsbgsEPFYw/ThrylxUbOksYxM=";
|
||||
};
|
||||
|
||||
patches = [ ./remove-prepack-script.patch ];
|
||||
|
||||
npmDepsHash = "sha256-tuEfyePwlOy2/mOPdXbqJskO6IowvAP4DWg8xSZwbJw=";
|
||||
|
||||
# The prepack script runs the build script, which we'd rather do in the build phase.
|
||||
npmPackFlags = [ "--ignore-scripts" ];
|
||||
|
||||
NODE_OPTIONS = "--openssl-legacy-provider";
|
||||
|
||||
meta = with lib; {
|
||||
|
@ -994,6 +994,32 @@ Convenience function for `makeWrapper` that replaces `<\executable\>` with a wra
|
||||
|
||||
If you will apply it multiple times, it will overwrite the wrapper file and you will end up with double wrapping, which should be avoided.
|
||||
|
||||
### `prependToVar` \<variableName\> \<elements...\> {#fun-prependToVar}
|
||||
|
||||
Prepend elements to a variable.
|
||||
|
||||
Example:
|
||||
|
||||
```shellSession
|
||||
$ configureFlags="--disable-static"
|
||||
$ prependToVar configureFlags --disable-dependency-tracking --enable-foo
|
||||
$ echo $configureFlags
|
||||
--disable-dependency-tracking --enable-foo --disable-static
|
||||
```
|
||||
|
||||
### `appendToVar` \<variableName\> \<elements...\> {#fun-appendToVar}
|
||||
|
||||
Append elements to a variable.
|
||||
|
||||
Example:
|
||||
|
||||
```shellSession
|
||||
$ configureFlags="--disable-static"
|
||||
$ appendToVar configureFlags --disable-dependency-tracking --enable-foo
|
||||
$ echo $configureFlags
|
||||
--disable-static --disable-dependency-tracking --enable-foo
|
||||
```
|
||||
|
||||
## Package setup hooks {#ssec-setup-hooks}
|
||||
|
||||
Nix itself considers a build-time dependency as merely something that should previously be built and accessible at build time—packages themselves are on their own to perform any additional setup. In most cases, that is fine, and the downstream derivation can deal with its own dependencies. But for a few common tasks, that would result in almost every package doing the same sort of setup work—depending not on the package itself, but entirely on which dependencies were used.
|
||||
|
@ -11824,6 +11824,12 @@
|
||||
githubId = 1973389;
|
||||
name = "Reuben D'Netto";
|
||||
};
|
||||
realsnick = {
|
||||
name = "Ido Samuelson";
|
||||
email = "ido.samuelson@gmail.com";
|
||||
github = "realsnick";
|
||||
githubId = 1440852;
|
||||
};
|
||||
redbaron = {
|
||||
email = "ivanov.maxim@gmail.com";
|
||||
github = "redbaron";
|
||||
|
@ -214,6 +214,17 @@
|
||||
or configure your firewall.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>llvmPackages_rocm.llvm</literal> will not contain
|
||||
<literal>clang</literal> or <literal>compiler-rt</literal>.
|
||||
<literal>llvmPackages_rocm.clang</literal> will not contain
|
||||
<literal>llvm</literal>.
|
||||
<literal>llvmPackages_rocm.clangNoCompilerRt</literal> has
|
||||
been removed in favor of using
|
||||
<literal>llvmPackages_rocm.clang-unwrapped</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The Nginx module now validates the syntax of config files at
|
||||
@ -271,6 +282,14 @@
|
||||
that it configures the NixOS boot process, not the Nix daemon.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Deprecated <literal>xlibsWrapper</literal> transitional
|
||||
package has been removed in favour of direct use of its
|
||||
constitutents: <literal>xorg.libX11</literal>,
|
||||
<literal>freetype</literal> and others.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section xml:id="sec-release-23.05-notable-changes">
|
||||
@ -475,6 +494,13 @@
|
||||
<link xlink:href="options.html#opt-system.stateVersion">system.stateVersion</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>hip</literal> has been separated into
|
||||
<literal>hip</literal>, <literal>hip-common</literal> and
|
||||
<literal>hipcc</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Resilio sync secret keys can now be provided using a secrets
|
||||
|
@ -59,6 +59,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||
|
||||
- The [services.unifi-video.openFirewall](#opt-services.unifi-video.openFirewall) module option default value has been changed from `true` to `false`. You will need to explicitly set this option to `true`, or configure your firewall.
|
||||
|
||||
- `llvmPackages_rocm.llvm` will not contain `clang` or `compiler-rt`. `llvmPackages_rocm.clang` will not contain `llvm`. `llvmPackages_rocm.clangNoCompilerRt` has been removed in favor of using `llvmPackages_rocm.clang-unwrapped`.
|
||||
|
||||
- The Nginx module now validates the syntax of config files at build time. For more complex configurations (using `include` with out-of-store files notably) you may need to disable this check by setting [services.nginx.validateConfig](#opt-services.nginx.validateConfig) to `false`.
|
||||
|
||||
- The EC2 image module previously detected and automatically mounted ext3-formatted instance store devices and partitions in stage-1 (initramfs), storing `/tmp` on the first discovered device. This behaviour, which only catered to very specific use cases and could not be disabled, has been removed. Users relying on this should provide their own implementation, and probably use ext4 and perform the mount in stage-2.
|
||||
@ -71,6 +73,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||
|
||||
- The `nix.readOnlyStore` option has been renamed to `boot.readOnlyNixStore` to clarify that it configures the NixOS boot process, not the Nix daemon.
|
||||
|
||||
- Deprecated `xlibsWrapper` transitional package has been removed in favour of direct use of its constitutents: `xorg.libX11`, `freetype` and others.
|
||||
|
||||
## Other Notable Changes {#sec-release-23.05-notable-changes}
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
@ -127,6 +131,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||
|
||||
- [Garage](https://garagehq.deuxfleurs.fr/) version is based on [system.stateVersion](options.html#opt-system.stateVersion), existing installations will keep using version 0.7. New installations will use version 0.8. In order to upgrade a Garage cluster, please follow [upstream instructions](https://garagehq.deuxfleurs.fr/documentation/cookbook/upgrading/) and force [services.garage.package](options.html#opt-services.garage.package) or upgrade accordingly [system.stateVersion](options.html#opt-system.stateVersion).
|
||||
|
||||
- `hip` has been separated into `hip`, `hip-common` and `hipcc`.
|
||||
|
||||
- Resilio sync secret keys can now be provided using a secrets file at runtime, preventing these secrets from ending up in the Nix store.
|
||||
|
||||
- The `firewall` and `nat` module now has a nftables based implementation. Enable `networking.nftables` to use it.
|
||||
|
@ -33,12 +33,16 @@ with lib;
|
||||
ffmpeg_4 = super.ffmpeg_4-headless;
|
||||
ffmpeg_5 = super.ffmpeg_5-headless;
|
||||
gobject-introspection = super.gobject-introspection.override { x11Support = false; };
|
||||
gst_all_1 = super.gst_all_1 // {
|
||||
gst-plugins-base = super.gst_all_1.gst-plugins-base.override { enableX11 = false; };
|
||||
};
|
||||
gpsd = super.gpsd.override { guiSupport = false; };
|
||||
imagemagick = super.imagemagick.override { libX11Support = false; libXtSupport = false; };
|
||||
imagemagickBig = super.imagemagickBig.override { libX11Support = false; libXtSupport = false; };
|
||||
libextractor = super.libextractor.override { gstreamerSupport = false; gtkSupport = false; };
|
||||
libextractor = super.libextractor.override { gtkSupport = false; };
|
||||
libva = super.libva-minimal;
|
||||
limesuite = super.limesuite.override { withGui = false; };
|
||||
mpv-unwrapped = super.mpv-unwrapped.override { sdl2Support = false; x11Support = false; };
|
||||
msmtp = super.msmtp.override { withKeyring = false; };
|
||||
networkmanager-fortisslvpn = super.networkmanager-fortisslvpn.override { withGnome = false; };
|
||||
networkmanager-iodine = super.networkmanager-iodine.override { withGnome = false; };
|
||||
|
@ -110,21 +110,26 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf (cfg.ensurePrinters != [] && config.services.printing.enable) {
|
||||
systemd.services.ensure-printers = let
|
||||
cupsUnit = if config.services.printing.startWhenNeeded then "cups.socket" else "cups.service";
|
||||
in {
|
||||
systemd.services.ensure-printers = {
|
||||
description = "Ensure NixOS-configured CUPS printers";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
requires = [ cupsUnit ];
|
||||
after = [ cupsUnit ];
|
||||
wants = [ "cups.service" ];
|
||||
after = [ "cups.service" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
|
||||
script = concatMapStringsSep "\n" ensurePrinter cfg.ensurePrinters
|
||||
+ optionalString (cfg.ensureDefaultPrinter != null) (ensureDefaultPrinter cfg.ensureDefaultPrinter);
|
||||
script = concatStringsSep "\n" [
|
||||
(concatMapStrings ensurePrinter cfg.ensurePrinters)
|
||||
(optionalString (cfg.ensureDefaultPrinter != null)
|
||||
(ensureDefaultPrinter cfg.ensureDefaultPrinter))
|
||||
# Note: if cupsd is "stateless" the service can't be stopped,
|
||||
# otherwise the configuration will be wiped on the next start.
|
||||
(optionalString (with config.services.printing; startWhenNeeded && !stateless)
|
||||
"systemctl stop cups.service")
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -1302,6 +1302,8 @@
|
||||
./system/boot/systemd/shutdown.nix
|
||||
./system/boot/systemd/tmpfiles.nix
|
||||
./system/boot/systemd/user.nix
|
||||
./system/boot/systemd/userdbd.nix
|
||||
./system/boot/systemd/homed.nix
|
||||
./system/boot/timesyncd.nix
|
||||
./system/boot/tmp.nix
|
||||
./system/boot/uvesafb.nix
|
||||
|
@ -488,6 +488,9 @@ let
|
||||
account [success=ok ignore=ignore default=die] ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so
|
||||
account [success=ok default=ignore] ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_admin.so
|
||||
'' +
|
||||
optionalString config.services.homed.enable ''
|
||||
account sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'' +
|
||||
# The required pam_unix.so module has to come after all the sufficient modules
|
||||
# because otherwise, the account lookup will fail if the user does not exist
|
||||
# locally, for example with MySQL- or LDAP-auth.
|
||||
@ -541,8 +544,10 @@ let
|
||||
# after it succeeds. Certain modules need to run after pam_unix
|
||||
# prompts the user for password so we run it once with 'optional' at an
|
||||
# earlier point and it will run again with 'sufficient' further down.
|
||||
# We use try_first_pass the second time to avoid prompting password twice
|
||||
(optionalString (cfg.unixAuth &&
|
||||
# We use try_first_pass the second time to avoid prompting password twice.
|
||||
#
|
||||
# The same principle applies to systemd-homed
|
||||
(optionalString ((cfg.unixAuth || config.services.homed.enable) &&
|
||||
(config.security.pam.enableEcryptfs
|
||||
|| config.security.pam.enableFscrypt
|
||||
|| cfg.pamMount
|
||||
@ -553,7 +558,10 @@ let
|
||||
|| cfg.failDelay.enable
|
||||
|| cfg.duoSecurity.enable))
|
||||
(
|
||||
''
|
||||
optionalString config.services.homed.enable ''
|
||||
auth optional ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'' +
|
||||
optionalString cfg.unixAuth ''
|
||||
auth optional pam_unix.so ${optionalString cfg.allowNullPassword "nullok"} ${optionalString cfg.nodelay "nodelay"} likeauth
|
||||
'' +
|
||||
optionalString config.security.pam.enableEcryptfs ''
|
||||
@ -584,6 +592,9 @@ let
|
||||
auth required ${pkgs.duo-unix}/lib/security/pam_duo.so
|
||||
''
|
||||
)) +
|
||||
optionalString config.services.homed.enable ''
|
||||
auth sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'' +
|
||||
optionalString cfg.unixAuth ''
|
||||
auth sufficient pam_unix.so ${optionalString cfg.allowNullPassword "nullok"} ${optionalString cfg.nodelay "nodelay"} likeauth try_first_pass
|
||||
'' +
|
||||
@ -605,6 +616,10 @@ let
|
||||
auth required pam_deny.so
|
||||
|
||||
# Password management.
|
||||
'' +
|
||||
optionalString config.services.homed.enable ''
|
||||
password sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'' + ''
|
||||
password sufficient pam_unix.so nullok sha512
|
||||
'' +
|
||||
optionalString config.security.pam.enableEcryptfs ''
|
||||
@ -650,6 +665,9 @@ let
|
||||
++ optional (cfg.ttyAudit.enablePattern != null) "enable=${cfg.ttyAudit.enablePattern}"
|
||||
++ optional (cfg.ttyAudit.disablePattern != null) "disable=${cfg.ttyAudit.disablePattern}"
|
||||
)) +
|
||||
optionalString config.services.homed.enable ''
|
||||
session required ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'' +
|
||||
optionalString cfg.makeHomeDir ''
|
||||
session required ${pkgs.pam}/lib/security/pam_mkhomedir.so silent skel=${config.security.pam.makeHomeDir.skelDirectory} umask=0077
|
||||
'' +
|
||||
@ -1361,6 +1379,9 @@ in
|
||||
'' +
|
||||
optionalString config.virtualisation.lxc.lxcfs.enable ''
|
||||
mr ${pkgs.lxc}/lib/security/pam_cgfs.so
|
||||
'' +
|
||||
optionalString config.services.homed.enable ''
|
||||
mr ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
doSub() {
|
||||
|
@ -341,7 +341,7 @@ in
|
||||
|
||||
systemd.sockets.cups = mkIf cfg.startWhenNeeded {
|
||||
wantedBy = [ "sockets.target" ];
|
||||
listenStreams = [ "/run/cups/cups.sock" ]
|
||||
listenStreams = [ "" "/run/cups/cups.sock" ]
|
||||
++ map (x: replaceStrings ["localhost"] ["127.0.0.1"] (removePrefix "*:" x)) cfg.listenAddresses;
|
||||
};
|
||||
|
||||
@ -395,10 +395,7 @@ in
|
||||
''}
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
PrivateTmp = true;
|
||||
RuntimeDirectory = [ "cups" ];
|
||||
};
|
||||
serviceConfig.PrivateTmp = true;
|
||||
};
|
||||
|
||||
systemd.services.cups-browsed = mkIf avahiEnabled
|
||||
|
@ -1,5 +1,6 @@
|
||||
set -e
|
||||
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
@ -450,7 +450,7 @@ in
|
||||
(mkAfter [ "systemd" ])
|
||||
]);
|
||||
group = (mkMerge [
|
||||
(mkAfter [ "systemd" ])
|
||||
(mkAfter [ "[success=merge] systemd" ]) # need merge so that NSS won't stop at file-based groups
|
||||
]);
|
||||
};
|
||||
|
||||
|
43
nixos/modules/system/boot/systemd/homed.nix
Normal file
43
nixos/modules/system/boot/systemd/homed.nix
Normal file
@ -0,0 +1,43 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.homed;
|
||||
in
|
||||
{
|
||||
options.services.homed.enable = lib.mkEnableOption (lib.mdDoc ''
|
||||
Enable systemd home area/user account manager
|
||||
'');
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.services.nscd.enable;
|
||||
message = "systemd-homed requires the use of systemd nss module. services.nscd.enable must be set to true,";
|
||||
}
|
||||
];
|
||||
|
||||
systemd.additionalUpstreamSystemUnits = [
|
||||
"systemd-homed.service"
|
||||
"systemd-homed-activate.service"
|
||||
];
|
||||
|
||||
# This is mentioned in homed's [Install] section.
|
||||
#
|
||||
# While homed appears to work without it, it's probably better
|
||||
# to follow upstream recommendations.
|
||||
services.userdbd.enable = lib.mkDefault true;
|
||||
|
||||
systemd.services = {
|
||||
systemd-homed = {
|
||||
# These packages are required to manage encrypted volumes
|
||||
path = config.system.fsPackages;
|
||||
aliases = [ "dbus-org.freedesktop.home1.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
systemd-homed-activate = {
|
||||
wantedBy = [ "systemd-homed.service" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
18
nixos/modules/system/boot/systemd/userdbd.nix
Normal file
18
nixos/modules/system/boot/systemd/userdbd.nix
Normal file
@ -0,0 +1,18 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.userdbd;
|
||||
in
|
||||
{
|
||||
options.services.userdbd.enable = lib.mkEnableOption (lib.mdDoc ''
|
||||
Enables the systemd JSON user/group record lookup service
|
||||
'');
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.additionalUpstreamSystemUnits = [
|
||||
"systemd-userdbd.socket"
|
||||
"systemd-userdbd.service"
|
||||
];
|
||||
|
||||
systemd.sockets.systemd-userdbd.wantedBy = [ "sockets.target" ];
|
||||
};
|
||||
}
|
@ -146,7 +146,8 @@ in rec {
|
||||
(onFullSupported "nixos.tests.predictable-interface-names.predictable")
|
||||
(onFullSupported "nixos.tests.predictable-interface-names.unpredictableNetworkd")
|
||||
(onFullSupported "nixos.tests.predictable-interface-names.unpredictable")
|
||||
(onFullSupported "nixos.tests.printing")
|
||||
(onFullSupported "nixos.tests.printing-service")
|
||||
(onFullSupported "nixos.tests.printing-socket")
|
||||
(onFullSupported "nixos.tests.proxy")
|
||||
(onFullSupported "nixos.tests.sddm.default")
|
||||
(onFullSupported "nixos.tests.shadow")
|
||||
|
@ -544,7 +544,8 @@ in {
|
||||
power-profiles-daemon = handleTest ./power-profiles-daemon.nix {};
|
||||
pppd = handleTest ./pppd.nix {};
|
||||
predictable-interface-names = handleTest ./predictable-interface-names.nix {};
|
||||
printing = handleTest ./printing.nix {};
|
||||
printing-socket = handleTest ./printing.nix { socket = true; };
|
||||
printing-service = handleTest ./printing.nix { socket = false; };
|
||||
privacyidea = handleTest ./privacyidea.nix {};
|
||||
privoxy = handleTest ./privoxy.nix {};
|
||||
prometheus = handleTest ./prometheus.nix {};
|
||||
@ -655,6 +656,8 @@ in {
|
||||
systemd-shutdown = handleTest ./systemd-shutdown.nix {};
|
||||
systemd-timesyncd = handleTest ./systemd-timesyncd.nix {};
|
||||
systemd-misc = handleTest ./systemd-misc.nix {};
|
||||
systemd-userdbd = handleTest ./systemd-userdbd.nix {};
|
||||
systemd-homed = handleTest ./systemd-homed.nix {};
|
||||
tandoor-recipes = handleTest ./tandoor-recipes.nix {};
|
||||
taskserver = handleTest ./taskserver.nix {};
|
||||
tayga = handleTest ./tayga.nix {};
|
||||
|
@ -1,19 +1,31 @@
|
||||
# Test printing via CUPS.
|
||||
|
||||
import ./make-test-python.nix ({pkgs, ... }:
|
||||
let
|
||||
printingServer = startWhenNeeded: {
|
||||
services.printing.enable = true;
|
||||
services.printing.stateless = true;
|
||||
services.printing.startWhenNeeded = startWhenNeeded;
|
||||
services.printing.listenAddresses = [ "*:631" ];
|
||||
services.printing.defaultShared = true;
|
||||
services.printing.extraConf = ''
|
||||
<Location />
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Location>
|
||||
'';
|
||||
import ./make-test-python.nix (
|
||||
{ pkgs
|
||||
, socket ? true # whether to use socket activation
|
||||
, ...
|
||||
}:
|
||||
|
||||
{
|
||||
name = "printing";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ domenkozar eelco matthewbauer ];
|
||||
};
|
||||
|
||||
nodes.server = { ... }: {
|
||||
services.printing = {
|
||||
enable = true;
|
||||
stateless = true;
|
||||
startWhenNeeded = socket;
|
||||
listenAddresses = [ "*:631" ];
|
||||
defaultShared = true;
|
||||
extraConf = ''
|
||||
<Location />
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Location>
|
||||
'';
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 631 ];
|
||||
# Add a HP Deskjet printer connected via USB to the server.
|
||||
hardware.printers.ensurePrinters = [{
|
||||
@ -22,32 +34,19 @@ let
|
||||
model = "drv:///sample.drv/deskjet.ppd";
|
||||
}];
|
||||
};
|
||||
printingClient = startWhenNeeded: {
|
||||
|
||||
nodes.client = { ... }: {
|
||||
services.printing.enable = true;
|
||||
services.printing.startWhenNeeded = startWhenNeeded;
|
||||
services.printing.startWhenNeeded = socket;
|
||||
# Add printer to the client as well, via IPP.
|
||||
hardware.printers.ensurePrinters = [{
|
||||
name = "DeskjetRemote";
|
||||
deviceUri = "ipp://${if startWhenNeeded then "socketActivatedServer" else "serviceServer"}/printers/DeskjetLocal";
|
||||
deviceUri = "ipp://server/printers/DeskjetLocal";
|
||||
model = "drv:///sample.drv/deskjet.ppd";
|
||||
}];
|
||||
hardware.printers.ensureDefaultPrinter = "DeskjetRemote";
|
||||
};
|
||||
|
||||
in {
|
||||
name = "printing";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ domenkozar eelco matthewbauer ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
socketActivatedServer = { ... }: (printingServer true);
|
||||
serviceServer = { ... }: (printingServer false);
|
||||
|
||||
socketActivatedClient = { ... }: (printingClient true);
|
||||
serviceClient = { ... }: (printingClient false);
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
import os
|
||||
import re
|
||||
@ -55,75 +54,69 @@ in {
|
||||
start_all()
|
||||
|
||||
with subtest("Make sure that cups is up on both sides and printers are set up"):
|
||||
serviceServer.wait_for_unit("cups.service")
|
||||
serviceClient.wait_for_unit("cups.service")
|
||||
socketActivatedClient.wait_for_unit("ensure-printers.service")
|
||||
server.wait_for_unit("cups.${if socket then "socket" else "service"}")
|
||||
client.wait_for_unit("cups.${if socket then "socket" else "service"}")
|
||||
|
||||
assert "scheduler is running" in client.succeed("lpstat -r")
|
||||
|
||||
def test_printing(client, server):
|
||||
assert "scheduler is running" in client.succeed("lpstat -r")
|
||||
with subtest("UNIX socket is used for connections"):
|
||||
assert "/var/run/cups/cups.sock" in client.succeed("lpstat -H")
|
||||
|
||||
with subtest("UNIX socket is used for connections"):
|
||||
assert "/var/run/cups/cups.sock" in client.succeed("lpstat -H")
|
||||
with subtest("HTTP server is available too"):
|
||||
client.succeed("curl --fail http://localhost:631/")
|
||||
client.succeed(f"curl --fail http://{server.name}:631/")
|
||||
server.fail(f"curl --fail --connect-timeout 2 http://{client.name}:631/")
|
||||
with subtest("HTTP server is available too"):
|
||||
client.succeed("curl --fail http://localhost:631/")
|
||||
client.succeed(f"curl --fail http://{server.name}:631/")
|
||||
server.fail(f"curl --fail --connect-timeout 2 http://{client.name}:631/")
|
||||
|
||||
with subtest("LP status checks"):
|
||||
assert "DeskjetRemote accepting requests" in client.succeed("lpstat -a")
|
||||
assert "DeskjetLocal accepting requests" in client.succeed(
|
||||
f"lpstat -h {server.name}:631 -a"
|
||||
)
|
||||
client.succeed("cupsdisable DeskjetRemote")
|
||||
out = client.succeed("lpq")
|
||||
print(out)
|
||||
assert re.search(
|
||||
"DeskjetRemote is not ready.*no entries",
|
||||
client.succeed("lpq"),
|
||||
flags=re.DOTALL,
|
||||
)
|
||||
client.succeed("cupsenable DeskjetRemote")
|
||||
assert re.match(
|
||||
"DeskjetRemote is ready.*no entries", client.succeed("lpq"), flags=re.DOTALL
|
||||
with subtest("LP status checks"):
|
||||
assert "DeskjetRemote accepting requests" in client.succeed("lpstat -a")
|
||||
assert "DeskjetLocal accepting requests" in client.succeed(
|
||||
f"lpstat -h {server.name}:631 -a"
|
||||
)
|
||||
client.succeed("cupsdisable DeskjetRemote")
|
||||
out = client.succeed("lpq")
|
||||
print(out)
|
||||
assert re.search(
|
||||
"DeskjetRemote is not ready.*no entries",
|
||||
client.succeed("lpq"),
|
||||
flags=re.DOTALL,
|
||||
)
|
||||
client.succeed("cupsenable DeskjetRemote")
|
||||
assert re.match(
|
||||
"DeskjetRemote is ready.*no entries", client.succeed("lpq"), flags=re.DOTALL
|
||||
)
|
||||
|
||||
# Test printing various file types.
|
||||
for file in [
|
||||
"${pkgs.groff.doc}/share/doc/*/examples/mom/penguin.pdf",
|
||||
"${pkgs.groff.doc}/share/doc/*/meref.ps",
|
||||
"${pkgs.cups.out}/share/doc/cups/images/cups.png",
|
||||
"${pkgs.pcre.doc}/share/doc/pcre/pcre.txt",
|
||||
]:
|
||||
file_name = os.path.basename(file)
|
||||
with subtest(f"print {file_name}"):
|
||||
# Print the file on the client.
|
||||
print(client.succeed("lpq"))
|
||||
client.succeed(f"lp {file}")
|
||||
client.wait_until_succeeds(
|
||||
f"lpq; lpq | grep -q -E 'active.*root.*{file_name}'"
|
||||
)
|
||||
|
||||
# Test printing various file types.
|
||||
for file in [
|
||||
"${pkgs.groff.doc}/share/doc/*/examples/mom/penguin.pdf",
|
||||
"${pkgs.groff.doc}/share/doc/*/meref.ps",
|
||||
"${pkgs.cups.out}/share/doc/cups/images/cups.png",
|
||||
"${pkgs.pcre.doc}/share/doc/pcre/pcre.txt",
|
||||
]:
|
||||
file_name = os.path.basename(file)
|
||||
with subtest(f"print {file_name}"):
|
||||
# Print the file on the client.
|
||||
print(client.succeed("lpq"))
|
||||
client.succeed(f"lp {file}")
|
||||
client.wait_until_succeeds(
|
||||
f"lpq; lpq | grep -q -E 'active.*root.*{file_name}'"
|
||||
)
|
||||
# Ensure that a raw PCL file appeared in the server's queue
|
||||
# (showing that the right filters have been applied). Of
|
||||
# course, since there is no actual USB printer attached, the
|
||||
# file will stay in the queue forever.
|
||||
server.wait_for_file("/var/spool/cups/d*-001")
|
||||
server.wait_until_succeeds(f"lpq -a | grep -q -E '{file_name}'")
|
||||
|
||||
# Ensure that a raw PCL file appeared in the server's queue
|
||||
# (showing that the right filters have been applied). Of
|
||||
# course, since there is no actual USB printer attached, the
|
||||
# file will stay in the queue forever.
|
||||
server.wait_for_file("/var/spool/cups/d*-001")
|
||||
server.wait_until_succeeds(f"lpq -a | grep -q -E '{file_name}'")
|
||||
# Delete the job on the client. It should disappear on the
|
||||
# server as well.
|
||||
client.succeed("lprm")
|
||||
client.wait_until_succeeds("lpq -a | grep -q -E 'no entries'")
|
||||
|
||||
# Delete the job on the client. It should disappear on the
|
||||
# server as well.
|
||||
client.succeed("lprm")
|
||||
client.wait_until_succeeds("lpq -a | grep -q -E 'no entries'")
|
||||
retry(lambda _: "no entries" in server.succeed("lpq -a"))
|
||||
|
||||
retry(lambda _: "no entries" in server.succeed("lpq -a"))
|
||||
|
||||
# The queue is empty already, so this should be safe.
|
||||
# Otherwise, pairs of "c*"-"d*-001" files might persist.
|
||||
server.execute("rm /var/spool/cups/*")
|
||||
|
||||
|
||||
test_printing(serviceClient, serviceServer)
|
||||
test_printing(socketActivatedClient, socketActivatedServer)
|
||||
# The queue is empty already, so this should be safe.
|
||||
# Otherwise, pairs of "c*"-"d*-001" files might persist.
|
||||
server.execute("rm /var/spool/cups/*")
|
||||
'';
|
||||
})
|
||||
|
99
nixos/tests/systemd-homed.nix
Normal file
99
nixos/tests/systemd-homed.nix
Normal file
@ -0,0 +1,99 @@
|
||||
import ./make-test-python.nix ({ pkgs, lib, ... }:
|
||||
let
|
||||
password = "foobar";
|
||||
newPass = "barfoo";
|
||||
in
|
||||
{
|
||||
name = "systemd-homed";
|
||||
nodes.machine = { config, pkgs, ... }: {
|
||||
services.homed.enable = true;
|
||||
|
||||
users.users.test-normal-user = {
|
||||
extraGroups = [ "wheel" ];
|
||||
isNormalUser = true;
|
||||
initialPassword = password;
|
||||
};
|
||||
};
|
||||
testScript = ''
|
||||
def switchTTY(number):
|
||||
machine.send_key(f"alt-f{number}")
|
||||
machine.wait_until_succeeds(f"[ $(fgconsole) = {number} ]")
|
||||
machine.wait_for_unit(f"getty@tty{number}.service")
|
||||
machine.wait_until_succeeds(f"pgrep -f 'agetty.*tty{number}'")
|
||||
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
|
||||
# Smoke test to make sure the pam changes didn't break regular users.
|
||||
machine.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
|
||||
with subtest("login as regular user"):
|
||||
switchTTY(2)
|
||||
machine.wait_until_tty_matches("2", "login: ")
|
||||
machine.send_chars("test-normal-user\n")
|
||||
machine.wait_until_tty_matches("2", "login: test-normal-user")
|
||||
machine.wait_until_tty_matches("2", "Password: ")
|
||||
machine.send_chars("${password}\n")
|
||||
machine.wait_until_succeeds("pgrep -u test-normal-user bash")
|
||||
machine.send_chars("whoami > /tmp/1\n")
|
||||
machine.wait_for_file("/tmp/1")
|
||||
assert "test-normal-user" in machine.succeed("cat /tmp/1")
|
||||
|
||||
with subtest("create homed encrypted user"):
|
||||
# TODO: Figure out how to pass password manually.
|
||||
#
|
||||
# This environment variable is used for homed internal testing
|
||||
# and is not documented.
|
||||
machine.succeed("NEWPASSWORD=${password} homectl create --shell=/run/current-system/sw/bin/bash --storage=luks -G wheel test-homed-user")
|
||||
|
||||
with subtest("login as homed user"):
|
||||
switchTTY(3)
|
||||
machine.wait_until_tty_matches("3", "login: ")
|
||||
machine.send_chars("test-homed-user\n")
|
||||
machine.wait_until_tty_matches("3", "login: test-homed-user")
|
||||
machine.wait_until_tty_matches("3", "Password: ")
|
||||
machine.send_chars("${password}\n")
|
||||
machine.wait_until_succeeds("pgrep -t tty3 -u test-homed-user bash")
|
||||
machine.send_chars("whoami > /tmp/2\n")
|
||||
machine.wait_for_file("/tmp/2")
|
||||
assert "test-homed-user" in machine.succeed("cat /tmp/2")
|
||||
|
||||
with subtest("change homed user password"):
|
||||
switchTTY(4)
|
||||
machine.wait_until_tty_matches("4", "login: ")
|
||||
machine.send_chars("test-homed-user\n")
|
||||
machine.wait_until_tty_matches("4", "login: test-homed-user")
|
||||
machine.wait_until_tty_matches("4", "Password: ")
|
||||
machine.send_chars("${password}\n")
|
||||
machine.wait_until_succeeds("pgrep -t tty4 -u test-homed-user bash")
|
||||
machine.send_chars("passwd\n")
|
||||
# homed does it in a weird order, it asks for new passes, then it asks
|
||||
# for the old one.
|
||||
machine.sleep(2)
|
||||
machine.send_chars("${newPass}\n")
|
||||
machine.sleep(2)
|
||||
machine.send_chars("${newPass}\n")
|
||||
machine.sleep(4)
|
||||
machine.send_chars("${password}\n")
|
||||
machine.wait_until_fails("pgrep -t tty4 passwd")
|
||||
|
||||
@polling_condition
|
||||
def not_logged_in_tty5():
|
||||
machine.fail("pgrep -t tty5 bash")
|
||||
|
||||
switchTTY(5)
|
||||
with not_logged_in_tty5: # type: ignore[union-attr]
|
||||
machine.wait_until_tty_matches("5", "login: ")
|
||||
machine.send_chars("test-homed-user\n")
|
||||
machine.wait_until_tty_matches("5", "login: test-homed-user")
|
||||
machine.wait_until_tty_matches("5", "Password: ")
|
||||
machine.send_chars("${password}\n")
|
||||
machine.wait_until_tty_matches("5", "Password incorrect or not sufficient for authentication of user test-homed-user.")
|
||||
machine.wait_until_tty_matches("5", "Sorry, try again: ")
|
||||
machine.send_chars("${newPass}\n")
|
||||
machine.send_chars("whoami > /tmp/4\n")
|
||||
machine.wait_for_file("/tmp/4")
|
||||
assert "test-homed-user" in machine.succeed("cat /tmp/4")
|
||||
|
||||
with subtest("homed user should be in wheel according to NSS"):
|
||||
machine.succeed("userdbctl group wheel -s io.systemd.NameServiceSwitch | grep test-homed-user")
|
||||
'';
|
||||
})
|
32
nixos/tests/systemd-userdbd.nix
Normal file
32
nixos/tests/systemd-userdbd.nix
Normal file
@ -0,0 +1,32 @@
|
||||
import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
||||
name = "systemd-userdbd";
|
||||
nodes.machine = { config, pkgs, ... }: {
|
||||
services.userdbd.enable = true;
|
||||
|
||||
users.users.test-user-nss = {
|
||||
isNormalUser = true;
|
||||
};
|
||||
|
||||
environment.etc."userdb/test-user-dropin.user".text = builtins.toJSON {
|
||||
userName = "test-user-dropin";
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ libvarlink ];
|
||||
};
|
||||
testScript = ''
|
||||
import json
|
||||
from shlex import quote
|
||||
|
||||
def getUserRecord(name):
|
||||
Interface = "unix:/run/systemd/userdb/io.systemd.Multiplexer/io.systemd.UserDatabase"
|
||||
payload = json.dumps({
|
||||
"service": "io.systemd.Multiplexer",
|
||||
"userName": name
|
||||
})
|
||||
return json.loads(machine.succeed(f"varlink call {Interface}.GetUserRecord {quote(payload)}"))
|
||||
|
||||
machine.wait_for_unit("systemd-userdbd.socket")
|
||||
getUserRecord("test-user-nss")
|
||||
getUserRecord("test-user-dropin")
|
||||
'';
|
||||
})
|
@ -20,7 +20,11 @@ stdenv.mkDerivation rec {
|
||||
++ lib.optionals stdenv.isLinux [ alsa-lib libpulseaudio ]
|
||||
++ lib.optionals stdenv.isDarwin [ AudioUnit CoreAudio CoreMIDI CoreServices ];
|
||||
|
||||
cmakeFlags = [ "-Denable-framework=off" ];
|
||||
cmakeFlags = [
|
||||
"-Denable-framework=off"
|
||||
# set CMAKE_INSTALL_NAME_DIR to correct value on darwin
|
||||
"-DCMAKE_INSTALL_LIBDIR=lib"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Real-time software synthesizer based on the SoundFont 2 specifications";
|
||||
|
@ -54,7 +54,7 @@ python3Packages.buildPythonApplication rec {
|
||||
mpv
|
||||
peewee
|
||||
pygobject3
|
||||
python-Levenshtein
|
||||
levenshtein
|
||||
python-dateutil
|
||||
requests
|
||||
semver
|
||||
|
@ -6,21 +6,16 @@
|
||||
|
||||
let chia = python3Packages.buildPythonApplication rec {
|
||||
pname = "chia";
|
||||
version = "1.6.0";
|
||||
version = "1.6.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Chia-Network";
|
||||
repo = "chia-blockchain";
|
||||
rev = version;
|
||||
fetchSubmodules = true;
|
||||
hash = "sha256-TNaHPvN19fkRqkQHtqdeEDwhqbntcVhxXhY8TNIScEg=";
|
||||
hash = "sha256-BgUgTYpjFsKisfFni8TzSYQ8+S3P+7m78DuyjWF5xh8=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# chia tries to put lock files in the python modules directory
|
||||
./dont_lock_in_store.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace setup.py \
|
||||
--replace "==" ">="
|
||||
@ -59,6 +54,7 @@ let chia = python3Packages.buildPythonApplication rec {
|
||||
fasteners
|
||||
filelock
|
||||
keyrings-cryptfile
|
||||
psutil
|
||||
pyyaml
|
||||
setproctitle
|
||||
setuptools # needs pkg_resources at runtime
|
||||
|
@ -1,21 +0,0 @@
|
||||
--- a/chia/wallet/puzzles/load_clvm.py
|
||||
+++ b/chia/wallet/puzzles/load_clvm.py
|
||||
@@ -82,18 +82,6 @@ def load_serialized_clvm(clvm_filename, package_or_requirement=__name__) -> Seri
|
||||
"""
|
||||
hex_filename = f"{clvm_filename}.hex"
|
||||
|
||||
- try:
|
||||
- if pkg_resources.resource_exists(package_or_requirement, clvm_filename):
|
||||
- # Establish whether the size is zero on entry
|
||||
- full_path = pathlib.Path(pkg_resources.resource_filename(package_or_requirement, clvm_filename))
|
||||
- output = full_path.parent / hex_filename
|
||||
- compile_clvm(full_path, output, search_paths=[full_path.parent])
|
||||
-
|
||||
- except NotImplementedError:
|
||||
- # pyinstaller doesn't support `pkg_resources.resource_exists`
|
||||
- # so we just fall through to loading the hex clvm
|
||||
- pass
|
||||
-
|
||||
clvm_hex = pkg_resources.resource_string(package_or_requirement, hex_filename).decode("utf8")
|
||||
assert len(clvm_hex.strip()) != 0
|
||||
clvm_blob = bytes.fromhex(clvm_hex)
|
@ -7,7 +7,7 @@
|
||||
|
||||
let
|
||||
pythonEnv = pythonPackages.python.withPackages(p: with p; [
|
||||
regex setuptools python-Levenshtein pyenchant
|
||||
regex setuptools levenshtein pyenchant
|
||||
pygobject3 pycairo pypandoc chardet
|
||||
]);
|
||||
|
||||
|
@ -20,7 +20,7 @@ in
|
||||
rec {
|
||||
launcher = runCommand "octave-kernel-launcher" {
|
||||
inherit octave;
|
||||
python = python3.withPackages (ps: [ ps.traitlets ps.jupyter_core ps.ipykernel ps.metakernel kernel ]);
|
||||
python = python3.withPackages (ps: [ ps.traitlets ps.jupyter-core ps.ipykernel ps.metakernel kernel ]);
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
} ''
|
||||
mkdir -p $out/bin
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
echo "unpacking $src..."
|
||||
|
@ -35,7 +35,5 @@ stdenv.mkDerivation rec {
|
||||
license = with licenses; [ publicDomain ];
|
||||
maintainers = with maintainers; [ xaverdh irenes ];
|
||||
platforms = platforms.unix;
|
||||
# never built on aarch64-darwin since first introduction in nixpkgs
|
||||
broken = stdenv.isDarwin && stdenv.isAarch64;
|
||||
};
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ python3Packages.buildPythonApplication rec {
|
||||
dbus-python
|
||||
pygobject3
|
||||
pyinotify
|
||||
python-Levenshtein
|
||||
levenshtein
|
||||
pyxdg
|
||||
pycairo
|
||||
requests
|
||||
|
@ -45,7 +45,7 @@ let
|
||||
mv bin/nomad-autoscaler $bin/bin
|
||||
ln -s $bin/bin/nomad-autoscaler $out/bin/nomad-autoscaler
|
||||
|
||||
for d in $outputs; do
|
||||
for d in $(getAllOutputNames); do
|
||||
mkdir -p ''${!d}/share
|
||||
done
|
||||
rmdir $bin/share
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
tar --extract --file=$src libreoffice-$version/download.lst -O > $out
|
||||
|
@ -155,7 +155,7 @@ python.pkgs.pythonPackages.buildPythonApplication rec {
|
||||
python-dateutil
|
||||
python-dotenv
|
||||
python-gnupg
|
||||
python-Levenshtein
|
||||
levenshtein
|
||||
python-magic
|
||||
pytz
|
||||
pyyaml
|
||||
|
@ -7,7 +7,7 @@
|
||||
, pycountry
|
||||
, whoosh
|
||||
, termcolor
|
||||
, python-Levenshtein
|
||||
, levenshtein
|
||||
, pygobject3
|
||||
, pyocr
|
||||
, natsort
|
||||
@ -55,7 +55,7 @@ buildPythonPackage rec {
|
||||
pygobject3
|
||||
pyocr
|
||||
pypillowfight
|
||||
python-Levenshtein
|
||||
levenshtein
|
||||
poppler_gi
|
||||
scikit-learn
|
||||
termcolor
|
||||
|
@ -26,8 +26,6 @@ stdenv.mkDerivation rec {
|
||||
maintainers = [ maintainers.mafo ];
|
||||
license = "xearth";
|
||||
platforms=platforms.unix;
|
||||
# never built on aarch64-darwin since first introduction in nixpkgs
|
||||
broken = stdenv.isDarwin && stdenv.isAarch64;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ python3Packages.buildPythonApplication rec {
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [
|
||||
pyvcf
|
||||
python-Levenshtein
|
||||
levenshtein
|
||||
progressbar2
|
||||
pysam
|
||||
pyfaidx
|
||||
|
@ -49,7 +49,7 @@
|
||||
, boost
|
||||
, singular
|
||||
, pip
|
||||
, jupyter_core
|
||||
, jupyter-core
|
||||
, sage-setup
|
||||
, libhomfly
|
||||
, libbraiding
|
||||
@ -87,7 +87,7 @@ buildPythonPackage rec {
|
||||
nativeBuildInputs = [
|
||||
iml
|
||||
perl
|
||||
jupyter_core
|
||||
jupyter-core
|
||||
pkg-config
|
||||
sage-setup
|
||||
pip # needed to query installed packages
|
||||
|
@ -1,7 +1,7 @@
|
||||
{ lib, bzip2, cmake, eigen, fetchFromGitHub, ffmpeg, fox_1_6, gdal,
|
||||
git, gl2ps, gpp , gtest, jdk, libGL, libGLU, libX11, libjpeg,
|
||||
libpng, libtiff, libxcrypt, openscenegraph , proj, python3,
|
||||
python37Packages, stdenv, swig, xercesc, xorg, zlib }:
|
||||
python3Packages, stdenv, swig, xercesc, xorg, zlib }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "sumo";
|
||||
@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
|
||||
libxcrypt
|
||||
openscenegraph
|
||||
proj
|
||||
python37Packages.setuptools
|
||||
python3Packages.setuptools
|
||||
xercesc
|
||||
zlib
|
||||
python3
|
||||
|
@ -60,6 +60,8 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
cargoSha256 = "sha256-t6ckX0PYI8UHfXhGRpcX8ly3DzE9A6i9P6f3Ny3DBzw=";
|
||||
|
||||
auditable = true; # TODO: remove when this is the default
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
installShellFiles
|
||||
|
@ -7,6 +7,7 @@
|
||||
, lib
|
||||
, packaging
|
||||
, poetry-core
|
||||
, py
|
||||
, pytest-freezegun
|
||||
, pytest-mock
|
||||
, pytest-regressions
|
||||
@ -18,17 +19,18 @@
|
||||
, typing-extensions
|
||||
, argcomplete
|
||||
, nix-update-script
|
||||
, pre-commit
|
||||
}:
|
||||
|
||||
buildPythonApplication rec {
|
||||
pname = "commitizen";
|
||||
version = "2.37.0";
|
||||
version = "2.38.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "commitizen-tools";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
hash = "sha256-wo1I6QDWLxByHISmkPdass+BcKh0oxR5hD31UN/5+WQ=";
|
||||
hash = "sha256-W+k+hqH0TKQAXf1Em6A1/VdqzJkhYp99I3lbqH6iDDc=";
|
||||
deepClone = true;
|
||||
};
|
||||
|
||||
@ -36,6 +38,11 @@ buildPythonApplication rec {
|
||||
|
||||
nativeBuildInputs = [ poetry-core ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace 'charset-normalizer = "^2.1.0"' 'charset-normalizer = "*"'
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [
|
||||
termcolor
|
||||
questionary
|
||||
@ -52,6 +59,8 @@ buildPythonApplication rec {
|
||||
doCheck = true;
|
||||
|
||||
checkInputs = [
|
||||
pre-commit
|
||||
py
|
||||
pytestCheckHook
|
||||
pytest-freezegun
|
||||
pytest-mock
|
||||
@ -79,6 +88,8 @@ buildPythonApplication rec {
|
||||
"test_bump_pre_commit_changelog"
|
||||
"test_bump_pre_commit_changelog_fails_always"
|
||||
"test_get_commits_with_signature"
|
||||
# fatal: not a git repository (or any of the parent directories): .git
|
||||
"test_commitizen_debug_excepthook"
|
||||
];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
@ -12,7 +12,7 @@
|
||||
, withManual ? true
|
||||
, pythonSupport ? true
|
||||
, withpcre2 ? true
|
||||
, sendEmailSupport ? false
|
||||
, sendEmailSupport ? perlSupport
|
||||
, Security, CoreServices
|
||||
, nixosTests
|
||||
, withLibsecret ? false
|
||||
@ -28,7 +28,7 @@ assert sendEmailSupport -> perlSupport;
|
||||
assert svnSupport -> perlSupport;
|
||||
|
||||
let
|
||||
version = "2.38.1";
|
||||
version = "2.39.0";
|
||||
svn = subversionClient.override { perlBindings = perlSupport; };
|
||||
gitwebPerlLibs = with perlPackages; [ CGI HTMLParser CGIFast FCGI FCGIProcManager HTMLTagCloud ];
|
||||
in
|
||||
@ -41,7 +41,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.kernel.org/pub/software/scm/git/git-${version}.tar.xz";
|
||||
sha256 = "sha256-l9346liiueD7wlCOJFAoynWRG9ONFVFhaxSMGqV0Ctk=";
|
||||
sha256 = "sha256-uhmbE/tamco97JF7C9c2vA61qd+Hc31DXt398Q1pJls=";
|
||||
};
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional withManual "doc";
|
||||
|
@ -13,7 +13,7 @@ let
|
||||
owner = "jstasiak";
|
||||
repo = "python-zeroconf";
|
||||
rev = version;
|
||||
sha256 = "158dqay74zvnz6kmpvip4ml0kw59nf2aaajwgaamx0zc8ci1p5pj";
|
||||
hash = "sha256-8pYbIkPsg16VelwqpYSzqfAJaCU37lun+XZ/crzCDZU=";
|
||||
};
|
||||
});
|
||||
|
||||
@ -29,7 +29,7 @@ let
|
||||
version = "9.2.0";
|
||||
src = oldAttrs.src.override {
|
||||
inherit version;
|
||||
sha256 = "02ig2wf2yyrnnl88r2n13s1naskwsifwgx3syifmcxygflsmjd3d";
|
||||
hash = "sha256-bTRZNXXPd1Zd9Hr0x13UfGplgx7BiowQtTZ7LxwXLwo=";
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -56,9 +56,9 @@ let
|
||||
bintoolsVersion = lib.getVersion bintools;
|
||||
bintoolsName = lib.removePrefix targetPrefix (lib.getName bintools);
|
||||
|
||||
libc_bin = if libc == null then null else getBin libc;
|
||||
libc_dev = if libc == null then null else getDev libc;
|
||||
libc_lib = if libc == null then null else getLib libc;
|
||||
libc_bin = if libc == null then "" else getBin libc;
|
||||
libc_dev = if libc == null then "" else getDev libc;
|
||||
libc_lib = if libc == null then "" else getLib libc;
|
||||
bintools_bin = if nativeTools then "" else getBin bintools;
|
||||
# The wrapper scripts use 'cat' and 'grep', so we may need coreutils.
|
||||
coreutils_bin = if nativeTools then "" else getBin coreutils;
|
||||
@ -69,7 +69,7 @@ let
|
||||
# The dynamic linker has different names on different platforms. This is a
|
||||
# shell glob that ought to match it.
|
||||
dynamicLinker =
|
||||
/**/ if sharedLibraryLoader == null then null
|
||||
/**/ if sharedLibraryLoader == null then ""
|
||||
else if targetPlatform.libc == "musl" then "${sharedLibraryLoader}/lib/ld-musl-*"
|
||||
else if targetPlatform.libc == "uclibc" then "${sharedLibraryLoader}/lib/ld*-uClibc.so.1"
|
||||
else if (targetPlatform.libc == "bionic" && targetPlatform.is32bit) then "/system/bin/linker"
|
||||
@ -88,7 +88,7 @@ let
|
||||
else if targetPlatform.isDarwin then "/usr/lib/dyld"
|
||||
else if targetPlatform.isFreeBSD then "/libexec/ld-elf.so.1"
|
||||
else if lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1"
|
||||
else null;
|
||||
else "";
|
||||
|
||||
expand-response-params =
|
||||
if buildPackages ? stdenv && buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null"
|
||||
@ -104,15 +104,10 @@ stdenv.mkDerivation {
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
inherit bintools_bin libc_bin libc_dev libc_lib coreutils_bin;
|
||||
shell = getBin shell + shell.shellPath or "";
|
||||
gnugrep_bin = if nativeTools then "" else gnugrep;
|
||||
|
||||
inherit targetPrefix suffixSalt;
|
||||
|
||||
outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (bintools ? info) "info");
|
||||
|
||||
passthru = {
|
||||
inherit targetPrefix suffixSalt;
|
||||
inherit bintools libc nativeTools nativeLibc nativePrefix;
|
||||
|
||||
emacsBufferSetup = pkgs: ''
|
||||
@ -206,8 +201,6 @@ stdenv.mkDerivation {
|
||||
strictDeps = true;
|
||||
depsTargetTargetPropagated = extraPackages;
|
||||
|
||||
wrapperName = "BINTOOLS_WRAPPER";
|
||||
|
||||
setupHooks = [
|
||||
../setup-hooks/role.bash
|
||||
./setup-hook.sh
|
||||
@ -379,10 +372,15 @@ stdenv.mkDerivation {
|
||||
##
|
||||
+ extraBuildCommands;
|
||||
|
||||
inherit dynamicLinker;
|
||||
|
||||
# for substitution in utils.bash
|
||||
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
|
||||
env = {
|
||||
# for substitution in utils.bash
|
||||
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
|
||||
shell = getBin shell + shell.shellPath or "";
|
||||
gnugrep_bin = if nativeTools then "" else gnugrep;
|
||||
wrapperName = "BINTOOLS_WRAPPER";
|
||||
inherit dynamicLinker targetPrefix suffixSalt coreutils_bin;
|
||||
inherit bintools_bin libc_bin libc_dev libc_lib;
|
||||
};
|
||||
|
||||
meta =
|
||||
let bintools_ = if bintools != null then bintools else {}; in
|
||||
|
@ -42,9 +42,9 @@ let
|
||||
ccVersion = lib.getVersion cc;
|
||||
ccName = lib.removePrefix targetPrefix (lib.getName cc);
|
||||
|
||||
libc_bin = if libc == null then null else getBin libc;
|
||||
libc_dev = if libc == null then null else getDev libc;
|
||||
libc_lib = if libc == null then null else getLib libc;
|
||||
libc_bin = if libc == null then "" else getBin libc;
|
||||
libc_dev = if libc == null then "" else getDev libc;
|
||||
libc_lib = if libc == null then "" else getLib libc;
|
||||
cc_solib = getLib cc
|
||||
+ optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}";
|
||||
|
||||
@ -132,22 +132,16 @@ stdenv.mkDerivation {
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
inherit cc libc_bin libc_dev libc_lib bintools coreutils_bin;
|
||||
shell = getBin shell + shell.shellPath or "";
|
||||
gnugrep_bin = if nativeTools then "" else gnugrep;
|
||||
|
||||
inherit targetPrefix suffixSalt;
|
||||
inherit darwinPlatformForCC darwinMinVersion darwinMinVersionVariable;
|
||||
|
||||
outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ];
|
||||
|
||||
passthru = {
|
||||
inherit targetPrefix suffixSalt;
|
||||
# "cc" is the generic name for a C compiler, but there is no one for package
|
||||
# providing the linker and related tools. The two we use now are GNU
|
||||
# Binutils, and Apple's "cctools"; "bintools" as an attempt to find an
|
||||
# unused middle-ground name that evokes both.
|
||||
inherit bintools;
|
||||
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang;
|
||||
inherit cc libc nativeTools nativeLibc nativePrefix isGNU isClang;
|
||||
|
||||
emacsBufferSetup = pkgs: ''
|
||||
; We should handle propagation here too
|
||||
@ -276,8 +270,6 @@ stdenv.mkDerivation {
|
||||
propagatedBuildInputs = [ bintools ] ++ extraTools ++ optionals cc.langD or false [ zlib ];
|
||||
depsTargetTargetPropagated = optional (libcxx != null) libcxx ++ extraPackages;
|
||||
|
||||
wrapperName = "CC_WRAPPER";
|
||||
|
||||
setupHooks = [
|
||||
../setup-hooks/role.bash
|
||||
] ++ lib.optional (cc.langC or true) ./setup-hook.sh
|
||||
@ -549,8 +541,16 @@ stdenv.mkDerivation {
|
||||
nixSupport);
|
||||
|
||||
|
||||
# for substitution in utils.bash
|
||||
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
|
||||
env = {
|
||||
# for substitution in utils.bash
|
||||
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
|
||||
shell = getBin shell + shell.shellPath or "";
|
||||
gnugrep_bin = if nativeTools then "" else gnugrep;
|
||||
wrapperName = "CC_WRAPPER";
|
||||
inherit suffixSalt coreutils_bin bintools cc;
|
||||
inherit libc_bin libc_dev libc_lib;
|
||||
inherit darwinPlatformForCC darwinMinVersion darwinMinVersionVariable;
|
||||
};
|
||||
|
||||
meta =
|
||||
let cc_ = if cc != null then cc else {}; in
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source "$stdenv/setup"
|
||||
|
||||
header "exporting \`$url' (revision $rev) into \`$out'"
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
(echo "#!$SHELL"; \
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
tagtext=""
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source "${stdenv}/setup"
|
||||
header "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}"
|
||||
mkdir -p "${out}"
|
||||
@ -8,7 +9,7 @@ cat <<EOF > "${out}/compositeImage.sh"
|
||||
# Create a tar archive of a docker image's layers, docker image config
|
||||
# json, manifest.json, and repositories json; this streams directly to
|
||||
# stdout and is intended to be used in concert with docker load, i.e:
|
||||
#
|
||||
#
|
||||
# ${out}/compositeImage.sh | docker load
|
||||
|
||||
# The first character follow the 's' command for sed becomes the
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
header "Cloning Fossil $url [$rev] into $out"
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
# - no revision specified and remote has a HEAD which is used
|
||||
# - revision specified and remote has a HEAD
|
||||
# - revision specified and remote without HEAD
|
||||
#
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
header "exporting $url (rev $rev) into $out"
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
header "getting $url${rev:+ ($rev)} into $out"
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
# Curl flags to handle redirects, not use EPSV, handle cookies for
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
set -x
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
header "exporting $url (r$rev) into $out"
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
header "exporting $url (r$rev) into $out"
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
source $mirrorsFile
|
||||
|
@ -32,8 +32,10 @@ stdenvNoCC.mkDerivation {
|
||||
'';
|
||||
|
||||
# FIXME: get rid of perl dependency.
|
||||
inherit perl;
|
||||
inherit (builtins) storeDir;
|
||||
shell = lib.getBin shell + (shell.shellPath or "");
|
||||
signingUtils = if darwinCodeSign then signingUtils else null;
|
||||
env = {
|
||||
inherit perl;
|
||||
inherit (builtins) storeDir;
|
||||
shell = lib.getBin shell + (shell.shellPath or "");
|
||||
signingUtils = if darwinCodeSign then signingUtils else "";
|
||||
};
|
||||
}
|
||||
|
@ -36,13 +36,10 @@ stdenv.mkDerivation {
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
shell = getBin stdenvNoCC.shell + stdenvNoCC.shell.shellPath or "";
|
||||
|
||||
inherit targetPrefix suffixSalt baseBinName;
|
||||
|
||||
outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (pkg-config ? doc) "doc");
|
||||
|
||||
passthru = {
|
||||
inherit targetPrefix suffixSalt;
|
||||
inherit pkg-config;
|
||||
};
|
||||
|
||||
@ -83,8 +80,6 @@ stdenv.mkDerivation {
|
||||
ln -s ${pkg-config}/share $out/share
|
||||
'';
|
||||
|
||||
wrapperName = "PKG_CONFIG_WRAPPER";
|
||||
|
||||
setupHooks = [
|
||||
../setup-hooks/role.bash
|
||||
./setup-hook.sh
|
||||
@ -120,6 +115,12 @@ stdenv.mkDerivation {
|
||||
##
|
||||
+ extraBuildCommands;
|
||||
|
||||
env = {
|
||||
shell = getBin stdenvNoCC.shell + stdenvNoCC.shell.shellPath or "";
|
||||
wrapperName = "PKG_CONFIG_WRAPPER";
|
||||
inherit targetPrefix suffixSalt baseBinName;
|
||||
};
|
||||
|
||||
meta =
|
||||
let pkg-config_ = if pkg-config != null then pkg-config else {}; in
|
||||
(if pkg-config_ ? meta then removeAttrs pkg-config.meta ["priority"] else {}) //
|
||||
|
@ -124,7 +124,7 @@ stdenv.mkDerivation (
|
||||
echo "$system" > $out/nix-support/system
|
||||
|
||||
if [ -z "${toString doingAnalysis}" ]; then
|
||||
for i in $outputs; do
|
||||
for i in $(getAllOutputNames); do
|
||||
if [ "$i" = out ]; then j=none; else j="$i"; fi
|
||||
mkdir -p ''${!i}/nix-support
|
||||
echo "nix-build $j ''${!i}" >> ''${!i}/nix-support/hydra-build-products
|
||||
|
@ -5,12 +5,14 @@
|
||||
, stdenv
|
||||
, callPackage
|
||||
, cacert
|
||||
, git
|
||||
, cargoBuildHook
|
||||
, cargoCheckHook
|
||||
, cargoInstallHook
|
||||
, cargoNextestHook
|
||||
, cargoSetupHook
|
||||
, cargo
|
||||
, cargo-auditable
|
||||
, cargo-auditable-cargo-wrapper
|
||||
, rustc
|
||||
, libiconv
|
||||
, windows
|
||||
@ -42,6 +44,8 @@
|
||||
, buildFeatures ? [ ]
|
||||
, checkFeatures ? buildFeatures
|
||||
, useNextest ? false
|
||||
, auditable ? false # TODO: change to true
|
||||
|
||||
, depsExtraArgs ? {}
|
||||
|
||||
# Toggles whether a custom sysroot is created when the target is a .json file.
|
||||
@ -115,9 +119,12 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg
|
||||
|
||||
patchRegistryDeps = ./patch-registry-deps;
|
||||
|
||||
nativeBuildInputs = nativeBuildInputs ++ [
|
||||
nativeBuildInputs = nativeBuildInputs ++ lib.optionals auditable [
|
||||
(cargo-auditable-cargo-wrapper.override {
|
||||
inherit cargo cargo-auditable;
|
||||
})
|
||||
] ++ [
|
||||
cacert
|
||||
git
|
||||
cargoBuildHook
|
||||
(if useNextest then cargoNextestHook else cargoCheckHook)
|
||||
cargoInstallHook
|
||||
@ -126,6 +133,7 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg
|
||||
];
|
||||
|
||||
buildInputs = buildInputs
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ]
|
||||
++ lib.optionals stdenv.hostPlatform.isMinGW [ windows.pthreads ];
|
||||
|
||||
patches = cargoPatches ++ patches;
|
||||
|
@ -1,6 +1,8 @@
|
||||
cargoSetupPostUnpackHook() {
|
||||
echo "Executing cargoSetupPostUnpackHook"
|
||||
|
||||
export NIX_LDFLAGS+=" @aarch64LinuxGccWorkaround@"
|
||||
|
||||
# Some cargo builds include build hooks that modify their own vendor
|
||||
# dependencies. This copies the vendor directory into the build tree and makes
|
||||
# it writable. If we're using a tarball, the unpackFile hook already handles
|
||||
|
@ -107,6 +107,9 @@ in {
|
||||
host-config = true
|
||||
target-applies-to-host = true
|
||||
'';
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/issues/201254
|
||||
aarch64LinuxGccWorkaround = lib.optionalString (stdenv.isLinux && stdenv.isAarch64 && stdenv.cc.isGNU) "-lgcc";
|
||||
};
|
||||
} ./cargo-setup-hook.sh) {};
|
||||
|
||||
|
@ -16,7 +16,7 @@ auditTmpdir() {
|
||||
header "checking for references to $TMPDIR/ in $dir..."
|
||||
|
||||
local i
|
||||
while IFS= read -r -d $'\0' i; do
|
||||
find "$dir" -type f -print0 | while IFS= read -r -d $'\0' i; do
|
||||
if [[ "$i" =~ .build-id ]]; then continue; fi
|
||||
|
||||
if isELF "$i"; then
|
||||
@ -35,7 +35,7 @@ auditTmpdir() {
|
||||
fi
|
||||
fi
|
||||
|
||||
done < <(find "$dir" -type f -print0)
|
||||
done
|
||||
|
||||
stopNest
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
declare -a autoPatchelfLibs
|
||||
declare -a extraAutoPatchelfLibs
|
||||
@ -84,7 +84,7 @@ autoPatchelf() {
|
||||
# (Expressions don't expand in single quotes, use double quotes for that.)
|
||||
postFixupHooks+=('
|
||||
if [ -z "${dontAutoPatchelf-}" ]; then
|
||||
autoPatchelf -- $(for output in $outputs; do
|
||||
autoPatchelf -- $(for output in $(getAllOutputNames); do
|
||||
[ -e "${!output}" ] || continue
|
||||
echo "${!output}"
|
||||
done)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
fixupOutputHooks+=('convertDesktopFiles $prefix')
|
||||
|
||||
# Get a param out of a desktop file. First parameter is the file and the second
|
||||
|
@ -1,4 +1,4 @@
|
||||
fixupOutputHooks+=(_makeSymlinksRelative)
|
||||
postFixupHooks+=(_makeSymlinksRelative)
|
||||
|
||||
# For every symlink in $output that refers to another file in $output
|
||||
# ensure that the symlink is relative. This removes references to the output
|
||||
|
@ -1,14 +1,19 @@
|
||||
# This setup hook moves $out/{man,doc,info} to $out/share; moves
|
||||
# $out/share/man to $man/share/man; and moves $out/share/doc to
|
||||
# $man/share/doc.
|
||||
# This setup hook moves $out/{man,doc,info} to $out/share.
|
||||
|
||||
preFixupHooks+=(_moveToShare)
|
||||
|
||||
_moveToShare() {
|
||||
forceShare=${forceShare:=man doc info}
|
||||
if [ -n "$__structuredAttrs" ]; then
|
||||
if [ -z "${forceShare-}" ]; then
|
||||
forceShare=( man doc info )
|
||||
fi
|
||||
else
|
||||
forceShare=( ${forceShare:-man doc info} )
|
||||
fi
|
||||
|
||||
if [[ -z "$out" ]]; then return; fi
|
||||
|
||||
for d in $forceShare; do
|
||||
for d in "${forceShare[@]}"; do
|
||||
if [ -d "$out/$d" ]; then
|
||||
if [ -d "$out/share/$d" ]; then
|
||||
echo "both $d/ and share/$d/ exist!"
|
||||
@ -20,4 +25,3 @@ _moveToShare() {
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
# This setup hook, for each output, moves everything in
|
||||
# $output/lib/systemd/user to $output/share/systemd/user, and replaces
|
||||
|
@ -47,7 +47,7 @@ _overrideFirst outputInfo "info" "$outputBin"
|
||||
|
||||
# Add standard flags to put files into the desired outputs.
|
||||
_multioutConfig() {
|
||||
if [ "$outputs" = "out" ] || [ -z "${setOutputFlags-1}" ]; then return; fi;
|
||||
if [ "$(getAllOutputNames)" = "out" ] || [ -z "${setOutputFlags-1}" ]; then return; fi;
|
||||
|
||||
# try to detect share/doc/${shareDocName}
|
||||
# Note: sadly, $configureScript detection comes later in configurePhase,
|
||||
@ -66,19 +66,17 @@ _multioutConfig() {
|
||||
fi
|
||||
fi
|
||||
|
||||
configureFlags="\
|
||||
--bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin \
|
||||
--includedir=${!outputInclude}/include --oldincludedir=${!outputInclude}/include \
|
||||
--mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info \
|
||||
--docdir=${!outputDoc}/share/doc/${shareDocName} \
|
||||
--libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec \
|
||||
--localedir=${!outputLib}/share/locale \
|
||||
$configureFlags"
|
||||
prependToVar configureFlags \
|
||||
--bindir="${!outputBin}"/bin --sbindir="${!outputBin}"/sbin \
|
||||
--includedir="${!outputInclude}"/include --oldincludedir="${!outputInclude}"/include \
|
||||
--mandir="${!outputMan}"/share/man --infodir="${!outputInfo}"/share/info \
|
||||
--docdir="${!outputDoc}"/share/doc/"${shareDocName}" \
|
||||
--libdir="${!outputLib}"/lib --libexecdir="${!outputLib}"/libexec \
|
||||
--localedir="${!outputLib}"/share/locale
|
||||
|
||||
installFlags="\
|
||||
pkgconfigdir=${!outputDev}/lib/pkgconfig \
|
||||
m4datadir=${!outputDev}/share/aclocal aclocaldir=${!outputDev}/share/aclocal \
|
||||
$installFlags"
|
||||
prependToVar installFlags \
|
||||
pkgconfigdir="${!outputDev}"/lib/pkgconfig \
|
||||
m4datadir="${!outputDev}"/share/aclocal aclocaldir="${!outputDev}"/share/aclocal
|
||||
}
|
||||
|
||||
|
||||
@ -94,7 +92,7 @@ moveToOutput() {
|
||||
local patt="$1"
|
||||
local dstOut="$2"
|
||||
local output
|
||||
for output in $outputs; do
|
||||
for output in $(getAllOutputNames); do
|
||||
if [ "${!output}" = "$dstOut" ]; then continue; fi
|
||||
local srcPath
|
||||
for srcPath in "${!output}"/$patt; do
|
||||
@ -149,7 +147,7 @@ _multioutDocs() {
|
||||
|
||||
# Move development-only stuff to the desired outputs.
|
||||
_multioutDevs() {
|
||||
if [ "$outputs" = "out" ] || [ -z "${moveToDev-1}" ]; then return; fi;
|
||||
if [ "$(getAllOutputNames)" = "out" ] || [ -z "${moveToDev-1}" ]; then return; fi;
|
||||
moveToOutput include "${!outputInclude}"
|
||||
# these files are sometimes provided even without using the corresponding tool
|
||||
moveToOutput lib/pkgconfig "${!outputDev}"
|
||||
@ -166,10 +164,10 @@ _multioutDevs() {
|
||||
|
||||
# Make the "dev" propagate other outputs needed for development.
|
||||
_multioutPropagateDev() {
|
||||
if [ "$outputs" = "out" ]; then return; fi;
|
||||
if [ "$(getAllOutputNames)" = "out" ]; then return; fi;
|
||||
|
||||
local outputFirst
|
||||
for outputFirst in $outputs; do
|
||||
for outputFirst in $(getAllOutputNames); do
|
||||
break
|
||||
done
|
||||
local propagaterOutput="$outputDev"
|
||||
|
@ -70,7 +70,7 @@ patchPpdFileCommands () {
|
||||
# * outputs of current build before buildInputs
|
||||
# * `/lib/cups/filter' before `/bin`
|
||||
# * add HOST_PATH at end, so we don't miss anything
|
||||
for path in $outputs; do
|
||||
for path in $(getAllOutputNames); do
|
||||
addToSearchPath cupspath "${!path}/lib/cups/filter"
|
||||
addToSearchPath cupspath "${!path}/bin"
|
||||
done
|
||||
|
@ -12,11 +12,20 @@ _doStrip() {
|
||||
local -ra stripCmds=(STRIP STRIP_FOR_TARGET)
|
||||
local -ra ranlibCmds=(RANLIB RANLIB_FOR_TARGET)
|
||||
|
||||
# TODO(structured-attrs): This doesn't work correctly if one of
|
||||
# the items in strip*List or strip*Flags contains a space,
|
||||
# even with structured attrs enabled. This is OK for now
|
||||
# because very few packages set any of these, and it doesn't
|
||||
# affect any of them.
|
||||
#
|
||||
# After __structuredAttrs = true is universal, come back and
|
||||
# push arrays all the way through this logic.
|
||||
|
||||
# Strip only host paths by default. Leave targets as is.
|
||||
stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
|
||||
stripDebugListTarget=${stripDebugListTarget:-}
|
||||
stripAllList=${stripAllList:-}
|
||||
stripAllListTarget=${stripAllListTarget:-}
|
||||
stripDebugList=${stripDebugList[*]:-lib lib32 lib64 libexec bin sbin}
|
||||
stripDebugListTarget=${stripDebugListTarget[*]:-}
|
||||
stripAllList=${stripAllList[*]:-}
|
||||
stripAllListTarget=${stripAllListTarget[*]:-}
|
||||
|
||||
local i
|
||||
for i in ${!stripCmds[@]}; do
|
||||
@ -30,8 +39,8 @@ _doStrip() {
|
||||
if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null
|
||||
then continue; fi
|
||||
|
||||
stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags:--S}"
|
||||
stripDirs "$stripCmd" "$ranlibCmd" "$allDirList" "${stripAllFlags:--s}"
|
||||
stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags[*]:--S}"
|
||||
stripDirs "$stripCmd" "$ranlibCmd" "$allDirList" "${stripAllFlags[*]:--s}"
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ _linkDLLs() {
|
||||
# prefix $PATH by currently-built outputs
|
||||
local DLLPATH=""
|
||||
local outName
|
||||
for outName in $outputs; do
|
||||
for outName in $(getAllOutputNames); do
|
||||
addToSearchPath DLLPATH "${!outName}/bin"
|
||||
done
|
||||
DLLPATH="$DLLPATH:$PATH"
|
||||
|
@ -35,7 +35,7 @@ echo "testBuildFailure: Original builder produced exit code: $r"
|
||||
# -----------------------------------------
|
||||
# Write the build log to the default output
|
||||
|
||||
outs=( $outputs )
|
||||
outs=( $(getAllOutputNames) )
|
||||
defOut=${outs[0]}
|
||||
defOutPath=${!defOut}
|
||||
|
||||
|
@ -48,7 +48,6 @@ denyFileList=(
|
||||
# to be conditionally disabled
|
||||
denyAttrList=(
|
||||
python27Packages
|
||||
python37Packages
|
||||
linuxPackages_
|
||||
rubyPackages_
|
||||
)
|
||||
|
@ -50,7 +50,7 @@ stdenvNoCC.mkDerivation {
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
for output in $outputs; do
|
||||
for output in $(getAllOutputNames); do
|
||||
if [ "$output" != "out" ]; then
|
||||
local outputDir="''${!output}"
|
||||
local iconsDir="$outputDir"/share/icons
|
||||
|
@ -52,7 +52,7 @@ stdenvNoCC.mkDerivation rec {
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
for outputName in $outputs ; do
|
||||
for outputName in $(getAllOutputNames) ; do
|
||||
if [ $outputName != out ]; then
|
||||
local outputDir=''${!outputName};
|
||||
local iconsDir=$outputDir/share/icons
|
||||
|
@ -143,7 +143,7 @@ stdenv.mkDerivation rec {
|
||||
# We use rsync to merge the directories.
|
||||
rsync --archive "${DESTDIR}/etc" "$out"
|
||||
rm --recursive "${DESTDIR}/etc"
|
||||
for o in $outputs; do
|
||||
for o in $(getAllOutputNames); do
|
||||
if [[ "$o" = "debug" ]]; then continue; fi
|
||||
rsync --archive "${DESTDIR}/''${!o}" "$(dirname "''${!o}")"
|
||||
rm --recursive "${DESTDIR}/''${!o}"
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
preConfigure() {
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
export JAVA_HOME=$jre
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
header "exporting egg ${eggName} (version $version) into $out"
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
header "exporting egg ${eggName} (version $version) into $out"
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
pkgdir=$(pwd)/pkg
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
tar xf $src
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
|
||||
|
@ -10,13 +10,13 @@
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "glslang";
|
||||
version = "1.3.231.0";
|
||||
version = "1.3.236.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "glslang";
|
||||
rev = "sdk-${version}";
|
||||
hash = "sha256-huPrQr+lPi7QCF8CufAavHEKGDDimGrcskiojhH9QYk=";
|
||||
hash = "sha256-iVcx1j7OMJEU4cPydNwQSFufTUiqq7GKp69Y6pEt7Wc=";
|
||||
};
|
||||
|
||||
# These get set at all-packages, keep onto them for child drvs
|
||||
@ -28,12 +28,6 @@ stdenv.mkDerivation rec {
|
||||
nativeBuildInputs = [ cmake python3 bison jq ];
|
||||
|
||||
patches = [
|
||||
# https://github.com/NixOS/nixpkgs/pull/201747
|
||||
(fetchpatch {
|
||||
name = "Fix-locations-of-cmake-files-in-side-compat-shims.patch";
|
||||
url = "https://github.com/KhronosGroup/glslang/commit/88fd417b0bb7d91755961c70e846d274c182f2b0.patch";
|
||||
hash = "sha256-rjeaPX5Ieem6zkICNvPd2SjvvLzG5wBERZfDLZEJsAk=";
|
||||
})
|
||||
(fetchpatch {
|
||||
name = "Use-CMAKE_INSTALL_FULL_LIBDIR-in-compat-cmake-files.patch";
|
||||
url = "https://github.com/KhronosGroup/glslang/commit/7627bd89583c5aafb8b38c81c15494019271fabf.patch";
|
||||
|
129
pkgs/development/compilers/hip-common/0000-fixup-paths.patch
Normal file
129
pkgs/development/compilers/hip-common/0000-fixup-paths.patch
Normal file
@ -0,0 +1,129 @@
|
||||
diff --git a/bin/hipcc.pl b/bin/hipcc.pl
|
||||
index da9559b..7aaa540 100755
|
||||
--- a/bin/hipcc.pl
|
||||
+++ b/bin/hipcc.pl
|
||||
@@ -185,7 +185,7 @@ if ($HIP_PLATFORM eq "amd") {
|
||||
chomp($HIP_CLANG_TARGET);
|
||||
|
||||
if (! defined $HIP_CLANG_INCLUDE_PATH) {
|
||||
- $HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include");
|
||||
+ $HIP_CLANG_INCLUDE_PATH = abs_path("@clang@/resource-root/include");
|
||||
}
|
||||
if (! defined $HIP_INCLUDE_PATH) {
|
||||
$HIP_INCLUDE_PATH = "$HIP_PATH/include";
|
||||
@@ -206,8 +206,8 @@ if ($HIP_PLATFORM eq "amd") {
|
||||
print ("HIP_CLANG_TARGET=$HIP_CLANG_TARGET\n");
|
||||
}
|
||||
|
||||
- $HIPCXXFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH/..\"";
|
||||
- $HIPCFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH/..\"";
|
||||
+ $HIPCXXFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH\"";
|
||||
+ $HIPCFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH\"";
|
||||
$HIPLDFLAGS .= " -L\"$HIP_LIB_PATH\"";
|
||||
if ($isWindows) {
|
||||
$HIPLDFLAGS .= " -lamdhip64";
|
||||
@@ -625,7 +625,7 @@ if($HIP_PLATFORM eq "amd"){
|
||||
$targetsStr = $ENV{HCC_AMDGPU_TARGET};
|
||||
} elsif (not $isWindows) {
|
||||
# Else try using rocm_agent_enumerator
|
||||
- $ROCM_AGENT_ENUM = "${ROCM_PATH}/bin/rocm_agent_enumerator";
|
||||
+ $ROCM_AGENT_ENUM = "@rocminfo@/bin/rocm_agent_enumerator";
|
||||
$targetsStr = `${ROCM_AGENT_ENUM} -t GPU`;
|
||||
$targetsStr =~ s/\n/,/g;
|
||||
}
|
||||
@@ -724,16 +724,16 @@ if ($HIP_PLATFORM eq "amd") {
|
||||
|
||||
if (not $isWindows and not $compileOnly) {
|
||||
if ($linkType eq 0) {
|
||||
- $toolArgs = " -L$HIP_LIB_PATH -lamdhip64 -L$ROCM_PATH/lib -lhsa-runtime64 -ldl -lnuma " . ${toolArgs};
|
||||
+ $toolArgs = " -L$HIP_LIB_PATH -lamdhip64 -L@rocm_runtime@/lib -lhsa-runtime64 -ldl -lnuma " . ${toolArgs};
|
||||
} else {
|
||||
$toolArgs = ${toolArgs} . " -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 ";
|
||||
}
|
||||
# To support __fp16 and _Float16, explicitly link with compiler-rt
|
||||
- $HIP_CLANG_BUILTIN_LIB="$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a";
|
||||
+ $HIP_CLANG_BUILTIN_LIB="@clang@/resource-root/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a";
|
||||
if (-e $HIP_CLANG_BUILTIN_LIB) {
|
||||
- $toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET -lclang_rt.builtins "
|
||||
+ $toolArgs .= " -L@clang@/resource-root/lib/$HIP_CLANG_TARGET -lclang_rt.builtins "
|
||||
} else {
|
||||
- $toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/linux -lclang_rt.builtins-x86_64 "
|
||||
+ $toolArgs .= " -L@clang@/resource-root/lib/linux -lclang_rt.builtins-x86_64 "
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/bin/hipconfig.pl b/bin/hipconfig.pl
|
||||
index 5ddb8e9..6a76a2e 100755
|
||||
--- a/bin/hipconfig.pl
|
||||
+++ b/bin/hipconfig.pl
|
||||
@@ -77,7 +77,7 @@ if ($HIP_COMPILER eq "clang") {
|
||||
$CPP_CONFIG = " -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__=";
|
||||
|
||||
$HIP_PATH_INCLUDE = $HIP_PATH."/include";
|
||||
- $HIP_CLANG_INCLUDE = $HIP_CLANG_PATH."/../lib/clang/".$HIP_CLANG_VERSION;
|
||||
+ $HIP_CLANG_INCLUDE = "@clang@/resource-root/include";
|
||||
if($isWindows) {
|
||||
$CPP_CONFIG .= " -I\"$HIP_PATH_INCLUDE\" -I\"$HIP_CLANG_INCLUDE\"";
|
||||
} else {
|
||||
@@ -168,7 +168,7 @@ if (!$printed or $p_full) {
|
||||
print ("HIP_CLANG_PATH : $HIP_CLANG_PATH\n");
|
||||
if ($isWindows) {
|
||||
system("\"$HIP_CLANG_PATH/clang++\" --version");
|
||||
- system("\"$HIP_CLANG_PATH/llc\" --version");
|
||||
+ system("\"@llvm@/bin/llc\" --version");
|
||||
printf("hip-clang-cxxflags : ");
|
||||
$win_output = `perl \"$HIP_PATH/bin/hipcc\" --cxxflags`;
|
||||
printf("$win_output \n");
|
||||
@@ -177,7 +177,7 @@ if (!$printed or $p_full) {
|
||||
printf("$win_output \n");
|
||||
} else {
|
||||
system("$HIP_CLANG_PATH/clang++ --version");
|
||||
- system("$HIP_CLANG_PATH/llc --version");
|
||||
+ system("@llvm@/bin/llc --version");
|
||||
print ("hip-clang-cxxflags : ");
|
||||
system("$HIP_PATH/bin/hipcc --cxxflags");
|
||||
printf("\n");
|
||||
@@ -219,8 +219,8 @@ if (!$printed or $p_full) {
|
||||
system ("uname -a");
|
||||
}
|
||||
|
||||
- if (-e "/usr/bin/lsb_release") {
|
||||
- system ("/usr/bin/lsb_release -a");
|
||||
+ if (-e "@lsb_release@/bin/lsb_release") {
|
||||
+ system ("@lsb_release@/bin/lsb_release -a");
|
||||
}
|
||||
|
||||
print "\n" ;
|
||||
diff --git a/hip-lang-config.cmake.in b/hip-lang-config.cmake.in
|
||||
index 9250a68..f6e27b7 100644
|
||||
--- a/hip-lang-config.cmake.in
|
||||
+++ b/hip-lang-config.cmake.in
|
||||
@@ -71,8 +71,8 @@ get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH)
|
||||
|
||||
|
||||
#need _IMPORT_PREFIX to be set #FILE_REORG_BACKWARD_COMPATIBILITY
|
||||
-file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "${_IMPORT_PREFIX}/../llvm/lib/clang/*/include")
|
||||
-file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "${_IMPORT_PREFIX}/llvm/lib/clang/*/include")
|
||||
+file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "@clang@/resource-root/include")
|
||||
+file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "@clang@/resource-root/include")
|
||||
find_path(HIP_CLANG_INCLUDE_PATH __clang_cuda_math.h
|
||||
HINTS ${HIP_CLANG_INCLUDE_SEARCH_PATHS}
|
||||
${HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG}
|
||||
@@ -89,7 +89,7 @@ find_path(HSA_HEADER hsa/hsa.h
|
||||
PATHS
|
||||
"${_IMPORT_PREFIX}/../include" #FILE_REORG_BACKWARD_COMPATIBILITY
|
||||
"${_IMPORT_PREFIX}/include"
|
||||
- "${ROCM_PATH}/include"
|
||||
+ "@rocm_runtime@/include"
|
||||
)
|
||||
|
||||
if (NOT HSA_HEADER)
|
||||
@@ -97,7 +97,7 @@ if (NOT HSA_HEADER)
|
||||
endif()
|
||||
|
||||
get_filename_component(HIP_COMPILER_INSTALL_PATH ${CMAKE_HIP_COMPILER} DIRECTORY)
|
||||
-file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${HIP_COMPILER_INSTALL_PATH}/../lib/clang/*/lib/*")
|
||||
+file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "@clang@/resource-root/lib/*")
|
||||
find_library(CLANGRT_BUILTINS
|
||||
NAMES
|
||||
clang_rt.builtins
|
59
pkgs/development/compilers/hip-common/default.nix
Normal file
59
pkgs/development/compilers/hip-common/default.nix
Normal file
@ -0,0 +1,59 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, rocmUpdateScript
|
||||
, substituteAll
|
||||
, llvm
|
||||
, rocm-runtime
|
||||
, rocminfo
|
||||
, lsb-release
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "hip-common";
|
||||
version = "5.4.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ROCm-Developer-Tools";
|
||||
repo = "HIP";
|
||||
rev = "rocm-${finalAttrs.version}";
|
||||
hash = "sha256-JpHWTsR2Z8pXp1gNjO29pDYvH/cJvd5Dlpeig33UD28=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./0000-fixup-paths.patch;
|
||||
inherit llvm rocminfo;
|
||||
clang = stdenv.cc;
|
||||
rocm_runtime = rocm-runtime;
|
||||
lsb_release = lsb-release;
|
||||
})
|
||||
];
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
mv * $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateScript = rocmUpdateScript {
|
||||
name = finalAttrs.pname;
|
||||
owner = finalAttrs.src.owner;
|
||||
repo = finalAttrs.src.repo;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "C++ Heterogeneous-Compute Interface for Portability";
|
||||
homepage = "https://github.com/ROCm-Developer-Tools/HIP";
|
||||
license = with licenses; [ mit ];
|
||||
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
|
||||
platforms = platforms.linux;
|
||||
broken = finalAttrs.version != stdenv.cc.version;
|
||||
};
|
||||
})
|
62
pkgs/development/compilers/hip/0000-fixup-paths.patch
Normal file
62
pkgs/development/compilers/hip/0000-fixup-paths.patch
Normal file
@ -0,0 +1,62 @@
|
||||
diff --git a/hip-config.cmake.in b/hip-config.cmake.in
|
||||
index 89d1224..dc9ba05 100755
|
||||
--- a/hip-config.cmake.in
|
||||
+++ b/hip-config.cmake.in
|
||||
@@ -142,7 +142,7 @@ if(HIP_COMPILER STREQUAL "clang")
|
||||
file(TO_CMAKE_PATH "${HIP_PATH}/../lc" HIP_CLANG_ROOT)
|
||||
endif()
|
||||
else()
|
||||
- set(HIP_CLANG_ROOT "${ROCM_PATH}/llvm")
|
||||
+ set(HIP_CLANG_ROOT "@clang@")
|
||||
endif()
|
||||
if(NOT HIP_CXX_COMPILER)
|
||||
set(HIP_CXX_COMPILER ${CMAKE_CXX_COMPILER})
|
||||
@@ -171,7 +171,7 @@ if(HIP_COMPILER STREQUAL "clang")
|
||||
get_filename_component(_HIP_CLANG_BIN_PATH "${_HIP_CLANG_REAL_PATH}" DIRECTORY)
|
||||
get_filename_component(HIP_CLANG_ROOT "${_HIP_CLANG_BIN_PATH}" DIRECTORY)
|
||||
endif()
|
||||
- file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS ${HIP_CLANG_ROOT}/lib/clang/*/include)
|
||||
+ file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "@clang@/resource-root/include")
|
||||
find_path(HIP_CLANG_INCLUDE_PATH stddef.h
|
||||
HINTS
|
||||
${HIP_CLANG_INCLUDE_SEARCH_PATHS}
|
||||
@@ -209,7 +209,7 @@ if(NOT WIN32)
|
||||
"${_IMPORT_PREFIX}/include"
|
||||
#FILE_REORG_BACKWARD_COMPATIBILITY ${_IMPORT_PREFIX}/../include is for Backward compatibility
|
||||
"${_IMPORT_PREFIX}/../include"
|
||||
- ${ROCM_PATH}/include
|
||||
+ "@rocm_runtime@/include"
|
||||
)
|
||||
|
||||
if (NOT HSA_HEADER)
|
||||
@@ -291,7 +291,7 @@ if(HIP_COMPILER STREQUAL "clang")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
- file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${HIP_CLANG_ROOT}/lib/clang/*/lib/*")
|
||||
+ file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "@clang@/resource-root/lib/*")
|
||||
find_library(CLANGRT_BUILTINS
|
||||
NAMES
|
||||
clang_rt.builtins
|
||||
diff --git a/src/hip_embed_pch.sh b/src/hip_embed_pch.sh
|
||||
index 0a1572b..2feb19a 100755
|
||||
--- a/src/hip_embed_pch.sh
|
||||
+++ b/src/hip_embed_pch.sh
|
||||
@@ -149,7 +149,7 @@ EOF
|
||||
|
||||
$LLVM_DIR/bin/clang -cc1 -O3 -emit-pch -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -std=c++17 -fgnuc-version=4.2.1 -o $tmp/hip_wave64.pch -x hip-cpp-output - <$tmp/pch_wave64.cui &&
|
||||
|
||||
- $LLVM_DIR/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj &&
|
||||
+ @llvm@/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj &&
|
||||
|
||||
rm -rf $tmp
|
||||
}
|
||||
@@ -195,7 +195,7 @@ EOF
|
||||
set -x
|
||||
$LLVM_DIR/bin/clang -O3 --rocm-path=$HIP_INC_DIR/.. -std=c++14 -nogpulib --hip-version=4.4 -isystem $HIP_INC_DIR -isystem $HIP_BUILD_INC_DIR -isystem $HIP_AMD_INC_DIR --cuda-device-only -D__HIPCC_RTC__ -x hip $tmp/hipRTC_header.h -E -o $tmp/hiprtc &&
|
||||
cat $macroFile >> $tmp/hiprtc &&
|
||||
- $LLVM_DIR/bin/llvm-mc -o $tmp/hiprtc_header.o $tmp/hipRTC_header.mcin --filetype=obj &&
|
||||
+ @llvm@/bin/llvm-mc -o $tmp/hiprtc_header.o $tmp/hipRTC_header.mcin --filetype=obj &&
|
||||
$LLVM_DIR/bin/clang $tmp/hiprtc_header.o -o $rtc_shared_lib_out -shared &&
|
||||
$LLVM_DIR/bin/clang -O3 --rocm-path=$HIP_INC_DIR/.. -std=c++14 -nogpulib -nogpuinc -emit-llvm -c -o $tmp/tmp.bc --cuda-device-only -D__HIPCC_RTC__ --offload-arch=gfx906 -x hip-cpp-output $tmp/hiprtc &&
|
||||
rm -rf $tmp
|
@ -1,113 +1,61 @@
|
||||
{ stdenv
|
||||
, binutils-unwrapped
|
||||
, clang
|
||||
, cmake
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, file
|
||||
, lib
|
||||
, libglvnd
|
||||
, libX11
|
||||
, libxml2
|
||||
, llvm
|
||||
, rocmUpdateScript
|
||||
, substituteAll
|
||||
, makeWrapper
|
||||
, numactl
|
||||
, perl
|
||||
, python3
|
||||
, python3Packages
|
||||
, hip-common
|
||||
, hipcc
|
||||
, rocclr
|
||||
, roctracer
|
||||
, cmake
|
||||
, perl
|
||||
, llvm
|
||||
, rocminfo
|
||||
, rocm-thunk
|
||||
, rocm-comgr
|
||||
, rocm-device-libs
|
||||
, rocm-opencl-runtime
|
||||
, rocm-runtime
|
||||
, rocm-thunk
|
||||
, rocminfo
|
||||
, substituteAll
|
||||
, writeScript
|
||||
, writeText
|
||||
, rocm-opencl-runtime
|
||||
, cudatoolkit
|
||||
, numactl
|
||||
, libxml2
|
||||
, libX11
|
||||
, libglvnd
|
||||
, doxygen
|
||||
, graphviz
|
||||
, fontconfig
|
||||
, python3Packages
|
||||
, buildDocs ? true
|
||||
, buildTests ? false
|
||||
, useNVIDIA ? false
|
||||
}:
|
||||
|
||||
let
|
||||
hip = stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "hip";
|
||||
version = "5.4.0";
|
||||
hipPlatform = if useNVIDIA then "nvidia" else "amd";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ROCm-Developer-Tools";
|
||||
repo = "HIP";
|
||||
rev = "rocm-${finalAttrs.version}";
|
||||
hash = "sha256-34SJM2n3jZWIS2uwpboWOXVFhaVWGK5ELPKD/cJc1zw=";
|
||||
};
|
||||
wrapperArgs = [
|
||||
"--prefix PATH : $out/bin"
|
||||
"--prefix LD_LIBRARY_PATH : ${rocm-runtime}"
|
||||
"--set HIP_PLATFORM ${hipPlatform}"
|
||||
"--set HIP_PATH $out"
|
||||
"--set HIP_CLANG_PATH ${stdenv.cc}/bin"
|
||||
"--set DEVICE_LIB_PATH ${rocm-device-libs}/amdgcn/bitcode"
|
||||
"--set HSA_PATH ${rocm-runtime}"
|
||||
"--set ROCM_PATH $out"
|
||||
] ++ lib.optionals useNVIDIA [
|
||||
"--set CUDA_PATH ${cudatoolkit}"
|
||||
];
|
||||
in stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "hip-${hipPlatform}";
|
||||
version = "5.4.1";
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./hip-config-paths.patch;
|
||||
inherit llvm;
|
||||
rocm_runtime = rocm-runtime;
|
||||
})
|
||||
];
|
||||
|
||||
# - fix bash paths
|
||||
# - fix path to rocm_agent_enumerator
|
||||
# - fix hcc path
|
||||
# - fix hcc version parsing
|
||||
# - add linker flags for libhsa-runtime64 and hc_am since libhip_hcc
|
||||
# refers to them.
|
||||
prePatch = ''
|
||||
for f in $(find bin -type f); do
|
||||
sed -e 's,#!/usr/bin/perl,#!${perl}/bin/perl,' \
|
||||
-e 's,#!/bin/bash,#!${stdenv.shell},' \
|
||||
-i "$f"
|
||||
done
|
||||
|
||||
sed 's,#!/usr/bin/python,#!${python3.interpreter},' -i hip_prof_gen.py
|
||||
|
||||
sed -e 's,$ROCM_AGENT_ENUM = "''${ROCM_PATH}/bin/rocm_agent_enumerator";,$ROCM_AGENT_ENUM = "${rocminfo}/bin/rocm_agent_enumerator";,' \
|
||||
-e 's,^\($DEVICE_LIB_PATH=\).*$,\1"${rocm-device-libs}/amdgcn/bitcode";,' \
|
||||
-e 's,^\($HIP_COMPILER=\).*$,\1"clang";,' \
|
||||
-e 's,^\($HIP_RUNTIME=\).*$,\1"ROCclr";,' \
|
||||
-e 's,^\([[:space:]]*$HSA_PATH=\).*$,\1"${rocm-runtime}";,'g \
|
||||
-e 's,^\([[:space:]]*\)$HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include");,\1$HIP_CLANG_INCLUDE_PATH = "${llvm}/lib/clang/$HIP_CLANG_VERSION/include";,' \
|
||||
-e 's,^\([[:space:]]*$HIPCXXFLAGS .= " -isystem \\"$HIP_CLANG_INCLUDE_PATH/..\\"\)";,\1 -isystem ${rocm-runtime}/include";,' \
|
||||
-e 's,$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION,$HIP_CLANG_PATH/../resource-root,g' \
|
||||
-e 's,`file,`${file}/bin/file,g' \
|
||||
-e 's,`readelf,`${binutils-unwrapped}/bin/readelf,' \
|
||||
-e 's, ar , ${binutils-unwrapped}/bin/ar ,g' \
|
||||
-i bin/hipcc.pl
|
||||
|
||||
sed -e 's,^\($HSA_PATH=\).*$,\1"${rocm-runtime}";,' \
|
||||
-e 's,^\($HIP_CLANG_PATH=\).*$,\1"${clang}/bin";,' \
|
||||
-e 's,^\($HIP_PLATFORM=\).*$,\1"amd";,' \
|
||||
-e 's,$HIP_CLANG_PATH/llc,${llvm}/bin/llc,' \
|
||||
-e 's, abs_path, Cwd::abs_path,' \
|
||||
-i bin/hipconfig.pl
|
||||
|
||||
sed -e 's, abs_path, Cwd::abs_path,' -i bin/hipvars.pm
|
||||
'';
|
||||
|
||||
buildPhase = "";
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp -r * $out/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "C++ Heterogeneous-Compute Interface for Portability";
|
||||
homepage = "https://github.com/ROCm-Developer-Tools/HIP";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
});
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "hip";
|
||||
version = "5.4.0";
|
||||
outputs = [
|
||||
"out"
|
||||
] ++ lib.optionals buildDocs [
|
||||
"doc"
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ROCm-Developer-Tools";
|
||||
@ -116,105 +64,115 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
hash = "sha256-VL0vZVv099pZPX0J2pXPFvrhkVO/b6X+ZZDaD9B1hYI=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake python3 makeWrapper perl ];
|
||||
buildInputs = [ libxml2 numactl libglvnd libX11 python3Packages.cppheaderparser ];
|
||||
propagatedBuildInputs = [
|
||||
clang
|
||||
llvm
|
||||
rocm-comgr
|
||||
rocm-device-libs
|
||||
rocm-runtime
|
||||
rocm-thunk
|
||||
rocminfo
|
||||
];
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./hipamd-config-paths.patch;
|
||||
inherit clang llvm hip;
|
||||
src = ./0000-fixup-paths.patch;
|
||||
inherit llvm;
|
||||
clang = stdenv.cc;
|
||||
rocm_runtime = rocm-runtime;
|
||||
})
|
||||
|
||||
# https://github.com/ROCm-Developer-Tools/hipamd/commit/be33ec55acc104a59d01df5912261d007c7f3ee9
|
||||
(fetchpatch {
|
||||
url = "https://github.com/ROCm-Developer-Tools/hipamd/commit/be33ec55acc104a59d01df5912261d007c7f3ee9.patch";
|
||||
hash = "sha256-eTC4mUIN1FwRce1n38uDOlITFL/vpcOhvnaZTo5R7lo=";
|
||||
})
|
||||
];
|
||||
|
||||
prePatch = ''
|
||||
sed -e 's,#!/bin/bash,#!${stdenv.shell},' \
|
||||
-i src/hip_embed_pch.sh
|
||||
'';
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
cmake
|
||||
perl
|
||||
python3Packages.python
|
||||
python3Packages.cppheaderparser
|
||||
] ++ lib.optionals buildDocs [
|
||||
doxygen
|
||||
graphviz
|
||||
fontconfig
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
export HIP_CLANG_PATH=${clang}/bin
|
||||
export DEVICE_LIB_PATH=${rocm-device-libs}/lib
|
||||
'';
|
||||
buildInputs = [
|
||||
numactl
|
||||
libxml2
|
||||
libX11
|
||||
libglvnd
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
stdenv.cc
|
||||
llvm
|
||||
rocminfo
|
||||
rocm-thunk
|
||||
rocm-comgr
|
||||
rocm-device-libs
|
||||
rocm-runtime
|
||||
rocm-opencl-runtime
|
||||
] ++ lib.optionals useNVIDIA [
|
||||
cudatoolkit
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DHIP_PLATFORM=amd"
|
||||
"-DAMD_OPENCL_PATH=${rocm-opencl-runtime.src}"
|
||||
"-DHIP_COMMON_DIR=${hip}"
|
||||
"-DROCM_PATH=${rocminfo}"
|
||||
"-DHIP_PLATFORM=${hipPlatform}"
|
||||
"-DHIP_COMMON_DIR=${hip-common}"
|
||||
"-DHIPCC_BIN_DIR=${hipcc}/bin"
|
||||
"-DHIP_LLVM_ROOT=${stdenv.cc}"
|
||||
"-DROCCLR_PATH=${rocclr}"
|
||||
"-DHIP_VERSION_BUILD_ID=0"
|
||||
"-DAMD_OPENCL_PATH=${rocm-opencl-runtime.src}"
|
||||
"-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext"
|
||||
# Temporarily set variables to work around upstream CMakeLists issue
|
||||
# Can be removed once https://github.com/ROCm-Developer-Tools/hipamd/issues/55 is fixed
|
||||
"-DCMAKE_INSTALL_BINDIR=bin"
|
||||
"-DCMAKE_INSTALL_INCLUDEDIR=include"
|
||||
"-DCMAKE_INSTALL_LIBDIR=lib"
|
||||
] ++ lib.optionals buildTests [
|
||||
"-DHIP_CATCH_TEST=1"
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
export HIP_CLANG_PATH=${stdenv.cc}/bin
|
||||
patchShebangs src
|
||||
'' + lib.optionalString buildDocs ''
|
||||
export HOME=$(mktemp -d)
|
||||
export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
|
||||
'';
|
||||
|
||||
doCheck = buildTests;
|
||||
checkTarget = "build_tests";
|
||||
|
||||
preCheck = lib.optionalString buildTests ''
|
||||
export ROCM_PATH=$PWD
|
||||
export DEVICE_LIB_PATH=${rocm-device-libs}/amdgcn/bitcode
|
||||
patchShebangs bin
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
patchShebangs $out/bin
|
||||
wrapProgram $out/bin/hipcc --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin --prefix PATH : ${llvm}/bin --set ROCM_PATH $out
|
||||
wrapProgram $out/bin/hipconfig --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin
|
||||
cp -a $out/bin/hipcc $out/bin/hipcc-pl
|
||||
cp -a $out/bin/hipconfig $out/bin/hipconfig-pl
|
||||
wrapProgram $out/bin/hipcc --set HIP_USE_PERL_SCRIPTS 0
|
||||
wrapProgram $out/bin/hipconfig --set HIP_USE_PERL_SCRIPTS 0
|
||||
wrapProgram $out/bin/hipcc.bin ${lib.concatStringsSep " " wrapperArgs}
|
||||
wrapProgram $out/bin/hipconfig.bin ${lib.concatStringsSep " " wrapperArgs}
|
||||
wrapProgram $out/bin/hipcc-pl --set HIP_USE_PERL_SCRIPTS 1
|
||||
wrapProgram $out/bin/hipconfig-pl --set HIP_USE_PERL_SCRIPTS 1
|
||||
wrapProgram $out/bin/hipcc.pl ${lib.concatStringsSep " " wrapperArgs}
|
||||
wrapProgram $out/bin/hipconfig.pl ${lib.concatStringsSep " " wrapperArgs}
|
||||
'';
|
||||
|
||||
# TODO: Separate HIP and hipamd into separate derivations
|
||||
passthru.updateScript = writeScript "update.sh" ''
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github
|
||||
version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
|
||||
-sL "https://api.github.com/repos/ROCm-Developer-Tools/HIP/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
|
||||
|
||||
IFS='.' read -a version_arr <<< "$version"
|
||||
|
||||
if [ "''${#version_arr[*]}" == 2 ]; then
|
||||
version="''${version}.0"
|
||||
fi
|
||||
|
||||
current_version="$(grep "version =" pkgs/development/compilers/hip/default.nix | head -n1 | cut -d'"' -f2)"
|
||||
if [[ "$version" != "$current_version" ]]; then
|
||||
tarball_meta="$(nix-prefetch-github ROCm-Developer-Tools HIP --rev "rocm-$version")"
|
||||
tarball_hash="$(nix to-base64 sha256-$(jq -r '.sha256' <<< "$tarball_meta"))"
|
||||
sed -i -z "pkgs/development/compilers/hip/default.nix" \
|
||||
-e 's,version = "[^'"'"'"]*",version = "'"$version"'",1' \
|
||||
-e 's,hash = "[^'"'"'"]*",hash = "sha256-'"$tarball_hash"'",1'
|
||||
else
|
||||
echo hip already up-to-date
|
||||
fi
|
||||
|
||||
version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
|
||||
-sL "https://api.github.com/repos/ROCm-Developer-Tools/hipamd/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
|
||||
|
||||
IFS='.' read -a version_arr <<< "$version"
|
||||
|
||||
if [ "''${#version_arr[*]}" == 2 ]; then
|
||||
version="''${version}.0"
|
||||
fi
|
||||
|
||||
current_version="$(grep "version =" pkgs/development/compilers/hip/default.nix | tail -n1 | cut -d'"' -f2)"
|
||||
if [[ "$version" != "$current_version" ]]; then
|
||||
tarball_meta="$(nix-prefetch-github ROCm-Developer-Tools hipamd --rev "rocm-$version")"
|
||||
tarball_hash="$(nix to-base64 sha256-$(jq -r '.sha256' <<< "$tarball_meta"))"
|
||||
sed -i -z "pkgs/development/compilers/hip/default.nix" \
|
||||
-e 's,version = "[^'"'"'"]*",version = "'"$version"'",2' \
|
||||
-e 's,hash = "[^'"'"'"]*",hash = "sha256-'"$tarball_hash"'",2'
|
||||
else
|
||||
echo hipamd already up-to-date
|
||||
fi
|
||||
'';
|
||||
passthru.updateScript = rocmUpdateScript {
|
||||
name = finalAttrs.pname;
|
||||
owner = finalAttrs.src.owner;
|
||||
repo = finalAttrs.src.repo;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "C++ Heterogeneous-Compute Interface for Portability";
|
||||
description = "C++ Heterogeneous-Compute Interface for Portability specifically for AMD platform";
|
||||
homepage = "https://github.com/ROCm-Developer-Tools/hipamd";
|
||||
license = licenses.mit;
|
||||
license = with licenses; [ mit ];
|
||||
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
|
||||
platforms = platforms.linux;
|
||||
# Tests require GPU, also include issues
|
||||
broken = finalAttrs.version != hip-common.version || finalAttrs.version != hipcc.version || buildTests;
|
||||
};
|
||||
})
|
||||
|
@ -1,35 +0,0 @@
|
||||
diff --git a/hip-lang-config.cmake.in b/hip-lang-config.cmake.in
|
||||
index 1a72643a..7f35031f 100644
|
||||
--- a/hip-lang-config.cmake.in
|
||||
+++ b/hip-lang-config.cmake.in
|
||||
@@ -71,8 +71,8 @@ get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH)
|
||||
|
||||
|
||||
#need _IMPORT_PREFIX to be set #FILE_REORG_BACKWARD_COMPATIBILITY
|
||||
-file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "${_IMPORT_PREFIX}/../llvm/lib/clang/*/include")
|
||||
-file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "${_IMPORT_PREFIX}/llvm/lib/clang/*/include")
|
||||
+file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "@llvm@/lib/clang/*/include")
|
||||
+file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "@llvm@/lib/clang/*/include")
|
||||
find_path(HIP_CLANG_INCLUDE_PATH __clang_cuda_math.h
|
||||
HINTS ${HIP_CLANG_INCLUDE_SEARCH_PATHS}
|
||||
${HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG}
|
||||
@@ -87,9 +87,7 @@ endif()
|
||||
#if HSA is not under ROCm then provide CMAKE_PREFIX_PATH=<HSA_PATH>
|
||||
find_path(HSA_HEADER hsa/hsa.h
|
||||
PATHS
|
||||
- "${_IMPORT_PREFIX}/../include" #FILE_REORG_BACKWARD_COMPATIBILITY
|
||||
- "${_IMPORT_PREFIX}/include"
|
||||
- "${ROCM_PATH}/include"
|
||||
+ "@rocm_runtime@/include"
|
||||
)
|
||||
|
||||
if (NOT HSA_HEADER)
|
||||
@@ -97,7 +94,7 @@ if (HSA_HEADER-NOTFOUND)
|
||||
endif()
|
||||
|
||||
get_filename_component(HIP_COMPILER_INSTALL_PATH ${CMAKE_HIP_COMPILER} DIRECTORY)
|
||||
-file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${HIP_COMPILER_INSTALL_PATH}/../lib/clang/*/lib/*")
|
||||
+file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "@llvm@/lib/clang/*/lib/*")
|
||||
find_library(CLANGRT_BUILTINS
|
||||
NAMES
|
||||
clang_rt.builtins
|
@ -1,73 +0,0 @@
|
||||
diff --git a/hip-config.cmake.in b/hip-config.cmake.in
|
||||
index 89d1224e..120b68c6 100755
|
||||
--- a/hip-config.cmake.in
|
||||
+++ b/hip-config.cmake.in
|
||||
@@ -142,7 +142,7 @@ if(HIP_COMPILER STREQUAL "clang")
|
||||
file(TO_CMAKE_PATH "${HIP_PATH}/../lc" HIP_CLANG_ROOT)
|
||||
endif()
|
||||
else()
|
||||
- set(HIP_CLANG_ROOT "${ROCM_PATH}/llvm")
|
||||
+ set(HIP_CLANG_ROOT "@clang@")
|
||||
endif()
|
||||
if(NOT HIP_CXX_COMPILER)
|
||||
set(HIP_CXX_COMPILER ${CMAKE_CXX_COMPILER})
|
||||
@@ -206,10 +206,7 @@ if(NOT WIN32)
|
||||
#if HSA is not under ROCm then provide CMAKE_PREFIX_PATH=<HSA_PATH>
|
||||
find_path(HSA_HEADER hsa/hsa.h
|
||||
PATHS
|
||||
- "${_IMPORT_PREFIX}/include"
|
||||
- #FILE_REORG_BACKWARD_COMPATIBILITY ${_IMPORT_PREFIX}/../include is for Backward compatibility
|
||||
- "${_IMPORT_PREFIX}/../include"
|
||||
- ${ROCM_PATH}/include
|
||||
+ "@rocm_runtime@/include"
|
||||
)
|
||||
|
||||
if (NOT HSA_HEADER)
|
||||
@@ -224,8 +221,8 @@ set_target_properties(hip::host PROPERTIES
|
||||
|
||||
if(HIP_RUNTIME MATCHES "rocclr")
|
||||
set_target_properties(hip::amdhip64 PROPERTIES
|
||||
- INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${HSA_HEADER}"
|
||||
- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${HSA_HEADER}"
|
||||
+ INTERFACE_INCLUDE_DIRECTORIES "@hip@/include;${HSA_HEADER}"
|
||||
+ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "@hip@/include;${HSA_HEADER}"
|
||||
)
|
||||
|
||||
get_target_property(amdhip64_type hip::amdhip64 TYPE)
|
||||
@@ -233,8 +230,8 @@ if(HIP_RUNTIME MATCHES "rocclr")
|
||||
|
||||
if(NOT WIN32)
|
||||
set_target_properties(hip::device PROPERTIES
|
||||
- INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
||||
- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
||||
+ INTERFACE_INCLUDE_DIRECTORIES "@hip@/include"
|
||||
+ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "@hip@/include"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 83866d83..4125d3aa 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -178,7 +178,7 @@ if(__HIP_ENABLE_PCH)
|
||||
${ROCM_PATH}/llvm)
|
||||
# find_package(LLVM) returns the lib/cmake/llvm location. We require the root.
|
||||
if(NOT DEFINED HIP_LLVM_ROOT)
|
||||
- set(HIP_LLVM_ROOT "${LLVM_DIR}/../../..")
|
||||
+ set(HIP_LLVM_ROOT "@clang@")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND sh -c "${CMAKE_CURRENT_SOURCE_DIR}/hip_embed_pch.sh ${HIP_COMMON_INCLUDE_DIR} ${PROJECT_BINARY_DIR}/include ${PROJECT_SOURCE_DIR}/include ${HIP_LLVM_ROOT}" COMMAND_ECHO STDERR RESULT_VARIABLE EMBED_PCH_RC)
|
||||
diff --git a/src/hip_embed_pch.sh b/src/hip_embed_pch.sh
|
||||
index 0a1572b2..aa855d63 100755
|
||||
--- a/src/hip_embed_pch.sh
|
||||
+++ b/src/hip_embed_pch.sh
|
||||
@@ -149,7 +149,7 @@ EOF
|
||||
|
||||
$LLVM_DIR/bin/clang -cc1 -O3 -emit-pch -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -std=c++17 -fgnuc-version=4.2.1 -o $tmp/hip_wave64.pch -x hip-cpp-output - <$tmp/pch_wave64.cui &&
|
||||
|
||||
- $LLVM_DIR/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj &&
|
||||
+ @llvm@/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj &&
|
||||
|
||||
rm -rf $tmp
|
||||
}
|
130
pkgs/development/compilers/hipcc/0000-fixup-paths.patch
Normal file
130
pkgs/development/compilers/hipcc/0000-fixup-paths.patch
Normal file
@ -0,0 +1,130 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c21f247..5bd3e45 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -17,6 +17,6 @@ if (NOT WIN32) # C++17 does not require the std lib linking
|
||||
target_link_libraries(hipconfig.bin ${LINK_LIBS} ) # for hipconfig.bin
|
||||
endif()
|
||||
|
||||
-set(HIP_VERSION_MAJOR 4 PARENT_SCOPE)
|
||||
-set(HIP_VERSION_MINOR 4 PARENT_SCOPE)
|
||||
-set(HIP_VERSION_PATCH 4 PARENT_SCOPE)
|
||||
+set(HIP_VERSION_MAJOR @version_major@)
|
||||
+set(HIP_VERSION_MINOR @version_minor@)
|
||||
+set(HIP_VERSION_PATCH @version_patch@)
|
||||
diff --git a/src/hipBin_amd.h b/src/hipBin_amd.h
|
||||
index f94e4a5..f0b1b83 100644
|
||||
--- a/src/hipBin_amd.h
|
||||
+++ b/src/hipBin_amd.h
|
||||
@@ -207,7 +207,7 @@ void HipBinAmd::initializeHipCXXFlags() {
|
||||
hipClangIncludePath = getCompilerIncludePath();
|
||||
hipCXXFlags += " -isystem \"" + hipClangIncludePath;
|
||||
fs::path hipCXXFlagsTempFs = hipCXXFlags;
|
||||
- hipCXXFlagsTempFs /= "..\"";
|
||||
+ hipCXXFlagsTempFs /= "\"";
|
||||
hipCXXFlags = hipCXXFlagsTempFs.string();
|
||||
const EnvVariables& var = getEnvVariables();
|
||||
// Allow __fp16 as function parameter and return type.
|
||||
@@ -266,7 +266,7 @@ void HipBinAmd::printCompilerInfo() const {
|
||||
string cmd = hipClangPath + "/clang++ --version";
|
||||
system(cmd.c_str()); // hipclang version
|
||||
cout << "llc-version :" << endl;
|
||||
- cmd = hipClangPath + "/llc --version";
|
||||
+ cmd = "@llvm@/bin/llc --version";
|
||||
system(cmd.c_str()); // llc version
|
||||
cout << "hip-clang-cxxflags :" << endl;
|
||||
cmd = hipPath + "/bin/hipcc --cxxflags";
|
||||
@@ -278,7 +278,7 @@ void HipBinAmd::printCompilerInfo() const {
|
||||
} else {
|
||||
string cmd = hipClangPath + "/clang++ --version";
|
||||
system(cmd.c_str()); // hipclang version
|
||||
- cmd = hipClangPath + "/llc --version";
|
||||
+ cmd = "@llvm@/bin/llc --version";
|
||||
system(cmd.c_str()); // llc version
|
||||
cout << "hip-clang-cxxflags :" << endl;
|
||||
cmd = hipPath + "/bin/hipcc --cxxflags";
|
||||
@@ -331,10 +331,7 @@ string HipBinAmd::getCppConfig() {
|
||||
hipPathInclude /= "include";
|
||||
|
||||
const string& compilerPath = getCompilerPath();
|
||||
- hipClangInclude = compilerPath;
|
||||
- hipClangInclude = hipClangInclude.parent_path();
|
||||
- hipClangInclude /= "lib/clang/";
|
||||
- hipClangInclude /= compilerVersion;
|
||||
+ hipClangInclude = "@clang@/resource-root/include";
|
||||
string hipClangPath = hipClangInclude.string();
|
||||
|
||||
const OsType& osInfo = getOSInfo();
|
||||
@@ -442,17 +439,7 @@ string HipBinAmd::getHipCC() const {
|
||||
|
||||
|
||||
string HipBinAmd::getCompilerIncludePath() {
|
||||
- string hipClangVersion, includePath, compilerIncludePath;
|
||||
- const string& hipClangPath = getCompilerPath();
|
||||
- hipClangVersion = getCompilerVersion();
|
||||
- fs::path includePathfs = hipClangPath;
|
||||
- includePathfs = includePathfs.parent_path();
|
||||
- includePathfs /= "lib/clang/";
|
||||
- includePathfs /= hipClangVersion;
|
||||
- includePathfs /= "include";
|
||||
- includePathfs = fs::absolute(includePathfs).string();
|
||||
- compilerIncludePath = includePathfs.string();
|
||||
- return compilerIncludePath;
|
||||
+ return "@clang@/resource-root/include";
|
||||
}
|
||||
|
||||
|
||||
@@ -506,8 +493,8 @@ void HipBinAmd::printFull() {
|
||||
cout << endl << "== Envirnoment Variables" << endl;
|
||||
printEnvironmentVariables();
|
||||
getSystemInfo();
|
||||
- if (fs::exists("/usr/bin/lsb_release"))
|
||||
- system("/usr/bin/lsb_release -a");
|
||||
+ if (fs::exists("@lsb_release@/bin/lsb_release"))
|
||||
+ system("@lsb_release@/bin/lsb_release -a");
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
@@ -993,7 +980,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
|
||||
} else if (os != windows) {
|
||||
// Else try using rocm_agent_enumerator
|
||||
string ROCM_AGENT_ENUM;
|
||||
- ROCM_AGENT_ENUM = roccmPath + "/bin/rocm_agent_enumerator";
|
||||
+ ROCM_AGENT_ENUM = "@rocminfo@/bin/rocm_agent_enumerator";
|
||||
targetsStr = ROCM_AGENT_ENUM +" -t GPU";
|
||||
SystemCmdOut sysOut = hipBinUtilPtr_->exec(targetsStr.c_str());
|
||||
regex toReplace("\n+");
|
||||
@@ -1097,7 +1084,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
|
||||
string hipClangVersion, toolArgTemp;
|
||||
if (linkType == 0) {
|
||||
toolArgTemp = " -L"+ hipLibPath + "-lamdhip64 -L" +
|
||||
- roccmPath+ "/lib -lhsa-runtime64 -ldl -lnuma " + toolArgs;
|
||||
+ "@rocm_runtime@/lib -lhsa-runtime64 -ldl -lnuma " + toolArgs;
|
||||
toolArgs = toolArgTemp;
|
||||
} else {
|
||||
toolArgTemp = toolArgs + " -Wl,--enable-new-dtags -Wl,-rpath=" + hipLibPath + ":"
|
||||
@@ -1107,8 +1094,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
|
||||
|
||||
hipClangVersion = getCompilerVersion();
|
||||
// To support __fp16 and _Float16, explicitly link with compiler-rt
|
||||
- toolArgs += " -L" + hipClangPath + "/../lib/clang/" +
|
||||
- hipClangVersion + "/lib/linux -lclang_rt.builtins-x86_64 ";
|
||||
+ toolArgs += " -L@clang@/resource-root/lib/linux -lclang_rt.builtins-x86_64 ";
|
||||
}
|
||||
if (!var.hipccCompileFlagsAppendEnv_.empty()) {
|
||||
HIPCXXFLAGS += " " + var.hipccCompileFlagsAppendEnv_ + " ";
|
||||
diff --git a/src/hipBin_nvidia.h b/src/hipBin_nvidia.h
|
||||
index 6feb315..b61739d 100644
|
||||
--- a/src/hipBin_nvidia.h
|
||||
+++ b/src/hipBin_nvidia.h
|
||||
@@ -157,8 +157,8 @@ void HipBinNvidia::printFull() {
|
||||
cout << endl << "== Envirnoment Variables" << endl;
|
||||
printEnvironmentVariables();
|
||||
getSystemInfo();
|
||||
- if (fs::exists("/usr/bin/lsb_release"))
|
||||
- system("/usr/bin/lsb_release -a");
|
||||
+ if (fs::exists("@lsb_release@/bin/lsb_release"))
|
||||
+ system("@lsb_release@/bin/lsb_release -a");
|
||||
}
|
||||
|
||||
// returns hip include
|
62
pkgs/development/compilers/hipcc/default.nix
Normal file
62
pkgs/development/compilers/hipcc/default.nix
Normal file
@ -0,0 +1,62 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, rocmUpdateScript
|
||||
, substituteAll
|
||||
, cmake
|
||||
, llvm
|
||||
, rocm-runtime
|
||||
, rocminfo
|
||||
, lsb-release
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "hipcc";
|
||||
version = "5.4.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ROCm-Developer-Tools";
|
||||
repo = "HIPCC";
|
||||
rev = "rocm-${finalAttrs.version}";
|
||||
hash = "sha256-PEwue4O43MiMkF8UmTeHsmlikBG2V3/nFQLKmtHrRWQ=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./0000-fixup-paths.patch;
|
||||
inherit llvm rocminfo;
|
||||
version_major = lib.versions.major finalAttrs.version;
|
||||
version_minor = lib.versions.minor finalAttrs.version;
|
||||
version_patch = lib.versions.patch finalAttrs.version;
|
||||
clang = stdenv.cc;
|
||||
rocm_runtime = rocm-runtime;
|
||||
lsb_release = lsb-release;
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
mv *.bin $out/bin
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateScript = rocmUpdateScript {
|
||||
name = finalAttrs.pname;
|
||||
owner = finalAttrs.src.owner;
|
||||
repo = finalAttrs.src.repo;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Compiler driver utility that calls clang or nvcc";
|
||||
homepage = "https://github.com/ROCm-Developer-Tools/HIPCC";
|
||||
license = with licenses; [ mit ];
|
||||
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
|
||||
platforms = platforms.linux;
|
||||
broken = finalAttrs.version != stdenv.cc.version;
|
||||
};
|
||||
})
|
@ -1,4 +1,5 @@
|
||||
# -*- shell-script -*-
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
function extract
|
||||
|
18
pkgs/development/compilers/llvm/rocm/0000-fix-openmp.patch
Normal file
18
pkgs/development/compilers/llvm/rocm/0000-fix-openmp.patch
Normal file
@ -0,0 +1,18 @@
|
||||
diff --git a/libomptarget/plugins/amdgpu/impl/impl.cpp b/libomptarget/plugins/amdgpu/impl/impl.cpp
|
||||
index 80e024789..3a14e0889 100644
|
||||
--- a/libomptarget/plugins/amdgpu/impl/impl.cpp
|
||||
+++ b/libomptarget/plugins/amdgpu/impl/impl.cpp
|
||||
@@ -21,10 +21,11 @@ bool is_locked(void *ptr, hsa_status_t *err_p, void **agentBaseAddress) {
|
||||
info.size = sizeof(hsa_amd_pointer_info_t);
|
||||
err = hsa_amd_pointer_info(ptr, &info, nullptr, nullptr, nullptr);
|
||||
|
||||
- if (err != HSA_STATUS_SUCCESS)
|
||||
+ if (err != HSA_STATUS_SUCCESS) {
|
||||
DP("Error when getting pointer info\n");
|
||||
- else
|
||||
+ } else {
|
||||
is_locked = (info.type == HSA_EXT_POINTER_TYPE_LOCKED);
|
||||
+ }
|
||||
|
||||
if (is_locked && agentBaseAddress != nullptr) {
|
||||
// When user passes in a basePtr+offset we need to fix the
|
@ -1,54 +1,600 @@
|
||||
{ stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }:
|
||||
{ lib
|
||||
, stdenv
|
||||
, callPackage
|
||||
, overrideCC
|
||||
, wrapCCWith
|
||||
, wrapBintoolsWith
|
||||
, runCommand
|
||||
, lit
|
||||
, glibc
|
||||
, spirv-llvm-translator
|
||||
, xz
|
||||
, swig
|
||||
, lua5_3
|
||||
, gtest
|
||||
, hip
|
||||
, rocm-comgr
|
||||
, vulkan-loader
|
||||
, vulkan-headers
|
||||
, glslang
|
||||
, shaderc
|
||||
, perl
|
||||
, rocm-device-libs
|
||||
, rocm-runtime
|
||||
, elfutils
|
||||
, python3Packages
|
||||
}:
|
||||
|
||||
let
|
||||
version = "5.4.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "RadeonOpenCompute";
|
||||
repo = "llvm-project";
|
||||
rev = "rocm-${version}";
|
||||
hash = "sha256-rlVo77h344PLGj/mIzsw+/ndWywsBsiKDXsEDpWSUno=";
|
||||
# Stage 1
|
||||
# Base
|
||||
llvm = callPackage ./llvm.nix { };
|
||||
|
||||
# Projects
|
||||
clang-unwrapped = callPackage ./llvm.nix rec {
|
||||
targetName = "clang";
|
||||
targetDir = targetName;
|
||||
extraBuildInputs = [ llvm ];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DCMAKE_POLICY_DEFAULT_CMP0116=NEW"
|
||||
"-DCLANG_INCLUDE_DOCS=ON"
|
||||
"-DCLANG_INCLUDE_TESTS=ON"
|
||||
];
|
||||
|
||||
extraPostPatch = ''
|
||||
# Looks like they forgot to add finding libedit to the standalone build
|
||||
ln -s ../cmake/Modules/FindLibEdit.cmake cmake/modules
|
||||
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace "include(CheckIncludeFile)" "include(CheckIncludeFile)''\nfind_package(LibEdit)"
|
||||
|
||||
# `No such file or directory: '/build/source/clang/tools/scan-build/bin/scan-build'`
|
||||
rm test/Analysis/scan-build/*.test
|
||||
rm test/Analysis/scan-build/rebuild_index/rebuild_index.test
|
||||
|
||||
# `does not depend on a module exporting 'baz.h'`
|
||||
rm test/Modules/header-attribs.cpp
|
||||
|
||||
# `fatal error: 'stdio.h' file not found`
|
||||
rm test/OpenMP/amdgcn_emit_llvm.c
|
||||
'';
|
||||
|
||||
extraPostInstall = ''
|
||||
mv bin/clang-tblgen $out/bin
|
||||
'';
|
||||
};
|
||||
|
||||
lld = callPackage ./llvm.nix rec {
|
||||
buildMan = false; # No man pages to build
|
||||
targetName = "lld";
|
||||
targetDir = targetName;
|
||||
extraBuildInputs = [ llvm ];
|
||||
extraCMakeFlags = [ "-DCMAKE_POLICY_DEFAULT_CMP0116=NEW" ];
|
||||
checkTargets = [ "check-lld" ];
|
||||
};
|
||||
|
||||
# Runtimes
|
||||
runtimes = callPackage ./llvm.nix {
|
||||
buildDocs = false;
|
||||
buildMan = false;
|
||||
buildTests = false;
|
||||
targetDir = "runtimes";
|
||||
|
||||
targetRuntimes = [
|
||||
# "libc" https://github.com/llvm/llvm-project/issues/57719
|
||||
"libunwind"
|
||||
"libcxxabi"
|
||||
"libcxx"
|
||||
"compiler-rt"
|
||||
];
|
||||
|
||||
extraBuildInputs = [ llvm ];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DCMAKE_POLICY_DEFAULT_CMP0114=NEW"
|
||||
"-DLIBCXX_INCLUDE_BENCHMARKS=OFF"
|
||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||
];
|
||||
|
||||
extraLicenses = [ lib.licenses.mit ];
|
||||
};
|
||||
|
||||
# Stage 2
|
||||
# Helpers
|
||||
rStdenv = overrideCC stdenv (wrapCCWith rec {
|
||||
inherit bintools;
|
||||
libcxx = runtimes;
|
||||
cc = clang-unwrapped;
|
||||
|
||||
extraPackages = [
|
||||
llvm
|
||||
lld
|
||||
];
|
||||
|
||||
nixSupport.cc-cflags = [
|
||||
"-resource-dir=$out/resource-root"
|
||||
"-fuse-ld=lld"
|
||||
"-rtlib=compiler-rt"
|
||||
"-unwindlib=libunwind"
|
||||
"-Wno-unused-command-line-argument"
|
||||
];
|
||||
|
||||
extraBuildCommands = ''
|
||||
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
|
||||
mkdir -p $out/resource-root
|
||||
ln -s ${cc}/lib/clang/$clang_version/include $out/resource-root
|
||||
ln -s ${runtimes}/lib $out/resource-root
|
||||
'';
|
||||
});
|
||||
|
||||
bintools = wrapBintoolsWith { bintools = bintools-unwrapped; };
|
||||
|
||||
bintools-unwrapped = runCommand "rocm-llvm-binutils-${llvm.version}" { preferLocalBuild = true; } ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
for prog in ${lld}/bin/*; do
|
||||
ln -s $prog $out/bin/$(basename $prog)
|
||||
done
|
||||
|
||||
for prog in ${llvm}/bin/*; do
|
||||
ln -sf $prog $out/bin/$(basename $prog)
|
||||
done
|
||||
|
||||
ln -s ${llvm}/bin/llvm-ar $out/bin/ar
|
||||
ln -s ${llvm}/bin/llvm-as $out/bin/as
|
||||
ln -s ${llvm}/bin/llvm-dwp $out/bin/dwp
|
||||
ln -s ${llvm}/bin/llvm-nm $out/bin/nm
|
||||
ln -s ${llvm}/bin/llvm-objcopy $out/bin/objcopy
|
||||
ln -s ${llvm}/bin/llvm-objdump $out/bin/objdump
|
||||
ln -s ${llvm}/bin/llvm-ranlib $out/bin/ranlib
|
||||
ln -s ${llvm}/bin/llvm-readelf $out/bin/readelf
|
||||
ln -s ${llvm}/bin/llvm-size $out/bin/size
|
||||
ln -s ${llvm}/bin/llvm-strip $out/bin/strip
|
||||
ln -s ${lld}/bin/lld $out/bin/ld
|
||||
'';
|
||||
in rec {
|
||||
inherit
|
||||
llvm
|
||||
clang-unwrapped
|
||||
lld
|
||||
bintools
|
||||
bintools-unwrapped;
|
||||
|
||||
# Runtimes
|
||||
libc = callPackage ./llvm.nix rec {
|
||||
stdenv = rStdenv;
|
||||
targetName = "libc";
|
||||
targetDir = "runtimes";
|
||||
targetRuntimes = [ targetName ];
|
||||
isBroken = true; # https://github.com/llvm/llvm-project/issues/57719
|
||||
};
|
||||
|
||||
libunwind = callPackage ./llvm.nix rec {
|
||||
stdenv = rStdenv;
|
||||
buildMan = false; # No man pages to build
|
||||
targetName = "libunwind";
|
||||
targetDir = "runtimes";
|
||||
targetRuntimes = [ targetName ];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DLIBUNWIND_INCLUDE_DOCS=ON"
|
||||
"-DLIBUNWIND_INCLUDE_TESTS=ON"
|
||||
"-DLIBUNWIND_USE_COMPILER_RT=ON"
|
||||
];
|
||||
};
|
||||
|
||||
libcxxabi = callPackage ./llvm.nix rec {
|
||||
stdenv = rStdenv;
|
||||
buildDocs = false; # No documentation to build
|
||||
buildMan = false; # No man pages to build
|
||||
targetName = "libcxxabi";
|
||||
targetDir = "runtimes";
|
||||
|
||||
targetRuntimes = [
|
||||
"libunwind"
|
||||
targetName
|
||||
"libcxx"
|
||||
];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DLIBCXXABI_INCLUDE_TESTS=ON"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
"-DLIBCXXABI_USE_COMPILER_RT=ON"
|
||||
|
||||
# Workaround having to build combined
|
||||
"-DLIBUNWIND_INCLUDE_DOCS=OFF"
|
||||
"-DLIBUNWIND_INCLUDE_TESTS=OFF"
|
||||
"-DLIBUNWIND_USE_COMPILER_RT=ON"
|
||||
"-DLIBUNWIND_INSTALL_LIBRARY=OFF"
|
||||
"-DLIBUNWIND_INSTALL_HEADERS=OFF"
|
||||
"-DLIBCXX_INCLUDE_DOCS=OFF"
|
||||
"-DLIBCXX_INCLUDE_TESTS=OFF"
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||
"-DLIBCXX_INSTALL_LIBRARY=OFF"
|
||||
"-DLIBCXX_INSTALL_HEADERS=OFF"
|
||||
];
|
||||
};
|
||||
|
||||
libcxx = callPackage ./llvm.nix rec {
|
||||
stdenv = rStdenv;
|
||||
buildMan = false; # No man pages to build
|
||||
targetName = "libcxx";
|
||||
targetDir = "runtimes";
|
||||
|
||||
targetRuntimes = [
|
||||
"libunwind"
|
||||
"libcxxabi"
|
||||
targetName
|
||||
];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DLIBCXX_INCLUDE_DOCS=ON"
|
||||
"-DLIBCXX_INCLUDE_TESTS=ON"
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||
|
||||
# Workaround having to build combined
|
||||
"-DLIBUNWIND_INCLUDE_DOCS=OFF"
|
||||
"-DLIBUNWIND_INCLUDE_TESTS=OFF"
|
||||
"-DLIBUNWIND_USE_COMPILER_RT=ON"
|
||||
"-DLIBUNWIND_INSTALL_LIBRARY=OFF"
|
||||
"-DLIBUNWIND_INSTALL_HEADERS=OFF"
|
||||
"-DLIBCXXABI_INCLUDE_TESTS=OFF"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
"-DLIBCXXABI_USE_COMPILER_RT=ON"
|
||||
"-DLIBCXXABI_INSTALL_LIBRARY=OFF"
|
||||
"-DLIBCXXABI_INSTALL_HEADERS=OFF"
|
||||
];
|
||||
|
||||
# Most of these can't find `bash` or `mkdir`, might just be hard-coded paths, or PATH is altered
|
||||
extraPostPatch = ''
|
||||
chmod +w -R ../libcxx/test/{libcxx,std}
|
||||
rm -rf ../libcxx/test/libcxx/input.output/filesystems
|
||||
rm ../libcxx/test/libcxx/selftest/remote-substitutions.sh.cpp
|
||||
rm ../libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp
|
||||
rm ../libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
|
||||
rm ../libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
|
||||
rm ../libcxx/test/std/utilities/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp
|
||||
rm -rf ../libcxx/test/std/utilities/optional/optional.object/optional.object.ctor
|
||||
rm -rf ../libcxx/test/std/input.output/filesystems/{class.directory_entry,class.directory_iterator,class.rec.dir.itr,fs.op.funcs}
|
||||
'';
|
||||
};
|
||||
|
||||
compiler-rt = callPackage ./llvm.nix rec {
|
||||
stdenv = rStdenv;
|
||||
buildDocs = false; # No documentation to build
|
||||
buildMan = false; # No man pages to build
|
||||
targetName = "compiler-rt";
|
||||
targetDir = "runtimes";
|
||||
|
||||
targetRuntimes = [
|
||||
"libunwind"
|
||||
"libcxxabi"
|
||||
"libcxx"
|
||||
targetName
|
||||
];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DCMAKE_POLICY_DEFAULT_CMP0114=NEW"
|
||||
"-DCOMPILER_RT_INCLUDE_TESTS=ON"
|
||||
"-DCOMPILER_RT_USE_LLVM_UNWINDER=ON"
|
||||
"-DCOMPILER_RT_CXX_LIBRARY=libcxx"
|
||||
"-DCOMPILER_RT_CAN_EXECUTE_TESTS=OFF" # We can't run most of these
|
||||
|
||||
# Workaround having to build combined
|
||||
"-DLIBUNWIND_INCLUDE_DOCS=OFF"
|
||||
"-DLIBUNWIND_INCLUDE_TESTS=OFF"
|
||||
"-DLIBUNWIND_USE_COMPILER_RT=ON"
|
||||
"-DLIBUNWIND_INSTALL_LIBRARY=OFF"
|
||||
"-DLIBUNWIND_INSTALL_HEADERS=OFF"
|
||||
"-DLIBCXXABI_INCLUDE_TESTS=OFF"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
"-DLIBCXXABI_USE_COMPILER_RT=ON"
|
||||
"-DLIBCXXABI_INSTALL_LIBRARY=OFF"
|
||||
"-DLIBCXXABI_INSTALL_HEADERS=OFF"
|
||||
"-DLIBCXX_INCLUDE_DOCS=OFF"
|
||||
"-DLIBCXX_INCLUDE_TESTS=OFF"
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||
"-DLIBCXX_INSTALL_LIBRARY=OFF"
|
||||
"-DLIBCXX_INSTALL_HEADERS=OFF"
|
||||
];
|
||||
|
||||
extraPostPatch = ''
|
||||
# `No such file or directory: 'ldd'`
|
||||
substituteInPlace ../compiler-rt/test/lit.common.cfg.py \
|
||||
--replace "'ldd'," "'${glibc.bin}/bin/ldd',"
|
||||
|
||||
# We can run these
|
||||
substituteInPlace ../compiler-rt/test/CMakeLists.txt \
|
||||
--replace "endfunction()" "endfunction()''\nadd_subdirectory(builtins)''\nadd_subdirectory(shadowcallstack)"
|
||||
'';
|
||||
|
||||
extraLicenses = [ lib.licenses.mit ];
|
||||
};
|
||||
|
||||
# Stage 3
|
||||
# Helpers
|
||||
rocmClangStdenv = overrideCC stdenv clang;
|
||||
|
||||
clang = wrapCCWith rec {
|
||||
cc = llvm;
|
||||
# inherit libc libcxx bintools;
|
||||
inherit libcxx bintools;
|
||||
|
||||
# We do this to avoid HIP pathing problems, and mimic a monolithic install
|
||||
cc = stdenv.mkDerivation (finalAttrs: {
|
||||
inherit (clang-unwrapped) pname version;
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
clang_version=`${clang-unwrapped}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
|
||||
mkdir -p $out/{bin,include/c++/v1,lib/{cmake,clang/$clang_version/{include,lib}},libexec,share}
|
||||
|
||||
for path in ${llvm} ${clang-unwrapped} ${lld} ${libunwind} ${libcxxabi} ${libcxx} ${compiler-rt}; do
|
||||
cp -as $path/* $out
|
||||
chmod +w $out/{*,include/c++/v1,lib/{clang/$clang_version/include,cmake}}
|
||||
rm -f $out/lib/libc++.so
|
||||
done
|
||||
|
||||
ln -s $out/lib/* $out/lib/clang/$clang_version/lib
|
||||
ln -s $out/include/* $out/lib/clang/$clang_version/include
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.isClang = true;
|
||||
});
|
||||
|
||||
extraPackages = [
|
||||
llvm
|
||||
lld
|
||||
libunwind
|
||||
libcxxabi
|
||||
compiler-rt
|
||||
];
|
||||
|
||||
nixSupport.cc-cflags = [
|
||||
"-resource-dir=$out/resource-root"
|
||||
"-fuse-ld=lld"
|
||||
"-rtlib=compiler-rt"
|
||||
"-unwindlib=libunwind"
|
||||
"-Wno-unused-command-line-argument"
|
||||
];
|
||||
|
||||
extraBuildCommands = ''
|
||||
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
|
||||
ln -s "${cc}/lib/clang/$clang_version/lib" "$rsrc/lib"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags
|
||||
mkdir -p $out/resource-root
|
||||
ln -s ${cc}/lib/clang/$clang_version/{include,lib} $out/resource-root
|
||||
|
||||
# Not sure why, but hardening seems to make things break
|
||||
rm $out/nix-support/add-hardening.sh
|
||||
touch $out/nix-support/add-hardening.sh
|
||||
# GPU compilation uses builtin lld
|
||||
substituteInPlace $out/bin/clang \
|
||||
--replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;'
|
||||
substituteInPlace $out/bin/clang++ \
|
||||
--replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;'
|
||||
|
||||
# GPU compilation uses builtin `lld`
|
||||
substituteInPlace $out/bin/{clang,clang++} \
|
||||
--replace "-MM) dontLink=1 ;;" "-MM | --cuda-device-only) dontLink=1 ;;''\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;"
|
||||
'';
|
||||
};
|
||||
|
||||
clangNoCompilerRt = wrapCCWith rec {
|
||||
cc = llvm;
|
||||
extraBuildCommands = ''
|
||||
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags
|
||||
rm $out/nix-support/add-hardening.sh
|
||||
touch $out/nix-support/add-hardening.sh
|
||||
# GPU compilation uses builtin lld
|
||||
substituteInPlace $out/bin/clang \
|
||||
--replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;'
|
||||
substituteInPlace $out/bin/clang++ \
|
||||
--replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;'
|
||||
# Base
|
||||
# Unfortunately, we cannot build `clang-tools-extra` separately.
|
||||
clang-tools-extra = callPackage ./llvm.nix {
|
||||
stdenv = rocmClangStdenv;
|
||||
buildTests = false; # `invalid operands to binary expression ('std::basic_stringstream<char>' and 'const llvm::StringRef')`
|
||||
targetName = "clang-tools-extra";
|
||||
|
||||
targetProjects = [
|
||||
"clang"
|
||||
"clang-tools-extra"
|
||||
];
|
||||
|
||||
extraBuildInputs = [ gtest ];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DLLVM_INCLUDE_DOCS=OFF"
|
||||
"-DLLVM_INCLUDE_TESTS=OFF"
|
||||
"-DCLANG_INCLUDE_DOCS=OFF"
|
||||
"-DCLANG_INCLUDE_TESTS=ON"
|
||||
"-DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=ON"
|
||||
];
|
||||
|
||||
extraPostInstall = ''
|
||||
# Remove LLVM and Clang
|
||||
for path in `find ${llvm} ${clang-unwrapped}`; do
|
||||
if [ $path != ${llvm} ] && [ $path != ${clang-unwrapped} ]; then
|
||||
rm -f $out''${path#${llvm}} $out''${path#${clang-unwrapped}} || true
|
||||
fi
|
||||
done
|
||||
|
||||
# Cleanup empty directories
|
||||
find $out -type d -empty -delete
|
||||
'';
|
||||
};
|
||||
|
||||
llvm = callPackage ./llvm.nix {
|
||||
inherit src version;
|
||||
# Projects
|
||||
libclc = let
|
||||
spirv = (spirv-llvm-translator.override { inherit llvm; });
|
||||
in callPackage ./llvm.nix rec {
|
||||
stdenv = rocmClangStdenv;
|
||||
buildDocs = false; # No documentation to build
|
||||
buildMan = false; # No man pages to build
|
||||
targetName = "libclc";
|
||||
targetDir = targetName;
|
||||
extraBuildInputs = [ spirv ];
|
||||
|
||||
# `spirv-mesa3d` isn't compiling with LLVM 15.0.0, it does with LLVM 14.0.0
|
||||
# Try removing the `spirv-mesa3d` and `clspv` patches next update
|
||||
# `clspv` tests fail, unresolved calls
|
||||
extraPostPatch = ''
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace "find_program( LLVM_CLANG clang PATHS \''${LLVM_BINDIR} NO_DEFAULT_PATH )" \
|
||||
"find_program( LLVM_CLANG clang PATHS \"${clang}/bin\" NO_DEFAULT_PATH )" \
|
||||
--replace "find_program( LLVM_SPIRV llvm-spirv PATHS \''${LLVM_BINDIR} NO_DEFAULT_PATH )" \
|
||||
"find_program( LLVM_SPIRV llvm-spirv PATHS \"${spirv}/bin\" NO_DEFAULT_PATH )" \
|
||||
--replace " spirv-mesa3d-" "" \
|
||||
--replace " spirv64-mesa3d-" "" \
|
||||
--replace "NOT \''${t} MATCHES" \
|
||||
"NOT \''${ARCH} STREQUAL \"clspv\" AND NOT \''${ARCH} STREQUAL \"clspv64\" AND NOT \''${t} MATCHES"
|
||||
'';
|
||||
|
||||
checkTargets = [ ];
|
||||
};
|
||||
|
||||
lldb = callPackage ./llvm.nix rec {
|
||||
stdenv = rocmClangStdenv;
|
||||
buildTests = false; # ld.lld: error: unable to find library -lllvm_gtest_main
|
||||
targetName = "lldb";
|
||||
targetDir = targetName;
|
||||
extraNativeBuildInputs = [ python3Packages.sphinx-automodapi ];
|
||||
|
||||
extraBuildInputs = [
|
||||
xz
|
||||
swig
|
||||
lua5_3
|
||||
gtest
|
||||
];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DLLVM_EXTERNAL_LIT=${lit}/bin/.lit-wrapped"
|
||||
"-DLLDB_INCLUDE_TESTS=ON"
|
||||
"-DLLDB_INCLUDE_UNITTESTS=ON"
|
||||
];
|
||||
};
|
||||
|
||||
mlir = callPackage ./llvm.nix rec {
|
||||
stdenv = rocmClangStdenv;
|
||||
buildDocs = false; # No decent way to hack this to work
|
||||
buildMan = false; # No man pages to build
|
||||
targetName = "mlir";
|
||||
targetDir = targetName;
|
||||
extraNativeBuildInputs = [ hip ];
|
||||
|
||||
extraBuildInputs = [
|
||||
rocm-comgr
|
||||
vulkan-headers
|
||||
vulkan-loader
|
||||
glslang
|
||||
shaderc
|
||||
];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DCMAKE_POLICY_DEFAULT_CMP0116=NEW"
|
||||
"-DMLIR_INCLUDE_DOCS=ON"
|
||||
"-DMLIR_INCLUDE_TESTS=ON"
|
||||
"-DMLIR_ENABLE_ROCM_RUNNER=ON"
|
||||
"-DMLIR_ENABLE_SPIRV_CPU_RUNNER=ON"
|
||||
"-DMLIR_ENABLE_VULKAN_RUNNER=ON"
|
||||
"-DROCM_TEST_CHIPSET=gfx000" # CPU runner
|
||||
];
|
||||
|
||||
extraPostPatch = ''
|
||||
chmod +w ../llvm
|
||||
mkdir -p ../llvm/build/bin
|
||||
ln -s ${lit}/bin/lit ../llvm/build/bin/llvm-lit
|
||||
|
||||
substituteInPlace test/CMakeLists.txt \
|
||||
--replace "FileCheck count not" "" \
|
||||
--replace "list(APPEND MLIR_TEST_DEPENDS mlir_rocm_runtime)" ""
|
||||
|
||||
substituteInPlace lib/ExecutionEngine/CMakeLists.txt \
|
||||
--replace "return()" ""
|
||||
|
||||
# Remove problematic tests
|
||||
rm test/CAPI/execution_engine.c
|
||||
rm test/Target/LLVMIR/llvmir-intrinsics.mlir
|
||||
rm test/Target/LLVMIR/llvmir.mlir
|
||||
rm test/Target/LLVMIR/openmp-llvm.mlir
|
||||
rm test/mlir-cpu-runner/*.mlir
|
||||
rm test/mlir-vulkan-runner/*.mlir
|
||||
'';
|
||||
|
||||
extraPostInstall = ''
|
||||
mkdir -p $out/bin
|
||||
mv bin/mlir-tblgen $out/bin
|
||||
'';
|
||||
|
||||
checkTargets = [ "check-${targetName}" ];
|
||||
};
|
||||
|
||||
polly = callPackage ./llvm.nix rec {
|
||||
stdenv = rocmClangStdenv;
|
||||
targetName = "polly";
|
||||
targetDir = targetName;
|
||||
checkTargets = [ "check-${targetName}" ];
|
||||
};
|
||||
|
||||
flang = callPackage ./llvm.nix rec {
|
||||
stdenv = rocmClangStdenv;
|
||||
buildTests = false; # `Executable "flang1" doesn't exist!`
|
||||
targetName = "flang";
|
||||
targetDir = targetName;
|
||||
extraNativeBuildInputs = [ python3Packages.sphinx-markdown-tables ];
|
||||
extraBuildInputs = [ mlir ];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DCMAKE_POLICY_DEFAULT_CMP0116=NEW"
|
||||
"-DCLANG_DIR=${clang-unwrapped}/lib/cmake/clang"
|
||||
"-DFLANG_INCLUDE_TESTS=OFF"
|
||||
"-DMLIR_TABLEGEN_EXE=${mlir}/bin/mlir-tblgen"
|
||||
];
|
||||
|
||||
extraPostPatch = ''
|
||||
substituteInPlace test/CMakeLists.txt \
|
||||
--replace "FileCheck" "" \
|
||||
--replace "count" "" \
|
||||
--replace "not" ""
|
||||
|
||||
substituteInPlace docs/CMakeLists.txt \
|
||||
--replace "CLANG_TABLEGEN_EXE clang-tblgen" "CLANG_TABLEGEN_EXE ${clang-unwrapped}/bin/clang-tblgen"
|
||||
'';
|
||||
};
|
||||
|
||||
openmp = callPackage ./llvm.nix rec {
|
||||
stdenv = rocmClangStdenv;
|
||||
buildTests = false; # Too many failures, most pass
|
||||
targetName = "openmp";
|
||||
targetDir = targetName;
|
||||
extraPatches = [ ./0000-fix-openmp.patch ];
|
||||
extraNativeBuildInputs = [ perl ];
|
||||
|
||||
extraBuildInputs = [
|
||||
rocm-device-libs
|
||||
rocm-runtime
|
||||
elfutils
|
||||
];
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DCMAKE_MODULE_PATH=/build/source/llvm/cmake/modules" # For docs
|
||||
"-DCLANG_TOOL=${clang}/bin/clang"
|
||||
"-DCLANG_OFFLOAD_BUNDLER_TOOL=${clang-unwrapped}/bin/clang-offload-bundler"
|
||||
"-DOPENMP_LLVM_TOOLS_DIR=${llvm}/bin"
|
||||
"-DOPENMP_LLVM_LIT_EXECUTABLE=${lit}/bin/.lit-wrapped"
|
||||
"-DDEVICELIBS_ROOT=${rocm-device-libs.src}"
|
||||
];
|
||||
|
||||
extraPostPatch = ''
|
||||
# We can't build this target at the moment
|
||||
substituteInPlace libomptarget/DeviceRTL/CMakeLists.txt \
|
||||
--replace "gfx1010" ""
|
||||
'';
|
||||
|
||||
checkTargets = [ "check-${targetName}" ];
|
||||
extraLicenses = [ lib.licenses.mit ];
|
||||
};
|
||||
|
||||
# Runtimes
|
||||
pstl = callPackage ./llvm.nix rec {
|
||||
stdenv = rocmClangStdenv;
|
||||
buildDocs = false; # No documentation to build
|
||||
buildMan = false; # No man pages to build
|
||||
buildTests = false; # Too many errors
|
||||
targetName = "pstl";
|
||||
targetDir = "runtimes";
|
||||
targetRuntimes = [ targetName ];
|
||||
checkTargets = [ "check-${targetName}" ];
|
||||
};
|
||||
}
|
||||
|
@ -1,22 +1,44 @@
|
||||
{ stdenv
|
||||
, lib
|
||||
, fetchgit
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, writeScript
|
||||
, rocmUpdateScript
|
||||
, pkg-config
|
||||
, cmake
|
||||
, ninja
|
||||
, python3
|
||||
, git
|
||||
, doxygen
|
||||
, sphinx
|
||||
, lit
|
||||
, libxml2
|
||||
, libffi
|
||||
, libbfd
|
||||
, libxcrypt
|
||||
, ncurses
|
||||
, libedit
|
||||
, libffi
|
||||
, mpfr
|
||||
, zlib
|
||||
, debugVersion ? false
|
||||
, enableManpages ? false
|
||||
|
||||
, version
|
||||
, src
|
||||
, ncurses
|
||||
, python3Packages
|
||||
, buildDocs ? true
|
||||
, buildMan ? true
|
||||
, buildTests ? true
|
||||
, targetName ? "llvm"
|
||||
, targetDir ? "llvm"
|
||||
, targetProjects ? [ ]
|
||||
, targetRuntimes ? [ ]
|
||||
, extraPatches ? [ ]
|
||||
, extraNativeBuildInputs ? [ ]
|
||||
, extraBuildInputs ? [ ]
|
||||
, extraCMakeFlags ? [ ]
|
||||
, extraPostPatch ? ""
|
||||
, checkTargets ? [(
|
||||
lib.optionalString buildTests (
|
||||
if targetDir == "runtimes"
|
||||
then "check-runtimes"
|
||||
else "check-all"
|
||||
)
|
||||
)]
|
||||
, extraPostInstall ? ""
|
||||
, extraLicenses ? [ ]
|
||||
, isBroken ? false
|
||||
}:
|
||||
|
||||
let
|
||||
@ -25,73 +47,119 @@ let
|
||||
else if stdenv.isAarch64 then "AArch64"
|
||||
else throw "Unsupported ROCm LLVM platform";
|
||||
in stdenv.mkDerivation (finalAttrs: {
|
||||
inherit src version;
|
||||
pname = "rocm-llvm-${targetName}";
|
||||
version = "5.4.1";
|
||||
|
||||
pname = "rocm-llvm";
|
||||
|
||||
sourceRoot = "${src.name}/llvm";
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 ];
|
||||
|
||||
buildInputs = [ libxml2 libxcrypt ];
|
||||
|
||||
propagatedBuildInputs = [ ncurses zlib ];
|
||||
|
||||
cmakeFlags = with stdenv; [
|
||||
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
||||
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
||||
"-DLLVM_TARGETS_TO_BUILD=AMDGPU;${llvmNativeTarget}"
|
||||
"-DLLVM_ENABLE_PROJECTS=clang;lld;compiler-rt"
|
||||
]
|
||||
++ lib.optionals enableManpages [
|
||||
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
|
||||
"-DLLVM_BUILD_DOCS=ON"
|
||||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||
outputs = [
|
||||
"out"
|
||||
] ++ lib.optionals buildDocs [
|
||||
"doc"
|
||||
] ++ lib.optionals buildMan [
|
||||
"man"
|
||||
"info" # Avoid `attribute 'info' missing` when using with wrapCC
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
patches = extraPatches;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "RadeonOpenCompute";
|
||||
repo = "llvm-project";
|
||||
rev = "rocm-${finalAttrs.version}";
|
||||
hash = "sha256-rlVo77h344PLGj/mIzsw+/ndWywsBsiKDXsEDpWSUno=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
cmake
|
||||
ninja
|
||||
git
|
||||
python3Packages.python
|
||||
] ++ lib.optionals (buildDocs || buildMan) [
|
||||
doxygen
|
||||
sphinx
|
||||
python3Packages.recommonmark
|
||||
] ++ lib.optionals (buildTests && !finalAttrs.passthru.isLLVM) [
|
||||
lit
|
||||
] ++ extraNativeBuildInputs;
|
||||
|
||||
buildInputs = [
|
||||
libxml2
|
||||
libxcrypt
|
||||
libedit
|
||||
libffi
|
||||
mpfr
|
||||
] ++ extraBuildInputs;
|
||||
|
||||
propagatedBuildInputs = lib.optionals finalAttrs.passthru.isLLVM [
|
||||
zlib
|
||||
ncurses
|
||||
];
|
||||
|
||||
sourceRoot = "${finalAttrs.src.name}/${targetDir}";
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_TARGETS_TO_BUILD=AMDGPU;${llvmNativeTarget}"
|
||||
] ++ lib.optionals (finalAttrs.passthru.isLLVM && targetProjects != [ ]) [
|
||||
"-DLLVM_ENABLE_PROJECTS=${lib.concatStringsSep ";" targetProjects}"
|
||||
] ++ lib.optionals ((finalAttrs.passthru.isLLVM || targetDir == "runtimes") && targetRuntimes != [ ]) [
|
||||
"-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" targetRuntimes}"
|
||||
] ++ lib.optionals (finalAttrs.passthru.isLLVM || finalAttrs.passthru.isClang) [
|
||||
"-DLLVM_ENABLE_RTTI=ON"
|
||||
"-DLLVM_ENABLE_EH=ON"
|
||||
] ++ lib.optionals (buildDocs || buildMan) [
|
||||
"-DLLVM_INCLUDE_DOCS=ON"
|
||||
"-DLLVM_BUILD_DOCS=ON"
|
||||
# "-DLLVM_ENABLE_DOXYGEN=ON" Way too slow, only uses one core
|
||||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DLLVM_ENABLE_OCAMLDOC=OFF"
|
||||
"-DSPHINX_OUTPUT_HTML=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||
] ++ lib.optionals buildTests [
|
||||
"-DLLVM_INCLUDE_TESTS=ON"
|
||||
"-DLLVM_BUILD_TESTS=ON"
|
||||
] ++ lib.optionals (buildTests && !finalAttrs.passthru.isLLVM) [
|
||||
"-DLLVM_EXTERNAL_LIT=${lit}/bin/.lit-wrapped"
|
||||
] ++ extraCMakeFlags;
|
||||
|
||||
postPatch = lib.optionalString finalAttrs.passthru.isLLVM ''
|
||||
patchShebangs lib/OffloadArch/make_generated_offload_arch_h.sh
|
||||
substituteInPlace ../clang/cmake/modules/CMakeLists.txt \
|
||||
--replace 'FILES_MATCHING' 'NO_SOURCE_PERMISSIONS FILES_MATCHING'
|
||||
'';
|
||||
'' + lib.optionalString (buildTests && finalAttrs.passthru.isLLVM) ''
|
||||
# FileSystem permissions tests fail with various special bits
|
||||
rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
|
||||
rm unittests/Support/Path.cpp
|
||||
|
||||
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||
--replace "Path.cpp" ""
|
||||
'' + extraPostPatch;
|
||||
|
||||
doCheck = buildTests;
|
||||
checkTarget = lib.concatStringsSep " " checkTargets;
|
||||
|
||||
postInstall = lib.optionalString finalAttrs.passthru.isLLVM ''
|
||||
# `lit` expects these for some test suites
|
||||
mv bin/{FileCheck,not,count,yaml2obj,obj2yaml} $out/bin
|
||||
'' + lib.optionalString buildMan ''
|
||||
mkdir -p $info
|
||||
'' + extraPostInstall;
|
||||
|
||||
passthru = {
|
||||
isClang = true;
|
||||
isLLVM = targetDir == "llvm";
|
||||
isClang = targetDir == "clang" || builtins.elem "clang" targetProjects;
|
||||
|
||||
updateScript = writeScript "update.sh" ''
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github
|
||||
|
||||
version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
|
||||
-sL "https://api.github.com/repos/RadeonOpenCompute/llvm-project/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
|
||||
|
||||
IFS='.' read -a version_arr <<< "$version"
|
||||
|
||||
if [ "''${#version_arr[*]}" == 2 ]; then
|
||||
version="''${version}.0"
|
||||
fi
|
||||
|
||||
current_version="$(grep "version =" pkgs/development/compilers/llvm/rocm/default.nix | cut -d'"' -f2)"
|
||||
if [[ "$version" != "$current_version" ]]; then
|
||||
tarball_meta="$(nix-prefetch-github RadeonOpenCompute llvm-project --rev "rocm-$version")"
|
||||
tarball_hash="$(nix to-base64 sha256-$(jq -r '.sha256' <<< "$tarball_meta"))"
|
||||
sed -i "pkgs/development/compilers/llvm/rocm/default.nix" \
|
||||
-e 's,version = "\(.*\)",version = "'"$version"'",' \
|
||||
-e 's,hash = "\(.*\)",hash = "sha256-'"$tarball_hash"'",'
|
||||
else
|
||||
echo rocm-llvm already up-to-date
|
||||
fi
|
||||
'';
|
||||
updateScript = rocmUpdateScript {
|
||||
name = finalAttrs.pname;
|
||||
owner = finalAttrs.src.owner;
|
||||
repo = finalAttrs.src.repo;
|
||||
};
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "ROCm fork of the LLVM compiler infrastructure";
|
||||
homepage = "https://github.com/RadeonOpenCompute/llvm-project";
|
||||
license = with licenses; [ ncsa ];
|
||||
license = with licenses; [ ncsa ] ++ extraLicenses;
|
||||
maintainers = with maintainers; [ acowley lovesegfault ] ++ teams.rocm.members;
|
||||
platforms = platforms.linux;
|
||||
broken = isBroken;
|
||||
};
|
||||
})
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "nasm";
|
||||
version = "2.15.05";
|
||||
version = "2.16.01";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.nasm.us/pub/nasm/releasebuilds/${version}/${pname}-${version}.tar.xz";
|
||||
sha256 = "0gqand86b0r86k3h46dh560lykxmxqqywz5m55kgjfq7q4lngbrw";
|
||||
sha256 = "sha256-x3dF9IAjde/u4uxcCta38DfqnIfJKxSaljf/CZ8WJVg=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ perl ];
|
||||
|
@ -1,3 +1,4 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
configureFlags="-prefix $out $configureFlags"
|
||||
|
@ -11,8 +11,8 @@
|
||||
let
|
||||
major = "11";
|
||||
minor = "0";
|
||||
update = "15";
|
||||
build = "10";
|
||||
update = "17";
|
||||
build = "8";
|
||||
|
||||
openjdk = stdenv.mkDerivation rec {
|
||||
pname = "openjdk" + lib.optionalString headless "-headless";
|
||||
@ -22,7 +22,7 @@ let
|
||||
owner = "openjdk";
|
||||
repo = "jdk${major}u";
|
||||
rev = "jdk-${version}";
|
||||
sha256 = "le2JDxPJPSuga4JxLJNRZwCaodptSb2kh4TsJXumTXs=";
|
||||
sha256 = "sha256-kvgLYqQZPqyuigVyzbDHc3TMff0clvzM8IdzYLYcxPU=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkg-config autoconf unzip ];
|
||||
@ -131,12 +131,12 @@ let
|
||||
postFixup = ''
|
||||
# Build the set of output library directories to rpath against
|
||||
LIBDIRS=""
|
||||
for output in $outputs; do
|
||||
for output in $(getAllOutputNames); do
|
||||
if [ "$output" = debug ]; then continue; fi
|
||||
LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
|
||||
done
|
||||
# Add the local library paths to remove dependencies on the bootstrap
|
||||
for output in $outputs; do
|
||||
for output in $(getAllOutputNames); do
|
||||
if [ "$output" = debug ]; then continue; fi
|
||||
OUTPUTDIR=$(eval echo \$$output)
|
||||
BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
|
||||
|
@ -135,12 +135,12 @@ let
|
||||
postFixup = ''
|
||||
# Build the set of output library directories to rpath against
|
||||
LIBDIRS=""
|
||||
for output in $outputs; do
|
||||
for output in $(getAllOutputNames); do
|
||||
if [ "$output" = debug ]; then continue; fi
|
||||
LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
|
||||
done
|
||||
# Add the local library paths to remove dependencies on the bootstrap
|
||||
for output in $outputs; do
|
||||
for output in $(getAllOutputNames); do
|
||||
if [ "$output" = debug ]; then continue; fi
|
||||
OUTPUTDIR=$(eval echo \$$output)
|
||||
BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user