Skip to content

Commit

Permalink
[staging] merge from staging-next (#370761)
Browse files Browse the repository at this point in the history
  • Loading branch information
Atemu authored Jan 4, 2025
2 parents a2891e6 + dbee3b0 commit c2e24a7
Show file tree
Hide file tree
Showing 4,752 changed files with 6,329 additions and 5,595 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
24 changes: 20 additions & 4 deletions .github/workflows/eval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ jobs:
tag:
name: Tag
runs-on: ubuntu-latest
needs: process
needs: [ attrs, process ]
if: needs.process.outputs.baseRunId
permissions:
pull-requests: write
Expand All @@ -239,6 +239,21 @@ jobs:
name: comparison
path: comparison

- name: Install Nix
uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30

# Important: This workflow job runs with extra permissions,
# so we need to make sure to not run untrusted code from PRs
- name: Check out Nixpkgs at the base commit
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ needs.attrs.outputs.baseSha }}
path: base
sparse-checkout: ci

- name: Build the requestReviews derivation
run: nix-build base/ci -A requestReviews

- name: Tagging pull request
run: |
# Get all currently set rebuild labels
Expand Down Expand Up @@ -271,20 +286,21 @@ jobs:
# maintainers.json contains GitHub IDs. Look up handles to request reviews from.
# There appears to be no API to request reviews based on GitHub IDs
jq -r 'keys[]' comparison/maintainers.json \
| while read -r id; do gh api /user/"$id"; done \
| jq -s '{ reviewers: map(.login) }' \
| while read -r id; do gh api /user/"$id" --jq .login; done \
| GH_TOKEN=${{ steps.app-token.outputs.token }} result/bin/process-reviewers.sh "$REPOSITORY" "$NUMBER" "$AUTHOR" \
> reviewers.json
# Request reviewers from maintainers of changed output paths
GH_TOKEN=${{ steps.app-token.outputs.token }} gh api \
--method POST \
/repos/${{ github.repository }}/pulls/${{ github.event.number }}/requested_reviewers \
/repos/"$REPOSITORY"/pulls/"$NUMBER"/requested_reviewers \
--input reviewers.json
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
NUMBER: ${{ github.event.number }}
AUTHOR: ${{ github.event.pull_request.user.login }}

