diff --git a/nixos/modules/config/update-users-groups.pl b/nixos/modules/config/update-users-groups.pl index bef08dc4020..232f886789d 100644 --- a/nixos/modules/config/update-users-groups.pl +++ b/nixos/modules/config/update-users-groups.pl @@ -1,11 +1,10 @@ use strict; +use warnings; use File::Path qw(make_path); use File::Slurp; +use Getopt::Long; use JSON; -make_path("/var/lib/nixos", { mode => 0755 }); - - # Keep track of deleted uids and gids. my $uidMapFile = "/var/lib/nixos/uid-map"; my $uidMap = -e $uidMapFile ? decode_json(read_file($uidMapFile)) : {}; @@ -13,12 +12,19 @@ my $uidMap = -e $uidMapFile ? decode_json(read_file($uidMapFile)) : {}; my $gidMapFile = "/var/lib/nixos/gid-map"; my $gidMap = -e $gidMapFile ? decode_json(read_file($gidMapFile)) : {}; +my $is_dry = ($ENV{'NIXOS_ACTION'} // "") eq "dry-activate"; +GetOptions("dry-activate" => \$is_dry); +make_path("/var/lib/nixos", { mode => 0755 }) unless $is_dry; sub updateFile { my ($path, $contents, $perms) = @_; + return if $is_dry; write_file($path, { atomic => 1, binmode => ':utf8', perms => $perms // 0644 }, $contents) or die; } +sub nscdInvalidate { + system("nscd", "--invalidate", $_[0]) unless $is_dry; +} sub hashPassword { my ($password) = @_; @@ -28,6 +34,14 @@ sub hashPassword { return crypt($password, '$6$' . $salt . '$'); } +sub dry_print { + if ($is_dry) { + print STDERR ("$_[1] $_[2]\n") + } else { + print STDERR ("$_[0] $_[2]\n") + } +} + # Functions for allocating free GIDs/UIDs. FIXME: respect ID ranges in # /etc/login.defs. @@ -51,7 +65,7 @@ sub allocGid { my ($name) = @_; my $prevGid = $gidMap->{$name}; if (defined $prevGid && !defined $gidsUsed{$prevGid}) { - print STDERR "reviving group '$name' with GID $prevGid\n"; + dry_print("reviving", "would revive", "group '$name' with GID $prevGid"); $gidsUsed{$prevGid} = 1; return $prevGid; } @@ -63,15 +77,14 @@ sub allocUid { my ($min, $max, $up) = $isSystemUser ? (400, 999, 0) : (1000, 29999, 1); my $prevUid = $uidMap->{$name}; if (defined $prevUid && $prevUid >= $min && $prevUid <= $max && !defined $uidsUsed{$prevUid}) { - print STDERR "reviving user '$name' with UID $prevUid\n"; + dry_print("reviving", "would revive", "user '$name' with UID $prevUid"); $uidsUsed{$prevUid} = 1; return $prevUid; } return allocId(\%uidsUsed, \%uidsPrevUsed, $min, $max, $up, sub { my ($uid) = @_; getpwuid($uid) }); } - -# Read the declared users/groups. +# Read the declared users/groups my $spec = decode_json(read_file($ARGV[0])); # Don't allocate UIDs/GIDs that are manually assigned. @@ -134,7 +147,7 @@ foreach my $g (@{$spec->{groups}}) { if (defined $existing) { $g->{gid} = $existing->{gid} if !defined $g->{gid}; if ($g->{gid} != $existing->{gid}) { - warn "warning: not applying GID change of group ‘$name’ ($existing->{gid} -> $g->{gid})\n"; + dry_print("warning: not applying", "warning: would not apply", "GID change of group ‘$name’ ($existing->{gid} -> $g->{gid})"); $g->{gid} = $existing->{gid}; } $g->{password} = $existing->{password}; # do we want this? @@ -163,7 +176,7 @@ foreach my $name (keys %groupsCur) { my $g = $groupsCur{$name}; next if defined $groupsOut{$name}; if (!$spec->{mutableUsers} || defined $declGroups{$name}) { - print STDERR "removing group ‘$name’\n"; + dry_print("removing group", "would remove group", "‘$name’"); } else { $groupsOut{$name} = $g; } @@ -175,7 +188,7 @@ my @lines = map { join(":", $_->{name}, $_->{password}, $_->{gid}, $_->{members} (sort { $a->{gid} <=> $b->{gid} } values(%groupsOut)); updateFile($gidMapFile, to_json($gidMap)); updateFile("/etc/group", \@lines); -system("nscd --invalidate group"); +nscdInvalidate("group"); # Generate a new /etc/passwd containing the declared users. my %usersOut; @@ -196,7 +209,7 @@ foreach my $u (@{$spec->{users}}) { if (defined $existing) { $u->{uid} = $existing->{uid} if !defined $u->{uid}; if ($u->{uid} != $existing->{uid}) { - warn "warning: not applying UID change of user ‘$name’ ($existing->{uid} -> $u->{uid})\n"; + dry_print("warning: not applying", "warning: would not apply", "UID change of user ‘$name’ ($existing->{uid} -> $u->{uid})"); $u->{uid} = $existing->{uid}; } } else { @@ -211,7 +224,7 @@ foreach my $u (@{$spec->{users}}) { # Ensure home directory incl. ownership and permissions. if ($u->{createHome}) { - make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home}; + make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home} and ! $is_dry; chown $u->{uid}, $u->{gid}, $u->{home}; chmod 0700, $u->{home}; } @@ -250,7 +263,7 @@ foreach my $name (keys %usersCur) { my $u = $usersCur{$name}; next if defined $usersOut{$name}; if (!$spec->{mutableUsers} || defined $declUsers{$name}) { - print STDERR "removing user ‘$name’\n"; + dry_print("removing user", "would remove user", "‘$name’"); } else { $usersOut{$name} = $u; } @@ -261,7 +274,7 @@ foreach my $name (keys %usersCur) { (sort { $a->{uid} <=> $b->{uid} } (values %usersOut)); updateFile($uidMapFile, to_json($uidMap)); updateFile("/etc/passwd", \@lines); -system("nscd --invalidate passwd"); +nscdInvalidate("passwd"); # Rewrite /etc/shadow to add new accounts or remove dead ones. @@ -293,7 +306,7 @@ updateFile("/etc/shadow", \@shadowNew, 0640); my $uid = getpwnam "root"; my $gid = getgrnam "shadow"; my $path = "/etc/shadow"; - chown($uid, $gid, $path) || die "Failed to change ownership of $path: $!"; + (chown($uid, $gid, $path) || die "Failed to change ownership of $path: $!") unless $is_dry; } # Rewrite /etc/subuid & /etc/subgid to include default container mappings diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index f86be3be2c6..d88162558e6 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -561,14 +561,16 @@ in { shadow.gid = ids.gids.shadow; }; - system.activationScripts.users = stringAfter [ "stdio" ] - '' + system.activationScripts.users = { + supportsDryActivation = true; + text = '' install -m 0700 -d /root install -m 0755 -d /home ${pkgs.perl.withPackages (p: [ p.FileSlurp p.JSON ])}/bin/perl \ -w ${./update-users-groups.pl} ${spec} ''; + }; # for backwards compatibility system.activationScripts.groups = stringAfter [ "users" ] ""; diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix index 3a6930314b1..548b4de852b 100644 --- a/nixos/modules/system/activation/activation-script.nix +++ b/nixos/modules/system/activation/activation-script.nix @@ -17,6 +17,41 @@ let ''; }); + systemActivationScript = set: onlyDry: let + set' = filterAttrs (_: v: onlyDry -> v.supportsDryActivation) (mapAttrs (_: v: if isString v then (noDepEntry v) // { supportsDryActivation = false; } else v) set); + withHeadlines = addAttributeName set'; + in + '' + #!${pkgs.runtimeShell} + + systemConfig='@out@' + + export PATH=/empty + for i in ${toString path}; do + PATH=$PATH:$i/bin:$i/sbin + done + + _status=0 + trap "_status=1 _localstatus=\$?" ERR + + # Ensure a consistent umask. + umask 0022 + + ${textClosureMap id (withHeadlines) (attrNames withHeadlines)} + + '' + optionalString (!onlyDry) '' + # Make this configuration the current configuration. + # The readlink is there to ensure that when $systemConfig = /system + # (which is a symlink to the store), /run/current-system is still + # used as a garbage collection root. + ln -sfn "$(readlink -f "$systemConfig")" /run/current-system + + # Prevent the current configuration from being garbage-collected. + ln -sfn /run/current-system /nix/var/nix/gcroots/current-system + + exit $_status + ''; + path = with pkgs; map getBin [ coreutils gnugrep @@ -28,7 +63,7 @@ let util-linux # needed for mount and mountpoint ]; - scriptType = with types; + scriptType = withDry: with types; let scriptOptions = { deps = mkOption { type = types.listOf types.str; @@ -39,6 +74,19 @@ let { type = types.lines; description = "The content of the script."; }; + } // optionalAttrs withDry { + supportsDryActivation = mkOption + { type = types.bool; + default = false; + description = '' + Whether this activation script supports being dry-activated. + These activation scripts will also be executed on dry-activate + activations with the environment variable + NIXOS_ACTION being set to dry-activate + . it's important that these activation scripts don't + modify anything about the system when the variable is set. + ''; + }; }; in either str (submodule { options = scriptOptions; }); @@ -74,47 +122,19 @@ in idempotent and fast. ''; - type = types.attrsOf scriptType; - - apply = set: { - script = - '' - #! ${pkgs.runtimeShell} - - systemConfig=@out@ - - export PATH=/empty - for i in ${toString path}; do - PATH=$PATH:$i/bin:$i/sbin - done - - _status=0 - trap "_status=1 _localstatus=\$?" ERR - - # Ensure a consistent umask. - umask 0022 - - ${ - let - set' = mapAttrs (n: v: if isString v then noDepEntry v else v) set; - withHeadlines = addAttributeName set'; - in textClosureMap id (withHeadlines) (attrNames withHeadlines) - } - - # Make this configuration the current configuration. - # The readlink is there to ensure that when $systemConfig = /system - # (which is a symlink to the store), /run/current-system is still - # used as a garbage collection root. - ln -sfn "$(readlink -f "$systemConfig")" /run/current-system - - # Prevent the current configuration from being garbage-collected. - ln -sfn /run/current-system /nix/var/nix/gcroots/current-system - - exit $_status - ''; + type = types.attrsOf (scriptType true); + apply = set: set // { + script = systemActivationScript set false; }; }; + system.dryActivationScript = mkOption { + description = "The shell script that is to be run when dry-activating a system."; + readOnly = true; + internal = true; + default = systemActivationScript (removeAttrs config.system.activationScripts [ "script" ]) true; + }; + system.userActivationScripts = mkOption { default = {}; @@ -137,7 +157,7 @@ in idempotent and fast. ''; - type = with types; attrsOf scriptType; + type = with types; attrsOf (scriptType false); apply = set: { script = '' diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl index dd391c8b5d7..b7a06275529 100644 --- a/nixos/modules/system/activation/switch-to-configuration.pl +++ b/nixos/modules/system/activation/switch-to-configuration.pl @@ -36,6 +36,8 @@ EOF exit 1; } +$ENV{NIXOS_ACTION} = $action; + # This is a NixOS installation if it has /etc/NIXOS or a proper # /etc/os-release. die "This is not a NixOS installation!\n" unless @@ -360,6 +362,10 @@ if ($action eq "dry-activate") { if scalar @unitsToStopFiltered > 0; print STDERR "would NOT stop the following changed units: ", join(", ", sort(keys %unitsToSkip)), "\n" if scalar(keys %unitsToSkip) > 0; + + print STDERR "would activate the configuration...\n"; + system("$out/dry-activate", "$out"); + print STDERR "would restart systemd\n" if $restartSystemd; print STDERR "would restart the following units: ", join(", ", sort(keys %unitsToRestart)), "\n" if scalar(keys %unitsToRestart) > 0; diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index d3e4923a993..80835d9688f 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -56,9 +56,11 @@ let ''} echo "$activationScript" > $out/activate + echo "$dryActivationScript" > $out/dry-activate substituteInPlace $out/activate --subst-var out - chmod u+x $out/activate - unset activationScript + substituteInPlace $out/dry-activate --subst-var out + chmod u+x $out/activate $out/dry-activate + unset activationScript dryActivationScript cp ${config.system.build.bootStage2} $out/init substituteInPlace $out/init --subst-var-by systemConfig $out @@ -108,6 +110,7 @@ let config.system.build.installBootLoader or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true"; activationScript = config.system.activationScripts.script; + dryActivationScript = config.system.dryActivationScript; nixosLabel = config.system.nixos.label; configurationName = config.boot.loader.grub.configurationName; diff --git a/nixos/modules/tasks/lvm.nix b/nixos/modules/tasks/lvm.nix index 98a0e2ddef9..aaa76b49fa3 100644 --- a/nixos/modules/tasks/lvm.nix +++ b/nixos/modules/tasks/lvm.nix @@ -46,22 +46,32 @@ in { kernelModules = [ "dm-snapshot" "dm-thin-pool" ]; extraUtilsCommands = '' - copy_bin_and_libs ${pkgs.thin-provisioning-tools}/bin/pdata_tools - copy_bin_and_libs ${pkgs.thin-provisioning-tools}/bin/thin_check + for BIN in ${pkgs.thin-provisioning-tools}/bin/*; do + copy_bin_and_libs $BIN + done + ''; + + extraUtilsCommandsTest = '' + ls ${pkgs.thin-provisioning-tools}/bin/ | grep -v pdata_tools | while read BIN; do + $out/bin/$(basename $BIN) --help > /dev/null + done ''; }; - environment.etc."lvm/lvm.conf".text = '' - global/thin_check_executable = "${pkgs.thin-provisioning-tools}/bin/thin_check" - ''; + environment.etc."lvm/lvm.conf".text = concatMapStringsSep "\n" + (bin: "global/${bin}_executable = ${pkgs.thin-provisioning-tools}/bin/${bin}") + [ "thin_check" "thin_dump" "thin_repair" "cache_check" "cache_dump" "cache_repair" ]; }) (mkIf (cfg.dmeventd.enable || cfg.boot.thin.enable) { boot.initrd.preLVMCommands = '' mkdir -p /etc/lvm cat << EOF >> /etc/lvm/lvm.conf - ${optionalString cfg.boot.thin.enable '' - global/thin_check_executable = "$(command -v thin_check)" - ''} + ${optionalString cfg.boot.thin.enable ( + concatMapStringsSep "\n" + (bin: "global/${bin}_executable = $(command -v ${bin})") + [ "thin_check" "thin_dump" "thin_repair" "cache_check" "cache_dump" "cache_repair" ] + ) + } ${optionalString cfg.dmeventd.enable '' dmeventd/executable = "$(command -v false)" activation/monitoring = 0 diff --git a/nixos/tests/mutable-users.nix b/nixos/tests/mutable-users.nix index e3f002d9b19..ebe32e6487e 100644 --- a/nixos/tests/mutable-users.nix +++ b/nixos/tests/mutable-users.nix @@ -12,6 +12,7 @@ import ./make-test-python.nix ({ pkgs, ...} : { }; mutable = { ... }: { users.mutableUsers = true; + users.users.dry-test.isNormalUser = true; }; }; @@ -41,5 +42,32 @@ import ./make-test-python.nix ({ pkgs, ...} : { "${mutableSystem}/bin/switch-to-configuration test" ) assert "/run/wrappers/" in machine.succeed("which passwd") + + with subtest("dry-activation does not change files"): + machine.succeed('test -e /home/dry-test') # home was created + machine.succeed('rm -rf /home/dry-test') + + files_to_check = ['/etc/group', + '/etc/passwd', + '/etc/shadow', + '/etc/subuid', + '/etc/subgid', + '/var/lib/nixos/uid-map', + '/var/lib/nixos/gid-map', + '/var/lib/nixos/declarative-groups', + '/var/lib/nixos/declarative-users' + ] + expected_hashes = {} + expected_stats = {} + for file in files_to_check: + expected_hashes[file] = machine.succeed(f"sha256sum {file}") + expected_stats[file] = machine.succeed(f"stat {file}") + + machine.succeed("/run/current-system/bin/switch-to-configuration dry-activate") + + machine.fail('test -e /home/dry-test') # home was not recreated + for file in files_to_check: + assert machine.succeed(f"sha256sum {file}") == expected_hashes[file] + assert machine.succeed(f"stat {file}") == expected_stats[file] ''; }) diff --git a/pkgs/applications/audio/lollypop/default.nix b/pkgs/applications/audio/lollypop/default.nix index 860a621847d..56427756288 100644 --- a/pkgs/applications/audio/lollypop/default.nix +++ b/pkgs/applications/audio/lollypop/default.nix @@ -25,7 +25,7 @@ python3.pkgs.buildPythonApplication rec { pname = "lollypop"; - version = "1.4.17"; + version = "1.4.23"; format = "other"; doCheck = false; @@ -34,7 +34,7 @@ python3.pkgs.buildPythonApplication rec { url = "https://gitlab.gnome.org/World/lollypop"; rev = "refs/tags/${version}"; fetchSubmodules = true; - sha256 = "sha256-GrznUXIYUTYOKQ1znsCqmBdm5YImCABMK2NGRtx5fSk="; + sha256 = "sha256-wwdH3gMpYt40VGqrL1XfB1dOfg45zLKtTEI23AwjCis="; }; nativeBuildInputs = [ diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix index c693fa8fdcf..f54f9d84546 100644 --- a/pkgs/applications/virtualization/virtualbox/default.nix +++ b/pkgs/applications/virtualization/virtualbox/default.nix @@ -200,6 +200,11 @@ in stdenv.mkDerivation { done ''} + # https://github.com/NixOS/nixpkgs/issues/137104 + ${optionalString (enableHardening || headless) '' + rm $libexec/components/VBoxREM.so + ''} + cp -rv out/linux.*/${buildType}/bin/src "$modsrc" ''; diff --git a/pkgs/build-support/coq/default.nix b/pkgs/build-support/coq/default.nix index 5f2b5e646b0..05f6e7762a0 100644 --- a/pkgs/build-support/coq/default.nix +++ b/pkgs/build-support/coq/default.nix @@ -57,7 +57,8 @@ let ] "") + optionalString (v == null) "-broken"; append-version = p: n: p + display-pkg n "" coqPackages.${n}.version + "-"; prefix-name = foldl append-version "" namePrefix; - var-coqlib-install = (optionalString (versions.isGe "8.7" coq.coq-version) "COQMF_") + "COQLIB"; + var-coqlib-install = + (optionalString (versions.isGe "8.7" coq.coq-version || coq.coq-version == "dev") "COQMF_") + "COQLIB"; useDune2 = args.useDune2 or (useDune2ifVersion fetched.version); in diff --git a/pkgs/build-support/mkshell/default.nix b/pkgs/build-support/mkshell/default.nix index f85a11394cb..27ee7e32262 100644 --- a/pkgs/build-support/mkshell/default.nix +++ b/pkgs/build-support/mkshell/default.nix @@ -16,7 +16,7 @@ let mergeInputs = name: (attrs.${name} or []) ++ - (lib.subtractLists inputsFrom (lib.catAttrs name inputsFrom)); + (lib.subtractLists inputsFrom (lib.flatten (lib.catAttrs name inputsFrom))); rest = builtins.removeAttrs attrs [ "packages" diff --git a/pkgs/development/compilers/hip/default.nix b/pkgs/development/compilers/hip/default.nix new file mode 100644 index 00000000000..ff5a34330ed --- /dev/null +++ b/pkgs/development/compilers/hip/default.nix @@ -0,0 +1,166 @@ +{ stdenv +, binutils-unwrapped +, clang +, clang-unwrapped +, cmake +, compiler-rt +, fetchFromGitHub +, fetchpatch +, file +, lib +, lld +, llvm +, makeWrapper +, perl +, python +, rocclr +, rocm-comgr +, rocm-device-libs +, rocm-opencl-runtime +, rocm-runtime +, rocm-thunk +, rocminfo +, writeText +}: + +stdenv.mkDerivation rec { + name = "hip"; + version = "4.3.1"; + src = fetchFromGitHub { + owner = "ROCm-Developer-Tools"; + repo = "HIP"; + rev = "rocm-${version}"; + sha256 = "sha256-dUdP32H0u6kVItS+VUE549vvxkV1mSN84HvyfeK2hEE="; + }; + + # FIXME: https://github.com/ROCm-Developer-Tools/HIP/issues/2317 + postPatch = '' + cp ${rocm-opencl-runtime.src}/amdocl/cl_vk_amd.hpp amdocl/ + ''; + + nativeBuildInputs = [ cmake python makeWrapper ]; + propagatedBuildInputs = [ + clang + compiler-rt + lld + llvm + rocclr + rocm-comgr + rocm-device-libs + rocm-runtime + rocm-thunk + rocminfo + ]; + + preConfigure = '' + export HIP_CLANG_PATH=${clang}/bin + export DEVICE_LIB_PATH=${rocm-device-libs}/lib + ''; + + # The patch version is the last two digits of year + week number + + # day in the week: date -d "2021-07-25" +%y%U%w + workweek = "21300"; + + cmakeFlags = [ + "-DHSA_PATH=${rocm-runtime}" + "-DHIP_COMPILER=clang" + "-DHIP_PLATFORM=amd" + "-DHIP_VERSION_GITDATE=${workweek}" + "-DCMAKE_C_COMPILER=${clang}/bin/clang" + "-DCMAKE_CXX_COMPILER=${clang}/bin/clang++" + "-DLLVM_ENABLE_RTTI=ON" + "-DLIBROCclr_STATIC_DIR=${rocclr}/lib/cmake" + "-DROCclr_DIR=${rocclr}" + "-DHIP_CLANG_ROOT=${clang-unwrapped}" + ]; + + patches = [ + (fetchpatch { + name = "no-git-during-build"; + url = "https://github.com/acowley/HIP/commit/310b7e972cfb23216250c0240ba6134741679aee.patch"; + sha256 = "08ky7v1yvajabn9m5x3afzrnz38gnrgc7vgqlbyr7s801c383ha1"; + }) + (fetchpatch { + name = "use-PATH-when-compiling-pch"; + url = "https://github.com/acowley/HIP/commit/bfb4dd1eafa9714a2c05a98229cc35ffa3429b37.patch"; + sha256 = "1wp0m32df7pf4rhx3k5n750fd7kz10zr60z0wllb0mw6h00w6xpz"; + }) + ]; + + # - 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 + + for f in $(find . -regex '.*\.cpp\|.*\.h\(pp\)?'); do + if grep -q __hcc_workweek__ "$f" ; then + substituteInPlace "$f" --replace '__hcc_workweek__' '${workweek}' + fi + done + + sed 's,#!/usr/bin/python,#!${python}/bin/python,' -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,^\($HIP_LIB_PATH=\).*$,\1\"$out/lib\";," \ + -e 's,^\($HIP_CLANG_PATH=\).*$,\1"${clang}/bin";,' \ + -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:]]*$HOST_OSNAME=\).*,\1"nixos";,' \ + -e 's,\([[:space:]]*$HOST_OSVER=\).*,\1"${lib.versions.majorMinor lib.version}";,' \ + -e 's,^\([[:space:]]*\)$HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include");,\1$HIP_CLANG_INCLUDE_PATH = "${clang-unwrapped}/lib/clang/$HIP_CLANG_VERSION/include";,' \ + -e 's,^\([[:space:]]*$HIPCXXFLAGS .= " -isystem $HIP_CLANG_INCLUDE_PATH\)";,\1 -isystem ${rocm-runtime}/include";,' \ + -e 's,\($HIPCXXFLAGS .= " -isystem \\"$HIP_INCLUDE_PATH\\"\)" ;,\1 --rocm-path=${rocclr}";,' \ + -e "s,\$HIP_PATH/\(bin\|lib\),$out/\1,g" \ + -e "s,^\$HIP_LIB_PATH=\$ENV{'HIP_LIB_PATH'};,\$HIP_LIB_PATH=\"$out/lib\";," \ + -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 + + 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 + + sed -e 's, abs_path, Cwd::abs_path,' -i bin/hipvars.pm + + sed -e 's|_IMPORT_PREFIX}/../include|_IMPORT_PREFIX}/include|g' \ + -e 's|''${HIP_CLANG_ROOT}/lib/clang/\*/include|${clang-unwrapped}/lib/clang/*/include|' \ + -i hip-config.cmake.in + ''; + + preInstall = '' + mkdir -p $out/lib/cmake + ''; + + # The upstream ROCclr setup wants everything built into the same + # ROCclr output directory. We copy things into the HIP output + # directory, since it is downstream of ROCclr in terms of dependency + # direction. Thus we have device-libs and rocclr pieces in the HIP + # output directory. + postInstall = '' + mkdir -p $out/share + mv $out/lib/cmake $out/share/ + mv $out/cmake/* $out/share/cmake/hip + mkdir -p $out/lib + ln -s ${rocm-device-libs}/lib $out/lib/bitcode + mkdir -p $out/include + ln -s ${clang-unwrapped}/lib/clang/11.0.0/include $out/include/clang + ln -s ${rocclr}/lib/*.* $out/lib + ln -s ${rocclr}/include/* $out/include + wrapProgram $out/bin/hipcc --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin --prefix PATH : ${lld}/bin --set NIX_CC_WRAPPER_TARGET_HOST_${stdenv.cc.suffixSalt} 1 --prefix NIX_LDFLAGS ' ' -L${compiler-rt}/lib --prefix NIX_LDFLAGS_FOR_TARGET ' ' -L${compiler-rt}/lib + wrapProgram $out/bin/hipconfig --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin + ''; +} diff --git a/pkgs/development/compilers/llvm/rocm/clang.nix b/pkgs/development/compilers/llvm/rocm/clang.nix index d6bfd07d444..c2844633252 100644 --- a/pkgs/development/compilers/llvm/rocm/clang.nix +++ b/pkgs/development/compilers/llvm/rocm/clang.nix @@ -1,4 +1,5 @@ -{ lib, stdenv +{ stdenv +, lib , fetchFromGitHub , cmake , python3 @@ -65,7 +66,7 @@ stdenv.mkDerivation rec { description = "ROCm fork of the clang C/C++/Objective-C/Objective-C++ LLVM compiler frontend"; homepage = "https://llvm.org/"; license = with licenses; [ ncsa ]; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ acowley danieldk lovesegfault ]; platforms = platforms.linux; }; } diff --git a/pkgs/development/compilers/llvm/rocm/compiler-rt/compiler-rt-codesign.patch b/pkgs/development/compilers/llvm/rocm/compiler-rt/compiler-rt-codesign.patch new file mode 100644 index 00000000000..3cc12b94b20 --- /dev/null +++ b/pkgs/development/compilers/llvm/rocm/compiler-rt/compiler-rt-codesign.patch @@ -0,0 +1,33 @@ +From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001 +From: Will Dietz +Date: Tue, 19 Sep 2017 13:13:06 -0500 +Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that + needs it + +--- + cmake/Modules/AddCompilerRT.cmake | 8 ------ + test/asan/CMakeLists.txt | 52 --------------------------------------- + test/tsan/CMakeLists.txt | 47 ----------------------------------- + 3 files changed, 107 deletions(-) + +diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake +index bc5fb9ff7..b64eb4246 100644 +--- a/cmake/Modules/AddCompilerRT.cmake ++++ b/cmake/Modules/AddCompilerRT.cmake +@@ -210,14 +210,6 @@ function(add_compiler_rt_runtime name type) + set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "") + set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib") + endif() +- if(APPLE) +- # Ad-hoc sign the dylibs +- add_custom_command(TARGET ${libname} +- POST_BUILD +- COMMAND codesign --sign - $ +- WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR} +- ) +- endif() + endif() + install(TARGETS ${libname} + ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR} +2.14.1 + diff --git a/pkgs/development/compilers/llvm/rocm/compiler-rt/default.nix b/pkgs/development/compilers/llvm/rocm/compiler-rt/default.nix new file mode 100644 index 00000000000..f05ff91055a --- /dev/null +++ b/pkgs/development/compilers/llvm/rocm/compiler-rt/default.nix @@ -0,0 +1,65 @@ +{ stdenv, lib, version, src, cmake, python3, llvm, libcxxabi }: +stdenv.mkDerivation rec { + pname = "compiler-rt"; + inherit version src; + + nativeBuildInputs = [ cmake python3 llvm ]; + + NIX_CFLAGS_COMPILE = [ + "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" + ]; + + cmakeFlags = [ + "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" + "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}" + "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" + "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" + "-DCOMPILER_RT_BUILD_XRAY=OFF" + "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" + "-DCOMPILER_RT_BUILD_PROFILE=OFF" + "-DCMAKE_C_COMPILER_WORKS=ON" + "-DCMAKE_CXX_COMPILER_WORKS=ON" + "-DCOMPILER_RT_BAREMETAL_BUILD=ON" + "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" + "-DCOMPILER_RT_BUILD_BUILTINS=ON" + "-DCMAKE_C_FLAGS=-nodefaultlibs" + #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program + "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" + ]; + + outputs = [ "out" "dev" ]; + + patches = [ + ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory + ]; + + + # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks + # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra + # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd + # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by + # a flag and turn the flag off during the stdenv build. + postPatch = lib.optionalString (!stdenv.isDarwin) '' + substituteInPlace cmake/builtin-config-ix.cmake \ + --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' + ''; + + # Hack around weird upsream RPATH bug + postInstall = '' + ln -s "$out/lib"/*/* "$out/lib" + ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o + ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o + ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o + ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o + ''; + + enableParallelBuilding = true; + + meta = with lib; { + description = "ROCm fork of the LLVM Compiler runtime libraries"; + homepage = "https://github.com/RadeonOpenCompute/llvm-project"; + license = licenses.ncsa; + maintainers = with maintainers; [ acowley danieldk lovesegfault ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/development/compilers/llvm/rocm/default.nix b/pkgs/development/compilers/llvm/rocm/default.nix index 581d0574671..3497f910d6d 100644 --- a/pkgs/development/compilers/llvm/rocm/default.nix +++ b/pkgs/development/compilers/llvm/rocm/default.nix @@ -1,12 +1,12 @@ -{ lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith }: +{ stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }: let - version = "4.1.0"; + version = "4.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; repo = "llvm-project"; rev = "rocm-${version}"; - hash = "sha256-DlId/dF5r0ULl2omYPCyu1Ic3XKlLL7ndiCA0RaF264="; + hash = "sha256-7XVtHcrTpw+NYUvuKQFWWFE0FlOTt8EnfZpvepQqE1c="; }; in rec { clang = wrapCCWith rec { @@ -15,8 +15,25 @@ in rec { clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"` rsrc="$out/resource-root" mkdir "$rsrc" - ln -s "${lib.getLib cc}/lib/clang/$clang_version/include" "$rsrc" + ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc" + ln -s "${compiler-rt}/lib" "$rsrc/lib" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags + echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags + echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags + rm $out/nix-support/add-hardening.sh + touch $out/nix-support/add-hardening.sh + ''; + }; + + clangNoCompilerRt = wrapCCWith rec { + cc = clang-unwrapped; + 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 echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags rm $out/nix-support/add-hardening.sh touch $out/nix-support/add-hardening.sh @@ -28,10 +45,15 @@ in rec { src = "${src}/clang"; }; - lld = callPackage ./lld { + compiler-rt = callPackage ./compiler-rt { + inherit version llvm; + src = "${src}/compiler-rt"; + stdenv = overrideCC stdenv clangNoCompilerRt; + }; + + lld = callPackage ./lld.nix { inherit llvm version; src = "${src}/lld"; - buildLlvmTools = buildPackages.llvmPackages_rocm; }; llvm = callPackage ./llvm { diff --git a/pkgs/development/compilers/llvm/rocm/lld/default.nix b/pkgs/development/compilers/llvm/rocm/lld.nix similarity index 67% rename from pkgs/development/compilers/llvm/rocm/lld/default.nix rename to pkgs/development/compilers/llvm/rocm/lld.nix index c8ca83f76c1..ae153f5e0de 100644 --- a/pkgs/development/compilers/llvm/rocm/lld/default.nix +++ b/pkgs/development/compilers/llvm/rocm/lld.nix @@ -1,5 +1,5 @@ -{ lib, stdenv -, buildLlvmTools +{ stdenv +, lib , cmake , libxml2 , llvm @@ -14,18 +14,13 @@ stdenv.mkDerivation rec { pname = "lld"; nativeBuildInputs = [ cmake ]; + buildInputs = [ libxml2 llvm ]; - - cmakeFlags = [ - "-DLLVM_MAIN_SRC_DIR=${llvm.src}" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - "-DLLVM_CONFIG_PATH=${llvm.dev}/bin/llvm-config-native" - ]; - outputs = [ "out" "dev" ]; + cmakeFlags = [ "-DLLVM_MAIN_SRC_DIR=${llvm.src}" ]; + postInstall = '' moveToOutput include "$dev" moveToOutput lib "$dev" @@ -39,7 +34,7 @@ stdenv.mkDerivation rec { description = "ROCm fork of the LLVM Linker"; homepage = "https://github.com/RadeonOpenCompute/llvm-project"; license = licenses.ncsa; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ acowley danieldk lovesegfault ]; platforms = platforms.linux; }; } diff --git a/pkgs/development/compilers/llvm/rocm/llvm/default.nix b/pkgs/development/compilers/llvm/rocm/llvm/default.nix index 6d1ff664972..05b6d9de086 100644 --- a/pkgs/development/compilers/llvm/rocm/llvm/default.nix +++ b/pkgs/development/compilers/llvm/rocm/llvm/default.nix @@ -1,4 +1,5 @@ -{ lib, stdenv +{ stdenv +, lib , fetchFromGitHub , cmake , python3 @@ -91,7 +92,7 @@ in stdenv.mkDerivation rec { description = "ROCm fork of the LLVM compiler infrastructure"; homepage = "https://github.com/RadeonOpenCompute/llvm-project"; license = with licenses; [ ncsa ]; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ acowley danieldk lovesegfault ]; platforms = platforms.linux; }; } diff --git a/pkgs/development/libraries/libxc/default.nix b/pkgs/development/libraries/libxc/default.nix index 65458c2d970..3f16f3cc3e2 100644 --- a/pkgs/development/libraries/libxc/default.nix +++ b/pkgs/development/libraries/libxc/default.nix @@ -2,13 +2,13 @@ stdenv.mkDerivation rec { pname = "libxc"; - version = "5.1.5"; + version = "5.1.6"; src = fetchFromGitLab { owner = "libxc"; repo = "libxc"; rev = version; - sha256 = "0cy3x2zn1bldc5i0rzislfbc8h4nqgds445jkfqjv0d1shvdy0zn"; + sha256 = "07iljmv737kx24kd33x9ndf5l854mwslg9x2psqm12k07jmq9wjw"; }; nativeBuildInputs = [ perl cmake gfortran ]; diff --git a/pkgs/development/libraries/rocclr/default.nix b/pkgs/development/libraries/rocclr/default.nix index cf085d50edb..c96753f9a4b 100644 --- a/pkgs/development/libraries/rocclr/default.nix +++ b/pkgs/development/libraries/rocclr/default.nix @@ -15,13 +15,13 @@ stdenv.mkDerivation rec { pname = "rocclr"; - version = "4.1.0"; + version = "4.3.1"; src = fetchFromGitHub { owner = "ROCm-Developer-Tools"; repo = "ROCclr"; rev = "rocm-${version}"; - hash = "sha256-2DI/PL29aiZcxOrGZBzXwAnNgZQpSDjyyGKgl+vDErk="; + hash = "sha256-3lk7Zucoam+11gFBzg/TWQI1L8uAlxTrPz/mDwTwod4="; }; nativeBuildInputs = [ cmake rocm-cmake ]; @@ -55,7 +55,7 @@ stdenv.mkDerivation rec { description = "Radeon Open Compute common language runtime"; homepage = "https://github.com/ROCm-Developer-Tools/ROCclr"; license = licenses.mit; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ lovesegfault ]; # rocclr seems to have some AArch64 ifdefs, but does not seem # to be supported yet by the build infrastructure. Recheck in # the future. diff --git a/pkgs/development/libraries/rocm-comgr/default.nix b/pkgs/development/libraries/rocm-comgr/default.nix index 95fe28ce9fd..52a3cb6784d 100644 --- a/pkgs/development/libraries/rocm-comgr/default.nix +++ b/pkgs/development/libraries/rocm-comgr/default.nix @@ -1,21 +1,21 @@ -{ lib, stdenv, fetchFromGitHub, cmake, clang, device-libs, lld, llvm }: +{ lib, stdenv, fetchFromGitHub, cmake, clang, rocm-device-libs, lld, llvm }: stdenv.mkDerivation rec { pname = "rocm-comgr"; - version = "4.1.0"; + version = "4.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; repo = "ROCm-CompilerSupport"; rev = "rocm-${version}"; - hash = "sha256-LbQqyJxRqb6vpXiYSkRlF1FeqXJJXktPafGmYDDK02U="; + hash = "sha256-wHSAhp1cqR9xOreGt2M2Td/ELCuLEHjpMRRkqE9dUy0="; }; sourceRoot = "source/lib/comgr"; nativeBuildInputs = [ cmake ]; - buildInputs = [ clang device-libs lld llvm ]; + buildInputs = [ clang rocm-device-libs lld llvm ]; cmakeFlags = [ "-DCLANG=${clang}/bin/clang" @@ -40,7 +40,7 @@ stdenv.mkDerivation rec { description = "APIs for compiling and inspecting AMDGPU code objects"; homepage = "https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/tree/amd-stg-open/lib/comgr"; license = licenses.ncsa; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ lovesegfault ]; platforms = platforms.linux; }; } diff --git a/pkgs/development/libraries/rocm-device-libs/default.nix b/pkgs/development/libraries/rocm-device-libs/default.nix index 383d91bd08c..77dd4b721f2 100644 --- a/pkgs/development/libraries/rocm-device-libs/default.nix +++ b/pkgs/development/libraries/rocm-device-libs/default.nix @@ -9,13 +9,13 @@ stdenv.mkDerivation rec { pname = "rocm-device-libs"; - version = "4.1.0"; + version = "4.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; repo = "ROCm-Device-Libs"; rev = "rocm-${version}"; - hash = "sha256-9p6PIXdHFIgHgNWZzqVz5O9i2Np0z/iyxodG2cLrpGs="; + hash = "sha256-fPD9vevO2UDaFaclSI0CC/lRfM5WemWmxP1K5ajXHbk="; }; nativeBuildInputs = [ cmake ]; @@ -34,7 +34,7 @@ stdenv.mkDerivation rec { description = "Set of AMD-specific device-side language runtime libraries"; homepage = "https://github.com/RadeonOpenCompute/ROCm-Device-Libs"; license = licenses.ncsa; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ lovesegfault ]; platforms = platforms.linux; }; } diff --git a/pkgs/development/libraries/rocm-opencl-icd/default.nix b/pkgs/development/libraries/rocm-opencl-icd/default.nix index 0a9d124561e..9b0f7ab9f81 100644 --- a/pkgs/development/libraries/rocm-opencl-icd/default.nix +++ b/pkgs/development/libraries/rocm-opencl-icd/default.nix @@ -14,7 +14,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "OpenCL ICD definition for AMD GPUs using the ROCm stack"; license = licenses.mit; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ lovesegfault ]; platforms = platforms.linux; }; } diff --git a/pkgs/development/libraries/rocm-opencl-runtime/default.nix b/pkgs/development/libraries/rocm-opencl-runtime/default.nix index 40ffcae7924..04fba42525e 100644 --- a/pkgs/development/libraries/rocm-opencl-runtime/default.nix +++ b/pkgs/development/libraries/rocm-opencl-runtime/default.nix @@ -1,4 +1,5 @@ -{ lib, stdenv +{ stdenv +, lib , fetchFromGitHub , addOpenGLRunpath , cmake @@ -21,13 +22,13 @@ stdenv.mkDerivation rec { pname = "rocm-opencl-runtime"; - version = "4.1.0"; + version = "4.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; repo = "ROCm-OpenCL-Runtime"; rev = "rocm-${version}"; - hash = "sha256-+6h1E5uWNKjjaeO5ZIi854CWYi0QGQ5mVUHdi9+4vX4="; + hash = "sha256-4+PNxRqvAvU0Nj2igYl3WiS5h5HGV63J+cHbIVW89LE="; }; nativeBuildInputs = [ cmake rocm-cmake ]; @@ -77,7 +78,7 @@ stdenv.mkDerivation rec { description = "OpenCL runtime for AMD GPUs, part of the ROCm stack"; homepage = "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime"; license = with licenses; [ asl20 mit ]; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ acowley danieldk lovesegfault ]; platforms = platforms.linux; }; } diff --git a/pkgs/development/libraries/rocm-runtime/default.nix b/pkgs/development/libraries/rocm-runtime/default.nix index eb4ce3c19fb..fc3c627a562 100644 --- a/pkgs/development/libraries/rocm-runtime/default.nix +++ b/pkgs/development/libraries/rocm-runtime/default.nix @@ -1,4 +1,5 @@ -{ lib, stdenv +{ stdenv +, lib , fetchFromGitHub , addOpenGLRunpath , clang-unwrapped @@ -6,25 +7,26 @@ , xxd , elfutils , llvm +, numactl , rocm-device-libs , rocm-thunk }: stdenv.mkDerivation rec { pname = "rocm-runtime"; - version = "4.1.0"; + version = "4.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; repo = "ROCR-Runtime"; rev = "rocm-${version}"; - hash = "sha256-Jxg3n203tV0L+UrmeQEuzX0TKpFu5An2cnuEA/F/SNY="; + hash = "sha256-B67v9B8LXDbWNxYNRxM3dgFFLjFSyJmm0zd3G5Bgvek="; }; sourceRoot = "source/src"; nativeBuildInputs = [ cmake xxd ]; - buildInputs = [ clang-unwrapped elfutils llvm ]; + buildInputs = [ clang-unwrapped elfutils llvm numactl ]; cmakeFlags = [ "-DBITCODE_DIR=${rocm-device-libs}/amdgcn/bitcode" @@ -43,6 +45,6 @@ stdenv.mkDerivation rec { description = "Platform runtime for ROCm"; homepage = "https://github.com/RadeonOpenCompute/ROCR-Runtime"; license = with licenses; [ ncsa ]; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ danieldk lovesegfault ]; }; } diff --git a/pkgs/development/libraries/rocm-thunk/default.nix b/pkgs/development/libraries/rocm-thunk/default.nix index 770dd16740c..432688e1bfb 100644 --- a/pkgs/development/libraries/rocm-thunk/default.nix +++ b/pkgs/development/libraries/rocm-thunk/default.nix @@ -7,13 +7,13 @@ stdenv.mkDerivation rec { pname = "rocm-thunk"; - version = "4.1.0"; + version = "4.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; repo = "ROCT-Thunk-Interface"; rev = "rocm-${version}"; - hash = "sha256-gdto7BbrSRa3UiRNvTW1KLkHyjrcxdah4+L+1Gdm0wA="; + hash = "sha256-jpwFL4UbEnWkw1AiM4U1s1t7GiqzBeOwa55VpnOG2Dk="; }; preConfigure = '' @@ -32,6 +32,6 @@ stdenv.mkDerivation rec { description = "Radeon open compute thunk interface"; homepage = "https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface"; license = with licenses; [ bsd2 mit ]; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ lovesegfault ]; }; } diff --git a/pkgs/development/python-modules/google-cloud-asset/default.nix b/pkgs/development/python-modules/google-cloud-asset/default.nix index 4e1dbf8c465..d2132533c84 100644 --- a/pkgs/development/python-modules/google-cloud-asset/default.nix +++ b/pkgs/development/python-modules/google-cloud-asset/default.nix @@ -17,11 +17,11 @@ buildPythonPackage rec { pname = "google-cloud-asset"; - version = "3.4.0"; + version = "3.5.0"; src = fetchPypi { inherit pname version; - sha256 = "bd1fe84efd2e45042d95c7e5713e0a0365ec8138df062c07fab761233202ab6f"; + sha256 = "7d7218ffdd17d64184e1de69ef016f1f070bb0c888785510c4731948b078067d"; }; postPatch = '' diff --git a/pkgs/development/python-modules/google-resumable-media/default.nix b/pkgs/development/python-modules/google-resumable-media/default.nix index 67ee4cb22d4..077fc45526c 100644 --- a/pkgs/development/python-modules/google-resumable-media/default.nix +++ b/pkgs/development/python-modules/google-resumable-media/default.nix @@ -12,11 +12,11 @@ buildPythonPackage rec { pname = "google-resumable-media"; - version = "2.0.1"; + version = "2.0.2"; src = fetchPypi { inherit pname version; - sha256 = "cac55be7802e3424b8f022d8a572a8349327e7ce8494eee5e0f4df02458b1813"; + sha256 = "36d682161fdcbfa29681212c210fabecbf6849a505a0cbc54b7f70a10a5278a2"; }; propagatedBuildInputs = [ google-auth google-crc32c requests ]; diff --git a/pkgs/development/python-modules/pomegranate/default.nix b/pkgs/development/python-modules/pomegranate/default.nix index 518840d415a..cb87f352154 100644 --- a/pkgs/development/python-modules/pomegranate/default.nix +++ b/pkgs/development/python-modules/pomegranate/default.nix @@ -31,7 +31,11 @@ buildPythonPackage rec { url = "https://github.com/jmschrei/pomegranate/commit/42d14bebc44ffd4a778b2a6430aa845591b7c3b7.patch"; sha256 = "0f9cx0fj9xkr3hch7jyrn76zjypilh5bqw734caaw6g2m49lvbff"; }) - ]; + ] ++ [ + # Likely an upstream test bug and not a real problem: + # https://github.com/jmschrei/pomegranate/issues/939 + ./disable-failed-on-nextworkx-2.6.patch + ] ; propagatedBuildInputs = [ numpy scipy cython networkx joblib pyyaml ]; diff --git a/pkgs/development/python-modules/pomegranate/disable-failed-on-nextworkx-2.6.patch b/pkgs/development/python-modules/pomegranate/disable-failed-on-nextworkx-2.6.patch new file mode 100644 index 00000000000..484ca4f9cbc --- /dev/null +++ b/pkgs/development/python-modules/pomegranate/disable-failed-on-nextworkx-2.6.patch @@ -0,0 +1,26 @@ +Test started failing after upgrading networkx 2.5.1 -> 2.6.2: + https://github.com/jmschrei/pomegranate/issues/939 + +Failures look benigh. +--- a/tests/test_bayesian_network.py ++++ b/tests/test_bayesian_network.py +@@ -1057,7 +1057,8 @@ def test_exact_structure_learning_exclude_edges(): + assert_not_equal(model.structure[-2], (d-1,)) + assert_equal(model.structure[-2], (1,)) + +-def test_exact_dp_structure_learning_exclude_edges(): ++# disabled for https://github.com/jmschrei/pomegranate/issues/939 ++def disabled_exact_dp_structure_learning_exclude_edges(): + for X in datasets: + X = X.copy() + X[:,1] = X[:,-1] +@@ -1139,7 +1140,8 @@ def test_constrained_parents_structure_learning_exclude_edges(): + assert_equal(model.structure[7], (2,)) + assert_equal(model.structure[4], (0,)) + +-def test_constrained_slap_structure_learning_exclude_edges(): ++# disabled for https://github.com/jmschrei/pomegranate/issues/939 ++def disabled_constrained_slap_structure_learning_exclude_edges(): + for X in datasets: + X = X.copy() + X[:,1] = X[:,-1] diff --git a/pkgs/development/python-modules/trezor/default.nix b/pkgs/development/python-modules/trezor/default.nix index 3015e8d7ebb..137d6712445 100644 --- a/pkgs/development/python-modules/trezor/default.nix +++ b/pkgs/development/python-modules/trezor/default.nix @@ -24,13 +24,13 @@ buildPythonPackage rec { pname = "trezor"; - version = "0.12.3"; + version = "0.12.4"; disabled = !isPy3k; src = fetchPypi { inherit pname version; - sha256 = "02c39c333435b8f6dc62cc79bb5bf35fc7f0eb144a1a748be3b7c065ee3e85ae"; + sha256 = "3e180d9f9f8b69176b5ef36311b6161f5b793b538eb2dfd4babbb4d3fb1e374e"; }; nativeBuildInputs = [ installShellFiles ]; diff --git a/pkgs/development/tools/build-managers/rocm-cmake/default.nix b/pkgs/development/tools/build-managers/rocm-cmake/default.nix index 68cd3d449ca..31f4265597f 100644 --- a/pkgs/development/tools/build-managers/rocm-cmake/default.nix +++ b/pkgs/development/tools/build-managers/rocm-cmake/default.nix @@ -2,13 +2,13 @@ stdenv.mkDerivation rec { pname = "rocm-cmake"; - version = "4.1.0"; + version = "4.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; repo = "rocm-cmake"; rev = "rocm-${version}"; - hash = "sha256-uK060F7d7/pTCNbGqdKCzxgPrPPbGjNwuUOt176z7EM="; + hash = "sha256-BhpYOL7+IlBpkzeFjfy6KLO7ail472KQWFfQX/sXLGo="; }; nativeBuildInputs = [ cmake ]; diff --git a/pkgs/development/tools/rocminfo/default.nix b/pkgs/development/tools/rocminfo/default.nix new file mode 100644 index 00000000000..bf95e15873f --- /dev/null +++ b/pkgs/development/tools/rocminfo/default.nix @@ -0,0 +1,38 @@ +{ stdenv, lib, fetchFromGitHub, fetchpatch, cmake, rocm-runtime, python3, rocm-cmake, busybox, gnugrep + # rocminfo requires that the calling user have a password and be in + # the video group. If we let rocm_agent_enumerator rely upon + # rocminfo's output, then it, too, has those requirements. Instead, + # we can specify the GPU targets for this system (e.g. "gfx803" for + # Polaris) such that no system call is needed for downstream + # compilers to determine the desired target. +, defaultTargets ? []}: +stdenv.mkDerivation rec { + version = "4.3.1"; + pname = "rocminfo"; + src = fetchFromGitHub { + owner = "RadeonOpenCompute"; + repo = "rocminfo"; + rev = "rocm-${version}"; + sha256 = "sha256-n80tiSVaPTFl4imZvoFENM4KhPLxgDKz5VlOvhEYlV0="; + }; + + enableParallelBuilding = true; + buildInputs = [ cmake rocm-cmake rocm-runtime ]; + cmakeFlags = [ + "-DROCM_DIR=${rocm-runtime}" + "-DROCRTST_BLD_TYPE=Release" + ]; + + prePatch = '' + sed 's,#!/usr/bin/env python3,#!${python3}/bin/python,' -i rocm_agent_enumerator + sed 's,lsmod | grep ,${busybox}/bin/lsmod | ${gnugrep}/bin/grep ,' -i rocminfo.cc + ''; + + installPhase = '' + mkdir -p $out/bin + cp rocminfo $out/bin + cp rocm_agent_enumerator $out/bin + '' + lib.optionalString (defaultTargets != []) '' + echo '${lib.concatStringsSep "\n" defaultTargets}' > $out/bin/target.lst + ''; +} diff --git a/pkgs/misc/vim-plugins/generated.nix b/pkgs/misc/vim-plugins/generated.nix index cb35276ed96..27698478f12 100644 --- a/pkgs/misc/vim-plugins/generated.nix +++ b/pkgs/misc/vim-plugins/generated.nix @@ -3482,12 +3482,12 @@ final: prev: pname = "neorg"; version = "2021-09-05"; src = fetchFromGitHub { - owner = "vhyrro"; + owner = "nvim-neorg"; repo = "neorg"; rev = "47a0a3d91ddde94488ccd03d38b5beeb296d3148"; sha256 = "0n8scyjy3wx2l3anl3dyipx7rlayrjb5dlri2r81dr1s77vkch83"; }; - meta.homepage = "https://github.com/vhyrro/neorg/"; + meta.homepage = "https://github.com/nvim-neorg/neorg/"; }; neoscroll-nvim = buildVimPluginFrom2Nix { diff --git a/pkgs/misc/vim-plugins/vim-plugin-names b/pkgs/misc/vim-plugins/vim-plugin-names index a2c2dd5b126..e3398cdc0d8 100644 --- a/pkgs/misc/vim-plugins/vim-plugin-names +++ b/pkgs/misc/vim-plugins/vim-plugin-names @@ -511,6 +511,7 @@ nvim-lua/lsp-status.nvim nvim-lua/lsp_extensions.nvim nvim-lua/plenary.nvim nvim-lua/popup.nvim +nvim-neorg/neorg@main nvim-telescope/telescope-dap.nvim nvim-telescope/telescope-frecency.nvim nvim-telescope/telescope-fzf-native.nvim@main @@ -789,7 +790,6 @@ urbit/hoon.vim Valloric/MatchTagAlways Valodim/deoplete-notmuch vhda/verilog_systemverilog.vim -vhyrro/neorg@main vigoux/LanguageTool.nvim vim-airline/vim-airline vim-airline/vim-airline-themes diff --git a/pkgs/os-specific/linux/bbswitch/default.nix b/pkgs/os-specific/linux/bbswitch/default.nix index 837906fb554..a64e1297ea0 100644 --- a/pkgs/os-specific/linux/bbswitch/default.nix +++ b/pkgs/os-specific/linux/bbswitch/default.nix @@ -59,5 +59,6 @@ stdenv.mkDerivation { platforms = [ "x86_64-linux" "i686-linux" ]; homepage = "https://github.com/Bumblebee-Project/bbswitch"; maintainers = with maintainers; [ abbradar ]; + license = licenses.gpl2Plus; }; } diff --git a/pkgs/os-specific/linux/perf-tools/default.nix b/pkgs/os-specific/linux/perf-tools/default.nix index 5c3ef666c83..8c3e31e4538 100644 --- a/pkgs/os-specific/linux/perf-tools/default.nix +++ b/pkgs/os-specific/linux/perf-tools/default.nix @@ -40,6 +40,6 @@ stdenv.mkDerivation { homepage = "https://github.com/brendangregg/perf-tools"; description = "Performance analysis tools based on Linux perf_events (aka perf) and ftrace"; maintainers = [ maintainers.eelco ]; - license = licenses.gpl2; + license = licenses.gpl2Plus; }; } diff --git a/pkgs/tools/backup/mylvmbackup/default.nix b/pkgs/tools/backup/mylvmbackup/default.nix index ba25c56c28f..6c87fca0567 100644 --- a/pkgs/tools/backup/mylvmbackup/default.nix +++ b/pkgs/tools/backup/mylvmbackup/default.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { version = "0.16"; src = fetchurl { - url = "${meta.homepage}/${pname}-${version}.tar.gz"; + url = "https://www.lenzg.net/mylvmbackup/${pname}-${version}.tar.gz"; sha256 = "sha256-vb7M3EPIrxIz6jUwm241fzaEz2czqdCObrFgSOSgJRU="; }; diff --git a/pkgs/tools/networking/spoof-mac/default.nix b/pkgs/tools/networking/spoof-mac/default.nix new file mode 100644 index 00000000000..fdd282fa8b5 --- /dev/null +++ b/pkgs/tools/networking/spoof-mac/default.nix @@ -0,0 +1,26 @@ +{ lib, buildPythonPackage, fetchFromGitHub, docopt }: + +buildPythonPackage rec { + pname = "spoof-mac"; + version = "unstable-2018-01-27"; + + src = fetchFromGitHub { + owner = "feross"; + repo = "SpoofMAC"; + rev = "2cfc796150ef48009e9b765fe733e37d82c901e0"; + sha256 = "sha256-Qiu0URjUyx8QDVQQUFGxPax0J80e2m4+bPJeqFoKxX8="; + }; + + propagatedBuildInputs = [ docopt ]; + + # No tests + doCheck = false; + + meta = with lib; { + description = "Change your MAC address for debugging purposes"; + homepage = "https://github.com/feross/SpoofMAC"; + license = licenses.mit; + maintainers = with maintainers; [ siraben ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/tools/system/rocm-smi/default.nix b/pkgs/tools/system/rocm-smi/default.nix index de9afdae294..bbee315e9c7 100644 --- a/pkgs/tools/system/rocm-smi/default.nix +++ b/pkgs/tools/system/rocm-smi/default.nix @@ -1,17 +1,17 @@ -{ lib, stdenv, fetchFromGitHub, cmake, python3 }: +{ lib, stdenv, fetchFromGitHub, cmake, wrapPython }: stdenv.mkDerivation rec { pname = "rocm-smi"; - version = "4.1.0"; + version = "4.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; repo = "rocm_smi_lib"; rev = "rocm-${version}"; - hash = "sha256-LEaC1XhmyoVWrpL05MhgN02LVT2rLKdnw9g2QdfM/uE="; + hash = "sha256-Ckno73Otkc9rHEUkSgNoOui+6ZHGUF+B9iAoe0NQH0c="; }; - nativeBuildInputs = [ cmake python3.pkgs.wrapPython ]; + nativeBuildInputs = [ cmake wrapPython ]; postPatch = '' # Upstream ROCm is installed in an /opt directory. For this reason, @@ -46,7 +46,7 @@ stdenv.mkDerivation rec { description = "System management interface for AMD GPUs supported by ROCm"; homepage = "https://github.com/RadeonOpenCompute/ROC-smi"; license = with licenses; [ mit ]; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ lovesegfault ]; platforms = [ "x86_64-linux" ]; }; } diff --git a/pkgs/tools/text/difftastic/default.nix b/pkgs/tools/text/difftastic/default.nix index 3a32f855c0c..bfe43095748 100644 --- a/pkgs/tools/text/difftastic/default.nix +++ b/pkgs/tools/text/difftastic/default.nix @@ -2,22 +2,22 @@ rustPlatform.buildRustPackage rec { pname = "difftastic"; - version = "0.6"; + version = "0.8"; src = fetchFromGitHub { owner = "wilfred"; repo = pname; rev = version; - sha256 = "WFvxdRCbTBW1RGn2SvAo2iXn82OO/Z06cZQkIu4eiew="; + sha256 = "0103py4v4v7xqv85yiczhd9w9h1aa54svhhdibvbl6x4b35y2mk5"; }; - cargoSha256 = "2hRUfIxNVs4uSrEESas3wvvVsZHVocP8aiO7K0NZ+mY="; + cargoSha256 = "1k0d7yadicfzfc2m1aqs4c4a2k3srb54fpwarc3kwn26v3vfjai1"; meta = with lib; { description = "A syntax-aware diff"; homepage = "https://github.com/Wilfred/difftastic"; + changelog = "https://github.com/Wilfred/difftastic/raw/${version}/CHANGELOG.md"; license = licenses.mit; maintainers = with maintainers; [ ethancedwards8 ]; - platforms = platforms.unix; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d7fd92a3b12..cd0c3ddbb95 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9086,6 +9086,8 @@ with pkgs; spicy = callPackage ../development/tools/spicy { }; + spoof-mac = python3Packages.callPackage ../tools/networking/spoof-mac { }; + ssh-askpass-fullscreen = callPackage ../tools/networking/ssh-askpass-fullscreen { }; sshguard = callPackage ../tools/security/sshguard {}; @@ -12173,11 +12175,14 @@ with pkgs; inherit (llvmPackages_rocm) clang; }; + hip = callPackage ../development/compilers/hip { + inherit (llvmPackages_rocm) clang clang-unwrapped compiler-rt lld llvm; + }; + rocm-cmake = callPackage ../development/tools/build-managers/rocm-cmake { }; rocm-comgr = callPackage ../development/libraries/rocm-comgr { inherit (llvmPackages_rocm) clang lld llvm; - device-libs = rocm-device-libs; }; rocm-device-libs = callPackage ../development/libraries/rocm-device-libs { @@ -12194,11 +12199,12 @@ with pkgs; inherit (llvmPackages_rocm) clang-unwrapped llvm; }; - # Python >= 3.8 still gives a bunch of warnings. - rocm-smi = python37.pkgs.callPackage ../tools/system/rocm-smi { }; + rocm-smi = python3Packages.callPackage ../tools/system/rocm-smi { }; rocm-thunk = callPackage ../development/libraries/rocm-thunk { }; + rocminfo = callPackage ../development/tools/rocminfo { }; + rtags = callPackage ../development/tools/rtags { inherit (darwin) apple_sdk; };