Compare commits
132
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d340f188c6 | ||
|
|
3c23b8170c | ||
|
|
5968add551 | ||
|
|
8dce03d1bf | ||
|
|
e08987ac51 | ||
|
|
ebd7b8f6ed | ||
|
|
afc4aced62 | ||
|
|
59209bf9ba | ||
|
|
aa9553503d | ||
|
|
989f7a3f12 | ||
|
|
3ca2ce200f | ||
|
|
c3687f4f95 | ||
|
|
278d8e58d2 | ||
|
|
9713638cda | ||
|
|
f170bb7b41 | ||
|
|
b601b44de5 | ||
|
|
2a79b7765c | ||
|
|
5a842aa155 | ||
|
|
803eaf9ef3 | ||
|
|
394a8da9dd | ||
|
|
0398ee1f7e | ||
|
|
105e54078f | ||
|
|
e7b9f0167f | ||
|
|
41ed8d3c62 | ||
|
|
544f8e24b0 | ||
|
|
29acca3ad6 | ||
|
|
44cfdd0b01 | ||
|
|
485d9c522f | ||
|
|
4b161a8684 | ||
|
|
c5eebac667 | ||
|
|
feafdeb174 | ||
|
|
d6342a8656 | ||
|
|
4624f61dfb | ||
|
|
be2053886d | ||
|
|
9e842a3bfc | ||
|
|
7644508957 | ||
|
|
47c4378634 | ||
|
|
b245f7a744 | ||
|
|
271a0b784e | ||
|
|
4517c162d6 | ||
|
|
5b4fec4125 | ||
|
|
5b0b65ee6a | ||
|
|
e398f43632 | ||
|
|
f9f38cddd2 | ||
|
|
256fdf31e6 | ||
|
|
103b38bfdc | ||
|
|
ad0fa9e2c6 | ||
|
|
36a1dc34fc | ||
|
|
7060505b26 | ||
|
|
d9fc17d299 | ||
|
|
ba5bede9f5 | ||
|
|
de4df1e90b | ||
|
|
6ac33ab878 | ||
|
|
0f4073f9d7 | ||
|
|
cf0e563f38 | ||
|
|
fb79e6a7a1 | ||
|
|
3e50cadbe6 | ||
|
|
6c4dc93d9b | ||
|
|
bd0522c15b | ||
|
|
1d1d553083 | ||
|
|
ca5f35fcf7 | ||
|
|
1e190d840a | ||
|
|
d56115eeb4 | ||
|
|
0167a50133 | ||
|
|
379564981a | ||
|
|
450cceb5ad | ||
|
|
a5f9651163 | ||
|
|
4a8b515260 | ||
|
|
d7fc293353 | ||
|
|
46a43dede9 | ||
|
|
5b8c24fb31 | ||
|
|
be250f00b9 | ||
|
|
b591265a05 | ||
|
|
70b7c059fd | ||
|
|
287b54b49c | ||
|
|
441aba4823 | ||
|
|
aa657c1679 | ||
|
|
a4fb83a239 | ||
|
|
47ba375285 | ||
|
|
5c9e22d75a | ||
|
|
e6d823e46d | ||
|
|
038cc7913b | ||
|
|
828bf74cd0 | ||
|
|
ec122cbfda | ||
|
|
e1ff27324b | ||
|
|
7b41563055 | ||
|
|
7f9b9c3638 | ||
|
|
ed09f1b4d9 | ||
|
|
fc6811cb51 | ||
|
|
a24df3d4e5 | ||
|
|
e6003b5c4f | ||
|
|
f566957dc4 | ||
|
|
f434a3e3c6 | ||
|
|
939f81c2e6 | ||
|
|
758dacacf4 | ||
|
|
9e4177bc67 | ||
|
|
328a3bbbd0 | ||
|
|
5c9481de19 | ||
|
|
ebadea0734 | ||
|
|
7d7ca3fe96 | ||
|
|
3a92f83e75 | ||
|
|
291e8ab6bd | ||
|
|
19441dd317 | ||
|
|
71ec2cf62d | ||
|
|
b36f8043d2 | ||
|
|
4d1f72a324 | ||
|
|
ac3532d0f2 | ||
|
|
84dbf182d4 | ||
|
|
4a27d70132 | ||
|
|
dadb5b01b7 | ||
|
|
3c39583e55 | ||
|
|
a038c92d38 | ||
|
|
cf6ad228ae | ||
|
|
44701007b4 | ||
|
|
ff1f145992 | ||
|
|
3519ad2ca6 | ||
|
|
16af6a8ed1 | ||
|
|
549a2e8272 | ||
|
|
2531dcad75 | ||
|
|
11f9c59140 | ||
|
|
a25a219e79 | ||
|
|
f07486b205 | ||
|
|
9ec98f7844 | ||
|
|
634e1d3b65 | ||
|
|
70655061e3 | ||
|
|
da328e6004 | ||
|
|
6b16af8c0e | ||
|
|
010b78e0cf | ||
|
|
98b7654390 | ||
|
|
c5799aa62c | ||
|
|
72e3dd396c | ||
|
|
d069633b3d |
No files matched your search
@@ -4,15 +4,29 @@ inputs:
|
|||||||
dogfood:
|
dogfood:
|
||||||
description: "Whether to use Nix installed from the latest artifact from master branch"
|
description: "Whether to use Nix installed from the latest artifact from master branch"
|
||||||
required: true # Be explicit about the fact that we are using unreleased artifacts
|
required: true # Be explicit about the fact that we are using unreleased artifacts
|
||||||
|
experimental-installer:
|
||||||
|
description: "Whether to use the experimental installer to install Nix"
|
||||||
|
default: false
|
||||||
|
experimental-installer-version:
|
||||||
|
description: "Version of the experimental installer to use. If `latest`, the newest artifact from the default branch is used."
|
||||||
|
# TODO: This should probably be pinned to a release after https://github.com/NixOS/experimental-nix-installer/pull/49 lands in one
|
||||||
|
default: "latest"
|
||||||
extra_nix_config:
|
extra_nix_config:
|
||||||
description: "Gets appended to `/etc/nix/nix.conf` if passed."
|
description: "Gets appended to `/etc/nix/nix.conf` if passed."
|
||||||
install_url:
|
install_url:
|
||||||
description: "URL of the Nix installer"
|
description: "URL of the Nix installer"
|
||||||
required: false
|
required: false
|
||||||
default: "https://releases.nixos.org/nix/nix-2.30.2/install"
|
default: "https://releases.nixos.org/nix/nix-2.30.2/install"
|
||||||
|
tarball_url:
|
||||||
|
description: "URL of the Nix tarball to use with the experimental installer"
|
||||||
|
required: false
|
||||||
github_token:
|
github_token:
|
||||||
description: "Github token"
|
description: "Github token"
|
||||||
required: true
|
required: true
|
||||||
|
use_cache:
|
||||||
|
description: "Whether to setup github actions cache (not implemented currently)"
|
||||||
|
default: false
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@@ -37,14 +51,74 @@ runs:
|
|||||||
|
|
||||||
gh run download "$RUN_ID" --repo "$DOGFOOD_REPO" -n "$INSTALLER_ARTIFACT" -D "$INSTALLER_DOWNLOAD_DIR"
|
gh run download "$RUN_ID" --repo "$DOGFOOD_REPO" -n "$INSTALLER_ARTIFACT" -D "$INSTALLER_DOWNLOAD_DIR"
|
||||||
echo "installer-path=file://$INSTALLER_DOWNLOAD_DIR" >> "$GITHUB_OUTPUT"
|
echo "installer-path=file://$INSTALLER_DOWNLOAD_DIR" >> "$GITHUB_OUTPUT"
|
||||||
|
TARBALL_PATH="$(find "$INSTALLER_DOWNLOAD_DIR" -name 'nix*.tar.xz' -print | head -n 1)"
|
||||||
|
echo "tarball-path=file://$TARBALL_PATH" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
echo "::notice ::Dogfooding Nix installer from master (https://github.com/$DOGFOOD_REPO/actions/runs/$RUN_ID)"
|
echo "::notice ::Dogfooding Nix installer from master (https://github.com/$DOGFOOD_REPO/actions/runs/$RUN_ID)"
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ inputs.github_token }}
|
GH_TOKEN: ${{ inputs.github_token }}
|
||||||
DOGFOOD_REPO: "NixOS/nix"
|
DOGFOOD_REPO: "NixOS/nix"
|
||||||
|
- name: "Gather system info for experimental installer"
|
||||||
|
shell: bash
|
||||||
|
if: ${{ inputs.experimental-installer == 'true' }}
|
||||||
|
run: |
|
||||||
|
echo "::notice Using experimental installer from $EXPERIMENTAL_INSTALLER_REPO (https://github.com/$EXPERIMENTAL_INSTALLER_REPO)"
|
||||||
|
|
||||||
|
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||||
|
EXPERIMENTAL_INSTALLER_SYSTEM="linux"
|
||||||
|
echo "EXPERIMENTAL_INSTALLER_SYSTEM=$EXPERIMENTAL_INSTALLER_SYSTEM" >> "$GITHUB_ENV"
|
||||||
|
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||||
|
EXPERIMENTAL_INSTALLER_SYSTEM="darwin"
|
||||||
|
echo "EXPERIMENTAL_INSTALLER_SYSTEM=$EXPERIMENTAL_INSTALLER_SYSTEM" >> "$GITHUB_ENV"
|
||||||
|
else
|
||||||
|
echo "::error ::Unsupported RUNNER_OS: $RUNNER_OS"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$RUNNER_ARCH" == "X64" ]; then
|
||||||
|
EXPERIMENTAL_INSTALLER_ARCH=x86_64
|
||||||
|
echo "EXPERIMENTAL_INSTALLER_ARCH=$EXPERIMENTAL_INSTALLER_ARCH" >> "$GITHUB_ENV"
|
||||||
|
elif [ "$RUNNER_ARCH" == "ARM64" ]; then
|
||||||
|
EXPERIMENTAL_INSTALLER_ARCH=aarch64
|
||||||
|
echo "EXPERIMENTAL_INSTALLER_ARCH=$EXPERIMENTAL_INSTALLER_ARCH" >> "$GITHUB_ENV"
|
||||||
|
else
|
||||||
|
echo "::error ::Unsupported RUNNER_ARCH: $RUNNER_ARCH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "EXPERIMENTAL_INSTALLER_ARTIFACT=nix-installer-$EXPERIMENTAL_INSTALLER_ARCH-$EXPERIMENTAL_INSTALLER_SYSTEM" >> "$GITHUB_ENV"
|
||||||
|
env:
|
||||||
|
EXPERIMENTAL_INSTALLER_REPO: "NixOS/experimental-nix-installer"
|
||||||
|
- name: "Download latest experimental installer"
|
||||||
|
shell: bash
|
||||||
|
id: download-latest-experimental-installer
|
||||||
|
if: ${{ inputs.experimental-installer == 'true' && inputs.experimental-installer-version == 'latest' }}
|
||||||
|
run: |
|
||||||
|
RUN_ID=$(gh run list --repo "$EXPERIMENTAL_INSTALLER_REPO" --workflow ci.yml --branch main --status success --json databaseId --jq ".[0].databaseId")
|
||||||
|
|
||||||
|
EXPERIMENTAL_INSTALLER_DOWNLOAD_DIR="$GITHUB_WORKSPACE/$EXPERIMENTAL_INSTALLER_ARTIFACT"
|
||||||
|
mkdir -p "$EXPERIMENTAL_INSTALLER_DOWNLOAD_DIR"
|
||||||
|
|
||||||
|
gh run download "$RUN_ID" --repo "$EXPERIMENTAL_INSTALLER_REPO" -n "$EXPERIMENTAL_INSTALLER_ARTIFACT" -D "$EXPERIMENTAL_INSTALLER_DOWNLOAD_DIR"
|
||||||
|
# Executable permissions are lost in artifacts
|
||||||
|
find $EXPERIMENTAL_INSTALLER_DOWNLOAD_DIR -type f -exec chmod +x {} +
|
||||||
|
echo "installer-path=$EXPERIMENTAL_INSTALLER_DOWNLOAD_DIR" >> "$GITHUB_OUTPUT"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ inputs.github_token }}
|
||||||
|
EXPERIMENTAL_INSTALLER_REPO: "NixOS/experimental-nix-installer"
|
||||||
- uses: cachix/install-nix-action@c134e4c9e34bac6cab09cf239815f9339aaaf84e # v31.5.1
|
- uses: cachix/install-nix-action@c134e4c9e34bac6cab09cf239815f9339aaaf84e # v31.5.1
|
||||||
|
if: ${{ inputs.experimental-installer != 'true' }}
|
||||||
with:
|
with:
|
||||||
# Ternary operator in GHA: https://www.github.com/actions/runner/issues/409#issuecomment-752775072
|
# Ternary operator in GHA: https://www.github.com/actions/runner/issues/409#issuecomment-752775072
|
||||||
install_url: ${{ inputs.dogfood == 'true' && format('{0}/install', steps.download-nix-installer.outputs.installer-path) || inputs.install_url }}
|
install_url: ${{ inputs.dogfood == 'true' && format('{0}/install', steps.download-nix-installer.outputs.installer-path) || inputs.install_url }}
|
||||||
install_options: ${{ inputs.dogfood == 'true' && format('--tarball-url-prefix {0}', steps.download-nix-installer.outputs.installer-path) || '' }}
|
install_options: ${{ inputs.dogfood == 'true' && format('--tarball-url-prefix {0}', steps.download-nix-installer.outputs.installer-path) || '' }}
|
||||||
extra_nix_config: ${{ inputs.extra_nix_config }}
|
extra_nix_config: ${{ inputs.extra_nix_config }}
|
||||||
|
- uses: DeterminateSystems/nix-installer-action@786fff0690178f1234e4e1fe9b536e94f5433196 # v20
|
||||||
|
if: ${{ inputs.experimental-installer == 'true' }}
|
||||||
|
with:
|
||||||
|
diagnostic-endpoint: ""
|
||||||
|
# TODO: It'd be nice to use `artifacts.nixos.org` for both of these, maybe through an `/experimental-installer/latest` endpoint? or `/commit/<hash>`?
|
||||||
|
local-root: ${{ inputs.experimental-installer-version == 'latest' && steps.download-latest-experimental-installer.outputs.installer-path || '' }}
|
||||||
|
source-url: ${{ inputs.experimental-installer-version != 'latest' && 'https://artifacts.nixos.org/experimental-installer/tag/${{ inputs.experimental-installer-version }}/${{ env.EXPERIMENTAL_INSTALLER_ARTIFACT }}' || '' }}
|
||||||
|
nix-package-url: ${{ inputs.dogfood == 'true' && steps.download-nix-installer.outputs.tarball-path || (inputs.tarball_url || '') }}
|
||||||
|
extra-conf: ${{ inputs.extra_nix_config }}
|
||||||
+11
-72
@@ -27,6 +27,7 @@ jobs:
|
|||||||
extra_nix_config:
|
extra_nix_config:
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
use_cache: false
|
||||||
- run: nix flake show --all-systems --json
|
- run: nix flake show --all-systems --json
|
||||||
|
|
||||||
pre-commit-checks:
|
pre-commit-checks:
|
||||||
@@ -39,7 +40,6 @@ jobs:
|
|||||||
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
||||||
extra_nix_config: experimental-features = nix-command flakes
|
extra_nix_config: experimental-features = nix-command flakes
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
|
||||||
- run: ./ci/gha/tests/pre-commit-checks
|
- run: ./ci/gha/tests/pre-commit-checks
|
||||||
|
|
||||||
basic-checks:
|
basic-checks:
|
||||||
@@ -90,7 +90,6 @@ jobs:
|
|||||||
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
||||||
# The sandbox would otherwise be disabled by default on Darwin
|
# The sandbox would otherwise be disabled by default on Darwin
|
||||||
extra_nix_config: "sandbox = true"
|
extra_nix_config: "sandbox = true"
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
|
||||||
# Since ubuntu 22.30, unprivileged usernamespaces are no longer allowed to map to the root user:
|
# Since ubuntu 22.30, unprivileged usernamespaces are no longer allowed to map to the root user:
|
||||||
# https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces
|
# https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces
|
||||||
- run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
|
- run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
|
||||||
@@ -165,78 +164,20 @@ jobs:
|
|||||||
- run: exec bash -c "nix-channel --add https://releases.nixos.org/nixos/unstable/nixos-23.05pre466020.60c1d71f2ba nixpkgs"
|
- run: exec bash -c "nix-channel --add https://releases.nixos.org/nixos/unstable/nixos-23.05pre466020.60c1d71f2ba nixpkgs"
|
||||||
- run: exec bash -c "nix-channel --update && nix-env -iA nixpkgs.hello && hello"
|
- run: exec bash -c "nix-channel --update && nix-env -iA nixpkgs.hello && hello"
|
||||||
|
|
||||||
# Steps to test CI automation in your own fork.
|
|
||||||
# 1. Sign-up for https://hub.docker.com/
|
|
||||||
# 2. Store your dockerhub username as DOCKERHUB_USERNAME in "Repository secrets" of your fork repository settings (https://github.com/$githubuser/nix/settings/secrets/actions)
|
|
||||||
# 3. Create an access token in https://hub.docker.com/settings/security and store it as DOCKERHUB_TOKEN in "Repository secrets" of your fork
|
|
||||||
check_secrets:
|
|
||||||
permissions:
|
|
||||||
contents: none
|
|
||||||
name: Check presence of secrets
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
outputs:
|
|
||||||
docker: ${{ steps.secret.outputs.docker }}
|
|
||||||
steps:
|
|
||||||
- name: Check for DockerHub secrets
|
|
||||||
id: secret
|
|
||||||
env:
|
|
||||||
_DOCKER_SECRETS: ${{ secrets.DOCKERHUB_USERNAME }}${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
echo "docker=${{ env._DOCKER_SECRETS != '' }}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
docker_push_image:
|
docker_push_image:
|
||||||
needs: [tests, vm_tests, check_secrets]
|
name: Push docker image to DockerHub and GHCR
|
||||||
|
needs: [tests, vm_tests]
|
||||||
|
if: github.event_name == 'push' && github.ref_name == 'master'
|
||||||
|
uses: ./.github/workflows/docker-push.yml
|
||||||
|
with:
|
||||||
|
ref: ${{ github.sha }}
|
||||||
|
is_master: true
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
if: >-
|
secrets:
|
||||||
needs.check_secrets.outputs.docker == 'true' &&
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
github.event_name == 'push' &&
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
github.ref_name == 'master'
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
|
||||||
install_url: https://releases.nixos.org/nix/nix-2.20.3/install
|
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
|
||||||
- run: echo NIX_VERSION="$(nix --experimental-features 'nix-command flakes' eval .\#nix.version | tr -d \")" >> $GITHUB_ENV
|
|
||||||
- run: nix --experimental-features 'nix-command flakes' build .#dockerImage -L
|
|
||||||
- run: docker load -i ./result/image.tar.gz
|
|
||||||
- run: docker tag nix:$NIX_VERSION ${{ secrets.DOCKERHUB_USERNAME }}/nix:$NIX_VERSION
|
|
||||||
- run: docker tag nix:$NIX_VERSION ${{ secrets.DOCKERHUB_USERNAME }}/nix:master
|
|
||||||
# We'll deploy the newly built image to both Docker Hub and Github Container Registry.
|
|
||||||
#
|
|
||||||
# Push to Docker Hub first
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/nix:$NIX_VERSION
|
|
||||||
- run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/nix:master
|
|
||||||
# Push to GitHub Container Registry as well
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Push image
|
|
||||||
run: |
|
|
||||||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/nix
|
|
||||||
# Change all uppercase to lowercase
|
|
||||||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
|
||||||
|
|
||||||
docker tag nix:$NIX_VERSION $IMAGE_ID:$NIX_VERSION
|
|
||||||
docker tag nix:$NIX_VERSION $IMAGE_ID:latest
|
|
||||||
docker push $IMAGE_ID:$NIX_VERSION
|
|
||||||
docker push $IMAGE_ID:latest
|
|
||||||
# deprecated 2024-02-24
|
|
||||||
docker tag nix:$NIX_VERSION $IMAGE_ID:master
|
|
||||||
docker push $IMAGE_ID:master
|
|
||||||
|
|
||||||
vm_tests:
|
vm_tests:
|
||||||
needs: basic-checks
|
needs: basic-checks
|
||||||
@@ -280,7 +221,6 @@ jobs:
|
|||||||
extra_nix_config:
|
extra_nix_config:
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
|
||||||
- run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH MAX_FLAKES=25 flake-regressions/eval-all.sh
|
- run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH MAX_FLAKES=25 flake-regressions/eval-all.sh
|
||||||
|
|
||||||
profile_build:
|
profile_build:
|
||||||
@@ -301,7 +241,6 @@ jobs:
|
|||||||
extra_nix_config: |
|
extra_nix_config: |
|
||||||
experimental-features = flakes nix-command ca-derivations impure-derivations
|
experimental-features = flakes nix-command ca-derivations impure-derivations
|
||||||
max-jobs = 1
|
max-jobs = 1
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
|
||||||
- run: |
|
- run: |
|
||||||
nix build -L --file ./ci/gha/profile-build buildTimeReport --out-link build-time-report.md
|
nix build -L --file ./ci/gha/profile-build buildTimeReport --out-link build-time-report.md
|
||||||
cat build-time-report.md >> $GITHUB_STEP_SUMMARY
|
cat build-time-report.md >> $GITHUB_STEP_SUMMARY
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
name: "Push Docker Image"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
ref:
|
||||||
|
description: "Git ref to build the docker image from"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
is_master:
|
||||||
|
description: "Whether run from master branch"
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
secrets:
|
||||||
|
DOCKERHUB_USERNAME:
|
||||||
|
required: true
|
||||||
|
DOCKERHUB_TOKEN:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Steps to test CI automation in your own fork.
|
||||||
|
# 1. Sign-up for https://hub.docker.com/
|
||||||
|
# 2. Store your dockerhub username as DOCKERHUB_USERNAME in "Repository secrets" of your fork repository settings (https://github.com/$githubuser/nix/settings/secrets/actions)
|
||||||
|
# 3. Create an access token in https://hub.docker.com/settings/security and store it as DOCKERHUB_TOKEN in "Repository secrets" of your fork
|
||||||
|
check_secrets:
|
||||||
|
permissions:
|
||||||
|
contents: none
|
||||||
|
name: Check presence of secrets
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
outputs:
|
||||||
|
docker: ${{ steps.secret.outputs.docker }}
|
||||||
|
steps:
|
||||||
|
- name: Check for DockerHub secrets
|
||||||
|
id: secret
|
||||||
|
env:
|
||||||
|
_DOCKER_SECRETS: ${{ secrets.DOCKERHUB_USERNAME }}${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
echo "docker=${{ env._DOCKER_SECRETS != '' }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
push:
|
||||||
|
name: Push docker image to DockerHub and GHCR
|
||||||
|
needs: [check_secrets]
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
if: needs.check_secrets.outputs.docker == 'true'
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ inputs.ref }}
|
||||||
|
- uses: ./.github/actions/install-nix-action
|
||||||
|
with:
|
||||||
|
dogfood: false
|
||||||
|
extra_nix_config: |
|
||||||
|
experimental-features = flakes nix-command
|
||||||
|
- run: echo NIX_VERSION="$(nix eval .\#nix.version | tr -d \")" >> $GITHUB_ENV
|
||||||
|
- run: nix build .#dockerImage -L
|
||||||
|
- run: docker load -i ./result/image.tar.gz
|
||||||
|
# We'll deploy the newly built image to both Docker Hub and Github Container Registry.
|
||||||
|
#
|
||||||
|
# Push to Docker Hub first
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Push to Docker Hub
|
||||||
|
env:
|
||||||
|
IS_MASTER: ${{ inputs.is_master }}
|
||||||
|
DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_USERNAME }}/nix
|
||||||
|
run: |
|
||||||
|
docker tag nix:$NIX_VERSION $DOCKERHUB_REPO:$NIX_VERSION
|
||||||
|
docker push $DOCKERHUB_REPO:$NIX_VERSION
|
||||||
|
if [ "$IS_MASTER" = "true" ]; then
|
||||||
|
docker tag nix:$NIX_VERSION $DOCKERHUB_REPO:master
|
||||||
|
docker push $DOCKERHUB_REPO:master
|
||||||
|
fi
|
||||||
|
# Push to GitHub Container Registry as well
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Push to GHCR
|
||||||
|
env:
|
||||||
|
IS_MASTER: ${{ inputs.is_master }}
|
||||||
|
run: |
|
||||||
|
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/nix
|
||||||
|
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
||||||
|
|
||||||
|
docker tag nix:$NIX_VERSION $IMAGE_ID:$NIX_VERSION
|
||||||
|
docker push $IMAGE_ID:$NIX_VERSION
|
||||||
|
if [ "$IS_MASTER" = "true" ]; then
|
||||||
|
docker tag nix:$NIX_VERSION $IMAGE_ID:master
|
||||||
|
docker push $IMAGE_ID:master
|
||||||
|
fi
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
name: Upload Release
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
eval_id:
|
||||||
|
description: "Hydra evaluation ID"
|
||||||
|
required: true
|
||||||
|
type: number
|
||||||
|
is_latest:
|
||||||
|
description: "Mark as latest release"
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
packages: write
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
environment: releases
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
|
- uses: ./.github/actions/install-nix-action
|
||||||
|
with:
|
||||||
|
dogfood: false # Use stable version
|
||||||
|
use_cache: false # Don't want any cache injection shenanigans
|
||||||
|
extra_nix_config: |
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
- name: Set NIX_PATH from flake input
|
||||||
|
run: |
|
||||||
|
NIXPKGS_PATH=$(nix build --inputs-from .# nixpkgs#path --print-out-paths --no-link)
|
||||||
|
# Shebangs with perl have issues. Pin nixpkgs this way. nix shell should maybe
|
||||||
|
# get the same uberhack that nix-shell has to support it.
|
||||||
|
echo "NIX_PATH=nixpkgs=$NIXPKGS_PATH" >> "$GITHUB_ENV"
|
||||||
|
- name: Configure AWS credentials
|
||||||
|
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1
|
||||||
|
with:
|
||||||
|
role-to-assume: "arn:aws:iam::080433136561:role/nix-release"
|
||||||
|
role-session-name: nix-release-oidc-${{ github.run_id }}
|
||||||
|
aws-region: eu-west-1
|
||||||
|
- name: Disable containerd image store
|
||||||
|
run: |
|
||||||
|
# Docker 28+ defaults to the containerd image store, which
|
||||||
|
# pushes layers uncompressed instead of gzip. OCI clients
|
||||||
|
# that only support gzip (e.g. go-containerregistry) fail
|
||||||
|
# with "gzip: invalid header". Disabling the containerd
|
||||||
|
# snapshotter restores the classic storage driver, which
|
||||||
|
# preserves gzip-compressed layers through the
|
||||||
|
# `docker load` / `docker push` pipeline.
|
||||||
|
echo '{"features":{"containerd-snapshotter":false}}' | sudo tee /etc/docker/daemon.json > /dev/null
|
||||||
|
sudo systemctl restart docker
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Upload release
|
||||||
|
run: |
|
||||||
|
./maintainers/upload-release.pl \
|
||||||
|
${{ inputs.eval_id }} \
|
||||||
|
--skip-git
|
||||||
|
env:
|
||||||
|
IS_LATEST: ${{ inputs.is_latest && '1' || '' }}
|
||||||
|
- name: Push to GHCR
|
||||||
|
run: |
|
||||||
|
DOCKER_OWNER="ghcr.io/$(echo '${{ github.repository_owner }}' | tr '[A-Z]' '[a-z]')/nix"
|
||||||
|
./maintainers/upload-release.pl \
|
||||||
|
${{ inputs.eval_id }} \
|
||||||
|
--skip-git \
|
||||||
|
--skip-s3 \
|
||||||
|
--docker-owner "$DOCKER_OWNER"
|
||||||
|
env:
|
||||||
|
IS_LATEST: ${{ inputs.is_latest && '1' || '' }}
|
||||||
+10
-3
@@ -24,8 +24,15 @@ def map_contents_recursively(transformer):
|
|||||||
def process_command:
|
def process_command:
|
||||||
.[0] as $context |
|
.[0] as $context |
|
||||||
.[1] as $body |
|
.[1] as $body |
|
||||||
$body + {
|
# mdbook 0.5.x uses 'items' instead of 'sections'
|
||||||
sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
|
if $body.items then
|
||||||
};
|
$body + {
|
||||||
|
items: $body.items | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$body + {
|
||||||
|
sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
|
||||||
|
}
|
||||||
|
end;
|
||||||
|
|
||||||
process_command
|
process_command
|
||||||
@@ -23,12 +23,3 @@ renderers = ["html"]
|
|||||||
command = "jq --from-file ./anchors.jq"
|
command = "jq --from-file ./anchors.jq"
|
||||||
|
|
||||||
[output.markdown]
|
[output.markdown]
|
||||||
|
|
||||||
[output.linkcheck]
|
|
||||||
# no Internet during the build (in the sandbox)
|
|
||||||
follow-web-links = false
|
|
||||||
|
|
||||||
# mdbook-linkcheck does not understand [foo]{#bar} style links, resulting in
|
|
||||||
# excessive "Potential incomplete link" warnings. No other kind of warning was
|
|
||||||
# produced at the time of writing.
|
|
||||||
warning-policy = "ignore"
|
|
||||||
@@ -24,9 +24,9 @@ let
|
|||||||
in
|
in
|
||||||
concatStringsSep "\n" (map showEntry storesList);
|
concatStringsSep "\n" (map showEntry storesList);
|
||||||
|
|
||||||
"index.md" =
|
"index.md" = replaceStrings [ "@store-types@" ] [ index ] (
|
||||||
replaceStrings [ "@store-types@" ] [ index ]
|
readFile ./source/store/types/index.md.in
|
||||||
(readFile ./source/store/types/index.md.in);
|
);
|
||||||
|
|
||||||
tableOfContents =
|
tableOfContents =
|
||||||
let
|
let
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
ninja,
|
ninja,
|
||||||
lowdown-unsandboxed,
|
lowdown-unsandboxed,
|
||||||
mdbook,
|
mdbook,
|
||||||
mdbook-linkcheck,
|
|
||||||
jq,
|
jq,
|
||||||
python3,
|
python3,
|
||||||
rsync,
|
rsync,
|
||||||
@@ -51,7 +50,6 @@ mkMesonDerivation (finalAttrs: {
|
|||||||
ninja
|
ninja
|
||||||
(lib.getBin lowdown-unsandboxed)
|
(lib.getBin lowdown-unsandboxed)
|
||||||
mdbook
|
mdbook
|
||||||
mdbook-linkcheck
|
|
||||||
jq
|
jq
|
||||||
python3
|
python3
|
||||||
rsync
|
rsync
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
- Derivation JSON format now uses store path basenames only [#13570](https://github.com/NixOS/nix/issues/13570) [#13980](https://github.com/NixOS/nix/pull/13980)
|
- Derivation JSON format now uses store path basenames only [#13570](https://github.com/NixOS/nix/issues/13570) [#13980](https://github.com/NixOS/nix/pull/13980)
|
||||||
|
|
||||||
Experience with many JSON frameworks (e.g. nlohmann/json in C++, Serde in Rust, and Aeson in Haskell) has shown that the use of the store directory in JSON formats is an impediment to systematic JSON formats, because it requires the serializer/deserializer to take an extra paramater (the store directory).
|
Experience with many JSON frameworks (e.g. nlohmann/json in C++, Serde in Rust, and Aeson in Haskell) has shown that the use of the store directory in JSON formats is an impediment to systematic JSON formats, because it requires the serializer/deserializer to take an extra parameter (the store directory).
|
||||||
|
|
||||||
We ultimately want to rectify this issue with all JSON formats to the extent allowed by our stability promises. To start with, we are changing the JSON format for derivations because the `nix derivation` commands are — in addition to being formally unstable — less widely used than other unstable commands.
|
We ultimately want to rectify this issue with all JSON formats to the extent allowed by our stability promises. To start with, we are changing the JSON format for derivations because the `nix derivation` commands are — in addition to being formally unstable — less widely used than other unstable commands.
|
||||||
|
|
||||||
@@ -128,3 +128,38 @@ This release was made possible by the following 32 contributors:
|
|||||||
- Cole Helbling [**(@cole-h)**](https://github.com/cole-h)
|
- Cole Helbling [**(@cole-h)**](https://github.com/cole-h)
|
||||||
- Sinan Mohd [**(@sinanmohd)**](https://github.com/sinanmohd)
|
- Sinan Mohd [**(@sinanmohd)**](https://github.com/sinanmohd)
|
||||||
- Philipp Otterbein
|
- Philipp Otterbein
|
||||||
|
# Release 2.32.5 (2026-01-02)
|
||||||
|
|
||||||
|
## Bug fixes
|
||||||
|
|
||||||
|
- Fix `builtins.fetchGit` with `ref = "HEAD"` [#13948](https://github.com/NixOS/nix/issues/13948) [#14673](https://github.com/NixOS/nix/pull/14673)
|
||||||
|
|
||||||
|
- Fix dynamic attributes that are simple string expressions [#14642](https://github.com/NixOS/nix/issues/14642) [#14646](https://github.com/NixOS/nix/pull/14646)
|
||||||
|
|
||||||
|
Dynamic attributes are typically not allowed in [`let` expressions](https://nix.dev/manual/nix/2.32/language/syntax.html#let-expressions), but simple [string literals](https://nix.dev/manual/nix/2.32/language/string-literals.html) are allowed. This special-case was broken in prior releases of 2.32.
|
||||||
|
|
||||||
|
- Fix null pointer dereference on reading non-existent derivations [#14571](https://github.com/NixOS/nix/issues/14571) [#14891](https://github.com/NixOS/nix/issues/14891) [#14572](https://github.com/NixOS/nix/pull/14572)
|
||||||
|
|
||||||
|
- Fix use-after-free in derivation build scheduler [#14782](https://github.com/NixOS/nix/pull/14782)
|
||||||
|
|
||||||
|
- Avoid querying remaining substituters after first success [#14836](https://github.com/NixOS/nix/issues/14836) [#14839](https://github.com/NixOS/nix/pull/14839)
|
||||||
|
|
||||||
|
- Improve temporary path creation in hard link store optimisation [#7273](https://github.com/NixOS/nix/issues/7273) [#14680](https://github.com/NixOS/nix/pull/14680)
|
||||||
|
|
||||||
|
`auto-optimise-store` has been known to be flaky on Darwin due the usage of `rand()` when constructing the path of a temporary hardlink.
|
||||||
|
|
||||||
|
- Move singletons out of headers [#14558](https://github.com/NixOS/nix/issues/14558)
|
||||||
|
|
||||||
|
Such variables have ["vague linkage"](https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Vague-Linkage.html) and require special support from the dynamic linker to deduplicate across different shared libraries. Platforms such as Cygwin do not support this and duplicate the symbols instead.
|
||||||
|
|
||||||
|
- Fix `curl` with `c-ares` failing to resolve DNS inside sandbox on macOS [#14859](https://github.com/NixOS/nix/pull/14859)
|
||||||
|
|
||||||
|
- Fix `recursive-nix` [#14730](https://github.com/NixOS/nix/pull/14730)
|
||||||
|
|
||||||
|
## Improvements
|
||||||
|
|
||||||
|
- Support building manual with mdbook 0.5 [#14628](https://github.com/NixOS/nix/issues/14628) [#14693](https://github.com/NixOS/nix/pull/14693)
|
||||||
|
|
||||||
|
- Improve `parent directory is world-writable or a symlink` error message to include the offending path component [#13701](https://github.com/NixOS/nix/issues/13701) [#14849](https://github.com/NixOS/nix/pull/14849)
|
||||||
|
|
||||||
|
- Correct `build-dir` documentation in manual [#14748](https://github.com/NixOS/nix/pull/14748)
|
||||||
@@ -12,10 +12,11 @@
|
|||||||
|
|
||||||
The [`builder`](./derivation/index.md#builder) is executed as follows:
|
The [`builder`](./derivation/index.md#builder) is executed as follows:
|
||||||
|
|
||||||
- A temporary directory is created under the directory specified by
|
- A temporary directory is created where the build will take place. The
|
||||||
`TMPDIR` (default `/tmp`) where the build will take place. The
|
|
||||||
current directory is changed to this directory.
|
current directory is changed to this directory.
|
||||||
|
|
||||||
|
See the per-store [`build-dir`](@docroot@/store/types/local-store.md#store-local-store-build-dir) setting for more information.
|
||||||
|
|
||||||
- The environment is cleared and set to the derivation attributes, as
|
- The environment is cleared and set to the derivation attributes, as
|
||||||
specified above.
|
specified above.
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ def recursive_replace(data: dict[str, t.Any], book_root: Path, search_path: Path
|
|||||||
return data | dict(
|
return data | dict(
|
||||||
sections = [recursive_replace(section, book_root, search_path) for section in sections],
|
sections = [recursive_replace(section, book_root, search_path) for section in sections],
|
||||||
)
|
)
|
||||||
|
case {'items': items}:
|
||||||
|
return data | dict(
|
||||||
|
items = [recursive_replace(item, book_root, search_path) for item in items],
|
||||||
|
)
|
||||||
case {'Chapter': chapter}:
|
case {'Chapter': chapter}:
|
||||||
path_to_chapter = Path(chapter['path'])
|
path_to_chapter = Path(chapter['path'])
|
||||||
chapter_content = chapter['content']
|
chapter_content = chapter['content']
|
||||||
|
|||||||
Generated
+4
-4
@@ -63,16 +63,16 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1756178832,
|
"lastModified": 1761597516,
|
||||||
"narHash": "sha256-O2CIn7HjZwEGqBrwu9EU76zlmA5dbmna7jL1XUmAId8=",
|
"narHash": "sha256-wxX7u6D2rpkJLWkZ2E932SIvDJW8+ON/0Yy8+a5vsDU=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d98ce345cdab58477ca61855540999c86577d19d",
|
"rev": "daf6dc47aa4b44791372d6139ab7b25269184d55",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-25.05-small",
|
"ref": "nixos-25.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
description = "The purely functional package manager";
|
description = "The purely functional package manager";
|
||||||
|
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05-small";
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
|
||||||
|
|
||||||
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
||||||
inputs.nixpkgs-23-11.url = "github:NixOS/nixpkgs/a62e6edd6d5e1fa0329b8653c801147986f8d446";
|
inputs.nixpkgs-23-11.url = "github:NixOS/nixpkgs/a62e6edd6d5e1fa0329b8653c801147986f8d446";
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
|
|
||||||
officialRelease = false;
|
officialRelease = true;
|
||||||
|
|
||||||
linux32BitSystems = [ "i686-linux" ];
|
linux32BitSystems = [ "i686-linux" ];
|
||||||
linux64BitSystems = [
|
linux64BitSystems = [
|
||||||
|
|||||||
@@ -79,6 +79,8 @@
|
|||||||
# Not supported by nixfmt
|
# Not supported by nixfmt
|
||||||
''^tests/functional/lang/eval-okay-deprecate-cursed-or\.nix$''
|
''^tests/functional/lang/eval-okay-deprecate-cursed-or\.nix$''
|
||||||
''^tests/functional/lang/eval-okay-attrs5\.nix$''
|
''^tests/functional/lang/eval-okay-attrs5\.nix$''
|
||||||
|
''^tests/functional/lang/eval-fail-dynamic-attrs-inherit\.nix$''
|
||||||
|
''^tests/functional/lang/eval-fail-dynamic-attrs-inherit-2\.nix$''
|
||||||
|
|
||||||
# More syntax tests
|
# More syntax tests
|
||||||
# These tests, or parts of them, should have been parse-* test cases.
|
# These tests, or parts of them, should have been parse-* test cases.
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
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
|
||||||
|
7w==
|
||||||
|
=mXYP
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
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
|
||||||
|
=u5cX
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Maintainer GPG Keys
|
||||||
|
|
||||||
|
Release tags are signed by members of the [Nix maintainer team](https://nixos.org/community/teams/nix/) as part of the [release process](../release-process.md). This directory contains the public GPG keys used for signing.
|
||||||
|
|
||||||
|
## Keys
|
||||||
|
|
||||||
|
- **Eelco Dolstra**
|
||||||
|
GPG Fingerprint: `B541 D553 0127 0E0B CF15 CA5D 8170 B472 6D71 98DE`
|
||||||
|
|
||||||
|
- **Sergei Zimmerman**
|
||||||
|
GPG Fingerprint: [`158A 6F53 0EA2 02E5 F651 6113 14FA EA63 448E 1DF9`](https://keys.openpgp.org/vks/v1/by-fingerprint/158A6F530EA202E5F651611314FAEA63448E1DF9)
|
||||||
|
|
||||||
|
<!-- TODO: Add keys for other Nix team members -->
|
||||||
@@ -5,11 +5,11 @@
|
|||||||
The release process is intended to create the following for each
|
The release process is intended to create the following for each
|
||||||
release:
|
release:
|
||||||
|
|
||||||
* A Git tag
|
* A signed Git tag (public keys in `maintainers/keys/`)
|
||||||
|
|
||||||
* Binary tarballs in https://releases.nixos.org/?prefix=nix/
|
* Binary tarballs in https://releases.nixos.org/?prefix=nix/
|
||||||
|
|
||||||
* Docker images
|
* Docker images (arm64 and amd64 variants, uploaded to DockerHub and GHCR)
|
||||||
|
|
||||||
* Closures in https://cache.nixos.org
|
* Closures in https://cache.nixos.org
|
||||||
|
|
||||||
@@ -104,21 +104,17 @@ release:
|
|||||||
evaluation ID (e.g. `1780832` in
|
evaluation ID (e.g. `1780832` in
|
||||||
`https://hydra.nixos.org/eval/1780832`).
|
`https://hydra.nixos.org/eval/1780832`).
|
||||||
|
|
||||||
* Tag the release and upload the release artifacts to
|
* Tag the release:
|
||||||
[`releases.nixos.org`](https://releases.nixos.org/) and [Docker Hub](https://hub.docker.com/):
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ IS_LATEST=1 ./maintainers/upload-release.pl <EVAL-ID>
|
$ IS_LATEST=1 ./maintainers/upload-release.pl --skip-docker --skip-s3 --project-root $PWD <EVAL-ID>
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: `IS_LATEST=1` causes the `latest-release` branch to be
|
Note: `IS_LATEST=1` causes the `latest-release` branch to be
|
||||||
force-updated. This is used by the `nixos.org` website to get the
|
force-updated. This is used by the `nixos.org` website to get the
|
||||||
[latest Nix manual](https://nixos.org/manual/nixpkgs/unstable/).
|
[latest Nix manual](https://nixos.org/manual/nixpkgs/unstable/).
|
||||||
|
|
||||||
TODO: This script requires the right AWS credentials. Document.
|
* Trigger the [`upload-release.yml` workflow](https://github.com/NixOS/nix/actions/workflows/upload-release.yml) via `workflow_dispatch` trigger. At the top click `Run workflow` -> select the current release branch from `Use workflow from` -> fill in `Hydra evaluation ID` with `<EVAL-ID>` value from previous steps -> click `Run workflow`. Wait for the run to be approved by `NixOS/nix-team` (or bypass checks if warranted). Wait for the workflow to succeed.
|
||||||
|
|
||||||
TODO: This script currently requires a
|
|
||||||
`/home/eelco/Dev/nix-pristine`.
|
|
||||||
|
|
||||||
TODO: trigger nixos.org netlify: https://docs.netlify.com/configure-builds/build-hooks/
|
TODO: trigger nixos.org netlify: https://docs.netlify.com/configure-builds/build-hooks/
|
||||||
|
|
||||||
@@ -182,16 +178,18 @@ release:
|
|||||||
* Wait for the desired evaluation of the maintenance jobset to finish
|
* Wait for the desired evaluation of the maintenance jobset to finish
|
||||||
building.
|
building.
|
||||||
|
|
||||||
* Run
|
* Tag the release
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ IS_LATEST=1 ./maintainers/upload-release.pl <EVAL-ID>
|
$ IS_LATEST=1 ./maintainers/upload-release.pl --skip-docker --skip-s3 --project-root $PWD <EVAL-ID>
|
||||||
```
|
```
|
||||||
|
|
||||||
Omit `IS_LATEST=1` when creating a point release that is not on the
|
Omit `IS_LATEST=1` when creating a point release that is not on the
|
||||||
most recent stable branch. This prevents `nixos.org` to going back
|
most recent stable branch. This prevents `nixos.org` to going back
|
||||||
to an older release.
|
to an older release.
|
||||||
|
|
||||||
|
* Trigger the [`upload-release.yml` workflow](https://github.com/NixOS/nix/actions/workflows/upload-release.yml) via `workflow_dispatch` trigger. At the top click `Run workflow` -> select the current release branch from `Use workflow from` -> fill in `Hydra evaluation ID` with `<EVAL-ID>` value from previous steps -> click `Run workflow`. Wait for the run to be approved by `NixOS/nix-team` (or bypass checks if warranted). Wait for the workflow to succeed.
|
||||||
|
|
||||||
* Bump the version number of the release branch as above (e.g. to
|
* Bump the version number of the release branch as above (e.g. to
|
||||||
`2.12.2`).
|
`2.12.2`).
|
||||||
|
|
||||||
|
|||||||
+128
-82
@@ -1,7 +1,8 @@
|
|||||||
#! /usr/bin/env nix-shell
|
#! /usr/bin/env nix-shell
|
||||||
#! nix-shell -i perl -p perl perlPackages.LWPUserAgent perlPackages.LWPProtocolHttps perlPackages.FileSlurp perlPackages.NetAmazonS3 gnupg1
|
#! nix-shell -i perl -p awscli2 perl perlPackages.LWPUserAgent perlPackages.LWPProtocolHttps perlPackages.FileSlurp perlPackages.NetAmazonS3 perlPackages.GetoptLongDescriptive gnupg1
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use Getopt::Long::Descriptive;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use File::Path;
|
use File::Path;
|
||||||
@@ -13,7 +14,30 @@ use Net::Amazon::S3;
|
|||||||
|
|
||||||
delete $ENV{'shell'}; # shut up a LWP::UserAgent.pm warning
|
delete $ENV{'shell'}; # shut up a LWP::UserAgent.pm warning
|
||||||
|
|
||||||
my $evalId = $ARGV[0] or die "Usage: $0 EVAL-ID\n";
|
my ($opt, $usage) = describe_options(
|
||||||
|
'%c %o <eval-id>',
|
||||||
|
[ 'skip-docker', 'Skip Docker image upload' ],
|
||||||
|
[ 'skip-git', 'Skip Git tagging' ],
|
||||||
|
[ 'skip-s3', 'Skip S3 upload' ],
|
||||||
|
[ 'docker-owner=s', 'Docker image owner', { default => 'nixos/nix' } ],
|
||||||
|
[ 'project-root=s', 'Pristine git repository path' ],
|
||||||
|
[ 's3-endpoint=s', 'Custom S3 endpoint' ],
|
||||||
|
[ 's3-host=s', 'S3 host', { default => 's3-eu-west-1.amazonaws.com' } ],
|
||||||
|
[],
|
||||||
|
[ 'help|h', 'Show this help message', { shortcircuit => 1 } ],
|
||||||
|
[],
|
||||||
|
[ 'Environment variables:' ],
|
||||||
|
[ 'AWS_ACCESS_KEY_ID' ],
|
||||||
|
[ 'AWS_SECRET_ACCESS_KEY' ],
|
||||||
|
[ 'AWS_SESSION_TOKEN For OIDC' ],
|
||||||
|
[ 'IS_LATEST Set to "1" to mark as latest release' ],
|
||||||
|
);
|
||||||
|
|
||||||
|
print($usage->text), exit if $opt->help;
|
||||||
|
|
||||||
|
my $evalId = $ARGV[0] or do { print STDERR $usage->text; exit 1 };
|
||||||
|
|
||||||
|
die "--project-root is required unless --skip-git is specified\n" unless $opt->skip_git || $opt->project_root;
|
||||||
|
|
||||||
my $releasesBucketName = "nix-releases";
|
my $releasesBucketName = "nix-releases";
|
||||||
my $channelsBucketName = "nix-channels";
|
my $channelsBucketName = "nix-channels";
|
||||||
@@ -62,25 +86,38 @@ File::Path::make_path($narCache);
|
|||||||
my $binaryCache = "https://cache.nixos.org/?local-nar-cache=$narCache";
|
my $binaryCache = "https://cache.nixos.org/?local-nar-cache=$narCache";
|
||||||
|
|
||||||
# S3 setup.
|
# S3 setup.
|
||||||
my $aws_access_key_id = $ENV{'AWS_ACCESS_KEY_ID'} or die "No AWS_ACCESS_KEY_ID given.";
|
my $aws_access_key_id = $ENV{'AWS_ACCESS_KEY_ID'};
|
||||||
my $aws_secret_access_key = $ENV{'AWS_SECRET_ACCESS_KEY'} or die "No AWS_SECRET_ACCESS_KEY given.";
|
my $aws_secret_access_key = $ENV{'AWS_SECRET_ACCESS_KEY'};
|
||||||
|
my $aws_session_token = $ENV{'AWS_SESSION_TOKEN'};
|
||||||
|
|
||||||
my $s3 = Net::Amazon::S3->new(
|
my ($s3, $releasesBucket, $s3_channels, $channelsBucket);
|
||||||
{ aws_access_key_id => $aws_access_key_id,
|
|
||||||
aws_secret_access_key => $aws_secret_access_key,
|
|
||||||
retry => 1,
|
|
||||||
host => "s3-eu-west-1.amazonaws.com",
|
|
||||||
});
|
|
||||||
|
|
||||||
my $releasesBucket = $s3->bucket($releasesBucketName) or die;
|
unless ($opt->skip_s3) {
|
||||||
|
$aws_access_key_id or die "No AWS_ACCESS_KEY_ID given.";
|
||||||
|
$aws_secret_access_key or die "No AWS_SECRET_ACCESS_KEY given.";
|
||||||
|
|
||||||
my $s3_us = Net::Amazon::S3->new(
|
$s3 = Net::Amazon::S3->new(
|
||||||
{ aws_access_key_id => $aws_access_key_id,
|
{ aws_access_key_id => $aws_access_key_id,
|
||||||
aws_secret_access_key => $aws_secret_access_key,
|
aws_secret_access_key => $aws_secret_access_key,
|
||||||
retry => 1,
|
$aws_session_token ? (aws_session_token => $aws_session_token) : (),
|
||||||
});
|
retry => 1,
|
||||||
|
host => $opt->s3_host,
|
||||||
|
secure => ($opt->s3_endpoint && $opt->s3_endpoint =~ /^http:/) ? 0 : 1,
|
||||||
|
});
|
||||||
|
|
||||||
my $channelsBucket = $s3_us->bucket($channelsBucketName) or die;
|
$releasesBucket = $s3->bucket($releasesBucketName) or die;
|
||||||
|
|
||||||
|
$s3_channels = Net::Amazon::S3->new(
|
||||||
|
{ aws_access_key_id => $aws_access_key_id,
|
||||||
|
aws_secret_access_key => $aws_secret_access_key,
|
||||||
|
$aws_session_token ? (aws_session_token => $aws_session_token) : (),
|
||||||
|
retry => 1,
|
||||||
|
$opt->s3_endpoint ? (host => $opt->s3_host) : (),
|
||||||
|
$opt->s3_endpoint ? (secure => ($opt->s3_endpoint =~ /^http:/) ? 0 : 1) : (),
|
||||||
|
});
|
||||||
|
|
||||||
|
$channelsBucket = $s3_channels->bucket($channelsBucketName) or die;
|
||||||
|
}
|
||||||
|
|
||||||
sub getStorePath {
|
sub getStorePath {
|
||||||
my ($jobName, $output) = @_;
|
my ($jobName, $output) = @_;
|
||||||
@@ -115,11 +152,12 @@ sub copyManual {
|
|||||||
File::Path::remove_tree("$tmpDir/manual.tmp", {safe => 1});
|
File::Path::remove_tree("$tmpDir/manual.tmp", {safe => 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
system("aws s3 sync '$tmpDir/manual' s3://$releasesBucketName/$releaseDir/manual") == 0
|
my $awsEndpoint = $opt->s3_endpoint ? "--endpoint-url " . $opt->s3_endpoint : "";
|
||||||
|
system("aws $awsEndpoint s3 sync '$tmpDir/manual' s3://$releasesBucketName/$releaseDir/manual") == 0
|
||||||
or die "syncing manual to S3\n";
|
or die "syncing manual to S3\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
copyManual;
|
copyManual unless $opt->skip_s3;
|
||||||
|
|
||||||
sub downloadFile {
|
sub downloadFile {
|
||||||
my ($jobName, $productNr, $dstName) = @_;
|
my ($jobName, $productNr, $dstName) = @_;
|
||||||
@@ -158,30 +196,12 @@ sub downloadFile {
|
|||||||
return $sha256_expected;
|
return $sha256_expected;
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadFile("binaryTarball.i686-linux", "1");
|
# Upload docker images.
|
||||||
downloadFile("binaryTarball.x86_64-linux", "1");
|
|
||||||
downloadFile("binaryTarball.aarch64-linux", "1");
|
|
||||||
downloadFile("binaryTarball.x86_64-darwin", "1");
|
|
||||||
downloadFile("binaryTarball.aarch64-darwin", "1");
|
|
||||||
eval {
|
|
||||||
downloadFile("binaryTarballCross.x86_64-linux.armv6l-unknown-linux-gnueabihf", "1");
|
|
||||||
};
|
|
||||||
warn "$@" if $@;
|
|
||||||
eval {
|
|
||||||
downloadFile("binaryTarballCross.x86_64-linux.armv7l-unknown-linux-gnueabihf", "1");
|
|
||||||
};
|
|
||||||
warn "$@" if $@;
|
|
||||||
eval {
|
|
||||||
downloadFile("binaryTarballCross.x86_64-linux.riscv64-unknown-linux-gnu", "1");
|
|
||||||
};
|
|
||||||
warn "$@" if $@;
|
|
||||||
downloadFile("installerScript", "1");
|
|
||||||
|
|
||||||
# Upload docker images to dockerhub.
|
|
||||||
my $dockerManifest = "";
|
my $dockerManifest = "";
|
||||||
my $dockerManifestLatest = "";
|
my $dockerManifestLatest = "";
|
||||||
my $haveDocker = 0;
|
my $haveDocker = 0;
|
||||||
|
|
||||||
|
unless ($opt->skip_docker) {
|
||||||
for my $platforms (["x86_64-linux", "amd64"], ["aarch64-linux", "arm64"]) {
|
for my $platforms (["x86_64-linux", "amd64"], ["aarch64-linux", "arm64"]) {
|
||||||
my $system = $platforms->[0];
|
my $system = $platforms->[0];
|
||||||
my $dockerPlatform = $platforms->[1];
|
my $dockerPlatform = $platforms->[1];
|
||||||
@@ -195,8 +215,8 @@ for my $platforms (["x86_64-linux", "amd64"], ["aarch64-linux", "arm64"]) {
|
|||||||
print STDERR "loading docker image for $dockerPlatform...\n";
|
print STDERR "loading docker image for $dockerPlatform...\n";
|
||||||
system("docker load -i $tmpDir/$fn") == 0 or die;
|
system("docker load -i $tmpDir/$fn") == 0 or die;
|
||||||
|
|
||||||
my $tag = "nixos/nix:$version-$dockerPlatform";
|
my $tag = $opt->docker_owner . ":$version-$dockerPlatform";
|
||||||
my $latestTag = "nixos/nix:latest-$dockerPlatform";
|
my $latestTag = $opt->docker_owner . ":latest-$dockerPlatform";
|
||||||
|
|
||||||
print STDERR "tagging $version docker image for $dockerPlatform...\n";
|
print STDERR "tagging $version docker image for $dockerPlatform...\n";
|
||||||
system("docker tag nix:$version $tag") == 0 or die;
|
system("docker tag nix:$version $tag") == 0 or die;
|
||||||
@@ -219,68 +239,94 @@ for my $platforms (["x86_64-linux", "amd64"], ["aarch64-linux", "arm64"]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($haveDocker) {
|
if ($haveDocker) {
|
||||||
|
my $dockerOwner = $opt->docker_owner;
|
||||||
print STDERR "creating multi-platform docker manifest...\n";
|
print STDERR "creating multi-platform docker manifest...\n";
|
||||||
system("docker manifest rm nixos/nix:$version");
|
system("docker manifest rm $dockerOwner:$version");
|
||||||
system("docker manifest create nixos/nix:$version $dockerManifest") == 0 or die;
|
system("docker manifest create $dockerOwner:$version $dockerManifest") == 0 or die;
|
||||||
if ($isLatest) {
|
if ($isLatest) {
|
||||||
print STDERR "creating latest multi-platform docker manifest...\n";
|
print STDERR "creating latest multi-platform docker manifest...\n";
|
||||||
system("docker manifest rm nixos/nix:latest");
|
system("docker manifest rm $dockerOwner:latest");
|
||||||
system("docker manifest create nixos/nix:latest $dockerManifestLatest") == 0 or die;
|
system("docker manifest create $dockerOwner:latest $dockerManifestLatest") == 0 or die;
|
||||||
}
|
}
|
||||||
|
|
||||||
print STDERR "pushing multi-platform docker manifest...\n";
|
print STDERR "pushing multi-platform docker manifest...\n";
|
||||||
system("docker manifest push nixos/nix:$version") == 0 or die;
|
system("docker manifest push $dockerOwner:$version") == 0 or die;
|
||||||
|
|
||||||
if ($isLatest) {
|
if ($isLatest) {
|
||||||
print STDERR "pushing latest multi-platform docker manifest...\n";
|
print STDERR "pushing latest multi-platform docker manifest...\n";
|
||||||
system("docker manifest push nixos/nix:latest") == 0 or die;
|
system("docker manifest push $dockerOwner:latest") == 0 or die;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Upload nix-fallback-paths.nix.
|
|
||||||
write_file("$tmpDir/fallback-paths.nix",
|
|
||||||
"{\n" .
|
|
||||||
" x86_64-linux = \"" . getStorePath("build.nix-everything.x86_64-linux") . "\";\n" .
|
|
||||||
" i686-linux = \"" . getStorePath("build.nix-everything.i686-linux") . "\";\n" .
|
|
||||||
" aarch64-linux = \"" . getStorePath("build.nix-everything.aarch64-linux") . "\";\n" .
|
|
||||||
" riscv64-linux = \"" . getStorePath("buildCross.nix-everything.riscv64-unknown-linux-gnu.x86_64-linux") . "\";\n" .
|
|
||||||
" x86_64-darwin = \"" . getStorePath("build.nix-everything.x86_64-darwin") . "\";\n" .
|
|
||||||
" aarch64-darwin = \"" . getStorePath("build.nix-everything.aarch64-darwin") . "\";\n" .
|
|
||||||
"}\n");
|
|
||||||
|
|
||||||
# Upload release files to S3.
|
# Upload release files to S3.
|
||||||
for my $fn (glob "$tmpDir/*") {
|
unless ($opt->skip_s3) {
|
||||||
my $name = basename($fn);
|
downloadFile("binaryTarball.i686-linux", "1");
|
||||||
next if $name eq "manual";
|
downloadFile("binaryTarball.x86_64-linux", "1");
|
||||||
my $dstKey = "$releaseDir/" . $name;
|
downloadFile("binaryTarball.aarch64-linux", "1");
|
||||||
unless (defined $releasesBucket->head_key($dstKey)) {
|
downloadFile("binaryTarball.x86_64-darwin", "1");
|
||||||
print STDERR "uploading $fn to s3://$releasesBucketName/$dstKey...\n";
|
downloadFile("binaryTarball.aarch64-darwin", "1");
|
||||||
|
eval {
|
||||||
|
downloadFile("binaryTarballCross.x86_64-linux.armv6l-unknown-linux-gnueabihf", "1");
|
||||||
|
};
|
||||||
|
warn "$@" if $@;
|
||||||
|
eval {
|
||||||
|
downloadFile("binaryTarballCross.x86_64-linux.armv7l-unknown-linux-gnueabihf", "1");
|
||||||
|
};
|
||||||
|
warn "$@" if $@;
|
||||||
|
eval {
|
||||||
|
downloadFile("binaryTarballCross.x86_64-linux.riscv64-unknown-linux-gnu", "1");
|
||||||
|
};
|
||||||
|
warn "$@" if $@;
|
||||||
|
downloadFile("installerScript", "1");
|
||||||
|
|
||||||
my $configuration = ();
|
# Upload nix-fallback-paths.nix.
|
||||||
$configuration->{content_type} = "application/octet-stream";
|
write_file("$tmpDir/fallback-paths.nix",
|
||||||
|
"{\n" .
|
||||||
|
" x86_64-linux = \"" . getStorePath("build.nix-everything.x86_64-linux") . "\";\n" .
|
||||||
|
" i686-linux = \"" . getStorePath("build.nix-everything.i686-linux") . "\";\n" .
|
||||||
|
" aarch64-linux = \"" . getStorePath("build.nix-everything.aarch64-linux") . "\";\n" .
|
||||||
|
" riscv64-linux = \"" . getStorePath("buildCross.nix-everything.riscv64-unknown-linux-gnu.x86_64-linux") . "\";\n" .
|
||||||
|
" x86_64-darwin = \"" . getStorePath("build.nix-everything.x86_64-darwin") . "\";\n" .
|
||||||
|
" aarch64-darwin = \"" . getStorePath("build.nix-everything.aarch64-darwin") . "\";\n" .
|
||||||
|
"}\n");
|
||||||
|
|
||||||
if ($fn =~ /.sha256|install|\.nix$/) {
|
for my $fn (glob "$tmpDir/*") {
|
||||||
$configuration->{content_type} = "text/plain";
|
my $name = basename($fn);
|
||||||
|
next if $name eq "manual";
|
||||||
|
my $dstKey = "$releaseDir/" . $name;
|
||||||
|
unless (defined $releasesBucket->head_key($dstKey)) {
|
||||||
|
print STDERR "uploading $fn to s3://$releasesBucketName/$dstKey...\n";
|
||||||
|
|
||||||
|
my $configuration = ();
|
||||||
|
$configuration->{content_type} = "application/octet-stream";
|
||||||
|
|
||||||
|
if ($fn =~ /.sha256|install|\.nix$/) {
|
||||||
|
$configuration->{content_type} = "text/plain";
|
||||||
|
}
|
||||||
|
|
||||||
|
$releasesBucket->add_key_filename($dstKey, $fn, $configuration)
|
||||||
|
or die $releasesBucket->err . ": " . $releasesBucket->errstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
$releasesBucket->add_key_filename($dstKey, $fn, $configuration)
|
|
||||||
or die $releasesBucket->err . ": " . $releasesBucket->errstr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Update the "latest" symlink.
|
||||||
|
$channelsBucket->add_key(
|
||||||
|
"nix-latest/install", "",
|
||||||
|
{ "x-amz-website-redirect-location" => "https://releases.nixos.org/$releaseDir/install" })
|
||||||
|
or die $channelsBucket->err . ": " . $channelsBucket->errstr
|
||||||
|
if $isLatest;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update the "latest" symlink.
|
|
||||||
$channelsBucket->add_key(
|
|
||||||
"nix-latest/install", "",
|
|
||||||
{ "x-amz-website-redirect-location" => "https://releases.nixos.org/$releaseDir/install" })
|
|
||||||
or die $channelsBucket->err . ": " . $channelsBucket->errstr
|
|
||||||
if $isLatest;
|
|
||||||
|
|
||||||
# Tag the release in Git.
|
# Tag the release in Git.
|
||||||
chdir("/home/eelco/Dev/nix-pristine") or die;
|
unless ($opt->skip_git) {
|
||||||
system("git remote update origin") == 0 or die;
|
chdir($opt->project_root) or die "Cannot chdir to " . $opt->project_root . ": $!";
|
||||||
system("git tag --force --sign $version $nixRev -m 'Tagging release $version'") == 0 or die;
|
system("git remote update origin") == 0 or die;
|
||||||
system("git push --tags") == 0 or die;
|
system("git tag --force --sign $version $nixRev -m 'Tagging release $version'") == 0 or die;
|
||||||
system("git push --force-with-lease origin $nixRev:refs/heads/latest-release") == 0 or die if $isLatest;
|
system("git push origin refs/tags/$version") == 0 or die;
|
||||||
|
system("git push --force-with-lease origin $nixRev:refs/heads/latest-release") == 0 or die if $isLatest;
|
||||||
|
}
|
||||||
|
|
||||||
File::Path::remove_tree($narCache, {safe => 1});
|
File::Path::remove_tree($narCache, {safe => 1});
|
||||||
File::Path::remove_tree($tmpDir, {safe => 1});
|
File::Path::remove_tree($tmpDir, {safe => 1});
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# shellcheck disable=all
|
|
||||||
#compdef nix
|
#compdef nix
|
||||||
|
# shellcheck disable=all
|
||||||
|
|
||||||
function _nix() {
|
function _nix() {
|
||||||
local ifs_bk="$IFS"
|
local ifs_bk="$IFS"
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
can_wrap_assert_fail_test_code = '''
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void * __real___assert_fail(const char *, const char *, unsigned int, const char *);
|
||||||
|
|
||||||
|
extern "C" void *
|
||||||
|
__wrap___assert_fail(const char *, const char *, unsigned int, const char *)
|
||||||
|
{
|
||||||
|
return __real___assert_fail(nullptr, nullptr, 0, nullptr);
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
|
||||||
|
wrap_assert_fail_args = [ '-Wl,--wrap=__assert_fail' ]
|
||||||
|
|
||||||
|
can_wrap_assert_fail = cxx.links(
|
||||||
|
can_wrap_assert_fail_test_code,
|
||||||
|
args : wrap_assert_fail_args,
|
||||||
|
name : 'linker can wrap __assert_fail',
|
||||||
|
)
|
||||||
|
|
||||||
|
if can_wrap_assert_fail
|
||||||
|
deps_other += declare_dependency(
|
||||||
|
sources : 'wrap-assert-fail.cc',
|
||||||
|
link_args : wrap_assert_fail_args,
|
||||||
|
)
|
||||||
|
endif
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#include "nix/util/error.hh"
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cinttypes>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
extern "C" [[noreturn]] void __attribute__((weak))
|
||||||
|
__wrap___assert_fail(const char * assertion, const char * file, unsigned int line, const char * function)
|
||||||
|
{
|
||||||
|
char buf[512];
|
||||||
|
int n =
|
||||||
|
snprintf(buf, sizeof(buf), "Assertion '%s' failed in %s at %s:%" PRIuLEAST32, assertion, function, file, line);
|
||||||
|
if (n < 0)
|
||||||
|
nix::panic("Assertion failed and could not format error message");
|
||||||
|
nix::panic(std::string_view(buf, std::min(static_cast<int>(sizeof(buf)), n)));
|
||||||
|
}
|
||||||
@@ -42,5 +42,27 @@ if cxx.get_id() == 'clang'
|
|||||||
add_project_arguments('-fpch-instantiate-templates', language : 'cpp')
|
add_project_arguments('-fpch-instantiate-templates', language : 'cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Darwin ld doesn't like "X.Y.Zpre"
|
# Detect if we're using libstdc++ (GCC's standard library)
|
||||||
nix_soversion = meson.project_version().split('pre')[0]
|
# libstdc++ uses Intel TBB as backend for C++17 parallel algorithms when <execution> is included.
|
||||||
|
# boost::concurrent_flat_map includes <execution>, which would require linking against TBB.
|
||||||
|
# Since we don't actually use parallel algorithms, disable the TBB backend to avoid the dependency.
|
||||||
|
# TBB is a dependency of blake3 and leaking into our build environment.
|
||||||
|
is_using_libstdcxx = cxx.compiles(
|
||||||
|
'''
|
||||||
|
#include <ciso646>
|
||||||
|
#ifndef __GLIBCXX__
|
||||||
|
#error "not libstdc++"
|
||||||
|
#endif
|
||||||
|
int main() { return 0; }
|
||||||
|
''',
|
||||||
|
name : 'using libstdc++',
|
||||||
|
)
|
||||||
|
|
||||||
|
if is_using_libstdcxx
|
||||||
|
add_project_arguments('-D_GLIBCXX_USE_TBB_PAR_BACKEND=0', language : 'cpp')
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Darwin ld doesn't like "X.Y.ZpreABCD+W"
|
||||||
|
nix_soversion = meson.project_version().split('+')[0].split('pre')[0]
|
||||||
|
|
||||||
|
subdir('assert-fail')
|
||||||
+15
-10
@@ -54,18 +54,23 @@ scope: {
|
|||||||
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ pkgs.buildPackages.bmake ];
|
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ pkgs.buildPackages.bmake ];
|
||||||
postInstall =
|
postInstall =
|
||||||
lib.replaceStrings [ "lowdown.so.1" "lowdown.1.dylib" ] [ "lowdown.so.2" "lowdown.2.dylib" ]
|
lib.replaceStrings [ "lowdown.so.1" "lowdown.1.dylib" ] [ "lowdown.so.2" "lowdown.2.dylib" ]
|
||||||
prevAttrs.postInstall;
|
(prevAttrs.postInstall or "");
|
||||||
});
|
});
|
||||||
|
|
||||||
toml11 = pkgs.toml11.overrideAttrs rec {
|
# TODO: Remove this when https://github.com/NixOS/nixpkgs/pull/442682 is included in a stable release
|
||||||
version = "4.4.0";
|
toml11 =
|
||||||
src = pkgs.fetchFromGitHub {
|
if lib.versionAtLeast pkgs.toml11.version "4.4.0" then
|
||||||
owner = "ToruNiina";
|
pkgs.toml11
|
||||||
repo = "toml11";
|
else
|
||||||
tag = "v${version}";
|
pkgs.toml11.overrideAttrs rec {
|
||||||
hash = "sha256-sgWKYxNT22nw376ttGsTdg0AMzOwp8QH3E8mx0BZJTQ=";
|
version = "4.4.0";
|
||||||
};
|
src = pkgs.fetchFromGitHub {
|
||||||
};
|
owner = "ToruNiina";
|
||||||
|
repo = "toml11";
|
||||||
|
tag = "v${version}";
|
||||||
|
hash = "sha256-sgWKYxNT22nw376ttGsTdg0AMzOwp8QH3E8mx0BZJTQ=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
|
# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
|
||||||
boost =
|
boost =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#include "nix/cmd/command.hh"
|
#include "nix/cmd/command.hh"
|
||||||
|
#include "nix/cmd/legacy.hh"
|
||||||
#include "nix/cmd/markdown.hh"
|
#include "nix/cmd/markdown.hh"
|
||||||
#include "nix/store/store-open.hh"
|
#include "nix/store/store-open.hh"
|
||||||
#include "nix/store/local-fs-store.hh"
|
#include "nix/store/local-fs-store.hh"
|
||||||
@@ -14,6 +15,18 @@
|
|||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
RegisterCommand::Commands & RegisterCommand::commands()
|
||||||
|
{
|
||||||
|
static RegisterCommand::Commands commands;
|
||||||
|
return commands;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegisterLegacyCommand::Commands & RegisterLegacyCommand::commands()
|
||||||
|
{
|
||||||
|
static RegisterLegacyCommand::Commands commands;
|
||||||
|
return commands;
|
||||||
|
}
|
||||||
|
|
||||||
nix::Commands RegisterCommand::getCommandsFor(const std::vector<std::string> & prefix)
|
nix::Commands RegisterCommand::getCommandsFor(const std::vector<std::string> & prefix)
|
||||||
{
|
{
|
||||||
nix::Commands res;
|
nix::Commands res;
|
||||||
|
|||||||
@@ -286,11 +286,7 @@ struct RegisterCommand
|
|||||||
{
|
{
|
||||||
typedef std::map<std::vector<std::string>, std::function<ref<Command>()>> Commands;
|
typedef std::map<std::vector<std::string>, std::function<ref<Command>()>> Commands;
|
||||||
|
|
||||||
static Commands & commands()
|
static Commands & commands();
|
||||||
{
|
|
||||||
static Commands commands;
|
|
||||||
return commands;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegisterCommand(std::vector<std::string> && name, std::function<ref<Command>()> command)
|
RegisterCommand(std::vector<std::string> && name, std::function<ref<Command>()> command)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,11 +13,7 @@ struct RegisterLegacyCommand
|
|||||||
{
|
{
|
||||||
typedef std::map<std::string, MainFunction> Commands;
|
typedef std::map<std::string, MainFunction> Commands;
|
||||||
|
|
||||||
static Commands & commands()
|
static Commands & commands();
|
||||||
{
|
|
||||||
static Commands commands;
|
|
||||||
return commands;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegisterLegacyCommand(const std::string & name, MainFunction fun)
|
RegisterLegacyCommand(const std::string & name, MainFunction fun)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "nix/expr/symbol-table.hh"
|
#include "nix/expr/symbol-table.hh"
|
||||||
|
|
||||||
#include <boost/container/static_vector.hpp>
|
#include <boost/container/static_vector.hpp>
|
||||||
|
#include <boost/iterator/function_output_iterator.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -463,12 +464,48 @@ private:
|
|||||||
return bindings->baseLayer;
|
return bindings->baseLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the bindings gets "layered" on top of another we need to recalculate
|
||||||
|
* the number of unique attributes in the chain.
|
||||||
|
*
|
||||||
|
* This is done by either iterating over the base "layer" and the newly added
|
||||||
|
* attributes and counting duplicates. If the base "layer" is big this approach
|
||||||
|
* is inefficient and we fall back to doing per-element binary search in the base
|
||||||
|
* "layer".
|
||||||
|
*/
|
||||||
void finishSizeIfNecessary()
|
void finishSizeIfNecessary()
|
||||||
{
|
{
|
||||||
if (hasBaseLayer())
|
if (!hasBaseLayer())
|
||||||
/* NOTE: Do not use std::ranges::distance, since Bindings is a sized
|
return;
|
||||||
range, but we are calculating this size here. */
|
|
||||||
bindings->numAttrsInChain = std::distance(bindings->begin(), bindings->end());
|
auto & base = *bindings->baseLayer;
|
||||||
|
auto attrs = std::span(bindings->attrs, bindings->numAttrs);
|
||||||
|
|
||||||
|
Bindings::size_type duplicates = 0;
|
||||||
|
|
||||||
|
/* If the base bindings is smaller than the newly added attributes
|
||||||
|
iterate using std::set_intersection to run in O(|base| + |attrs|) =
|
||||||
|
O(|attrs|). Otherwise use an O(|attrs| * log(|base|)) per-attr binary
|
||||||
|
search to check for duplicates. Note that if we are in this code path then
|
||||||
|
|attrs| <= bindingsUpdateLayerRhsSizeThreshold, which 16 by default. We are
|
||||||
|
optimizing for the case when a small attribute set gets "layered" on top of
|
||||||
|
a much larger one. When attrsets are already small it's fine to do a linear
|
||||||
|
scan, but we should avoid expensive iterations over large "base" attrsets. */
|
||||||
|
if (attrs.size() > base.size()) {
|
||||||
|
std::set_intersection(
|
||||||
|
base.begin(),
|
||||||
|
base.end(),
|
||||||
|
attrs.begin(),
|
||||||
|
attrs.end(),
|
||||||
|
boost::make_function_output_iterator([&]([[maybe_unused]] auto && _) { ++duplicates; }));
|
||||||
|
} else {
|
||||||
|
for (const auto & attr : attrs) {
|
||||||
|
if (base.get(attr.name))
|
||||||
|
++duplicates;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bindings->numAttrsInChain = base.numAttrsInChain + attrs.size() - duplicates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -185,28 +185,13 @@ struct ExprFloat : Expr
|
|||||||
|
|
||||||
struct ExprString : Expr
|
struct ExprString : Expr
|
||||||
{
|
{
|
||||||
|
std::string s;
|
||||||
Value v;
|
Value v;
|
||||||
|
|
||||||
/**
|
ExprString(std::string && s)
|
||||||
* This is only for strings already allocated in our polymorphic allocator,
|
: s(std::move(s))
|
||||||
* or that live at least that long (e.g. c++ string literals)
|
|
||||||
*/
|
|
||||||
ExprString(const char * s)
|
|
||||||
{
|
{
|
||||||
v.mkStringNoCopy(s);
|
v.mkStringNoCopy(this->s.data());
|
||||||
};
|
|
||||||
|
|
||||||
ExprString(std::pmr::polymorphic_allocator<char> & alloc, std::string_view sv)
|
|
||||||
{
|
|
||||||
auto len = sv.length();
|
|
||||||
if (len == 0) {
|
|
||||||
v.mkStringNoCopy("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
char * s = alloc.allocate(len + 1);
|
|
||||||
sv.copy(s, len);
|
|
||||||
s[len] = '\0';
|
|
||||||
v.mkStringNoCopy(s);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Value * maybeThunk(EvalState & state, Env & env) override;
|
Value * maybeThunk(EvalState & state, Env & env) override;
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ ParserState::stripIndentation(const PosIdx pos, std::vector<std::pair<PosIdx, st
|
|||||||
|
|
||||||
// Ignore empty strings for a minor optimisation and AST simplification
|
// Ignore empty strings for a minor optimisation and AST simplification
|
||||||
if (s2 != "") {
|
if (s2 != "") {
|
||||||
es2->emplace_back(i->first, new ExprString(alloc, s2));
|
es2->emplace_back(i->first, new ExprString(std::move(s2)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (; i != es.end(); ++i, --n) {
|
for (; i != es.end(); ++i, --n) {
|
||||||
|
|||||||
@@ -12,11 +12,7 @@ struct RegisterPrimOp
|
|||||||
{
|
{
|
||||||
typedef std::vector<PrimOp> PrimOps;
|
typedef std::vector<PrimOp> PrimOps;
|
||||||
|
|
||||||
static PrimOps & primOps()
|
static PrimOps & primOps();
|
||||||
{
|
|
||||||
static PrimOps primOps;
|
|
||||||
return primOps;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You can register a constant by passing an arity of 0. fun
|
* You can register a constant by passing an arity of 0. fun
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ struct PrintOptions
|
|||||||
* `PrintOptions` for unknown and therefore potentially large values in error messages,
|
* `PrintOptions` for unknown and therefore potentially large values in error messages,
|
||||||
* to avoid printing "too much" output.
|
* to avoid printing "too much" output.
|
||||||
*/
|
*/
|
||||||
static PrintOptions errorPrintOptions = PrintOptions{
|
static constexpr PrintOptions errorPrintOptions = PrintOptions{
|
||||||
.ansiColors = true,
|
.ansiColors = true,
|
||||||
.maxDepth = 10,
|
.maxDepth = 10,
|
||||||
.maxAttrs = 10,
|
.maxAttrs = 10,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ void ExprFloat::show(const SymbolTable & symbols, std::ostream & str) const
|
|||||||
|
|
||||||
void ExprString::show(const SymbolTable & symbols, std::ostream & str) const
|
void ExprString::show(const SymbolTable & symbols, std::ostream & str) const
|
||||||
{
|
{
|
||||||
printLiteralString(str, v.string_view());
|
printLiteralString(str, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExprPath::show(const SymbolTable & symbols, std::ostream & str) const
|
void ExprPath::show(const SymbolTable & symbols, std::ostream & str) const
|
||||||
|
|||||||
+32
-39
@@ -136,7 +136,6 @@ static Expr * makeCall(PosIdx pos, Expr * fn, Expr * arg) {
|
|||||||
std::vector<nix::AttrName> * attrNames;
|
std::vector<nix::AttrName> * attrNames;
|
||||||
std::vector<std::pair<nix::AttrName, nix::PosIdx>> * inheritAttrs;
|
std::vector<std::pair<nix::AttrName, nix::PosIdx>> * inheritAttrs;
|
||||||
std::vector<std::pair<nix::PosIdx, nix::Expr *>> * string_parts;
|
std::vector<std::pair<nix::PosIdx, nix::Expr *>> * string_parts;
|
||||||
std::variant<nix::Expr *, std::string_view> * to_be_string;
|
|
||||||
std::vector<std::pair<nix::PosIdx, std::variant<nix::Expr *, nix::StringToken>>> * ind_string_parts;
|
std::vector<std::pair<nix::PosIdx, std::variant<nix::Expr *, nix::StringToken>>> * ind_string_parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,8 +150,7 @@ static Expr * makeCall(PosIdx pos, Expr * fn, Expr * arg) {
|
|||||||
%type <inheritAttrs> attrs
|
%type <inheritAttrs> attrs
|
||||||
%type <string_parts> string_parts_interpolated
|
%type <string_parts> string_parts_interpolated
|
||||||
%type <ind_string_parts> ind_string_parts
|
%type <ind_string_parts> ind_string_parts
|
||||||
%type <e> path_start
|
%type <e> path_start string_parts string_attr
|
||||||
%type <to_be_string> string_parts string_attr
|
|
||||||
%type <id> attr
|
%type <id> attr
|
||||||
%token <id> ID
|
%token <id> ID
|
||||||
%token <str> STR IND_STR
|
%token <str> STR IND_STR
|
||||||
@@ -307,13 +305,7 @@ expr_simple
|
|||||||
}
|
}
|
||||||
| INT_LIT { $$ = new ExprInt($1); }
|
| INT_LIT { $$ = new ExprInt($1); }
|
||||||
| FLOAT_LIT { $$ = new ExprFloat($1); }
|
| FLOAT_LIT { $$ = new ExprFloat($1); }
|
||||||
| '"' string_parts '"' {
|
| '"' string_parts '"' { $$ = $2; }
|
||||||
std::visit(overloaded{
|
|
||||||
[&](std::string_view str) { $$ = new ExprString(state->alloc, str); },
|
|
||||||
[&](Expr * expr) { $$ = expr; }},
|
|
||||||
*$2);
|
|
||||||
delete $2;
|
|
||||||
}
|
|
||||||
| IND_STRING_OPEN ind_string_parts IND_STRING_CLOSE {
|
| IND_STRING_OPEN ind_string_parts IND_STRING_CLOSE {
|
||||||
$$ = state->stripIndentation(CUR_POS, std::move(*$2));
|
$$ = state->stripIndentation(CUR_POS, std::move(*$2));
|
||||||
delete $2;
|
delete $2;
|
||||||
@@ -324,11 +316,11 @@ expr_simple
|
|||||||
$$ = new ExprConcatStrings(CUR_POS, false, $2);
|
$$ = new ExprConcatStrings(CUR_POS, false, $2);
|
||||||
}
|
}
|
||||||
| SPATH {
|
| SPATH {
|
||||||
std::string_view path($1.p + 1, $1.l - 2);
|
std::string path($1.p + 1, $1.l - 2);
|
||||||
$$ = new ExprCall(CUR_POS,
|
$$ = new ExprCall(CUR_POS,
|
||||||
new ExprVar(state->s.findFile),
|
new ExprVar(state->s.findFile),
|
||||||
{new ExprVar(state->s.nixPath),
|
{new ExprVar(state->s.nixPath),
|
||||||
new ExprString(state->alloc, path)});
|
new ExprString(std::move(path))});
|
||||||
}
|
}
|
||||||
| URI {
|
| URI {
|
||||||
static bool noURLLiterals = experimentalFeatureSettings.isEnabled(Xp::NoUrlLiterals);
|
static bool noURLLiterals = experimentalFeatureSettings.isEnabled(Xp::NoUrlLiterals);
|
||||||
@@ -337,7 +329,7 @@ expr_simple
|
|||||||
.msg = HintFmt("URL literals are disabled"),
|
.msg = HintFmt("URL literals are disabled"),
|
||||||
.pos = state->positions[CUR_POS]
|
.pos = state->positions[CUR_POS]
|
||||||
});
|
});
|
||||||
$$ = new ExprString(state->alloc, $1);
|
$$ = new ExprString(std::string($1));
|
||||||
}
|
}
|
||||||
| '(' expr ')' { $$ = $2; }
|
| '(' expr ')' { $$ = $2; }
|
||||||
/* Let expressions `let {..., body = ...}' are just desugared
|
/* Let expressions `let {..., body = ...}' are just desugared
|
||||||
@@ -354,19 +346,19 @@ expr_simple
|
|||||||
;
|
;
|
||||||
|
|
||||||
string_parts
|
string_parts
|
||||||
: STR { $$ = new std::variant<Expr *, std::string_view>($1); }
|
: STR { $$ = new ExprString(std::string($1)); }
|
||||||
| string_parts_interpolated { $$ = new std::variant<Expr *, std::string_view>(new ExprConcatStrings(CUR_POS, true, $1)); }
|
| string_parts_interpolated { $$ = new ExprConcatStrings(CUR_POS, true, $1); }
|
||||||
| { $$ = new std::variant<Expr *, std::string_view>(std::string_view()); }
|
| { $$ = new ExprString(""); }
|
||||||
;
|
;
|
||||||
|
|
||||||
string_parts_interpolated
|
string_parts_interpolated
|
||||||
: string_parts_interpolated STR
|
: string_parts_interpolated STR
|
||||||
{ $$ = $1; $1->emplace_back(state->at(@2), new ExprString(state->alloc, $2)); }
|
{ $$ = $1; $1->emplace_back(state->at(@2), new ExprString(std::string($2))); }
|
||||||
| string_parts_interpolated DOLLAR_CURLY expr '}' { $$ = $1; $1->emplace_back(state->at(@2), $3); }
|
| string_parts_interpolated DOLLAR_CURLY expr '}' { $$ = $1; $1->emplace_back(state->at(@2), $3); }
|
||||||
| DOLLAR_CURLY expr '}' { $$ = new std::vector<std::pair<PosIdx, Expr *>>; $$->emplace_back(state->at(@1), $2); }
|
| DOLLAR_CURLY expr '}' { $$ = new std::vector<std::pair<PosIdx, Expr *>>; $$->emplace_back(state->at(@1), $2); }
|
||||||
| STR DOLLAR_CURLY expr '}' {
|
| STR DOLLAR_CURLY expr '}' {
|
||||||
$$ = new std::vector<std::pair<PosIdx, Expr *>>;
|
$$ = new std::vector<std::pair<PosIdx, Expr *>>;
|
||||||
$$->emplace_back(state->at(@1), new ExprString(state->alloc, $1));
|
$$->emplace_back(state->at(@1), new ExprString(std::string($1)));
|
||||||
$$->emplace_back(state->at(@2), $3);
|
$$->emplace_back(state->at(@2), $3);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@@ -464,16 +456,15 @@ attrs
|
|||||||
: attrs attr { $$ = $1; $1->emplace_back(AttrName(state->symbols.create($2)), state->at(@2)); }
|
: attrs attr { $$ = $1; $1->emplace_back(AttrName(state->symbols.create($2)), state->at(@2)); }
|
||||||
| attrs string_attr
|
| attrs string_attr
|
||||||
{ $$ = $1;
|
{ $$ = $1;
|
||||||
std::visit(overloaded {
|
ExprString * str = dynamic_cast<ExprString *>($2);
|
||||||
[&](std::string_view str) { $$->emplace_back(AttrName(state->symbols.create(str)), state->at(@2)); },
|
if (str) {
|
||||||
[&](Expr * expr) {
|
$$->emplace_back(AttrName(state->symbols.create(str->s)), state->at(@2));
|
||||||
throw ParseError({
|
delete str;
|
||||||
.msg = HintFmt("dynamic attributes not allowed in inherit"),
|
} else
|
||||||
.pos = state->positions[state->at(@2)]
|
throw ParseError({
|
||||||
});
|
.msg = HintFmt("dynamic attributes not allowed in inherit"),
|
||||||
}
|
.pos = state->positions[state->at(@2)]
|
||||||
}, *$2);
|
});
|
||||||
delete $2;
|
|
||||||
}
|
}
|
||||||
| { $$ = new std::vector<std::pair<AttrName, PosIdx>>; }
|
| { $$ = new std::vector<std::pair<AttrName, PosIdx>>; }
|
||||||
;
|
;
|
||||||
@@ -482,20 +473,22 @@ attrpath
|
|||||||
: attrpath '.' attr { $$ = $1; $1->push_back(AttrName(state->symbols.create($3))); }
|
: attrpath '.' attr { $$ = $1; $1->push_back(AttrName(state->symbols.create($3))); }
|
||||||
| attrpath '.' string_attr
|
| attrpath '.' string_attr
|
||||||
{ $$ = $1;
|
{ $$ = $1;
|
||||||
std::visit(overloaded {
|
ExprString * str = dynamic_cast<ExprString *>($3);
|
||||||
[&](std::string_view str) { $$->push_back(AttrName(state->symbols.create(str))); },
|
if (str) {
|
||||||
[&](Expr * expr) { $$->push_back(AttrName(expr)); }
|
$$->push_back(AttrName(state->symbols.create(str->s)));
|
||||||
}, *$3);
|
delete str;
|
||||||
delete $3;
|
} else
|
||||||
|
$$->push_back(AttrName($3));
|
||||||
}
|
}
|
||||||
| attr { $$ = new std::vector<AttrName>; $$->push_back(AttrName(state->symbols.create($1))); }
|
| attr { $$ = new std::vector<AttrName>; $$->push_back(AttrName(state->symbols.create($1))); }
|
||||||
| string_attr
|
| string_attr
|
||||||
{ $$ = new std::vector<AttrName>;
|
{ $$ = new std::vector<AttrName>;
|
||||||
std::visit(overloaded {
|
ExprString *str = dynamic_cast<ExprString *>($1);
|
||||||
[&](std::string_view str) { $$->push_back(AttrName(state->symbols.create(str))); },
|
if (str) {
|
||||||
[&](Expr * expr) { $$->push_back(AttrName(expr)); }
|
$$->push_back(AttrName(state->symbols.create(str->s)));
|
||||||
}, *$1);
|
delete str;
|
||||||
delete $1;
|
} else
|
||||||
|
$$->push_back(AttrName($1));
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -506,7 +499,7 @@ attr
|
|||||||
|
|
||||||
string_attr
|
string_attr
|
||||||
: '"' string_parts '"' { $$ = $2; }
|
: '"' string_parts '"' { $$ = $2; }
|
||||||
| DOLLAR_CURLY expr '}' { $$ = new std::variant<Expr *, std::string_view>($2); }
|
| DOLLAR_CURLY expr '}' { $$ = $2; }
|
||||||
;
|
;
|
||||||
|
|
||||||
expr_list
|
expr_list
|
||||||
|
|||||||
+13
-2
@@ -39,6 +39,12 @@
|
|||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
RegisterPrimOp::PrimOps & RegisterPrimOp::primOps()
|
||||||
|
{
|
||||||
|
static RegisterPrimOp::PrimOps primOps;
|
||||||
|
return primOps;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
* Miscellaneous
|
* Miscellaneous
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
@@ -1973,8 +1979,13 @@ static void prim_dirOf(EvalState & state, const PosIdx pos, Value ** args, Value
|
|||||||
NixStringContext context;
|
NixStringContext context;
|
||||||
auto path = state.coerceToString(
|
auto path = state.coerceToString(
|
||||||
pos, *args[0], context, "while evaluating the first argument passed to 'builtins.dirOf'", false, false);
|
pos, *args[0], context, "while evaluating the first argument passed to 'builtins.dirOf'", false, false);
|
||||||
auto dir = dirOf(*path);
|
auto pos = path->rfind('/');
|
||||||
v.mkString(dir, context);
|
if (pos == path->npos)
|
||||||
|
v.mkStringMove(".", context);
|
||||||
|
else if (pos == 0)
|
||||||
|
v.mkStringMove("/", context);
|
||||||
|
else
|
||||||
|
v.mkString(path->substr(0, pos), context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,6 +175,12 @@ TEST_F(GitUtilsTest, peel_reference)
|
|||||||
|
|
||||||
TEST(GitUtils, isLegalRefName)
|
TEST(GitUtils, isLegalRefName)
|
||||||
{
|
{
|
||||||
|
ASSERT_TRUE(isLegalRefName("A/b"));
|
||||||
|
ASSERT_TRUE(isLegalRefName("AaA/b"));
|
||||||
|
ASSERT_TRUE(isLegalRefName("FOO/BAR/BAZ"));
|
||||||
|
ASSERT_TRUE(isLegalRefName("HEAD"));
|
||||||
|
ASSERT_TRUE(isLegalRefName("refs/tags/1.2.3"));
|
||||||
|
ASSERT_TRUE(isLegalRefName("refs/heads/master"));
|
||||||
ASSERT_TRUE(isLegalRefName("foox"));
|
ASSERT_TRUE(isLegalRefName("foox"));
|
||||||
ASSERT_TRUE(isLegalRefName("1337"));
|
ASSERT_TRUE(isLegalRefName("1337"));
|
||||||
ASSERT_TRUE(isLegalRefName("foo.baz"));
|
ASSERT_TRUE(isLegalRefName("foo.baz"));
|
||||||
|
|||||||
@@ -237,6 +237,9 @@ void Input::checkLocks(Input specified, Input & result)
|
|||||||
if (auto prevNarHash = specified.getNarHash())
|
if (auto prevNarHash = specified.getNarHash())
|
||||||
specified.attrs.insert_or_assign("narHash", prevNarHash->to_string(HashFormat::SRI, true));
|
specified.attrs.insert_or_assign("narHash", prevNarHash->to_string(HashFormat::SRI, true));
|
||||||
|
|
||||||
|
if (auto narHash = result.getNarHash())
|
||||||
|
result.attrs.insert_or_assign("narHash", narHash->to_string(HashFormat::SRI, true));
|
||||||
|
|
||||||
for (auto & field : specified.attrs) {
|
for (auto & field : specified.attrs) {
|
||||||
auto field2 = result.attrs.find(field.first);
|
auto field2 = result.attrs.find(field.first);
|
||||||
if (field2 != result.attrs.end() && field.second != field2->second)
|
if (field2 != result.attrs.end() && field.second != field2->second)
|
||||||
@@ -332,8 +335,7 @@ std::pair<ref<SourceAccessor>, Input> Input::getAccessorUnchecked(ref<Store> sto
|
|||||||
|
|
||||||
debug("using substituted/cached input '%s' in '%s'", to_string(), store->printStorePath(storePath));
|
debug("using substituted/cached input '%s' in '%s'", to_string(), store->printStorePath(storePath));
|
||||||
|
|
||||||
// We just ensured the store object was there
|
auto accessor = store->requireStoreObjectAccessor(storePath);
|
||||||
auto accessor = ref{store->getFSAccessor(storePath)};
|
|
||||||
|
|
||||||
accessor->fingerprint = getFingerprint(store);
|
accessor->fingerprint = getFingerprint(store);
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <git2/attr.h>
|
#include <git2/attr.h>
|
||||||
#include <git2/blob.h>
|
#include <git2/blob.h>
|
||||||
|
#include <git2/branch.h>
|
||||||
#include <git2/commit.h>
|
#include <git2/commit.h>
|
||||||
#include <git2/config.h>
|
#include <git2/config.h>
|
||||||
#include <git2/describe.h>
|
#include <git2/describe.h>
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
#include <git2/submodule.h>
|
#include <git2/submodule.h>
|
||||||
#include <git2/sys/odb_backend.h>
|
#include <git2/sys/odb_backend.h>
|
||||||
#include <git2/sys/mempack.h>
|
#include <git2/sys/mempack.h>
|
||||||
|
#include <git2/tag.h>
|
||||||
#include <git2/tree.h>
|
#include <git2/tree.h>
|
||||||
|
|
||||||
#include <boost/unordered/unordered_flat_map.hpp>
|
#include <boost/unordered/unordered_flat_map.hpp>
|
||||||
@@ -1323,63 +1325,33 @@ GitRepo::WorkdirInfo GitRepo::getCachedWorkdirInfo(const std::filesystem::path &
|
|||||||
return workdirInfo;
|
return workdirInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that the git reference is valid and normalizes slash '/' sequences.
|
|
||||||
*
|
|
||||||
* Accepts shorthand references (one-level refnames are allowed).
|
|
||||||
*/
|
|
||||||
bool isValidRefNameAllowNormalizations(const std::string & refName)
|
|
||||||
{
|
|
||||||
/* Unfortunately libgit2 doesn't expose the limit in headers, but its internal
|
|
||||||
limit is also 1024. */
|
|
||||||
std::array<char, 1024> normalizedRefBuffer;
|
|
||||||
|
|
||||||
/* It would be nice to have a better API like git_reference_name_is_valid, but
|
|
||||||
* with GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND flag. libgit2 uses it internally
|
|
||||||
* but doesn't expose it in public headers [1].
|
|
||||||
* [1]:
|
|
||||||
* https://github.com/libgit2/libgit2/blob/9d5f1bacc23594c2ba324c8f0d41b88bf0e9ef04/src/libgit2/refs.c#L1362-L1365
|
|
||||||
*/
|
|
||||||
|
|
||||||
auto res = git_reference_normalize_name(
|
|
||||||
normalizedRefBuffer.data(),
|
|
||||||
normalizedRefBuffer.size(),
|
|
||||||
refName.c_str(),
|
|
||||||
GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL | GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND);
|
|
||||||
|
|
||||||
return res == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isLegalRefName(const std::string & refName)
|
bool isLegalRefName(const std::string & refName)
|
||||||
{
|
{
|
||||||
initLibGit2();
|
initLibGit2();
|
||||||
|
|
||||||
/* Since `git_reference_normalize_name` is the best API libgit2 has for verifying
|
|
||||||
* reference names with shorthands (see comment in normalizeRefName), we need to
|
|
||||||
* ensure that exceptions to the validity checks imposed by normalization [1] are checked
|
|
||||||
* explicitly.
|
|
||||||
* [1]: https://git-scm.com/docs/git-check-ref-format#Documentation/git-check-ref-format.txt---normalize
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Check for cases that don't get rejected by libgit2.
|
/* Check for cases that don't get rejected by libgit2.
|
||||||
* FIXME: libgit2 should reject this. */
|
* FIXME: libgit2 should reject this. */
|
||||||
if (refName == "@")
|
if (refName == "@")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Leading slashes and consecutive slashes are stripped during normalizatiton. */
|
|
||||||
if (refName.starts_with('/') || refName.find("//") != refName.npos)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Refer to libgit2. */
|
|
||||||
if (!isValidRefNameAllowNormalizations(refName))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* libgit2 doesn't barf on DEL symbol.
|
/* libgit2 doesn't barf on DEL symbol.
|
||||||
* FIXME: libgit2 should reject this. */
|
* FIXME: libgit2 should reject this. */
|
||||||
if (refName.find('\177') != refName.npos)
|
if (refName.find('\177') != refName.npos)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
for (auto * func : {
|
||||||
|
git_reference_name_is_valid,
|
||||||
|
git_branch_name_is_valid,
|
||||||
|
git_tag_name_is_valid,
|
||||||
|
}) {
|
||||||
|
int valid = 0;
|
||||||
|
if (func(&valid, refName.c_str()))
|
||||||
|
throw Error("checking git reference '%s': %s", refName, git_error_last()->message);
|
||||||
|
if (valid)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
+32
-3
@@ -164,8 +164,7 @@ struct GitInputScheme : InputScheme
|
|||||||
{
|
{
|
||||||
std::optional<Input> inputFromURL(const Settings & settings, const ParsedURL & url, bool requireTree) const override
|
std::optional<Input> inputFromURL(const Settings & settings, const ParsedURL & url, bool requireTree) const override
|
||||||
{
|
{
|
||||||
auto parsedScheme = parseUrlScheme(url.scheme);
|
if (url.scheme != "git" && parseUrlScheme(url.scheme).application != "git")
|
||||||
if (parsedScheme.application != "git")
|
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto url2(url);
|
auto url2(url);
|
||||||
@@ -496,6 +495,36 @@ struct GitInputScheme : InputScheme
|
|||||||
Git interprets them as part of the file name. So get
|
Git interprets them as part of the file name. So get
|
||||||
rid of them. */
|
rid of them. */
|
||||||
url.query.clear();
|
url.query.clear();
|
||||||
|
/* Backward compatibility hack: In old versions of Nix, if you had
|
||||||
|
a flake input like
|
||||||
|
|
||||||
|
inputs.foo.url = "git+https://foo/bar?dir=subdir";
|
||||||
|
|
||||||
|
it would result in a lock file entry like
|
||||||
|
|
||||||
|
"original": {
|
||||||
|
"dir": "subdir",
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://foo/bar?dir=subdir"
|
||||||
|
}
|
||||||
|
|
||||||
|
New versions of Nix remove `?dir=subdir` from the `url` field,
|
||||||
|
since the subdirectory is intended for `FlakeRef`, not the
|
||||||
|
fetcher (and specifically the remote server), that is, the
|
||||||
|
flakeref is parsed into
|
||||||
|
|
||||||
|
"original": {
|
||||||
|
"dir": "subdir",
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://foo/bar"
|
||||||
|
}
|
||||||
|
|
||||||
|
However, new versions of nix parsing old flake.lock files would pass the dir=
|
||||||
|
query parameter in the "url" attribute to git, which will then complain.
|
||||||
|
|
||||||
|
For this reason, we are filtering the `dir` query parameter from the URL
|
||||||
|
before passing it to git. */
|
||||||
|
url.query.erase("dir");
|
||||||
repoInfo.location = url;
|
repoInfo.location = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,7 +682,7 @@ struct GitInputScheme : InputScheme
|
|||||||
auto fetchRef = getAllRefsAttr(input) ? "refs/*:refs/*"
|
auto fetchRef = getAllRefsAttr(input) ? "refs/*:refs/*"
|
||||||
: input.getRev() ? input.getRev()->gitRev()
|
: input.getRev() ? input.getRev()->gitRev()
|
||||||
: ref.compare(0, 5, "refs/") == 0 ? fmt("%1%:%1%", ref)
|
: ref.compare(0, 5, "refs/") == 0 ? fmt("%1%:%1%", ref)
|
||||||
: ref == "HEAD" ? ref
|
: ref == "HEAD" ? "HEAD:HEAD"
|
||||||
: fmt("%1%:%1%", "refs/heads/" + ref);
|
: fmt("%1%:%1%", "refs/heads/" + ref);
|
||||||
|
|
||||||
repo->fetch(repoUrl.to_string(), fetchRef, shallow);
|
repo->fetch(repoUrl.to_string(), fetchRef, shallow);
|
||||||
|
|||||||
@@ -399,7 +399,8 @@ struct GitHubInputScheme : GitArchiveInputScheme
|
|||||||
Headers headers = makeHeadersWithAuthTokens(*input.settings, host, input);
|
Headers headers = makeHeadersWithAuthTokens(*input.settings, host, input);
|
||||||
|
|
||||||
auto downloadResult = downloadFile(store, *input.settings, url, "source", headers);
|
auto downloadResult = downloadFile(store, *input.settings, url, "source", headers);
|
||||||
auto json = nlohmann::json::parse(store->getFSAccessor(downloadResult.storePath)->readFile(CanonPath::root));
|
auto json = nlohmann::json::parse(
|
||||||
|
store->requireStoreObjectAccessor(downloadResult.storePath)->readFile(CanonPath::root));
|
||||||
|
|
||||||
return RefInfo{
|
return RefInfo{
|
||||||
.rev = Hash::parseAny(std::string{json["sha"]}, HashAlgorithm::SHA1),
|
.rev = Hash::parseAny(std::string{json["sha"]}, HashAlgorithm::SHA1),
|
||||||
@@ -473,7 +474,8 @@ struct GitLabInputScheme : GitArchiveInputScheme
|
|||||||
Headers headers = makeHeadersWithAuthTokens(*input.settings, host, input);
|
Headers headers = makeHeadersWithAuthTokens(*input.settings, host, input);
|
||||||
|
|
||||||
auto downloadResult = downloadFile(store, *input.settings, url, "source", headers);
|
auto downloadResult = downloadFile(store, *input.settings, url, "source", headers);
|
||||||
auto json = nlohmann::json::parse(store->getFSAccessor(downloadResult.storePath)->readFile(CanonPath::root));
|
auto json = nlohmann::json::parse(
|
||||||
|
store->requireStoreObjectAccessor(downloadResult.storePath)->readFile(CanonPath::root));
|
||||||
|
|
||||||
if (json.is_array() && json.size() >= 1 && json[0]["id"] != nullptr) {
|
if (json.is_array() && json.size() >= 1 && json[0]["id"] != nullptr) {
|
||||||
return RefInfo{.rev = Hash::parseAny(std::string(json[0]["id"]), HashAlgorithm::SHA1)};
|
return RefInfo{.rev = Hash::parseAny(std::string(json[0]["id"]), HashAlgorithm::SHA1)};
|
||||||
|
|||||||
@@ -158,9 +158,12 @@ struct Setter
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that the git reference is valid and normalized.
|
* Checks that the string can be a valid git reference, branch or tag name.
|
||||||
|
* Accepts shorthand references (one-level refnames are allowed), pseudorefs
|
||||||
|
* like `HEAD`.
|
||||||
*
|
*
|
||||||
* Accepts shorthand references (one-level refnames are allowed).
|
* @note This is a coarse test to make sure that the refname is at least something
|
||||||
|
* that Git can make sense of.
|
||||||
*/
|
*/
|
||||||
bool isLegalRefName(const std::string & refName);
|
bool isLegalRefName(const std::string & refName);
|
||||||
|
|
||||||
|
|||||||
@@ -329,9 +329,7 @@ struct MercurialInputScheme : InputScheme
|
|||||||
Input input(_input);
|
Input input(_input);
|
||||||
|
|
||||||
auto storePath = fetchToStore(store, input);
|
auto storePath = fetchToStore(store, input);
|
||||||
|
auto accessor = store->requireStoreObjectAccessor(storePath);
|
||||||
// We just added it, it should be there.
|
|
||||||
auto accessor = ref{store->getFSAccessor(storePath)};
|
|
||||||
|
|
||||||
accessor->setPathDisplay("«" + input.to_string() + "»");
|
accessor->setPathDisplay("«" + input.to_string() + "»");
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ struct PathInputScheme : InputScheme
|
|||||||
storePath = store->addToStoreFromDump(*src, "source");
|
storePath = store->addToStoreFromDump(*src, "source");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto accessor = ref{store->getFSAccessor(*storePath)};
|
auto accessor = store->requireStoreObjectAccessor(*storePath);
|
||||||
|
|
||||||
// To prevent `fetchToStore()` copying the path again to Nix
|
// To prevent `fetchToStore()` copying the path again to Nix
|
||||||
// store, pre-create an entry in the fetcher cache.
|
// store, pre-create an entry in the fetcher cache.
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ DownloadFileResult downloadFile(
|
|||||||
if (cached && !cached->expired)
|
if (cached && !cached->expired)
|
||||||
return useCached();
|
return useCached();
|
||||||
|
|
||||||
FileTransferRequest request(ValidURL{url});
|
FileTransferRequest request(VerbatimURL{url});
|
||||||
request.headers = headers;
|
request.headers = headers;
|
||||||
if (cached)
|
if (cached)
|
||||||
request.expectedETag = getStrAttr(cached->value, "etag");
|
request.expectedETag = getStrAttr(cached->value, "etag");
|
||||||
@@ -107,13 +107,13 @@ DownloadFileResult downloadFile(
|
|||||||
static DownloadTarballResult downloadTarball_(
|
static DownloadTarballResult downloadTarball_(
|
||||||
const Settings & settings, const std::string & urlS, const Headers & headers, const std::string & displayPrefix)
|
const Settings & settings, const std::string & urlS, const Headers & headers, const std::string & displayPrefix)
|
||||||
{
|
{
|
||||||
ValidURL url = urlS;
|
ParsedURL url = parseURL(urlS);
|
||||||
|
|
||||||
// Some friendly error messages for common mistakes.
|
// Some friendly error messages for common mistakes.
|
||||||
// Namely lets catch when the url is a local file path, but
|
// Namely lets catch when the url is a local file path, but
|
||||||
// it is not in fact a tarball.
|
// it is not in fact a tarball.
|
||||||
if (url.scheme() == "file") {
|
if (url.scheme == "file") {
|
||||||
std::filesystem::path localPath = renderUrlPathEnsureLegal(url.path());
|
std::filesystem::path localPath = renderUrlPathEnsureLegal(url.path);
|
||||||
if (!exists(localPath)) {
|
if (!exists(localPath)) {
|
||||||
throw Error("tarball '%s' does not exist.", localPath);
|
throw Error("tarball '%s' does not exist.", localPath);
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ static DownloadTarballResult downloadTarball_(
|
|||||||
|
|
||||||
/* Note: if the download is cached, `importTarball()` will receive
|
/* Note: if the download is cached, `importTarball()` will receive
|
||||||
no data, which causes it to import an empty tarball. */
|
no data, which causes it to import an empty tarball. */
|
||||||
auto archive = !url.path().empty() && hasSuffix(toLower(url.path().back()), ".zip") ? ({
|
auto archive = !url.path.empty() && hasSuffix(toLower(url.path.back()), ".zip") ? ({
|
||||||
/* In streaming mode, libarchive doesn't handle
|
/* In streaming mode, libarchive doesn't handle
|
||||||
symlinks in zip files correctly (#10649). So write
|
symlinks in zip files correctly (#10649). So write
|
||||||
the entire file to disk so libarchive can access it
|
the entire file to disk so libarchive can access it
|
||||||
@@ -178,7 +178,7 @@ static DownloadTarballResult downloadTarball_(
|
|||||||
}
|
}
|
||||||
TarArchive{path};
|
TarArchive{path};
|
||||||
})
|
})
|
||||||
: TarArchive{*source};
|
: TarArchive{*source};
|
||||||
auto tarballCache = getTarballCache();
|
auto tarballCache = getTarballCache();
|
||||||
auto parseSink = tarballCache->getFileSystemObjectSink();
|
auto parseSink = tarballCache->getFileSystemObjectSink();
|
||||||
auto lastModified = unpackTarfileToSink(archive, *parseSink);
|
auto lastModified = unpackTarfileToSink(archive, *parseSink);
|
||||||
|
|||||||
@@ -199,6 +199,28 @@ INSTANTIATE_TEST_SUITE_P(
|
|||||||
.description = "flake_id_ref_branch_ignore_empty_segments_ref_rev",
|
.description = "flake_id_ref_branch_ignore_empty_segments_ref_rev",
|
||||||
.expectedUrl = "flake:nixpkgs/branch/2aae6c35c94fcfb415dbe95f408b9ce91ee846ed",
|
.expectedUrl = "flake:nixpkgs/branch/2aae6c35c94fcfb415dbe95f408b9ce91ee846ed",
|
||||||
},
|
},
|
||||||
|
InputFromURLTestCase{
|
||||||
|
.url = "git://somewhere/repo?ref=branch",
|
||||||
|
.attrs =
|
||||||
|
{
|
||||||
|
{"type", Attr("git")},
|
||||||
|
{"ref", Attr("branch")},
|
||||||
|
{"url", Attr("git://somewhere/repo")},
|
||||||
|
},
|
||||||
|
.description = "plain_git_with_ref",
|
||||||
|
.expectedUrl = "git://somewhere/repo?ref=branch",
|
||||||
|
},
|
||||||
|
InputFromURLTestCase{
|
||||||
|
.url = "git+https://somewhere.aaaaaaa/repo?ref=branch",
|
||||||
|
.attrs =
|
||||||
|
{
|
||||||
|
{"type", Attr("git")},
|
||||||
|
{"ref", Attr("branch")},
|
||||||
|
{"url", Attr("https://somewhere.aaaaaaa/repo")},
|
||||||
|
},
|
||||||
|
.description = "git_https_with_ref",
|
||||||
|
.expectedUrl = "git+https://somewhere.aaaaaaa/repo?ref=branch",
|
||||||
|
},
|
||||||
InputFromURLTestCase{
|
InputFromURLTestCase{
|
||||||
// Note that this is different from above because the "flake id" shorthand
|
// Note that this is different from above because the "flake id" shorthand
|
||||||
// doesn't allow this.
|
// doesn't allow this.
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ static void prim_flakeRefToString(EvalState & state, const PosIdx pos, Value **
|
|||||||
state.forceAttrs(*args[0], noPos, "while evaluating the argument passed to builtins.flakeRefToString");
|
state.forceAttrs(*args[0], noPos, "while evaluating the argument passed to builtins.flakeRefToString");
|
||||||
fetchers::Attrs attrs;
|
fetchers::Attrs attrs;
|
||||||
for (const auto & attr : *args[0]->attrs()) {
|
for (const auto & attr : *args[0]->attrs()) {
|
||||||
|
state.forceValue(*attr.value, attr.pos);
|
||||||
auto t = attr.value->type();
|
auto t = attr.value->type();
|
||||||
if (t == nInt) {
|
if (t == nInt) {
|
||||||
auto intValue = attr.value->integer().value;
|
auto intValue = attr.value->integer().value;
|
||||||
|
|||||||
@@ -80,7 +80,8 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
|
|||||||
|
|
||||||
std::smatch match;
|
std::smatch match;
|
||||||
auto succeeds = std::regex_match(url, match, pathFlakeRegex);
|
auto succeeds = std::regex_match(url, match, pathFlakeRegex);
|
||||||
assert(succeeds);
|
if (!succeeds)
|
||||||
|
throw Error("invalid flakeref '%s'", url);
|
||||||
auto path = match[1].str();
|
auto path = match[1].str();
|
||||||
auto query = decodeQuery(match[3].str(), /*lenient=*/true);
|
auto query = decodeQuery(match[3].str(), /*lenient=*/true);
|
||||||
auto fragment = percentDecode(match[5].str());
|
auto fragment = percentDecode(match[5].str());
|
||||||
|
|||||||
+22
-27
@@ -320,34 +320,29 @@ int handleExceptions(const std::string & programName, std::function<void()> fun)
|
|||||||
std::string error = ANSI_RED "error:" ANSI_NORMAL " ";
|
std::string error = ANSI_RED "error:" ANSI_NORMAL " ";
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
try {
|
fun();
|
||||||
fun();
|
} catch (...) {
|
||||||
} catch (...) {
|
/* Subtle: we have to make sure that any `interrupted'
|
||||||
/* Subtle: we have to make sure that any `interrupted'
|
condition is discharged before we reach printMsg()
|
||||||
condition is discharged before we reach printMsg()
|
below, since otherwise it will throw an (uncaught)
|
||||||
below, since otherwise it will throw an (uncaught)
|
exception. */
|
||||||
exception. */
|
setInterruptThrown();
|
||||||
setInterruptThrown();
|
throw;
|
||||||
throw;
|
|
||||||
}
|
|
||||||
} catch (Exit & e) {
|
|
||||||
return e.status;
|
|
||||||
} catch (UsageError & e) {
|
|
||||||
logError(e.info());
|
|
||||||
printError("Try '%1% --help' for more information.", programName);
|
|
||||||
return 1;
|
|
||||||
} catch (BaseError & e) {
|
|
||||||
logError(e.info());
|
|
||||||
return e.info().status;
|
|
||||||
} catch (std::bad_alloc & e) {
|
|
||||||
printError(error + "out of memory");
|
|
||||||
return 1;
|
|
||||||
} catch (std::exception & e) {
|
|
||||||
printError(error + e.what());
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (Exit & e) {
|
||||||
/* In case logger also throws just give up. */
|
return e.status;
|
||||||
|
} catch (UsageError & e) {
|
||||||
|
logError(e.info());
|
||||||
|
printError("Try '%1% --help' for more information.", programName);
|
||||||
|
return 1;
|
||||||
|
} catch (BaseError & e) {
|
||||||
|
logError(e.info());
|
||||||
|
return e.info().status;
|
||||||
|
} catch (std::bad_alloc & e) {
|
||||||
|
printError(error + "out of memory");
|
||||||
|
return 1;
|
||||||
|
} catch (std::exception & e) {
|
||||||
|
printError(error + e.what());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
ssh://userinfo@[fea5:23e1:3916:fc24:cb52:2837:2ecb:ea8e%eth0]?a=b&c=d
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ssh://userinfo@[fea5:23e1:3916:fc24:cb52:2837:2ecb:ea8e%25eth0]?a=b&c=d
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ssh://userinfo@fea5:23e1:3916:fc24:cb52:2837:2ecb:ea8e%25?a=b&c=d
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ssh://userinfo@fea5:23e1:3916:fc24:cb52:2837:2ecb:ea8e%eth0?a=b&c=d
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ssh://fea5:23e1:3916:fc24:cb52:2837:2ecb:ea8e%eth0?a=b&c=d
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ssh://fea5:23e1:3916:fc24:cb52:2837:2ecb:ea8e%eth0
|
||||||
@@ -183,4 +183,64 @@ static StoreReference sshIPv6AuthorityWithUserinfoAndParams{
|
|||||||
|
|
||||||
URI_TEST_READ(ssh_unbracketed_ipv6_3, sshIPv6AuthorityWithUserinfoAndParams)
|
URI_TEST_READ(ssh_unbracketed_ipv6_3, sshIPv6AuthorityWithUserinfoAndParams)
|
||||||
|
|
||||||
|
static const StoreReference sshIPv6AuthorityWithUserinfoAndParamsAndZoneId{
|
||||||
|
.variant =
|
||||||
|
StoreReference::Specified{
|
||||||
|
.scheme = "ssh",
|
||||||
|
.authority = "userinfo@[fea5:23e1:3916:fc24:cb52:2837:2ecb:ea8e%25eth0]",
|
||||||
|
},
|
||||||
|
.params =
|
||||||
|
{
|
||||||
|
{"a", "b"},
|
||||||
|
{"c", "d"},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
URI_TEST_READ(ssh_unbracketed_ipv6_4, sshIPv6AuthorityWithUserinfoAndParamsAndZoneId)
|
||||||
|
URI_TEST_READ(ssh_unbracketed_ipv6_5, sshIPv6AuthorityWithUserinfoAndParamsAndZoneId)
|
||||||
|
|
||||||
|
static const StoreReference sshIPv6AuthorityWithUserinfoAndParamsAndZoneIdTricky{
|
||||||
|
.variant =
|
||||||
|
StoreReference::Specified{
|
||||||
|
.scheme = "ssh",
|
||||||
|
.authority = "userinfo@[fea5:23e1:3916:fc24:cb52:2837:2ecb:ea8e%2525]",
|
||||||
|
},
|
||||||
|
.params =
|
||||||
|
{
|
||||||
|
{"a", "b"},
|
||||||
|
{"c", "d"},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Non-standard syntax where the IPv6 literal appears without brackets. In
|
||||||
|
// this case don't considering %25 to be a pct-encoded % and just take it as a
|
||||||
|
// literal value. 25 is a perfectly legal ZoneId value in theory.
|
||||||
|
URI_TEST_READ(ssh_unbracketed_ipv6_6, sshIPv6AuthorityWithUserinfoAndParamsAndZoneIdTricky)
|
||||||
|
URI_TEST_READ(ssh_unbracketed_ipv6_7, sshIPv6AuthorityWithUserinfoAndParamsAndZoneId)
|
||||||
|
|
||||||
|
static const StoreReference sshIPv6AuthorityWithParamsAndZoneId{
|
||||||
|
.variant =
|
||||||
|
StoreReference::Specified{
|
||||||
|
.scheme = "ssh",
|
||||||
|
.authority = "[fea5:23e1:3916:fc24:cb52:2837:2ecb:ea8e%25eth0]",
|
||||||
|
},
|
||||||
|
.params =
|
||||||
|
{
|
||||||
|
{"a", "b"},
|
||||||
|
{"c", "d"},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
URI_TEST_READ(ssh_unbracketed_ipv6_8, sshIPv6AuthorityWithParamsAndZoneId)
|
||||||
|
|
||||||
|
static const StoreReference sshIPv6AuthorityWithZoneId{
|
||||||
|
.variant =
|
||||||
|
StoreReference::Specified{
|
||||||
|
.scheme = "ssh",
|
||||||
|
.authority = "[fea5:23e1:3916:fc24:cb52:2837:2ecb:ea8e%25eth0]",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
URI_TEST_READ(ssh_unbracketed_ipv6_9, sshIPv6AuthorityWithZoneId)
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
@@ -717,8 +717,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||||||
{
|
{
|
||||||
DerivationBuildingGoal & goal;
|
DerivationBuildingGoal & goal;
|
||||||
|
|
||||||
DerivationBuildingGoalCallbacks(
|
DerivationBuildingGoalCallbacks(DerivationBuildingGoal & goal)
|
||||||
DerivationBuildingGoal & goal, std::unique_ptr<DerivationBuilder> & builder)
|
|
||||||
: goal{goal}
|
: goal{goal}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -775,7 +774,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||||||
already be created, so we don't need to create it again. */
|
already be created, so we don't need to create it again. */
|
||||||
builder = makeDerivationBuilder(
|
builder = makeDerivationBuilder(
|
||||||
*localStoreP,
|
*localStoreP,
|
||||||
std::make_unique<DerivationBuildingGoalCallbacks>(*this, builder),
|
std::make_unique<DerivationBuildingGoalCallbacks>(*this),
|
||||||
DerivationBuilderParams{
|
DerivationBuilderParams{
|
||||||
.drvPath = drvPath,
|
.drvPath = drvPath,
|
||||||
.buildResult = buildResult,
|
.buildResult = buildResult,
|
||||||
@@ -860,7 +859,15 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||||||
{
|
{
|
||||||
builder.reset();
|
builder.reset();
|
||||||
StorePathSet outputPaths;
|
StorePathSet outputPaths;
|
||||||
for (auto & [_, output] : builtOutputs) {
|
/* In the check case we install no store objects, and so
|
||||||
|
`builtOutputs` is empty. However, per issue #14287, there is
|
||||||
|
an expectation that the post-build hook is still executed.
|
||||||
|
(This is useful for e.g. logging successful deterministic rebuilds.)
|
||||||
|
|
||||||
|
In order to make that work, in the check case just load the
|
||||||
|
(preexisting) infos from scratch, rather than relying on what
|
||||||
|
`DerivationBuilder` returned to us. */
|
||||||
|
for (auto & [_, output] : buildMode == bmCheck ? checkPathValidity(initialOutputs).second : builtOutputs) {
|
||||||
// for sake of `bmRepair`
|
// for sake of `bmRepair`
|
||||||
worker.markContentsGood(output.outPath);
|
worker.markContentsGood(output.outPath);
|
||||||
outputPaths.insert(output.outPath);
|
outputPaths.insert(output.outPath);
|
||||||
|
|||||||
@@ -182,7 +182,19 @@ Goal::Co DerivationGoal::haveDerivation()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(success.builtOutputs.count(wantedOutput) > 0);
|
/* If the wanted output is not in builtOutputs (e.g., because it
|
||||||
|
was already valid and therefore not re-registered), we need to
|
||||||
|
add it ourselves to ensure we return the correct information. */
|
||||||
|
if (success.builtOutputs.count(wantedOutput) == 0) {
|
||||||
|
debug(
|
||||||
|
"BUG! wanted output '%s' not in builtOutputs, working around by adding it manually", wantedOutput);
|
||||||
|
auto realisation = assertPathValidity();
|
||||||
|
realisation.id = DrvOutput{
|
||||||
|
.drvHash = outputHash,
|
||||||
|
.outputName = wantedOutput,
|
||||||
|
};
|
||||||
|
success.builtOutputs.emplace(wantedOutput, std::move(realisation));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,12 @@
|
|||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
RegisterBuiltinBuilder::BuiltinBuilders & RegisterBuiltinBuilder::builtinBuilders()
|
||||||
|
{
|
||||||
|
static RegisterBuiltinBuilder::BuiltinBuilders builders;
|
||||||
|
return builders;
|
||||||
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct State
|
struct State
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ static void builtinFetchurl(const BuiltinBuilderContext & ctx)
|
|||||||
|
|
||||||
auto fetch = [&](const std::string & url) {
|
auto fetch = [&](const std::string & url) {
|
||||||
auto source = sinkToSource([&](Sink & sink) {
|
auto source = sinkToSource([&](Sink & sink) {
|
||||||
FileTransferRequest request(ValidURL{url});
|
FileTransferRequest request(VerbatimURL{url});
|
||||||
request.decompress = false;
|
request.decompress = false;
|
||||||
|
|
||||||
auto decompressor = makeDecompressionSink(unpack && hasSuffix(mainUrl, ".xz") ? "xz" : "none", sink);
|
auto decompressor = makeDecompressionSink(unpack && hasSuffix(mainUrl, ".xz") ? "xz" : "none", sink);
|
||||||
|
|||||||
@@ -849,7 +849,10 @@ static void performOp(
|
|||||||
auto path = store->parseStorePath(readString(conn.from));
|
auto path = store->parseStorePath(readString(conn.from));
|
||||||
std::shared_ptr<const ValidPathInfo> info;
|
std::shared_ptr<const ValidPathInfo> info;
|
||||||
logger->startWork();
|
logger->startWork();
|
||||||
info = store->queryPathInfo(path);
|
try {
|
||||||
|
info = store->queryPathInfo(path);
|
||||||
|
} catch (InvalidPath &) {
|
||||||
|
}
|
||||||
logger->stopWork();
|
logger->stopWork();
|
||||||
if (info) {
|
if (info) {
|
||||||
conn.to << 1;
|
conn.to << 1;
|
||||||
|
|||||||
@@ -99,6 +99,17 @@ DerivationOptions DerivationOptions::fromStructuredAttrs(
|
|||||||
return fromStructuredAttrs(env, parsed ? &*parsed : nullptr);
|
return fromStructuredAttrs(env, parsed ? &*parsed : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void flatten(const nlohmann::json & value, StringSet & res)
|
||||||
|
{
|
||||||
|
if (value.is_array())
|
||||||
|
for (auto & v : value)
|
||||||
|
flatten(v, res);
|
||||||
|
else if (value.is_string())
|
||||||
|
res.insert(value);
|
||||||
|
else
|
||||||
|
throw Error("'exportReferencesGraph' value is not an array or a string");
|
||||||
|
}
|
||||||
|
|
||||||
DerivationOptions
|
DerivationOptions
|
||||||
DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAttrs * parsed, bool shouldWarn)
|
DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAttrs * parsed, bool shouldWarn)
|
||||||
{
|
{
|
||||||
@@ -219,12 +230,9 @@ DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAt
|
|||||||
if (!e || !e->is_object())
|
if (!e || !e->is_object())
|
||||||
return ret;
|
return ret;
|
||||||
for (auto & [key, value] : getObject(*e)) {
|
for (auto & [key, value] : getObject(*e)) {
|
||||||
if (value.is_array())
|
StringSet ss;
|
||||||
ret.insert_or_assign(key, value);
|
flatten(value, ss);
|
||||||
else if (value.is_string())
|
ret.insert_or_assign(key, std::move(ss));
|
||||||
ret.insert_or_assign(key, StringSet{value});
|
|
||||||
else
|
|
||||||
throw Error("'exportReferencesGraph' value is not an array or a string");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto s = getOr(env, "exportReferencesGraph", "");
|
auto s = getOr(env, "exportReferencesGraph", "");
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ struct DerivationBuilderParams
|
|||||||
*/
|
*/
|
||||||
const StorePathSet & inputPaths;
|
const StorePathSet & inputPaths;
|
||||||
|
|
||||||
const std::map<std::string, InitialOutput> & initialOutputs;
|
const std::map<std::string, InitialOutput> initialOutputs;
|
||||||
|
|
||||||
const BuildMode & buildMode;
|
const BuildMode & buildMode;
|
||||||
|
|
||||||
@@ -179,8 +179,15 @@ struct DerivationBuilder : RestrictionContext
|
|||||||
virtual bool killChild() = 0;
|
virtual bool killChild() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct DerivationBuilderDeleter
|
||||||
|
{
|
||||||
|
void operator()(DerivationBuilder * builder) noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
using DerivationBuilderUnique = std::unique_ptr<DerivationBuilder, DerivationBuilderDeleter>;
|
||||||
|
|
||||||
#ifndef _WIN32 // TODO enable `DerivationBuilder` on Windows
|
#ifndef _WIN32 // TODO enable `DerivationBuilder` on Windows
|
||||||
std::unique_ptr<DerivationBuilder> makeDerivationBuilder(
|
DerivationBuilderUnique makeDerivationBuilder(
|
||||||
LocalStore & store, std::unique_ptr<DerivationBuilderCallbacks> miscMethods, DerivationBuilderParams params);
|
LocalStore & store, std::unique_ptr<DerivationBuilderCallbacks> miscMethods, DerivationBuilderParams params);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "nix/store/parsed-derivations.hh"
|
#include "nix/store/parsed-derivations.hh"
|
||||||
#include "nix/store/derivation-options.hh"
|
#include "nix/store/derivation-options.hh"
|
||||||
#include "nix/store/build/derivation-building-misc.hh"
|
#include "nix/store/build/derivation-building-misc.hh"
|
||||||
|
#include "nix/store/build/derivation-builder.hh"
|
||||||
#include "nix/store/outputs-spec.hh"
|
#include "nix/store/outputs-spec.hh"
|
||||||
#include "nix/store/store-api.hh"
|
#include "nix/store/store-api.hh"
|
||||||
#include "nix/store/pathlocks.hh"
|
#include "nix/store/pathlocks.hh"
|
||||||
@@ -82,7 +83,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
std::unique_ptr<HookInstance> hook;
|
std::unique_ptr<HookInstance> hook;
|
||||||
|
|
||||||
std::unique_ptr<DerivationBuilder> builder;
|
DerivationBuilderUnique builder;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BuildMode buildMode;
|
BuildMode buildMode;
|
||||||
|
|||||||
@@ -20,11 +20,7 @@ struct RegisterBuiltinBuilder
|
|||||||
{
|
{
|
||||||
typedef std::map<std::string, BuiltinBuilder> BuiltinBuilders;
|
typedef std::map<std::string, BuiltinBuilder> BuiltinBuilders;
|
||||||
|
|
||||||
static BuiltinBuilders & builtinBuilders()
|
static BuiltinBuilders & builtinBuilders();
|
||||||
{
|
|
||||||
static BuiltinBuilders builders;
|
|
||||||
return builders;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegisterBuiltinBuilder(const std::string & name, BuiltinBuilder && fun)
|
RegisterBuiltinBuilder(const std::string & name, BuiltinBuilder && fun)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ extern const unsigned int RETRY_TIME_MS_DEFAULT;
|
|||||||
|
|
||||||
struct FileTransferRequest
|
struct FileTransferRequest
|
||||||
{
|
{
|
||||||
ValidURL uri;
|
VerbatimURL uri;
|
||||||
Headers headers;
|
Headers headers;
|
||||||
std::string expectedETag;
|
std::string expectedETag;
|
||||||
bool verifyTLS = true;
|
bool verifyTLS = true;
|
||||||
@@ -93,7 +93,7 @@ struct FileTransferRequest
|
|||||||
std::string mimeType;
|
std::string mimeType;
|
||||||
std::function<void(std::string_view data)> dataCallback;
|
std::function<void(std::string_view data)> dataCallback;
|
||||||
|
|
||||||
FileTransferRequest(ValidURL uri)
|
FileTransferRequest(VerbatimURL uri)
|
||||||
: uri(std::move(uri))
|
: uri(std::move(uri))
|
||||||
, parentAct(getCurActivity())
|
, parentAct(getCurActivity())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -794,6 +794,8 @@ public:
|
|||||||
"build-dir",
|
"build-dir",
|
||||||
R"(
|
R"(
|
||||||
Override the `build-dir` store setting for all stores that have this setting.
|
Override the `build-dir` store setting for all stores that have this setting.
|
||||||
|
|
||||||
|
See also the per-store [`build-dir`](@docroot@/store/types/local-store.md#store-local-store-build-dir) setting.
|
||||||
)"};
|
)"};
|
||||||
|
|
||||||
Setting<PathSet> allowedImpureHostPrefixes{
|
Setting<PathSet> allowedImpureHostPrefixes{
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ private:
|
|||||||
> `build-dir` must not be set to a world-writable directory.
|
> `build-dir` must not be set to a world-writable directory.
|
||||||
> Placing temporary build directories in a world-writable place allows other users to access or modify build data that is currently in use.
|
> Placing temporary build directories in a world-writable place allows other users to access or modify build data that is currently in use.
|
||||||
> This alone is merely an impurity, but combined with another factor this has allowed malicious derivations to escape the build sandbox.
|
> This alone is merely an impurity, but combined with another factor this has allowed malicious derivations to escape the build sandbox.
|
||||||
|
|
||||||
|
See also the global [`build-dir`](@docroot@/command-ref/conf-file.md#conf-build-dir) setting.
|
||||||
)"};
|
)"};
|
||||||
public:
|
public:
|
||||||
Path getBuildDir() const;
|
Path getBuildDir() const;
|
||||||
|
|||||||
@@ -52,7 +52,21 @@ struct RestrictionContext
|
|||||||
* Add 'path' to the set of paths that may be referenced by the
|
* Add 'path' to the set of paths that may be referenced by the
|
||||||
* outputs, and make it appear in the sandbox.
|
* outputs, and make it appear in the sandbox.
|
||||||
*/
|
*/
|
||||||
virtual void addDependency(const StorePath & path) = 0;
|
void addDependency(const StorePath & path)
|
||||||
|
{
|
||||||
|
if (isAllowed(path))
|
||||||
|
return;
|
||||||
|
addDependencyImpl(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the underlying implementation to be defined. The caller
|
||||||
|
* will ensure that this is only called on newly added dependencies,
|
||||||
|
* and that idempotent calls are a no-op.
|
||||||
|
*/
|
||||||
|
virtual void addDependencyImpl(const StorePath & path) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ struct ServeProto::BasicClientConnection
|
|||||||
BuildResult getBuildDerivationResponse(const StoreDirConfig & store);
|
BuildResult getBuildDerivationResponse(const StoreDirConfig & store);
|
||||||
|
|
||||||
void narFromPath(const StoreDirConfig & store, const StorePath & path, std::function<void(Source &)> fun);
|
void narFromPath(const StoreDirConfig & store, const StorePath & path, std::function<void(Source &)> fun);
|
||||||
|
|
||||||
|
void importPaths(const StoreDirConfig & store, std::function<void(Sink &)> fun);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServeProto::BasicServerConnection
|
struct ServeProto::BasicServerConnection
|
||||||
|
|||||||
@@ -108,6 +108,13 @@ enum struct ServeProto::Command : uint64_t {
|
|||||||
QueryValidPaths = 1,
|
QueryValidPaths = 1,
|
||||||
QueryPathInfos = 2,
|
QueryPathInfos = 2,
|
||||||
DumpStorePath = 3,
|
DumpStorePath = 3,
|
||||||
|
/**
|
||||||
|
* @note This is no longer used by Nix (as a client), but it is used
|
||||||
|
* by Hydra. We should therefore not remove it until Hydra no longer
|
||||||
|
* uses it either.
|
||||||
|
*/
|
||||||
|
ImportPaths = 4,
|
||||||
|
// ExportPaths = 5,
|
||||||
BuildPaths = 6,
|
BuildPaths = 6,
|
||||||
QueryClosure = 7,
|
QueryClosure = 7,
|
||||||
BuildDerivation = 8,
|
BuildDerivation = 8,
|
||||||
|
|||||||
@@ -724,10 +724,28 @@ public:
|
|||||||
* the Nix store.
|
* the Nix store.
|
||||||
*
|
*
|
||||||
* @return nullptr if the store doesn't contain an object at the
|
* @return nullptr if the store doesn't contain an object at the
|
||||||
* givine path.
|
* given path.
|
||||||
*/
|
*/
|
||||||
virtual std::shared_ptr<SourceAccessor> getFSAccessor(const StorePath & path, bool requireValidPath = true) = 0;
|
virtual std::shared_ptr<SourceAccessor> getFSAccessor(const StorePath & path, bool requireValidPath = true) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an accessor for the store object or throw an Error if it's invalid or
|
||||||
|
* doesn't exist.
|
||||||
|
*
|
||||||
|
* @throws InvalidPath if the store object doesn't exist or (if requireValidPath = true) is
|
||||||
|
* invalid.
|
||||||
|
*/
|
||||||
|
[[nodiscard]] ref<SourceAccessor> requireStoreObjectAccessor(const StorePath & path, bool requireValidPath = true)
|
||||||
|
{
|
||||||
|
auto accessor = getFSAccessor(path, requireValidPath);
|
||||||
|
if (!accessor) {
|
||||||
|
throw InvalidPath(
|
||||||
|
requireValidPath ? "path '%1%' is not a valid store path" : "store path '%1%' does not exist",
|
||||||
|
printStorePath(path));
|
||||||
|
}
|
||||||
|
return ref<SourceAccessor>{accessor};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repair the contents of the given path by redownloading it using
|
* Repair the contents of the given path by redownloading it using
|
||||||
* a substituter (if available).
|
* a substituter (if available).
|
||||||
|
|||||||
@@ -1383,7 +1383,7 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
|
|||||||
for (auto & link : DirectoryIterator{linksDir}) {
|
for (auto & link : DirectoryIterator{linksDir}) {
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
auto name = link.path().filename();
|
auto name = link.path().filename();
|
||||||
printMsg(lvlTalkative, "checking contents of '%s'", name);
|
printMsg(lvlTalkative, "checking contents of %s", name);
|
||||||
PosixSourceAccessor accessor;
|
PosixSourceAccessor accessor;
|
||||||
std::string hash = hashPath(
|
std::string hash = hashPath(
|
||||||
PosixSourceAccessor::createAtRoot(link.path()),
|
PosixSourceAccessor::createAtRoot(link.path()),
|
||||||
@@ -1391,10 +1391,10 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
|
|||||||
HashAlgorithm::SHA256)
|
HashAlgorithm::SHA256)
|
||||||
.first.to_string(HashFormat::Nix32, false);
|
.first.to_string(HashFormat::Nix32, false);
|
||||||
if (hash != name.string()) {
|
if (hash != name.string()) {
|
||||||
printError("link '%s' was modified! expected hash '%s', got '%s'", link.path(), name, hash);
|
printError("link %s was modified! expected hash %s, got '%s'", link.path(), name, hash);
|
||||||
if (repair) {
|
if (repair) {
|
||||||
std::filesystem::remove(link.path());
|
std::filesystem::remove(link.path());
|
||||||
printInfo("removed link '%s'", link.path());
|
printInfo("removed link %s", link.path());
|
||||||
} else {
|
} else {
|
||||||
errors = true;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ void LocalStore::optimisePath_(
|
|||||||
full. When that happens, it's fine to ignore it: we
|
full. When that happens, it's fine to ignore it: we
|
||||||
just effectively disable deduplication of this
|
just effectively disable deduplication of this
|
||||||
file. */
|
file. */
|
||||||
printInfo("cannot link '%s' to '%s': %s", linkPath, path, strerror(errno));
|
printInfo("cannot link %s to '%s': %s", linkPath, path, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,11 +216,11 @@ void LocalStore::optimisePath_(
|
|||||||
auto stLink = lstat(linkPath.string());
|
auto stLink = lstat(linkPath.string());
|
||||||
|
|
||||||
if (st.st_ino == stLink.st_ino) {
|
if (st.st_ino == stLink.st_ino) {
|
||||||
debug("'%1%' is already linked to '%2%'", path, linkPath);
|
debug("'%1%' is already linked to %2%", path, linkPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printMsg(lvlTalkative, "linking '%1%' to '%2%'", path, linkPath);
|
printMsg(lvlTalkative, "linking '%1%' to %2%", path, linkPath);
|
||||||
|
|
||||||
/* Make the containing directory writable, but only if it's not
|
/* Make the containing directory writable, but only if it's not
|
||||||
the store itself (we don't want or need to mess with its
|
the store itself (we don't want or need to mess with its
|
||||||
@@ -234,7 +234,7 @@ void LocalStore::optimisePath_(
|
|||||||
its timestamp back to 0. */
|
its timestamp back to 0. */
|
||||||
MakeReadOnly makeReadOnly(mustToggle ? dirOfPath : "");
|
MakeReadOnly makeReadOnly(mustToggle ? dirOfPath : "");
|
||||||
|
|
||||||
std::filesystem::path tempLink = fmt("%1%/.tmp-link-%2%-%3%", config->realStoreDir, getpid(), rand());
|
std::filesystem::path tempLink = makeTempPath(config->realStoreDir.get(), ".tmp-link");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::filesystem::create_hard_link(linkPath, tempLink);
|
std::filesystem::create_hard_link(linkPath, tempLink);
|
||||||
@@ -245,7 +245,7 @@ void LocalStore::optimisePath_(
|
|||||||
systems). This is likely to happen with empty files.
|
systems). This is likely to happen with empty files.
|
||||||
Just shrug and ignore. */
|
Just shrug and ignore. */
|
||||||
if (st.st_size)
|
if (st.st_size)
|
||||||
printInfo("'%1%' has maximum number of links", linkPath);
|
printInfo("%1% has maximum number of links", linkPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
@@ -255,14 +255,18 @@ void LocalStore::optimisePath_(
|
|||||||
try {
|
try {
|
||||||
std::filesystem::rename(tempLink, path);
|
std::filesystem::rename(tempLink, path);
|
||||||
} catch (std::filesystem::filesystem_error & e) {
|
} catch (std::filesystem::filesystem_error & e) {
|
||||||
std::filesystem::remove(tempLink);
|
{
|
||||||
printError("unable to unlink '%1%'", tempLink);
|
std::error_code ec;
|
||||||
|
remove(tempLink, ec); /* Clean up after ourselves. */
|
||||||
|
if (ec)
|
||||||
|
printError("unable to unlink %1%: %2%", tempLink, ec.message());
|
||||||
|
}
|
||||||
if (e.code() == std::errc::too_many_links) {
|
if (e.code() == std::errc::too_many_links) {
|
||||||
/* Some filesystems generate too many links on the rename,
|
/* Some filesystems generate too many links on the rename,
|
||||||
rather than on the original link. (Probably it
|
rather than on the original link. (Probably it
|
||||||
temporarily increases the st_nlink field before
|
temporarily increases the st_nlink field before
|
||||||
decreasing it again.) */
|
decreasing it again.) */
|
||||||
debug("'%s' has reached maximum number of links", linkPath);
|
debug("%s has reached maximum number of links", linkPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
|
|||||||
@@ -93,4 +93,14 @@ void ServeProto::BasicClientConnection::narFromPath(
|
|||||||
fun(from);
|
fun(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServeProto::BasicClientConnection::importPaths(const StoreDirConfig & store, std::function<void(Sink &)> fun)
|
||||||
|
{
|
||||||
|
to << ServeProto::Command::ImportPaths;
|
||||||
|
fun(to);
|
||||||
|
to.flush();
|
||||||
|
|
||||||
|
if (readInt(from) != 1)
|
||||||
|
throw Error("remote machine failed to import closure");
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
@@ -447,6 +447,8 @@ void Store::querySubstitutablePathInfos(const StorePathCAMap & paths, Substituta
|
|||||||
.downloadSize = narInfo ? narInfo->fileSize : 0,
|
.downloadSize = narInfo ? narInfo->fileSize : 0,
|
||||||
.narSize = info->narSize,
|
.narSize = info->narSize,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
break; /* We are done. */
|
||||||
} catch (InvalidPath &) {
|
} catch (InvalidPath &) {
|
||||||
} catch (SubstituterDisabled &) {
|
} catch (SubstituterDisabled &) {
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
@@ -1130,7 +1132,7 @@ Derivation Store::derivationFromPath(const StorePath & drvPath)
|
|||||||
|
|
||||||
static Derivation readDerivationCommon(Store & store, const StorePath & drvPath, bool requireValidPath)
|
static Derivation readDerivationCommon(Store & store, const StorePath & drvPath, bool requireValidPath)
|
||||||
{
|
{
|
||||||
auto accessor = store.getFSAccessor(drvPath, requireValidPath);
|
auto accessor = store.requireStoreObjectAccessor(drvPath, requireValidPath);
|
||||||
try {
|
try {
|
||||||
return parseDerivation(store, accessor->readFile(CanonPath::root), Derivation::nameFromPath(drvPath));
|
return parseDerivation(store, accessor->readFile(CanonPath::root), Derivation::nameFromPath(drvPath));
|
||||||
} catch (FormatError & e) {
|
} catch (FormatError & e) {
|
||||||
|
|||||||
@@ -121,7 +121,27 @@ StoreReference StoreReference::parse(const std::string & uri, const StoreReferen
|
|||||||
* greedily assumed to be the part of the host address. */
|
* greedily assumed to be the part of the host address. */
|
||||||
auto authorityString = schemeAndAuthority->authority;
|
auto authorityString = schemeAndAuthority->authority;
|
||||||
auto userinfo = splitPrefixTo(authorityString, '@');
|
auto userinfo = splitPrefixTo(authorityString, '@');
|
||||||
auto maybeIpv6 = boost::urls::parse_ipv6_address(authorityString);
|
/* Back-compat shim for ZoneId specifiers. Technically this isn't
|
||||||
|
* standard, but the expectation is this works with the old syntax
|
||||||
|
* for ZoneID specifiers. For the full story behind the fiasco that
|
||||||
|
* is ZoneID in URLs look at [^].
|
||||||
|
* [^]: https://datatracker.ietf.org/doc/html/draft-schinazi-httpbis-link-local-uri-bcp-03
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Fish out the internals from inside square brackets. It might be that the pct-sign is unencoded and that's
|
||||||
|
* why we failed to parse it previously. */
|
||||||
|
if (authorityString.starts_with('[') && authorityString.ends_with(']')) {
|
||||||
|
authorityString.remove_prefix(1);
|
||||||
|
authorityString.remove_suffix(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto maybeBeforePct = splitPrefixTo(authorityString, '%');
|
||||||
|
bool hasZoneId = maybeBeforePct.has_value();
|
||||||
|
auto maybeZoneId = hasZoneId ? std::optional{authorityString} : std::nullopt;
|
||||||
|
|
||||||
|
std::string_view maybeIpv6S = maybeBeforePct.value_or(authorityString);
|
||||||
|
auto maybeIpv6 = boost::urls::parse_ipv6_address(maybeIpv6S);
|
||||||
|
|
||||||
if (maybeIpv6) {
|
if (maybeIpv6) {
|
||||||
std::string fixedAuthority;
|
std::string fixedAuthority;
|
||||||
if (userinfo) {
|
if (userinfo) {
|
||||||
@@ -129,7 +149,11 @@ StoreReference StoreReference::parse(const std::string & uri, const StoreReferen
|
|||||||
fixedAuthority += '@';
|
fixedAuthority += '@';
|
||||||
}
|
}
|
||||||
fixedAuthority += '[';
|
fixedAuthority += '[';
|
||||||
fixedAuthority += authorityString;
|
fixedAuthority += maybeIpv6S;
|
||||||
|
if (maybeZoneId) {
|
||||||
|
fixedAuthority += "%25"; // pct-encoded percent character
|
||||||
|
fixedAuthority += *maybeZoneId;
|
||||||
|
}
|
||||||
fixedAuthority += ']';
|
fixedAuthority += ']';
|
||||||
return {
|
return {
|
||||||
.variant =
|
.variant =
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ struct ChrootDerivationBuilder : virtual DerivationBuilderImpl
|
|||||||
|
|
||||||
std::pair<Path, Path> addDependencyPrep(const StorePath & path)
|
std::pair<Path, Path> addDependencyPrep(const StorePath & path)
|
||||||
{
|
{
|
||||||
DerivationBuilderImpl::addDependency(path);
|
DerivationBuilderImpl::addDependencyImpl(path);
|
||||||
|
|
||||||
debug("materialising '%s' in the sandbox", store.printStorePath(path));
|
debug("materialising '%s' in the sandbox", store.printStorePath(path));
|
||||||
|
|
||||||
|
|||||||
@@ -92,10 +92,13 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~DerivationBuilderImpl()
|
/**
|
||||||
|
* Cleanup code to run when destroying any DerivationBuilderImpl implementation.
|
||||||
|
*/
|
||||||
|
void cleanupOnDestruction() noexcept
|
||||||
{
|
{
|
||||||
/* Careful: we should never ever throw an exception from a
|
/* Careful: we should never ever throw an exception from a
|
||||||
destructor. */
|
noexcept function. */
|
||||||
try {
|
try {
|
||||||
killChild();
|
killChild();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@@ -325,7 +328,7 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void addDependency(const StorePath & path) override;
|
void addDependencyImpl(const StorePath & path) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a file owned by the builder.
|
* Make a file owned by the builder.
|
||||||
@@ -659,17 +662,17 @@ static void handleChildException(bool sendException)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool checkNotWorldWritable(std::filesystem::path path)
|
static void checkNotWorldWritable(std::filesystem::path path)
|
||||||
{
|
{
|
||||||
while (true) {
|
while (true) {
|
||||||
auto st = lstat(path);
|
auto st = lstat(path);
|
||||||
if (st.st_mode & S_IWOTH)
|
if (st.st_mode & S_IWOTH)
|
||||||
return false;
|
throw Error("Path %s is world-writable or a symlink. That's not allowed for security.", path);
|
||||||
if (path == path.parent_path())
|
if (path == path.parent_path())
|
||||||
break;
|
break;
|
||||||
path = path.parent_path();
|
path = path.parent_path();
|
||||||
}
|
}
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DerivationBuilderImpl::checkSystem()
|
void DerivationBuilderImpl::checkSystem()
|
||||||
@@ -720,9 +723,8 @@ std::optional<Descriptor> DerivationBuilderImpl::startBuild()
|
|||||||
|
|
||||||
createDirs(buildDir);
|
createDirs(buildDir);
|
||||||
|
|
||||||
if (buildUser && !checkNotWorldWritable(buildDir))
|
if (buildUser)
|
||||||
throw Error(
|
checkNotWorldWritable(buildDir);
|
||||||
"Path %s or a parent directory is world-writable or a symlink. That's not allowed for security.", buildDir);
|
|
||||||
|
|
||||||
/* Create a temporary directory where the build will take
|
/* Create a temporary directory where the build will take
|
||||||
place. */
|
place. */
|
||||||
@@ -1181,11 +1183,8 @@ void DerivationBuilderImpl::stopDaemon()
|
|||||||
daemonSocket.close();
|
daemonSocket.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DerivationBuilderImpl::addDependency(const StorePath & path)
|
void DerivationBuilderImpl::addDependencyImpl(const StorePath & path)
|
||||||
{
|
{
|
||||||
if (isAllowed(path))
|
|
||||||
return;
|
|
||||||
|
|
||||||
addedPaths.insert(path);
|
addedPaths.insert(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1717,7 +1716,6 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
|
|||||||
if (buildMode == bmRepair) {
|
if (buildMode == bmRepair) {
|
||||||
/* Path already exists, need to replace it */
|
/* Path already exists, need to replace it */
|
||||||
replaceValidPath(store.toRealPath(finalDestPath), actualPath);
|
replaceValidPath(store.toRealPath(finalDestPath), actualPath);
|
||||||
actualPath = store.toRealPath(finalDestPath);
|
|
||||||
} else if (buildMode == bmCheck) {
|
} else if (buildMode == bmCheck) {
|
||||||
/* Path already exists, and we want to compare, so we leave out
|
/* Path already exists, and we want to compare, so we leave out
|
||||||
new path in place. */
|
new path in place. */
|
||||||
@@ -1731,7 +1729,6 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
|
|||||||
auto destPath = store.toRealPath(finalDestPath);
|
auto destPath = store.toRealPath(finalDestPath);
|
||||||
deletePath(destPath);
|
deletePath(destPath);
|
||||||
movePath(actualPath, destPath);
|
movePath(actualPath, destPath);
|
||||||
actualPath = destPath;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1784,7 +1781,9 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
|
|||||||
debug("unreferenced input: '%1%'", store.printStorePath(i));
|
debug("unreferenced input: '%1%'", store.printStorePath(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
store.optimisePath(actualPath, NoRepair); // FIXME: combine with scanForReferences()
|
if (!store.isValidPath(newInfo.path))
|
||||||
|
store.optimisePath(
|
||||||
|
store.toRealPath(finalDestPath), NoRepair); // FIXME: combine with scanForReferences()
|
||||||
|
|
||||||
newInfo.deriver = drvPath;
|
newInfo.deriver = drvPath;
|
||||||
newInfo.ultimate = true;
|
newInfo.ultimate = true;
|
||||||
@@ -1919,7 +1918,20 @@ StorePath DerivationBuilderImpl::makeFallbackPath(const StorePath & path)
|
|||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
std::unique_ptr<DerivationBuilder> makeDerivationBuilder(
|
void DerivationBuilderDeleter::operator()(DerivationBuilder * builder) noexcept
|
||||||
|
{
|
||||||
|
if (!builder) /* Idempotent and handles nullptr as any deleter must. */
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (auto builderImpl = dynamic_cast<DerivationBuilderImpl *>(builder))
|
||||||
|
/* Note that this might call into virtual functions, which we can't do in a destructor of
|
||||||
|
the DerivationBuilderImpl itself. */
|
||||||
|
builderImpl->cleanupOnDestruction();
|
||||||
|
|
||||||
|
delete builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<DerivationBuilder, DerivationBuilderDeleter> makeDerivationBuilder(
|
||||||
LocalStore & store, std::unique_ptr<DerivationBuilderCallbacks> miscMethods, DerivationBuilderParams params)
|
LocalStore & store, std::unique_ptr<DerivationBuilderCallbacks> miscMethods, DerivationBuilderParams params)
|
||||||
{
|
{
|
||||||
if (auto builder = ExternalDerivationBuilder::newIfSupported(store, miscMethods, params))
|
if (auto builder = ExternalDerivationBuilder::newIfSupported(store, miscMethods, params))
|
||||||
@@ -1973,17 +1985,19 @@ std::unique_ptr<DerivationBuilder> makeDerivationBuilder(
|
|||||||
throw Error("feature 'uid-range' is only supported in sandboxed builds");
|
throw Error("feature 'uid-range' is only supported in sandboxed builds");
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
return std::make_unique<DarwinDerivationBuilder>(store, std::move(miscMethods), std::move(params), useSandbox);
|
return DerivationBuilderUnique(
|
||||||
|
new DarwinDerivationBuilder(store, std::move(miscMethods), std::move(params), useSandbox));
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
if (useSandbox)
|
if (useSandbox)
|
||||||
return std::make_unique<ChrootLinuxDerivationBuilder>(store, std::move(miscMethods), std::move(params));
|
return DerivationBuilderUnique(
|
||||||
|
new ChrootLinuxDerivationBuilder(store, std::move(miscMethods), std::move(params)));
|
||||||
|
|
||||||
return std::make_unique<LinuxDerivationBuilder>(store, std::move(miscMethods), std::move(params));
|
return DerivationBuilderUnique(new LinuxDerivationBuilder(store, std::move(miscMethods), std::move(params)));
|
||||||
#else
|
#else
|
||||||
if (useSandbox)
|
if (useSandbox)
|
||||||
throw Error("sandboxing builds is not supported on this platform");
|
throw Error("sandboxing builds is not supported on this platform");
|
||||||
|
|
||||||
return std::make_unique<DerivationBuilderImpl>(store, std::move(miscMethods), std::move(params));
|
return DerivationBuilderUnique(new DerivationBuilderImpl(store, std::move(miscMethods), std::move(params)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ struct ExternalDerivationBuilder : DerivationBuilderImpl
|
|||||||
experimentalFeatureSettings.require(Xp::ExternalBuilders);
|
experimentalFeatureSettings.require(Xp::ExternalBuilders);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::unique_ptr<ExternalDerivationBuilder> newIfSupported(
|
static std::unique_ptr<ExternalDerivationBuilder, DerivationBuilderDeleter> newIfSupported(
|
||||||
LocalStore & store, std::unique_ptr<DerivationBuilderCallbacks> & miscMethods, DerivationBuilderParams & params)
|
LocalStore & store, std::unique_ptr<DerivationBuilderCallbacks> & miscMethods, DerivationBuilderParams & params)
|
||||||
{
|
{
|
||||||
for (auto & handler : settings.externalBuilders.get()) {
|
for (auto & handler : settings.externalBuilders.get()) {
|
||||||
for (auto & system : handler.systems)
|
for (auto & system : handler.systems)
|
||||||
if (params.drv.platform == system)
|
if (params.drv.platform == system)
|
||||||
return std::make_unique<ExternalDerivationBuilder>(
|
return std::unique_ptr<ExternalDerivationBuilder, DerivationBuilderDeleter>(
|
||||||
store, std::move(miscMethods), std::move(params), handler);
|
new ExternalDerivationBuilder(store, std::move(miscMethods), std::move(params), handler));
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -703,7 +703,7 @@ struct ChrootLinuxDerivationBuilder : ChrootDerivationBuilder, LinuxDerivationBu
|
|||||||
DerivationBuilderImpl::killSandbox(getStats);
|
DerivationBuilderImpl::killSandbox(getStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDependency(const StorePath & path) override
|
void addDependencyImpl(const StorePath & path) override
|
||||||
{
|
{
|
||||||
auto [source, target] = ChrootDerivationBuilder::addDependencyPrep(path);
|
auto [source, target] = ChrootDerivationBuilder::addDependencyPrep(path);
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ R""(
|
|||||||
|
|
||||||
; Allow DNS lookups.
|
; Allow DNS lookups.
|
||||||
(allow network-outbound (remote unix-socket (path-literal "/private/var/run/mDNSResponder")))
|
(allow network-outbound (remote unix-socket (path-literal "/private/var/run/mDNSResponder")))
|
||||||
|
(allow mach-lookup (global-name "com.apple.SystemConfiguration.DNSConfiguration"))
|
||||||
|
|
||||||
; Allow access to trustd.
|
; Allow access to trustd.
|
||||||
(allow mach-lookup (global-name "com.apple.trustd"))
|
(allow mach-lookup (global-name "com.apple.trustd"))
|
||||||
|
|||||||
@@ -868,6 +868,12 @@ TEST_P(ParsedURLPathSegmentsTest, segmentsAreCorrect)
|
|||||||
EXPECT_EQ(encodeUrlPath(segments), testCase.path);
|
EXPECT_EQ(encodeUrlPath(segments), testCase.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_P(ParsedURLPathSegmentsTest, to_string)
|
||||||
|
{
|
||||||
|
const auto & testCase = GetParam();
|
||||||
|
EXPECT_EQ(testCase.url, parseURL(testCase.url).to_string());
|
||||||
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
ParsedURL,
|
ParsedURL,
|
||||||
ParsedURLPathSegmentsTest,
|
ParsedURLPathSegmentsTest,
|
||||||
@@ -886,6 +892,13 @@ INSTANTIATE_TEST_SUITE_P(
|
|||||||
.skipEmpty = false,
|
.skipEmpty = false,
|
||||||
.description = "empty_authority_empty_path",
|
.description = "empty_authority_empty_path",
|
||||||
},
|
},
|
||||||
|
ParsedURLPathSegmentsTestCase{
|
||||||
|
.url = "path:/",
|
||||||
|
.segments = {"", ""},
|
||||||
|
.path = "/",
|
||||||
|
.skipEmpty = false,
|
||||||
|
.description = "empty_authority_root_path",
|
||||||
|
},
|
||||||
ParsedURLPathSegmentsTestCase{
|
ParsedURLPathSegmentsTestCase{
|
||||||
.url = "scheme:///",
|
.url = "scheme:///",
|
||||||
.segments = {"", ""},
|
.segments = {"", ""},
|
||||||
|
|||||||
@@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
GlobalConfig::ConfigRegistrations & GlobalConfig::configRegistrations()
|
||||||
|
{
|
||||||
|
static GlobalConfig::ConfigRegistrations configRegistrations;
|
||||||
|
return configRegistrations;
|
||||||
|
}
|
||||||
|
|
||||||
bool GlobalConfig::set(const std::string & name, const std::string & value)
|
bool GlobalConfig::set(const std::string & name, const std::string & value)
|
||||||
{
|
{
|
||||||
for (auto & config : configRegistrations())
|
for (auto & config : configRegistrations())
|
||||||
|
|||||||
@@ -730,11 +730,10 @@ Path makeTempPath(const Path & root, const Path & suffix)
|
|||||||
|
|
||||||
void createSymlink(const Path & target, const Path & link)
|
void createSymlink(const Path & target, const Path & link)
|
||||||
{
|
{
|
||||||
try {
|
std::error_code ec;
|
||||||
std::filesystem::create_symlink(target, link);
|
std::filesystem::create_symlink(target, link, ec);
|
||||||
} catch (std::filesystem::filesystem_error & e) {
|
if (ec)
|
||||||
throw SysError("creating symlink '%1%' -> '%2%'", link, target);
|
throw SysError(ec.value(), "creating symlink '%1%' -> '%2%'", link, target);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void replaceSymlink(const std::filesystem::path & target, const std::filesystem::path & link)
|
void replaceSymlink(const std::filesystem::path & target, const std::filesystem::path & link)
|
||||||
|
|||||||
@@ -9,11 +9,7 @@ struct GlobalConfig : public AbstractConfig
|
|||||||
{
|
{
|
||||||
typedef std::vector<Config *> ConfigRegistrations;
|
typedef std::vector<Config *> ConfigRegistrations;
|
||||||
|
|
||||||
static ConfigRegistrations & configRegistrations()
|
static ConfigRegistrations & configRegistrations();
|
||||||
{
|
|
||||||
static ConfigRegistrations configRegistrations;
|
|
||||||
return configRegistrations;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool set(const std::string & name, const std::string & value) override;
|
bool set(const std::string & name, const std::string & value) override;
|
||||||
|
|
||||||
|
|||||||
@@ -287,6 +287,10 @@ class AutoDelete
|
|||||||
public:
|
public:
|
||||||
AutoDelete();
|
AutoDelete();
|
||||||
AutoDelete(const std::filesystem::path & p, bool recursive = true);
|
AutoDelete(const std::filesystem::path & p, bool recursive = true);
|
||||||
|
AutoDelete(AutoDelete &&) = delete;
|
||||||
|
AutoDelete(const AutoDelete &) = delete;
|
||||||
|
AutoDelete & operator=(AutoDelete &&) = delete;
|
||||||
|
AutoDelete & operator=(const AutoDelete &) = delete;
|
||||||
~AutoDelete();
|
~AutoDelete();
|
||||||
|
|
||||||
void cancel();
|
void cancel();
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
#include "nix/util/error.hh"
|
#include "nix/util/error.hh"
|
||||||
#include "nix/util/canon-path.hh"
|
#include "nix/util/canon-path.hh"
|
||||||
|
#include "nix/util/split.hh"
|
||||||
|
#include "nix/util/util.hh"
|
||||||
|
#include "nix/util/variant-wrapper.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
@@ -342,8 +345,7 @@ ParsedURL fixGitURL(const std::string & url);
|
|||||||
bool isValidSchemeName(std::string_view scheme);
|
bool isValidSchemeName(std::string_view scheme);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Either a ParsedURL or a verbatim string, but the string must be a valid
|
* Either a ParsedURL or a verbatim string. This is necessary because in certain cases URI must be passed
|
||||||
* ParsedURL. This is necessary because in certain cases URI must be passed
|
|
||||||
* verbatim (e.g. in builtin fetchers), since those are specified by the user.
|
* verbatim (e.g. in builtin fetchers), since those are specified by the user.
|
||||||
* In those cases normalizations performed by the ParsedURL might be surprising
|
* In those cases normalizations performed by the ParsedURL might be surprising
|
||||||
* and undesirable, since Nix must be a universal client that has to work with
|
* and undesirable, since Nix must be a universal client that has to work with
|
||||||
@@ -354,23 +356,23 @@ bool isValidSchemeName(std::string_view scheme);
|
|||||||
*
|
*
|
||||||
* Though we perform parsing and validation for internal needs.
|
* Though we perform parsing and validation for internal needs.
|
||||||
*/
|
*/
|
||||||
struct ValidURL : private ParsedURL
|
struct VerbatimURL
|
||||||
{
|
{
|
||||||
std::optional<std::string> encoded;
|
using Raw = std::variant<std::string, ParsedURL>;
|
||||||
|
Raw raw;
|
||||||
|
|
||||||
ValidURL(std::string str)
|
VerbatimURL(std::string_view s)
|
||||||
: ParsedURL(parseURL(str, /*lenient=*/false))
|
: raw(std::string{s})
|
||||||
, encoded(std::move(str))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidURL(std::string_view str)
|
VerbatimURL(std::string s)
|
||||||
: ValidURL(std::string{str})
|
: raw(std::move(s))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidURL(ParsedURL parsed)
|
VerbatimURL(ParsedURL url)
|
||||||
: ParsedURL{std::move(parsed)}
|
: raw(std::move(url))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,25 +381,35 @@ struct ValidURL : private ParsedURL
|
|||||||
*/
|
*/
|
||||||
std::string to_string() const
|
std::string to_string() const
|
||||||
{
|
{
|
||||||
return encoded.or_else([&]() -> std::optional<std::string> { return ParsedURL::to_string(); }).value();
|
return std::visit(
|
||||||
|
overloaded{
|
||||||
|
[](const std::string & str) { return str; }, [](const ParsedURL & url) { return url.to_string(); }},
|
||||||
|
raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ParsedURL & parsed() const &
|
const ParsedURL parsed() const
|
||||||
{
|
{
|
||||||
return *this;
|
return std::visit(
|
||||||
|
overloaded{
|
||||||
|
[](const std::string & str) { return parseURL(str); }, [](const ParsedURL & url) { return url; }},
|
||||||
|
raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view scheme() const &
|
std::string_view scheme() const &
|
||||||
{
|
{
|
||||||
return ParsedURL::scheme;
|
return std::visit(
|
||||||
}
|
overloaded{
|
||||||
|
[](std::string_view str) {
|
||||||
const auto & path() const &
|
auto scheme = splitPrefixTo(str, ':');
|
||||||
{
|
if (!scheme)
|
||||||
return ParsedURL::path;
|
throw BadURL("URL '%s' doesn't have a scheme", str);
|
||||||
|
return *scheme;
|
||||||
|
},
|
||||||
|
[](const ParsedURL & url) -> std::string_view { return url.scheme; }},
|
||||||
|
raw);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream & operator<<(std::ostream & os, const ValidURL & url);
|
std::ostream & operator<<(std::ostream & os, const VerbatimURL & url);
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
@@ -64,7 +64,7 @@ boost = dependency(
|
|||||||
'url',
|
'url',
|
||||||
],
|
],
|
||||||
include_type : 'system',
|
include_type : 'system',
|
||||||
version : '>=1.82.0',
|
version : '>=1.87.0',
|
||||||
)
|
)
|
||||||
# boost is a public dependency, but not a pkg-config dependency unfortunately, so we
|
# boost is a public dependency, but not a pkg-config dependency unfortunately, so we
|
||||||
# put in `deps_other`.
|
# put in `deps_other`.
|
||||||
|
|||||||
@@ -35,14 +35,18 @@ struct UnionSourceAccessor : SourceAccessor
|
|||||||
DirEntries readDirectory(const CanonPath & path) override
|
DirEntries readDirectory(const CanonPath & path) override
|
||||||
{
|
{
|
||||||
DirEntries result;
|
DirEntries result;
|
||||||
|
bool exists = false;
|
||||||
for (auto & accessor : accessors) {
|
for (auto & accessor : accessors) {
|
||||||
auto st = accessor->maybeLstat(path);
|
auto st = accessor->maybeLstat(path);
|
||||||
if (!st)
|
if (!st)
|
||||||
continue;
|
continue;
|
||||||
|
exists = true;
|
||||||
for (auto & entry : accessor->readDirectory(path))
|
for (auto & entry : accessor->readDirectory(path))
|
||||||
// Don't override entries from previous accessors.
|
// Don't override entries from previous accessors.
|
||||||
result.insert(entry);
|
result.insert(entry);
|
||||||
}
|
}
|
||||||
|
if (!exists)
|
||||||
|
throw FileNotFound("path '%s' does not exist", showPath(path));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -350,7 +350,7 @@ std::string ParsedURL::renderAuthorityAndPath() const
|
|||||||
must either be empty or begin with a slash ("/") character. */
|
must either be empty or begin with a slash ("/") character. */
|
||||||
assert(path.empty() || path.front().empty());
|
assert(path.empty() || path.front().empty());
|
||||||
res += authority->to_string();
|
res += authority->to_string();
|
||||||
} else if (std::ranges::equal(std::views::take(path, 2), std::views::repeat("", 2))) {
|
} else if (std::ranges::equal(std::views::take(path, 3), std::views::repeat("", 3))) {
|
||||||
/* If a URI does not contain an authority component, then the path cannot begin
|
/* If a URI does not contain an authority component, then the path cannot begin
|
||||||
with two slash characters ("//") */
|
with two slash characters ("//") */
|
||||||
unreachable();
|
unreachable();
|
||||||
@@ -434,7 +434,7 @@ bool isValidSchemeName(std::string_view s)
|
|||||||
return std::regex_match(s.begin(), s.end(), regex, std::regex_constants::match_default);
|
return std::regex_match(s.begin(), s.end(), regex, std::regex_constants::match_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream & operator<<(std::ostream & os, const ValidURL & url)
|
std::ostream & operator<<(std::ostream & os, const VerbatimURL & url)
|
||||||
{
|
{
|
||||||
os << url.to_string();
|
os << url.to_string();
|
||||||
return os;
|
return os;
|
||||||
|
|||||||
+1
-4
@@ -41,10 +41,7 @@ struct CmdCatStore : StoreCommand, MixCat
|
|||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
auto [storePath, rest] = store->toStorePath(path);
|
auto [storePath, rest] = store->toStorePath(path);
|
||||||
auto accessor = store->getFSAccessor(storePath);
|
cat(store->requireStoreObjectAccessor(storePath), CanonPath{rest});
|
||||||
if (!accessor)
|
|
||||||
throw InvalidPath("path '%1%' is not a valid store path", store->printStorePath(storePath));
|
|
||||||
cat(ref{std::move(accessor)}, CanonPath{rest});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -798,8 +798,6 @@ struct CmdFlakeCheck : FlakeCommand
|
|||||||
// via substitution, as `nix flake check` only needs to verify buildability,
|
// via substitution, as `nix flake check` only needs to verify buildability,
|
||||||
// not actually produce the outputs.
|
// not actually produce the outputs.
|
||||||
auto missing = store->queryMissing(drvPaths);
|
auto missing = store->queryMissing(drvPaths);
|
||||||
// Only occurs if `drvPaths` contains a `DerivedPath::Opaque`, which should never happen
|
|
||||||
assert(missing.unknown.empty());
|
|
||||||
|
|
||||||
std::vector<DerivedPath> toBuild;
|
std::vector<DerivedPath> toBuild;
|
||||||
for (auto & path : missing.willBuild) {
|
for (auto & path : missing.willBuild) {
|
||||||
|
|||||||
+1
-4
@@ -115,10 +115,7 @@ struct CmdLsStore : StoreCommand, MixLs
|
|||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
auto [storePath, rest] = store->toStorePath(path);
|
auto [storePath, rest] = store->toStorePath(path);
|
||||||
auto accessor = store->getFSAccessor(storePath);
|
list(store->requireStoreObjectAccessor(storePath), CanonPath{rest});
|
||||||
if (!accessor)
|
|
||||||
throw InvalidPath("path '%1%' is not a valid store path", store->printStorePath(storePath));
|
|
||||||
list(ref{std::move(accessor)}, CanonPath{rest});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ static void registerValidity(bool reregister, bool hashGiven, bool canonicalise)
|
|||||||
#endif
|
#endif
|
||||||
if (!hashGiven) {
|
if (!hashGiven) {
|
||||||
HashResult hash = hashPath(
|
HashResult hash = hashPath(
|
||||||
{ref{store->getFSAccessor(info->path, false)}},
|
{store->requireStoreObjectAccessor(info->path, /*requireValidPath=*/false)},
|
||||||
FileSerialisationMethod::NixArchive,
|
FileSerialisationMethod::NixArchive,
|
||||||
HashAlgorithm::SHA256);
|
HashAlgorithm::SHA256);
|
||||||
info->narHash = hash.hash;
|
info->narHash = hash.hash;
|
||||||
@@ -986,6 +986,16 @@ static void opServe(Strings opFlags, Strings opArgs)
|
|||||||
store->narFromPath(store->parseStorePath(readString(in)), out);
|
store->narFromPath(store->parseStorePath(readString(in)), out);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ServeProto::Command::ImportPaths: {
|
||||||
|
if (!writeAllowed)
|
||||||
|
throw Error("importing paths is not allowed");
|
||||||
|
// FIXME: should we skip sig checking?
|
||||||
|
importPaths(*store, in, NoCheckSigs);
|
||||||
|
// indicate success
|
||||||
|
out << 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case ServeProto::Command::BuildPaths: {
|
case ServeProto::Command::BuildPaths: {
|
||||||
|
|
||||||
if (!writeAllowed)
|
if (!writeAllowed)
|
||||||
|
|||||||
+1
-1
@@ -105,7 +105,7 @@ std::tuple<StorePath, Hash> prefetchFile(
|
|||||||
|
|
||||||
FdSink sink(fd.get());
|
FdSink sink(fd.get());
|
||||||
|
|
||||||
FileTransferRequest req(ValidURL{url});
|
FileTransferRequest req(VerbatimURL{url});
|
||||||
req.decompress = false;
|
req.decompress = false;
|
||||||
getFileTransfer()->download(std::move(req), sink);
|
getFileTransfer()->download(std::move(req), sink);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ struct CmdWhyDepends : SourceExprCommand, MixOperateOnOptions
|
|||||||
contain the reference. */
|
contain the reference. */
|
||||||
std::map<std::string, Strings> hits;
|
std::map<std::string, Strings> hits;
|
||||||
|
|
||||||
auto accessor = store->getFSAccessor(node.path);
|
auto accessor = store->requireStoreObjectAccessor(node.path);
|
||||||
|
|
||||||
auto visitPath = [&](this auto && recur, const CanonPath & p) -> void {
|
auto visitPath = [&](this auto && recur, const CanonPath & p) -> void {
|
||||||
auto st = accessor->maybeLstat(p);
|
auto st = accessor->maybeLstat(p);
|
||||||
|
|||||||
Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -x
|
||||||
|
set -e
|
||||||
|
|
||||||
|
[ -n "$OUT_PATHS" ]
|
||||||
|
[ -n "$DRV_PATH" ]
|
||||||
|
[ -n "$HOOK_DEST" ]
|
||||||
|
|
||||||
|
for o in $OUT_PATHS; do
|
||||||
|
echo "$o" >> "$HOOK_DEST"
|
||||||
|
done
|
||||||
@@ -228,6 +228,10 @@ path8=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = \"file://$rep
|
|||||||
rev4=$(git -C "$repo" rev-parse HEAD)
|
rev4=$(git -C "$repo" rev-parse HEAD)
|
||||||
rev4_nix=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = \"file://$repo\"; ref = \"HEAD\"; }).rev")
|
rev4_nix=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = \"file://$repo\"; ref = \"HEAD\"; }).rev")
|
||||||
[[ $rev4 = "$rev4_nix" ]]
|
[[ $rev4 = "$rev4_nix" ]]
|
||||||
|
export _NIX_FORCE_HTTP=1
|
||||||
|
rev4_nix=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = \"file://$repo\"; ref = \"HEAD\"; }).rev")
|
||||||
|
[[ $rev4 = "$rev4_nix" ]]
|
||||||
|
unset _NIX_FORCE_HTTP
|
||||||
|
|
||||||
# The name argument should be handled
|
# The name argument should be handled
|
||||||
path9=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = \"file://$repo\"; ref = \"HEAD\"; name = \"foo\"; }).outPath")
|
path9=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = \"file://$repo\"; ref = \"HEAD\"; name = \"foo\"; }).outPath")
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ invalid_ref() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
valid_ref 'A/b'
|
||||||
|
valid_ref 'AaA/b'
|
||||||
|
valid_ref 'FOO/BAR/BAZ'
|
||||||
valid_ref 'foox'
|
valid_ref 'foox'
|
||||||
valid_ref '1337'
|
valid_ref '1337'
|
||||||
valid_ref 'foo.baz'
|
valid_ref 'foo.baz'
|
||||||
|
|||||||
Loaded 100 of 129 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user