- name: Add eval summary to commit statuses
if: ${{ github.event_name == 'pull_request_target' }}
Expand Down
1 change: 1 addition & 0 deletions ci/request-reviews/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ stdenvNoCC.mkDerivation {
root = ./.;
fileset = lib.fileset.unions [
./get-reviewers.sh
./process-reviewers.sh
./request-reviews.sh
./verify-base-branch.sh
./dev-branches.txt
Expand Down
42 changes: 6 additions & 36 deletions ci/request-reviews/get-reviewers.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
#!/usr/bin/env bash

# Get the code owners of the files changed by a PR,
# suitable to be consumed by the API endpoint to request reviews:
# https://docs.github.com/en/rest/pulls/review-requests?apiVersion=2022-11-28#request-reviewers-for-a-pull-request
# Get the code owners of the files changed by a PR, returning one username per line

set -euo pipefail

log() {
echo "$@" >&2
}

if (( "$#" < 7 )); then
log "Usage: $0 GIT_REPO OWNERS_FILE BASE_REPO BASE_REF HEAD_REF PR_NUMBER PR_AUTHOR"
if (( "$#" < 4 )); then
log "Usage: $0 GIT_REPO OWNERS_FILE BASE_REF HEAD_REF"
exit 1
fi

gitRepo=$1
ownersFile=$2
baseRepo=$3
baseRef=$4
headRef=$5
prNumber=$6
prAuthor=$7
baseRef=$3
headRef=$4

tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' exit
Expand Down Expand Up @@ -98,29 +93,4 @@ for file in "${touchedFiles[@]}"; do

done

# Cannot request a review from the author
if [[ -v users[${prAuthor,,}] ]]; then
log "One or more files are owned by the PR author, ignoring"
unset 'users[${prAuthor,,}]'
fi

gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/$baseRepo/pulls/$prNumber/reviews" \
--jq '.[].user.login' > "$tmp/already-reviewed-by"

# And we don't want to rerequest reviews from people who already reviewed
while read -r user; do
if [[ -v users[${user,,}] ]]; then
log "User $user is a code owner but has already left a review, ignoring"
unset 'users[${user,,}]'
fi
done < "$tmp/already-reviewed-by"

# Turn it into a JSON for the GitHub API call to request PR reviewers
jq -n \
--arg users "${!users[*]}" \
'{
reviewers: $users | split(" "),
}'
printf "%s\n" "${!users[@]}"
65 changes: 65 additions & 0 deletions ci/request-reviews/process-reviewers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

# Process reviewers for a PR, reading line-separated usernames on stdin,
# returning a JSON suitable to be consumed by the API endpoint to request reviews:
# https://docs.github.com/en/rest/pulls/review-requests?apiVersion=2022-11-28#request-reviewers-for-a-pull-request

set -euo pipefail

log() {
echo "$@" >&2
}

if (( "$#" < 3 )); then
log "Usage: $0 BASE_REPO PR_NUMBER PR_AUTHOR"
exit 1
fi

baseRepo=$1
prNumber=$2
prAuthor=$3

tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' exit

declare -A users=()
while read -r handle && [[ -n "$handle" ]]; do
users[$handle]=
done

# Cannot request a review from the author
if [[ -v users[${prAuthor,,}] ]]; then
log "One or more files are owned by the PR author, ignoring"
unset 'users[${prAuthor,,}]'
fi

gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/$baseRepo/pulls/$prNumber/reviews" \
--jq '.[].user.login' > "$tmp/already-reviewed-by"

# And we don't want to rerequest reviews from people who already reviewed
while read -r user; do
if [[ -v users[${user,,}] ]]; then
log "User $user is a code owner but has already left a review, ignoring"
unset 'users[${user,,}]'
fi
done < "$tmp/already-reviewed-by"

for user in "${!users[@]}"; do
if ! gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/$baseRepo/collaborators/$user" >&2; then
log "User $user is not a repository collaborator, probably missed the automated invite to the maintainers team (see <https://github.com/NixOS/nixpkgs/issues/234293>), ignoring"
unset 'users[$user]'
fi
done

# Turn it into a JSON for the GitHub API call to request PR reviewers
jq -n \
--arg users "${!users[*]}" \
'{
reviewers: $users | split(" "),
}'
3 changes: 2 additions & 1 deletion ci/request-reviews/request-reviews.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ if ! "$SCRIPT_DIR"/verify-base-branch.sh "$tmp/nixpkgs.git" "$headRef" "$baseRep
fi

log "Getting code owners to request reviews from"
"$SCRIPT_DIR"/get-reviewers.sh "$tmp/nixpkgs.git" "$ownersFile" "$baseRepo" "$baseBranch" "$headRef" "$prNumber" "$prAuthor" > "$tmp/reviewers.json"
"$SCRIPT_DIR"/get-reviewers.sh "$tmp/nixpkgs.git" "$ownersFile" "$baseBranch" "$headRef" | \
"$SCRIPT_DIR"/process-reviewers.sh "$baseRepo" "$prNumber" "$prAuthor" > "$tmp/reviewers.json"

log "Requesting reviews from: $(<"$tmp/reviewers.json")"

Expand Down
68 changes: 37 additions & 31 deletions nixos/modules/profiles/minimal.nix
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
# This module defines a small NixOS configuration. It does not
# contain any graphical stuff.

{ config, lib, ... }:

with lib;

{
documentation.enable = mkDefault false;

documentation.doc.enable = mkDefault false;

documentation.info.enable = mkDefault false;

documentation.man.enable = mkDefault false;

documentation.nixos.enable = mkDefault false;

# Perl is a default package.
environment.defaultPackages = mkDefault [ ];

environment.stub-ld.enable = mkDefault false;

# The lessopen package pulls in Perl.
programs.less.lessopen = mkDefault null;
lib,
...
}:
let
inherit (lib) mkDefault;
in
{
documentation = {
enable = mkDefault false;
doc.enable = mkDefault false;
info.enable = mkDefault false;
man.enable = mkDefault false;
nixos.enable = mkDefault false;
};

environment = {
# Perl is a default package.
defaultPackages = mkDefault [ ];
stub-ld.enable = mkDefault false;
};

programs = {
# The lessopen package pulls in Perl.
less.lessopen = mkDefault null;
command-not-found.enable = mkDefault false;
};

# This pulls in nixos-containers which depends on Perl.
boot.enableContainers = mkDefault false;

programs.command-not-found.enable = mkDefault false;

services.logrotate.enable = mkDefault false;

services.udisks2.enable = mkDefault false;

xdg.autostart.enable = mkDefault false;
xdg.icons.enable = mkDefault false;
xdg.mime.enable = mkDefault false;
xdg.sounds.enable = mkDefault false;
services = {
logrotate.enable = mkDefault false;
udisks2.enable = mkDefault false;
};

xdg = {
autostart.enable = mkDefault false;
icons.enable = mkDefault false;
mime.enable = mkDefault false;
sounds.enable = mkDefault false;
};
}
4 changes: 2 additions & 2 deletions nixos/modules/services/networking/unifi.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ in
restartTriggers = [ cfg.unifiPackage cfg.mongodbPackage ];

serviceConfig = {
Type = "simple";
Type = "notify";
ExecStart = "${cmd} start";
ExecStop = "${cmd} stop";
Restart = "on-failure";
Restart = "always";
TimeoutSec = "5min";
User = "unifi";
UMask = "0077";
Expand Down
3 changes: 2 additions & 1 deletion nixos/modules/virtualisation/vmware-guest.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ let
inherit (lib)
getExe'
literalExpression
maintainers
mkEnableOption
mkIf
mkOption
Expand All @@ -25,7 +26,7 @@ in
];

meta = {
maintainers = [ lib.maintainers.kjeremy ];
maintainers = [ maintainers.kjeremy ];
};

options.virtualisation.vmware.guest = {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/audio/greg/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buildPythonApplication rec {
src = fetchFromGitHub {
owner = "manolomartinez";
repo = pname;
rev = "refs/tags/v${version}";
tag = "v${version}";
sha256 = "sha256-o4+tXVJTgT52JyJOC+Glr2cvZjbTaZL8TIsmz+A4vE4=";
};

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/audio/littlegptracker/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ stdenv.mkDerivation (finalAttrs: {
src = fetchFromGitHub {
owner = "djdiskmachine";
repo = "littlegptracker";
rev = "refs/tags/${finalAttrs.version}";
tag = finalAttrs.version;
hash = "sha256-1uXC5nJ63YguQuNIkuK0yx9lmrMBqw0WdlmCV8o11cE=";
};

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/audio/pithos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pythonPackages.buildPythonApplication rec {
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "refs/tags/${version}";
tag = version;
hash = "sha256-3j6IoMi30BQ8WHK4BxbsW+/3XZx7rBFd47EBENa2GiQ=";
};

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/audio/puddletag/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python3.pkgs.buildPythonApplication rec {
src = fetchFromGitHub {
owner = "puddletag";
repo = "puddletag";
rev = "refs/tags/${version}";
tag = version;
hash = "sha256-oScT8YcQoDf2qZ+J7xKm22Sbfym3tkVUrWT5D2LU5e8=";
};

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/audio/zynaddsubfx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "refs/tags/${version}";
tag = version;
fetchSubmodules = true;
hash = "sha256-0siAx141DZx39facXWmKbsi0rHBNpobApTdey07EcXg=";
};
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/editors/lapce/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ rustPlatform.buildRustPackage rec {
src = fetchFromGitHub {
owner = "lapce";
repo = "lapce";
rev = "refs/tags/v${version}";
tag = "v${version}";
sha256 = "sha256-vBBYNHgZiW5JfGeUG6YZObf4oK0hHxTbsZNTfnIX95Y=";
};

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/editors/manuskript/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python3Packages.buildPythonApplication rec {
src = fetchFromGitHub {
repo = pname;
owner = "olivierkes";
rev = "refs/tags/${version}";
tag = version;
hash = "sha256-/Ryvv5mHdZ3iwMpZjOa62h8D2B00pzknJ70DfjDTPPA=";
};

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/editors/retext/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ python3.pkgs.buildPythonApplication rec {
src = fetchFromGitHub {
owner = "retext-project";
repo = pname;
rev = "refs/tags/${version}";
tag = version;
hash = "sha256-BToW9rPFEbgAErvJ5gtUpNadCLtlRihE7eKKFgO5N68=";
};

Expand Down
Loading

0 comments on commit c2e24a7

Please sign in to comment.