mirror of
https://github.com/NixOS/nix.git
synced 2025-11-28 13:11:00 +01:00
Merge remote-tracking branch 'origin/master' into gdennis/git-filter-config
This commit is contained in:
commit
9bba7ac3e8
887 changed files with 34455 additions and 28681 deletions
|
|
@ -8,7 +8,7 @@ BraceWrapping:
|
|||
AfterUnion: true
|
||||
SplitEmptyRecord: false
|
||||
PointerAlignment: Middle
|
||||
FixNamespaceComments: false
|
||||
FixNamespaceComments: true
|
||||
SortIncludes: Never
|
||||
#IndentPPDirectives: BeforeHash
|
||||
SpaceAfterCStyleCast: true
|
||||
|
|
@ -32,3 +32,4 @@ IndentPPDirectives: AfterHash
|
|||
PPIndentWidth: 2
|
||||
BinPackArguments: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
SeparateDefinitionBlocks: Always
|
||||
|
|
|
|||
6
.git-blame-ignore-revs
Normal file
6
.git-blame-ignore-revs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# bulk initial re-formatting with clang-format
|
||||
e4f62e46088919428a68bd8014201dc8e379fed7 # !autorebase ./maintainers/format.sh --until-stable
|
||||
# meson re-formatting
|
||||
385e2c3542c707d95e3784f7f6d623f67e77ab61 # !autorebase ./maintainers/format.sh --until-stable
|
||||
# nixfmt 1.0.0
|
||||
1d943f581908f35075a84a3d89c2eba3ff35067f # !autorebase ./maintainers/format.sh --until-stable
|
||||
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
|
@ -45,7 +45,7 @@ assignees: ''
|
|||
- [ ] checked [latest Nix manual] \([source])
|
||||
- [ ] checked [open bug issues and pull requests] for possible duplicates
|
||||
|
||||
[latest Nix manual]: https://nixos.org/manual/nix/unstable/
|
||||
[latest Nix manual]: https://nix.dev/manual/nix/development/
|
||||
[source]: https://github.com/NixOS/nix/tree/master/doc/manual/source
|
||||
[open bug issues and pull requests]: https://github.com/NixOS/nix/labels/bug
|
||||
|
||||
|
|
|
|||
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
|
@ -30,7 +30,7 @@ assignees: ''
|
|||
- [ ] checked [latest Nix manual] \([source])
|
||||
- [ ] checked [open feature issues and pull requests] for possible duplicates
|
||||
|
||||
[latest Nix manual]: https://nixos.org/manual/nix/unstable/
|
||||
[latest Nix manual]: https://nix.dev/manual/nix/development/
|
||||
[source]: https://github.com/NixOS/nix/tree/master/doc/manual/source
|
||||
[open feature issues and pull requests]: https://github.com/NixOS/nix/labels/feature
|
||||
|
||||
|
|
|
|||
2
.github/ISSUE_TEMPLATE/installer.md
vendored
2
.github/ISSUE_TEMPLATE/installer.md
vendored
|
|
@ -38,7 +38,7 @@ assignees: ''
|
|||
- [ ] checked [latest Nix manual] \([source])
|
||||
- [ ] checked [open installer issues and pull requests] for possible duplicates
|
||||
|
||||
[latest Nix manual]: https://nixos.org/manual/nix/unstable/
|
||||
[latest Nix manual]: https://nix.dev/manual/nix/development/
|
||||
[source]: https://github.com/NixOS/nix/tree/master/doc/manual/source
|
||||
[open installer issues and pull requests]: https://github.com/NixOS/nix/labels/installer
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ assignees: ''
|
|||
- [ ] checked [latest Nix manual] \([source])
|
||||
- [ ] checked [open documentation issues and pull requests] for possible duplicates
|
||||
|
||||
[latest Nix manual]: https://nixos.org/manual/nix/unstable/
|
||||
[latest Nix manual]: https://nix.dev/manual/nix/development/
|
||||
[source]: https://github.com/NixOS/nix/tree/master/doc/manual/source
|
||||
[open documentation issues and pull requests]: https://github.com/NixOS/nix/labels/documentation
|
||||
|
||||
|
|
|
|||
50
.github/actions/install-nix-action/action.yaml
vendored
Normal file
50
.github/actions/install-nix-action/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
name: "Install Nix"
|
||||
description: "Helper action for installing Nix with support for dogfooding from master"
|
||||
inputs:
|
||||
dogfood:
|
||||
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
|
||||
extra_nix_config:
|
||||
description: "Gets appended to `/etc/nix/nix.conf` if passed."
|
||||
install_url:
|
||||
description: "URL of the Nix installer"
|
||||
required: false
|
||||
default: "https://releases.nixos.org/nix/nix-2.30.2/install"
|
||||
github_token:
|
||||
description: "Github token"
|
||||
required: true
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Download nix install artifact from master"
|
||||
shell: bash
|
||||
id: download-nix-installer
|
||||
if: inputs.dogfood == 'true'
|
||||
run: |
|
||||
RUN_ID=$(gh run list --repo "$DOGFOOD_REPO" --workflow ci.yml --branch master --status success --json databaseId --jq ".[0].databaseId")
|
||||
|
||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||
INSTALLER_ARTIFACT="installer-linux"
|
||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||
INSTALLER_ARTIFACT="installer-darwin"
|
||||
else
|
||||
echo "::error ::Unsupported RUNNER_OS: $RUNNER_OS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
INSTALLER_DOWNLOAD_DIR="$GITHUB_WORKSPACE/$INSTALLER_ARTIFACT"
|
||||
mkdir -p "$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 "::notice ::Dogfooding Nix installer from master (https://github.com/$DOGFOOD_REPO/actions/runs/$RUN_ID)"
|
||||
env:
|
||||
GH_TOKEN: ${{ inputs.github_token }}
|
||||
DOGFOOD_REPO: "NixOS/nix"
|
||||
- uses: cachix/install-nix-action@c134e4c9e34bac6cab09cf239815f9339aaaf84e # v31.5.1
|
||||
with:
|
||||
# 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_options: ${{ inputs.dogfood == 'true' && format('--tarball-url-prefix {0}', steps.download-nix-installer.outputs.installer-path) || '' }}
|
||||
extra_nix_config: ${{ inputs.extra_nix_config }}
|
||||
141
.github/workflows/ci.yml
vendored
141
.github/workflows/ci.yml
vendored
|
|
@ -2,7 +2,15 @@ name: "CI"
|
|||
|
||||
on:
|
||||
pull_request:
|
||||
merge_group:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
dogfood:
|
||||
description: 'Use dogfood Nix build'
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
|
||||
permissions: read-all
|
||||
|
||||
|
|
@ -10,11 +18,16 @@ jobs:
|
|||
eval:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: cachix/install-nix-action@v31
|
||||
- run: nix --experimental-features 'nix-command flakes' flake show --all-systems --json
|
||||
- uses: ./.github/actions/install-nix-action
|
||||
with:
|
||||
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
||||
extra_nix_config:
|
||||
experimental-features = nix-command flakes
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- run: nix flake show --all-systems --json
|
||||
|
||||
tests:
|
||||
strategy:
|
||||
|
|
@ -24,34 +37,69 @@ jobs:
|
|||
- scenario: on ubuntu
|
||||
runs-on: ubuntu-24.04
|
||||
os: linux
|
||||
instrumented: false
|
||||
primary: true
|
||||
stdenv: stdenv
|
||||
- scenario: on macos
|
||||
runs-on: macos-14
|
||||
os: darwin
|
||||
instrumented: false
|
||||
primary: true
|
||||
stdenv: stdenv
|
||||
- scenario: on ubuntu (with sanitizers / coverage)
|
||||
runs-on: ubuntu-24.04
|
||||
os: linux
|
||||
instrumented: true
|
||||
primary: false
|
||||
stdenv: clangStdenv
|
||||
name: tests ${{ matrix.scenario }}
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: cachix/install-nix-action@v31
|
||||
- uses: ./.github/actions/install-nix-action
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
||||
# The sandbox would otherwise be disabled by default on Darwin
|
||||
extra_nix_config: |
|
||||
sandbox = true
|
||||
max-jobs = 1
|
||||
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:
|
||||
# https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces
|
||||
- run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
|
||||
if: matrix.os == 'linux'
|
||||
- run: scripts/build-checks
|
||||
- run: scripts/prepare-installer-for-github-actions
|
||||
- name: Run component tests
|
||||
run: |
|
||||
nix build --file ci/gha/tests/wrapper.nix componentTests -L \
|
||||
--arg withInstrumentation ${{ matrix.instrumented }} \
|
||||
--argstr stdenv "${{ matrix.stdenv }}"
|
||||
- name: Run flake checks and prepare the installer tarball
|
||||
run: |
|
||||
ci/gha/tests/build-checks
|
||||
ci/gha/tests/prepare-installer-for-github-actions
|
||||
if: ${{ matrix.primary }}
|
||||
- name: Collect code coverage
|
||||
run: |
|
||||
nix build --file ci/gha/tests/wrapper.nix codeCoverage.coverageReports -L \
|
||||
--arg withInstrumentation ${{ matrix.instrumented }} \
|
||||
--argstr stdenv "${{ matrix.stdenv }}" \
|
||||
--out-link coverage-reports
|
||||
cat coverage-reports/index.txt >> $GITHUB_STEP_SUMMARY
|
||||
if: ${{ matrix.instrumented }}
|
||||
- name: Upload coverage reports
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage-reports
|
||||
path: coverage-reports/
|
||||
if: ${{ matrix.instrumented }}
|
||||
- name: Upload installer tarball
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: installer-${{matrix.os}}
|
||||
path: out/*
|
||||
if: ${{ matrix.primary }}
|
||||
|
||||
installer_test:
|
||||
needs: [tests]
|
||||
|
|
@ -68,19 +116,19 @@ jobs:
|
|||
name: installer test ${{ matrix.scenario }}
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
- name: Download installer tarball
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: installer-${{matrix.os}}
|
||||
path: out
|
||||
- name: Serving installer
|
||||
id: serving_installer
|
||||
run: ./scripts/serve-installer-for-github-actions
|
||||
- name: Looking up the installer tarball URL
|
||||
id: installer-tarball-url
|
||||
run: echo "installer-url=file://$GITHUB_WORKSPACE/out" >> "$GITHUB_OUTPUT"
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
install_url: 'http://localhost:8126/install'
|
||||
install_options: "--tarball-url-prefix http://localhost:8126/"
|
||||
install_url: ${{ format('{0}/install', steps.installer-tarball-url.outputs.installer-url) }}
|
||||
install_options: ${{ format('--tarball-url-prefix {0}', steps.installer-tarball-url.outputs.installer-url) }}
|
||||
- run: sudo apt install fish zsh
|
||||
if: matrix.os == 'linux'
|
||||
- run: brew install fish
|
||||
|
|
@ -99,17 +147,17 @@ jobs:
|
|||
check_secrets:
|
||||
permissions:
|
||||
contents: none
|
||||
name: Check Docker secrets present for installer tests
|
||||
name: Check presence of secrets
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
docker: ${{ steps.secret.outputs.docker }}
|
||||
steps:
|
||||
- name: Check for secrets
|
||||
- name: Check for DockerHub secrets
|
||||
id: secret
|
||||
env:
|
||||
_DOCKER_SECRETS: ${{ secrets.DOCKERHUB_USERNAME }}${{ secrets.DOCKERHUB_TOKEN }}
|
||||
run: |
|
||||
echo "::set-output name=docker::${{ env._DOCKER_SECRETS != '' }}"
|
||||
echo "docker=${{ env._DOCKER_SECRETS != '' }}" >> $GITHUB_OUTPUT
|
||||
|
||||
docker_push_image:
|
||||
needs: [tests, vm_tests, check_secrets]
|
||||
|
|
@ -122,13 +170,7 @@ jobs:
|
|||
github.ref_name == 'master'
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Check for secrets
|
||||
id: secret
|
||||
env:
|
||||
_DOCKER_SECRETS: ${{ secrets.DOCKERHUB_USERNAME }}${{ secrets.DOCKERHUB_TOKEN }}
|
||||
run: |
|
||||
echo "::set-output name=docker::${{ env._DOCKER_SECRETS != '' }}"
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: cachix/install-nix-action@v31
|
||||
|
|
@ -174,8 +216,13 @@ jobs:
|
|||
vm_tests:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: actions/checkout@v5
|
||||
- uses: ./.github/actions/install-nix-action
|
||||
with:
|
||||
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
||||
extra_nix_config:
|
||||
experimental-features = nix-command flakes
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- run: |
|
||||
nix build -L \
|
||||
|
|
@ -190,17 +237,45 @@ jobs:
|
|||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout nix
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
- name: Checkout flake-regressions
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: NixOS/flake-regressions
|
||||
path: flake-regressions
|
||||
- name: Checkout flake-regressions-data
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: NixOS/flake-regressions-data
|
||||
path: flake-regressions/tests
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: ./.github/actions/install-nix-action
|
||||
with:
|
||||
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
||||
extra_nix_config:
|
||||
experimental-features = nix-command flakes
|
||||
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
|
||||
|
||||
profile_build:
|
||||
needs: tests
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 60
|
||||
if: >-
|
||||
github.event_name == 'push' &&
|
||||
github.ref_name == 'master'
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: ./.github/actions/install-nix-action
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
||||
extra_nix_config: |
|
||||
experimental-features = flakes nix-command ca-derivations impure-derivations
|
||||
max-jobs = 1
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- run: |
|
||||
nix build -L --file ./ci/gha/profile-build buildTimeReport --out-link build-time-report.md
|
||||
cat build-time-report.md >> $GITHUB_STEP_SUMMARY
|
||||
|
|
|
|||
2
.github/workflows/labels.yml
vendored
2
.github/workflows/labels.yml
vendored
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
runs-on: ubuntu-24.04
|
||||
if: github.repository_owner == 'NixOS'
|
||||
steps:
|
||||
- uses: actions/labeler@v5
|
||||
- uses: actions/labeler@v6
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
sync-labels: false
|
||||
|
|
|
|||
22
.mergify.yml
22
.mergify.yml
|
|
@ -150,3 +150,25 @@ pull_request_rules:
|
|||
labels:
|
||||
- automatic backport
|
||||
- merge-queue
|
||||
|
||||
- name: backport patches to 2.30
|
||||
conditions:
|
||||
- label=backport 2.30-maintenance
|
||||
actions:
|
||||
backport:
|
||||
branches:
|
||||
- "2.30-maintenance"
|
||||
labels:
|
||||
- automatic backport
|
||||
- merge-queue
|
||||
|
||||
- name: backport patches to 2.31
|
||||
conditions:
|
||||
- label=backport 2.31-maintenance
|
||||
actions:
|
||||
backport:
|
||||
branches:
|
||||
- "2.31-maintenance"
|
||||
labels:
|
||||
- automatic backport
|
||||
- merge-queue
|
||||
|
|
|
|||
2
.version
2
.version
|
|
@ -1 +1 @@
|
|||
2.30.0
|
||||
2.32.0
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ Check out the [security policy](https://github.com/NixOS/nix/security/policy).
|
|||
|
||||
## Making changes to the Nix manual
|
||||
|
||||
The Nix reference manual is hosted on https://nixos.org/manual/nix.
|
||||
The Nix reference manual is hosted on https://nix.dev/manual/nix.
|
||||
The underlying source files are located in [`doc/manual/source`](./doc/manual/source).
|
||||
For small changes you can [use GitHub to edit these files](https://docs.github.com/en/repositories/working-with-files/managing-files/editing-files)
|
||||
For larger changes see the [Nix reference manual](https://nix.dev/manual/nix/development/development/contributing.html).
|
||||
|
|
|
|||
101
ci/gha/profile-build/default.nix
Normal file
101
ci/gha/profile-build/default.nix
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
nixFlake ? builtins.getFlake ("git+file://" + toString ../../..),
|
||||
system ? builtins.currentSystem,
|
||||
pkgs ? nixFlake.inputs.nixpkgs.legacyPackages.${system},
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
|
||||
nixComponentsInstrumented =
|
||||
(nixFlake.lib.makeComponents {
|
||||
inherit pkgs;
|
||||
getStdenv = p: p.clangStdenv;
|
||||
}).overrideScope
|
||||
(
|
||||
_: _: {
|
||||
mesonComponentOverrides = finalAttrs: prevAttrs: {
|
||||
outputs = (prevAttrs.outputs or [ "out" ]) ++ [ "buildprofile" ];
|
||||
nativeBuildInputs = [ pkgs.clangbuildanalyzer ] ++ prevAttrs.nativeBuildInputs or [ ];
|
||||
__impure = true;
|
||||
|
||||
env = {
|
||||
CFLAGS = "-ftime-trace";
|
||||
CXXFLAGS = "-ftime-trace";
|
||||
};
|
||||
|
||||
preBuild = ''
|
||||
ClangBuildAnalyzer --start $PWD
|
||||
'';
|
||||
|
||||
postBuild = ''
|
||||
ClangBuildAnalyzer --stop $PWD $buildprofile
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
componentsToProfile = {
|
||||
"nix-util" = { };
|
||||
"nix-util-c" = { };
|
||||
"nix-util-test-support" = { };
|
||||
"nix-util-tests" = { };
|
||||
"nix-store" = { };
|
||||
"nix-store-c" = { };
|
||||
"nix-store-test-support" = { };
|
||||
"nix-store-tests" = { };
|
||||
"nix-fetchers" = { };
|
||||
"nix-fetchers-c" = { };
|
||||
"nix-fetchers-tests" = { };
|
||||
"nix-expr" = { };
|
||||
"nix-expr-c" = { };
|
||||
"nix-expr-test-support" = { };
|
||||
"nix-expr-tests" = { };
|
||||
"nix-flake" = { };
|
||||
"nix-flake-c" = { };
|
||||
"nix-flake-tests" = { };
|
||||
"nix-main" = { };
|
||||
"nix-main-c" = { };
|
||||
"nix-cmd" = { };
|
||||
"nix-cli" = { };
|
||||
};
|
||||
|
||||
componentDerivationsToProfile = builtins.intersectAttrs componentsToProfile nixComponentsInstrumented;
|
||||
componentBuildProfiles = lib.mapAttrs (
|
||||
n: v: lib.getOutput "buildprofile" v
|
||||
) componentDerivationsToProfile;
|
||||
|
||||
buildTimeReport =
|
||||
pkgs.runCommand "build-time-report"
|
||||
{
|
||||
__impure = true;
|
||||
__structuredAttrs = true;
|
||||
nativeBuildInputs = [ pkgs.clangbuildanalyzer ];
|
||||
inherit componentBuildProfiles;
|
||||
}
|
||||
''
|
||||
{
|
||||
echo "# Build time performance profile for components:"
|
||||
echo
|
||||
echo "This reports the build profile collected via \`-ftime-trace\` for each component."
|
||||
echo
|
||||
} >> $out
|
||||
|
||||
for name in "''\${!componentBuildProfiles[@]}"; do
|
||||
{
|
||||
echo "<details><summary><strong>$name</strong></summary>"
|
||||
echo
|
||||
echo '````'
|
||||
ClangBuildAnalyzer --analyze "''\${componentBuildProfiles[$name]}"
|
||||
echo '````'
|
||||
echo
|
||||
echo "</details>"
|
||||
} >> $out
|
||||
done
|
||||
'';
|
||||
in
|
||||
|
||||
{
|
||||
inherit buildTimeReport;
|
||||
inherit componentDerivationsToProfile;
|
||||
}
|
||||
229
ci/gha/tests/default.nix
Normal file
229
ci/gha/tests/default.nix
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
{
|
||||
nixFlake ? builtins.getFlake ("git+file://" + toString ../../..),
|
||||
system ? builtins.currentSystem,
|
||||
pkgs ? nixFlake.inputs.nixpkgs.legacyPackages.${system},
|
||||
nixComponents ? (
|
||||
nixFlake.lib.makeComponents {
|
||||
inherit pkgs;
|
||||
inherit getStdenv;
|
||||
}
|
||||
),
|
||||
getStdenv ? p: p.stdenv,
|
||||
componentTestsPrefix ? "",
|
||||
withSanitizers ? false,
|
||||
withCoverage ? false,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
hydraJobs = nixFlake.hydraJobs;
|
||||
packages' = nixFlake.packages.${system};
|
||||
stdenv = (getStdenv pkgs);
|
||||
|
||||
enableSanitizersLayer = finalAttrs: prevAttrs: {
|
||||
mesonFlags =
|
||||
(prevAttrs.mesonFlags or [ ])
|
||||
++ [
|
||||
# Run all tests with UBSAN enabled. Running both with ubsan and
|
||||
# without doesn't seem to have much immediate benefit for doubling
|
||||
# the GHA CI workaround.
|
||||
#
|
||||
# TODO: Work toward enabling "address,undefined" if it seems feasible.
|
||||
# This would maybe require dropping Boost coroutines and ignoring intentional
|
||||
# memory leaks with detect_leaks=0.
|
||||
(lib.mesonOption "b_sanitize" "undefined")
|
||||
]
|
||||
++ (lib.optionals stdenv.cc.isClang [
|
||||
# https://www.github.com/mesonbuild/meson/issues/764
|
||||
(lib.mesonBool "b_lundef" false)
|
||||
]);
|
||||
};
|
||||
|
||||
collectCoverageLayer = finalAttrs: prevAttrs: {
|
||||
env =
|
||||
let
|
||||
# https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#the-code-coverage-workflow
|
||||
coverageFlags = [
|
||||
"-fprofile-instr-generate"
|
||||
"-fcoverage-mapping"
|
||||
];
|
||||
in
|
||||
{
|
||||
CFLAGS = toString coverageFlags;
|
||||
CXXFLAGS = toString coverageFlags;
|
||||
};
|
||||
|
||||
# Done in a pre-configure hook, because $NIX_BUILD_TOP needs to be substituted.
|
||||
preConfigure = prevAttrs.preConfigure or "" + ''
|
||||
mappingFlag=" -fcoverage-prefix-map=$NIX_BUILD_TOP/${finalAttrs.src.name}=${finalAttrs.src}"
|
||||
CFLAGS+="$mappingFlag"
|
||||
CXXFLAGS+="$mappingFlag"
|
||||
'';
|
||||
};
|
||||
|
||||
componentOverrides =
|
||||
(lib.optional withSanitizers enableSanitizersLayer)
|
||||
++ (lib.optional withCoverage collectCoverageLayer);
|
||||
in
|
||||
|
||||
rec {
|
||||
nixComponentsInstrumented = nixComponents.overrideScope (
|
||||
final: prev: {
|
||||
nix-store-tests = prev.nix-store-tests.override { withBenchmarks = true; };
|
||||
|
||||
mesonComponentOverrides = lib.composeManyExtensions componentOverrides;
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
Top-level tests for the flake outputs, as they would be built by hydra.
|
||||
These tests generally can't be overridden to run with sanitizers.
|
||||
*/
|
||||
topLevel = {
|
||||
installerScriptForGHA = hydraJobs.installerScriptForGHA.${system};
|
||||
installTests = hydraJobs.installTests.${system};
|
||||
nixpkgsLibTests = hydraJobs.tests.nixpkgsLibTests.${system};
|
||||
rl-next = pkgs.buildPackages.runCommand "test-rl-next-release-notes" { } ''
|
||||
LANG=C.UTF-8 ${pkgs.changelog-d}/bin/changelog-d ${../../../doc/manual/rl-next} >$out
|
||||
'';
|
||||
repl-completion = pkgs.callPackage ../../../tests/repl-completion.nix { inherit (packages') nix; };
|
||||
|
||||
/**
|
||||
Checks for our packaging expressions.
|
||||
This shouldn't build anything significant; just check that things
|
||||
(including derivations) are _set up_ correctly.
|
||||
*/
|
||||
packaging-overriding =
|
||||
let
|
||||
nix = packages'.nix;
|
||||
in
|
||||
assert (nix.appendPatches [ pkgs.emptyFile ]).libs.nix-util.src.patches == [ pkgs.emptyFile ];
|
||||
if pkgs.stdenv.buildPlatform.isDarwin then
|
||||
lib.warn "packaging-overriding check currently disabled because of a permissions issue on macOS" pkgs.emptyFile
|
||||
else
|
||||
# If this fails, something might be wrong with how we've wired the scope,
|
||||
# or something could be broken in Nixpkgs.
|
||||
pkgs.testers.testEqualContents {
|
||||
assertion = "trivial patch does not change source contents";
|
||||
expected = "${../../..}";
|
||||
actual =
|
||||
# Same for all components; nix-util is an arbitrary pick
|
||||
(nix.appendPatches [ pkgs.emptyFile ]).libs.nix-util.src;
|
||||
};
|
||||
};
|
||||
|
||||
componentTests =
|
||||
(lib.concatMapAttrs (
|
||||
pkgName: pkg:
|
||||
lib.concatMapAttrs (testName: test: {
|
||||
"${componentTestsPrefix}${pkgName}-${testName}" = test;
|
||||
}) (pkg.tests or { })
|
||||
) nixComponentsInstrumented)
|
||||
// lib.optionalAttrs (pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform) {
|
||||
"${componentTestsPrefix}nix-functional-tests" = nixComponentsInstrumented.nix-functional-tests;
|
||||
};
|
||||
|
||||
codeCoverage =
|
||||
let
|
||||
componentsTestsToProfile =
|
||||
(builtins.mapAttrs (n: v: nixComponentsInstrumented.${n}.tests.run) {
|
||||
"nix-util-tests" = { };
|
||||
"nix-store-tests" = { };
|
||||
"nix-fetchers-tests" = { };
|
||||
"nix-expr-tests" = { };
|
||||
"nix-flake-tests" = { };
|
||||
})
|
||||
// {
|
||||
inherit (nixComponentsInstrumented) nix-functional-tests;
|
||||
};
|
||||
|
||||
coverageProfileDrvs = lib.mapAttrs (
|
||||
n: v:
|
||||
v.overrideAttrs (
|
||||
finalAttrs: prevAttrs: {
|
||||
outputs = (prevAttrs.outputs or [ "out" ]) ++ [ "profraw" ];
|
||||
env = {
|
||||
LLVM_PROFILE_FILE = "${placeholder "profraw"}/%m";
|
||||
};
|
||||
}
|
||||
)
|
||||
) componentsTestsToProfile;
|
||||
|
||||
coverageProfiles = lib.mapAttrsToList (n: v: lib.getOutput "profraw" v) coverageProfileDrvs;
|
||||
|
||||
mergedProfdata =
|
||||
pkgs.runCommand "merged-profdata"
|
||||
{
|
||||
__structuredAttrs = true;
|
||||
nativeBuildInputs = [ pkgs.llvmPackages.libllvm ];
|
||||
inherit coverageProfiles;
|
||||
}
|
||||
''
|
||||
rawProfiles=()
|
||||
for dir in "''\${coverageProfiles[@]}"; do
|
||||
rawProfiles+=($dir/*)
|
||||
done
|
||||
llvm-profdata merge -sparse -output $out "''\${rawProfiles[@]}"
|
||||
'';
|
||||
|
||||
coverageReports =
|
||||
let
|
||||
nixComponentDrvs = lib.filter (lib.isDerivation) (lib.attrValues nixComponentsInstrumented);
|
||||
in
|
||||
pkgs.runCommand "code-coverage-report"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
pkgs.llvmPackages.libllvm
|
||||
pkgs.jq
|
||||
];
|
||||
__structuredAttrs = true;
|
||||
nixComponents = nixComponentDrvs;
|
||||
}
|
||||
''
|
||||
# ${toString (lib.map (v: v.src) nixComponentDrvs)}
|
||||
|
||||
binaryFiles=()
|
||||
for dir in "''\${nixComponents[@]}"; do
|
||||
readarray -t filesInDir < <(find "$dir" -type f -executable)
|
||||
binaryFiles+=("''\${filesInDir[@]}")
|
||||
done
|
||||
|
||||
arguments=$(concatStringsSep " -object " binaryFiles)
|
||||
llvm-cov show $arguments -instr-profile ${mergedProfdata} -output-dir $out -format=html
|
||||
|
||||
{
|
||||
echo "# Code coverage summary (generated via \`llvm-cov\`):"
|
||||
echo
|
||||
echo '```'
|
||||
llvm-cov report $arguments -instr-profile ${mergedProfdata} -format=text -use-color=false
|
||||
echo '```'
|
||||
echo
|
||||
} >> $out/index.txt
|
||||
|
||||
llvm-cov export $arguments -instr-profile ${mergedProfdata} -format=text > $out/coverage.json
|
||||
|
||||
mkdir -p $out/nix-support
|
||||
|
||||
coverageTotals=$(jq ".data[0].totals" $out/coverage.json)
|
||||
|
||||
# Mostly inline from pkgs/build-support/setup-hooks/make-coverage-analysis-report.sh [1],
|
||||
# which we can't use here, because we rely on LLVM's infra for source code coverage collection.
|
||||
# [1]: https://github.com/NixOS/nixpkgs/blob/67bb48c4c8e327417d6d5aa7e538244b209e852b/pkgs/build-support/setup-hooks/make-coverage-analysis-report.sh#L16
|
||||
declare -A metricsArray=(["lineCoverage"]="lines" ["functionCoverage"]="functions" ["branchCoverage"]="branches")
|
||||
|
||||
for metricName in "''\${!metricsArray[@]}"; do
|
||||
key="''\${metricsArray[$metricName]}"
|
||||
metric=$(echo "$coverageTotals" | jq ".$key.percent * 10 | round / 10")
|
||||
echo "$metricName $metric %" >> $out/nix-support/hydra-metrics
|
||||
done
|
||||
|
||||
echo "report coverage $out" >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
in
|
||||
assert withCoverage;
|
||||
assert stdenv.cc.isClang;
|
||||
{
|
||||
inherit coverageProfileDrvs mergedProfdata coverageReports;
|
||||
};
|
||||
}
|
||||
16
ci/gha/tests/wrapper.nix
Normal file
16
ci/gha/tests/wrapper.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
nixFlake ? builtins.getFlake ("git+file://" + toString ../../..),
|
||||
system ? builtins.currentSystem,
|
||||
pkgs ? nixFlake.inputs.nixpkgs.legacyPackages.${system},
|
||||
stdenv ? "stdenv",
|
||||
componentTestsPrefix ? "",
|
||||
withInstrumentation ? false,
|
||||
}@args:
|
||||
import ./. (
|
||||
args
|
||||
// {
|
||||
getStdenv = p: p.${stdenv};
|
||||
withSanitizers = withInstrumentation;
|
||||
withCoverage = withInstrumentation;
|
||||
}
|
||||
)
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
project('nix-manual',
|
||||
project(
|
||||
'nix-manual',
|
||||
version : files('.version'),
|
||||
meson_version : '>= 1.1',
|
||||
license : 'LGPL-2.1-or-later',
|
||||
|
|
@ -8,6 +9,7 @@ nix = find_program('nix', native : true)
|
|||
|
||||
mdbook = find_program('mdbook', native : true)
|
||||
bash = find_program('bash', native : true)
|
||||
rsync = find_program('rsync', required : true, native : true)
|
||||
|
||||
pymod = import('python')
|
||||
python = pymod.find_installation('python3')
|
||||
|
|
@ -23,7 +25,8 @@ nix_env_for_docs = {
|
|||
nix_for_docs = [ nix, '--experimental-features', 'nix-command' ]
|
||||
nix_eval_for_docs_common = nix_for_docs + [
|
||||
'eval',
|
||||
'-I', 'nix=' + meson.current_source_dir(),
|
||||
'-I',
|
||||
'nix=' + meson.current_source_dir(),
|
||||
'--store', 'dummy://',
|
||||
'--impure',
|
||||
]
|
||||
|
|
@ -78,13 +81,14 @@ manual = custom_target(
|
|||
'manual',
|
||||
command : [
|
||||
bash,
|
||||
'-euo', 'pipefail',
|
||||
'-euo',
|
||||
'pipefail',
|
||||
'-c',
|
||||
'''
|
||||
@0@ @INPUT0@ @CURRENT_SOURCE_DIR@ > @DEPFILE@
|
||||
@0@ @INPUT1@ summary @2@ < @CURRENT_SOURCE_DIR@/source/SUMMARY.md.in > @2@/source/SUMMARY.md
|
||||
sed -e 's|@version@|@3@|g' < @INPUT2@ > @2@/book.toml
|
||||
rsync -r --include='*.md' @CURRENT_SOURCE_DIR@/ @2@/
|
||||
@4@ -r --include='*.md' @CURRENT_SOURCE_DIR@/ @2@/
|
||||
(cd @2@; RUST_LOG=warn @1@ build -d @2@ 3>&2 2>&1 1>&3) | { grep -Fv "because fragment resolution isn't implemented" || :; } 3>&2 2>&1 1>&3
|
||||
rm -rf @2@/manual
|
||||
mv @2@/html @2@/manual
|
||||
|
|
@ -94,6 +98,7 @@ manual = custom_target(
|
|||
mdbook.full_path(),
|
||||
meson.current_build_dir(),
|
||||
meson.project_version(),
|
||||
rsync.full_path(),
|
||||
),
|
||||
],
|
||||
input : [
|
||||
|
|
@ -131,7 +136,8 @@ install_subdir(
|
|||
)
|
||||
|
||||
nix_nested_manpages = [
|
||||
[ 'nix-env',
|
||||
[
|
||||
'nix-env',
|
||||
[
|
||||
'delete-generations',
|
||||
'install',
|
||||
|
|
@ -146,7 +152,8 @@ nix_nested_manpages = [
|
|||
'upgrade',
|
||||
],
|
||||
],
|
||||
[ 'nix-store',
|
||||
[
|
||||
'nix-store',
|
||||
[
|
||||
'add-fixed',
|
||||
'add',
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ mkMesonDerivation (finalAttrs: {
|
|||
];
|
||||
|
||||
# Hack for sake of the dev shell
|
||||
passthru.externalNativeBuildInputs =
|
||||
[
|
||||
passthru.externalNativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
(lib.getBin lowdown-unsandboxed)
|
||||
|
|
|
|||
6
doc/manual/rl-next/dropped-compat.md
Normal file
6
doc/manual/rl-next/dropped-compat.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
synopsis: "Removed support for daemons and clients older than Nix 2.0"
|
||||
prs: [13951]
|
||||
---
|
||||
|
||||
We have dropped support in the daemon worker protocol for daemons and clients that don't speak at least version 18 of the protocol. This first Nix release that supports this version is Nix 2.0, released in February 2018.
|
||||
6
doc/manual/rl-next/shorter-build-dir-names.md
Normal file
6
doc/manual/rl-next/shorter-build-dir-names.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
synopsis: "Temporary build directories no longer include derivation names"
|
||||
prs: [13839]
|
||||
---
|
||||
|
||||
Temporary build directories created during derivation builds no longer include the derivation name in their path to avoid build failures when the derivation name is too long. This change ensures predictable prefix lengths for build directories under `/nix/var/nix/builds`.
|
||||
|
|
@ -128,6 +128,7 @@
|
|||
- [Development](development/index.md)
|
||||
- [Building](development/building.md)
|
||||
- [Testing](development/testing.md)
|
||||
- [Benchmarking](development/benchmarking.md)
|
||||
- [Debugging](development/debugging.md)
|
||||
- [Documentation](development/documentation.md)
|
||||
- [CLI guideline](development/cli-guideline.md)
|
||||
|
|
@ -137,6 +138,7 @@
|
|||
- [Contributing](development/contributing.md)
|
||||
- [Releases](release-notes/index.md)
|
||||
{{#include ./SUMMARY-rl-next.md}}
|
||||
- [Release 2.31 (2025-08-21)](release-notes/rl-2.31.md)
|
||||
- [Release 2.30 (2025-07-07)](release-notes/rl-2.30.md)
|
||||
- [Release 2.29 (2025-05-14)](release-notes/rl-2.29.md)
|
||||
- [Release 2.28 (2025-04-02)](release-notes/rl-2.28.md)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ Most Nix commands interpret the following environment variables:
|
|||
- <span id="env-NIX_CONF_DIR">[`NIX_CONF_DIR`](#env-NIX_CONF_DIR)</span>
|
||||
|
||||
Overrides the location of the system Nix configuration directory
|
||||
(default `prefix/etc/nix`).
|
||||
(default `sysconfdir/nix`, i.e. `/etc/nix` on most systems).
|
||||
|
||||
- <span id="env-NIX_CONFIG">[`NIX_CONFIG`](#env-NIX_CONFIG)</span>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ xp_features_json = custom_target(
|
|||
|
||||
experimental_features_shortlist_md = custom_target(
|
||||
command : nix_eval_for_docs + [
|
||||
'--expr',
|
||||
'import @INPUT0@ (builtins.fromJSON (builtins.readFile ./@INPUT1@))',
|
||||
'--expr', 'import @INPUT0@ (builtins.fromJSON (builtins.readFile ./@INPUT1@))',
|
||||
],
|
||||
input : [
|
||||
'../../generate-xp-features-shortlist.nix',
|
||||
|
|
@ -19,14 +18,8 @@ experimental_features_shortlist_md = custom_target(
|
|||
)
|
||||
|
||||
nix3_cli_files = custom_target(
|
||||
command : [
|
||||
python.full_path(),
|
||||
'@INPUT0@',
|
||||
'@OUTPUT@',
|
||||
'--'
|
||||
] + nix_eval_for_docs + [
|
||||
'--expr',
|
||||
'import @INPUT1@ true (builtins.readFile ./@INPUT2@)',
|
||||
command : [ python.full_path(), '@INPUT0@', '@OUTPUT@', '--' ] + nix_eval_for_docs + [
|
||||
'--expr', 'import @INPUT1@ true (builtins.readFile ./@INPUT2@)',
|
||||
],
|
||||
input : [
|
||||
'../../remove_before_wrapper.py',
|
||||
|
|
@ -40,8 +33,7 @@ nix3_cli_files = custom_target(
|
|||
conf_file_md_body = custom_target(
|
||||
command : [
|
||||
nix_eval_for_docs,
|
||||
'--expr',
|
||||
'import @INPUT0@ { prefix = "conf"; } (builtins.fromJSON (builtins.readFile ./@INPUT1@))',
|
||||
'--expr', 'import @INPUT0@ { prefix = "conf"; } (builtins.fromJSON (builtins.readFile ./@INPUT1@))',
|
||||
],
|
||||
capture : true,
|
||||
input : [
|
||||
|
|
|
|||
187
doc/manual/source/development/benchmarking.md
Normal file
187
doc/manual/source/development/benchmarking.md
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
# Running Benchmarks
|
||||
|
||||
This guide explains how to build and run performance benchmarks in the Nix codebase.
|
||||
|
||||
## Overview
|
||||
|
||||
Nix uses the [Google Benchmark](https://github.com/google/benchmark) framework for performance testing. Benchmarks help measure and track the performance of critical operations like derivation parsing.
|
||||
|
||||
## Building Benchmarks
|
||||
|
||||
Benchmarks are disabled by default and must be explicitly enabled during the build configuration. For accurate results, use a debug-optimized release build.
|
||||
|
||||
### Development Environment Setup
|
||||
|
||||
First, enter the development shell which includes the necessary dependencies:
|
||||
|
||||
```bash
|
||||
nix develop .#native-ccacheStdenv
|
||||
```
|
||||
|
||||
### Configure Build with Benchmarks
|
||||
|
||||
From the project root, configure the build with benchmarks enabled and optimization:
|
||||
|
||||
```bash
|
||||
cd build
|
||||
meson configure -Dbenchmarks=true -Dbuildtype=debugoptimized
|
||||
```
|
||||
|
||||
The `debugoptimized` build type provides:
|
||||
- Compiler optimizations for realistic performance measurements
|
||||
- Debug symbols for profiling and analysis
|
||||
- Balance between performance and debuggability
|
||||
|
||||
### Build the Benchmarks
|
||||
|
||||
Build the project including benchmarks:
|
||||
|
||||
```bash
|
||||
ninja
|
||||
```
|
||||
|
||||
This will create benchmark executables in the build directory. Currently available:
|
||||
- `build/src/libstore-tests/nix-store-benchmarks` - Store-related performance benchmarks
|
||||
|
||||
Additional benchmark executables will be created as more benchmarks are added to the codebase.
|
||||
|
||||
## Running Benchmarks
|
||||
|
||||
### Basic Usage
|
||||
|
||||
Run benchmark executables directly. For example, to run store benchmarks:
|
||||
|
||||
```bash
|
||||
./build/src/libstore-tests/nix-store-benchmarks
|
||||
```
|
||||
|
||||
As more benchmark executables are added, run them similarly from their respective build directories.
|
||||
|
||||
### Filtering Benchmarks
|
||||
|
||||
Run specific benchmarks using regex patterns:
|
||||
|
||||
```bash
|
||||
# Run only derivation parser benchmarks
|
||||
./build/src/libstore-tests/nix-store-benchmarks --benchmark_filter="derivation.*"
|
||||
|
||||
# Run only benchmarks for hello.drv
|
||||
./build/src/libstore-tests/nix-store-benchmarks --benchmark_filter=".*hello.*"
|
||||
```
|
||||
|
||||
### Output Formats
|
||||
|
||||
Generate benchmark results in different formats:
|
||||
|
||||
```bash
|
||||
# JSON output
|
||||
./build/src/libstore-tests/nix-store-benchmarks --benchmark_format=json > results.json
|
||||
|
||||
# CSV output
|
||||
./build/src/libstore-tests/nix-store-benchmarks --benchmark_format=csv > results.csv
|
||||
```
|
||||
|
||||
### Advanced Options
|
||||
|
||||
```bash
|
||||
# Run benchmarks multiple times for better statistics
|
||||
./build/src/libstore-tests/nix-store-benchmarks --benchmark_repetitions=10
|
||||
|
||||
# Set minimum benchmark time (useful for micro-benchmarks)
|
||||
./build/src/libstore-tests/nix-store-benchmarks --benchmark_min_time=2
|
||||
|
||||
# Compare against baseline
|
||||
./build/src/libstore-tests/nix-store-benchmarks --benchmark_baseline=baseline.json
|
||||
|
||||
# Display time in custom units
|
||||
./build/src/libstore-tests/nix-store-benchmarks --benchmark_time_unit=ms
|
||||
```
|
||||
|
||||
## Writing New Benchmarks
|
||||
|
||||
To add new benchmarks:
|
||||
|
||||
1. Create a new `.cc` file in the appropriate `*-tests` directory
|
||||
2. Include the benchmark header:
|
||||
```cpp
|
||||
#include <benchmark/benchmark.h>
|
||||
```
|
||||
|
||||
3. Write benchmark functions:
|
||||
```cpp
|
||||
static void BM_YourBenchmark(benchmark::State & state)
|
||||
{
|
||||
// Setup code here
|
||||
|
||||
for (auto _ : state) {
|
||||
// Code to benchmark
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_YourBenchmark);
|
||||
```
|
||||
|
||||
4. Add the file to the corresponding `meson.build`:
|
||||
```meson
|
||||
benchmarks_sources = files(
|
||||
'your-benchmark.cc',
|
||||
# existing benchmarks...
|
||||
)
|
||||
```
|
||||
|
||||
## Profiling with Benchmarks
|
||||
|
||||
For deeper performance analysis, combine benchmarks with profiling tools:
|
||||
|
||||
```bash
|
||||
# Using Linux perf
|
||||
perf record ./build/src/libstore-tests/nix-store-benchmarks
|
||||
perf report
|
||||
```
|
||||
|
||||
### Using Valgrind Callgrind
|
||||
|
||||
Valgrind's callgrind tool provides detailed profiling information that can be visualized with kcachegrind:
|
||||
|
||||
```bash
|
||||
# Profile with callgrind
|
||||
valgrind --tool=callgrind ./build/src/libstore-tests/nix-store-benchmarks
|
||||
|
||||
# Visualize the results with kcachegrind
|
||||
kcachegrind callgrind.out.*
|
||||
```
|
||||
|
||||
This provides:
|
||||
- Function call graphs
|
||||
- Instruction-level profiling
|
||||
- Source code annotation
|
||||
- Interactive visualization of performance bottlenecks
|
||||
|
||||
## Continuous Performance Testing
|
||||
|
||||
```bash
|
||||
# Save baseline results
|
||||
./build/src/libstore-tests/nix-store-benchmarks --benchmark_format=json > baseline.json
|
||||
|
||||
# Compare against baseline in CI
|
||||
./build/src/libstore-tests/nix-store-benchmarks --benchmark_baseline=baseline.json
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Benchmarks not building
|
||||
|
||||
Ensure benchmarks are enabled:
|
||||
```bash
|
||||
meson configure build | grep benchmarks
|
||||
# Should show: benchmarks true
|
||||
```
|
||||
|
||||
### Inconsistent results
|
||||
|
||||
- Ensure your system is not under heavy load
|
||||
- Disable CPU frequency scaling for consistent results
|
||||
- Run benchmarks multiple times with `--benchmark_repetitions`
|
||||
|
||||
## See Also
|
||||
|
||||
- [Google Benchmark documentation](https://github.com/google/benchmark/blob/main/docs/user_guide.md)
|
||||
|
|
@ -34,7 +34,7 @@ $ nix-shell --attr devShells.x86_64-linux.native-clangStdenvPackages
|
|||
To build Nix itself in this shell:
|
||||
|
||||
```console
|
||||
[nix-shell]$ mesonFlags+=" --prefix=$(pwd)/outputs/out"
|
||||
[nix-shell]$ out="$(pwd)/outputs/out" dev=$out debug=$out mesonFlags+=" --prefix=${out}"
|
||||
[nix-shell]$ dontAddPrefix=1 configurePhase
|
||||
[nix-shell]$ buildPhase
|
||||
```
|
||||
|
|
@ -215,14 +215,18 @@ nix build .#nix-everything-x86_64-w64-mingw32
|
|||
|
||||
For historic reasons and backward-compatibility, some CPU and OS identifiers are translated as follows:
|
||||
|
||||
| `config.guess` | Nix |
|
||||
|----------------------------|---------------------|
|
||||
| `amd64` | `x86_64` |
|
||||
| `i*86` | `i686` |
|
||||
| `arm6` | `arm6l` |
|
||||
| `arm7` | `arm7l` |
|
||||
| `linux-gnu*` | `linux` |
|
||||
| `linux-musl*` | `linux` |
|
||||
| `host_machine.cpu_family()` | `host_machine.endian()` | Nix |
|
||||
|-----------------------------|-------------------------|---------------------|
|
||||
| `x86` | | `i686` |
|
||||
| `arm` | | `host_machine.cpu()`|
|
||||
| `ppc` | `little` | `powerpcle` |
|
||||
| `ppc64` | `little` | `powerpc64le` |
|
||||
| `ppc` | `big` | `powerpc` |
|
||||
| `ppc64` | `big` | `powerpc64` |
|
||||
| `mips` | `little` | `mipsel` |
|
||||
| `mips64` | `little` | `mips64el` |
|
||||
| `mips` | `big` | `mips` |
|
||||
| `mips64` | `big` | `mips64` |
|
||||
|
||||
## Compilation environments
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
experimental_feature_descriptions_md = custom_target(
|
||||
command : nix_eval_for_docs + [
|
||||
'--expr',
|
||||
'import @INPUT0@ (builtins.fromJSON (builtins.readFile @INPUT1@))',
|
||||
'--expr', 'import @INPUT0@ (builtins.fromJSON (builtins.readFile @INPUT1@))',
|
||||
],
|
||||
input : [
|
||||
'../../generate-xp-features.nix',
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
- Bash Shell. The `./configure` script relies on bashisms, so Bash is
|
||||
required.
|
||||
|
||||
- A version of GCC or Clang that supports C++20.
|
||||
- A version of GCC or Clang that supports C++23.
|
||||
|
||||
- `pkg-config` to locate dependencies. If your distribution does not
|
||||
provide it, you can get it from
|
||||
|
|
|
|||
|
|
@ -41,6 +41,38 @@ There may also be references to Nix in
|
|||
|
||||
which you may remove.
|
||||
|
||||
### FreeBSD
|
||||
|
||||
1. Stop and remove the Nix daemon service:
|
||||
|
||||
```console
|
||||
sudo service nix-daemon stop
|
||||
sudo rm -f /usr/local/etc/rc.d/nix-daemon
|
||||
sudo sysrc -x nix_daemon_enable
|
||||
```
|
||||
|
||||
2. Remove files created by Nix:
|
||||
|
||||
```console
|
||||
sudo rm -rf /etc/nix /usr/local/etc/profile.d/nix.sh /nix ~root/.nix-channels ~root/.nix-defexpr ~root/.nix-profile ~root/.cache/nix
|
||||
```
|
||||
|
||||
3. Remove build users and their group:
|
||||
|
||||
```console
|
||||
for i in $(seq 1 32); do
|
||||
sudo pw userdel nixbld$i
|
||||
done
|
||||
sudo pw groupdel nixbld
|
||||
```
|
||||
|
||||
4. There may also be references to Nix in:
|
||||
- `/usr/local/etc/bashrc`
|
||||
- `/usr/local/etc/zshrc`
|
||||
- Shell configuration files in users' home directories
|
||||
|
||||
which you may remove.
|
||||
|
||||
### macOS
|
||||
|
||||
> **Updating to macOS 15 Sequoia**
|
||||
|
|
|
|||
|
|
@ -160,7 +160,6 @@ See the [corresponding section in the derivation output page](@docroot@/store/de
|
|||
## Other output modifications
|
||||
|
||||
- [`unsafeDiscardReferences`]{#adv-attr-unsafeDiscardReferences}\
|
||||
|
||||
When using [structured attributes](#adv-attr-structuredAttrs), the
|
||||
attribute `unsafeDiscardReferences` is an attribute set with a boolean value for each output name.
|
||||
If set to `true`, it disables scanning the output for runtime dependencies.
|
||||
|
|
@ -195,7 +194,6 @@ See the [corresponding section in the derivation output page](@docroot@/store/de
|
|||
[`builder`]: ./derivations.md#attr-builder
|
||||
|
||||
- [`requiredSystemFeatures`]{#adv-attr-requiredSystemFeatures}\
|
||||
|
||||
If a derivation has the `requiredSystemFeatures` attribute, then Nix will only build it on a machine that has the corresponding features set in its [`system-features` configuration](@docroot@/command-ref/conf-file.md#conf-system-features).
|
||||
|
||||
For example, setting
|
||||
|
|
|
|||
|
|
@ -1,19 +1,13 @@
|
|||
builtins_md = custom_target(
|
||||
command : [
|
||||
python.full_path(),
|
||||
'@INPUT0@',
|
||||
'@OUTPUT@',
|
||||
'--'
|
||||
] + nix_eval_for_docs + [
|
||||
'--expr',
|
||||
'(builtins.readFile @INPUT3@) + import @INPUT1@ (builtins.fromJSON (builtins.readFile ./@INPUT2@)) + (builtins.readFile @INPUT4@)',
|
||||
command : [ python.full_path(), '@INPUT0@', '@OUTPUT@', '--' ] + nix_eval_for_docs + [
|
||||
'--expr', '(builtins.readFile @INPUT3@) + import @INPUT1@ (builtins.fromJSON (builtins.readFile ./@INPUT2@)) + (builtins.readFile @INPUT4@)',
|
||||
],
|
||||
input : [
|
||||
'../../remove_before_wrapper.py',
|
||||
'../../generate-builtins.nix',
|
||||
language_json,
|
||||
'builtins-prefix.md',
|
||||
'builtins-suffix.md'
|
||||
'builtins-suffix.md',
|
||||
],
|
||||
output : 'builtins.md',
|
||||
env : nix_env_for_docs,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
summary_rl_next = custom_target(
|
||||
command : [
|
||||
bash,
|
||||
'-euo', 'pipefail',
|
||||
'-euo',
|
||||
'pipefail',
|
||||
'-c',
|
||||
'''
|
||||
if [ -e "@INPUT@" ]; then
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ $ ln -s /nix/store/d718ef...-foo /nix/var/nix/gcroots/bar
|
|||
That is, after this command, the garbage collector will not remove
|
||||
`/nix/store/d718ef...-foo` or any of its dependencies.
|
||||
|
||||
Subdirectories of `prefix/nix/var/nix/gcroots` are also searched for
|
||||
symlinks. Symlinks to non-store paths are followed and searched for
|
||||
roots, but symlinks to non-store paths *inside* the paths reached in
|
||||
that way are not followed to prevent infinite recursion.
|
||||
Subdirectories of `prefix/nix/var/nix/gcroots` are searched
|
||||
recursively. Symlinks to store paths count as roots. Symlinks to
|
||||
non-store paths are ignored, unless the non-store path is itself a
|
||||
symlink to a store path.
|
||||
|
|
@ -24,7 +24,7 @@ nar-obj-inner
|
|||
| str("type"), str("directory") directory
|
||||
;
|
||||
|
||||
regular = [ str("executable"), str("") ], str("contents"), str(contents);
|
||||
regular = [ str("executable") ], str("contents"), str(contents);
|
||||
|
||||
symlink = str("target"), str(target);
|
||||
|
||||
|
|
|
|||
96
doc/manual/source/release-notes/rl-2.31.md
Normal file
96
doc/manual/source/release-notes/rl-2.31.md
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
# Release 2.31.0 (2025-08-21)
|
||||
|
||||
- `build-cores = 0` now auto-detects CPU cores [#13402](https://github.com/NixOS/nix/pull/13402)
|
||||
|
||||
When `build-cores` is set to `0`, Nix now automatically detects the number of available CPU cores and passes this value via `NIX_BUILD_CORES`, instead of passing `0` directly. This matches the behavior when `build-cores` is unset. This prevents the builder from having to detect the number of cores.
|
||||
|
||||
- Fix Git LFS SSH issues [#13337](https://github.com/NixOS/nix/issues/13337) [#13743](https://github.com/NixOS/nix/pull/13743)
|
||||
|
||||
Fixed some outstanding issues with Git LFS and SSH.
|
||||
|
||||
* Added support for `NIX_SSHOPTS`.
|
||||
* Properly use the parsed port from URL.
|
||||
* Better use of the response of `git-lfs-authenticate` to determine API endpoint when the API is not exposed on port 443.
|
||||
|
||||
- Add support for `user@address:port` syntax in store URIs [#7044](https://github.com/NixOS/nix/issues/7044) [#3425](https://github.com/NixOS/nix/pull/3425)
|
||||
|
||||
It's now possible to specify the port used for SSH stores directly in the store URL in accordance with [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986). Previously the only way to specify custom ports was via `ssh_config` or the `NIX_SSHOPTS` environment variable, because Nix incorrectly passed the port number together with the host name to the SSH executable.
|
||||
|
||||
This change affects [store references](@docroot@/store/types/index.md#store-url-format) passed via the `--store` and similar flags in CLI as well as in the configuration for [remote builders](@docroot@/command-ref/conf-file.md#conf-builders). For example, the following store URIs now work:
|
||||
|
||||
- `ssh://127.0.0.1:2222`
|
||||
- `ssh://[b573:6a48:e224:840b:6007:6275:f8f7:ebf3]:22`
|
||||
- `ssh-ng://[b573:6a48:e224:840b:6007:6275:f8f7:ebf3]:22`
|
||||
|
||||
- Represent IPv6 RFC4007 ZoneId literals in conformance with RFC6874 [#13445](https://github.com/NixOS/nix/pull/13445)
|
||||
|
||||
Prior versions of Nix since [#4646](https://github.com/NixOS/nix/pull/4646) accepted [IPv6 scoped addresses](https://datatracker.ietf.org/doc/html/rfc4007) in URIs like [store references](@docroot@/store/types/index.md#store-url-format) in the textual representation with a literal percent character: `[fe80::1%18]`. This was ambiguous, because the the percent literal `%` is reserved by [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986), since it's used to indicate percent encoding. Nix now requires that the percent `%` symbol is percent-encoded as `%25`. This implements [RFC6874](https://datatracker.ietf.org/doc/html/rfc6874), which defines the representation of zone identifiers in URIs. The example from above now has to be specified as `[fe80::1%2518]`.
|
||||
|
||||
- Use WAL mode for SQLite cache databases [#13800](https://github.com/NixOS/nix/pull/13800)
|
||||
|
||||
Previously, Nix used SQLite's "truncate" mode for caches. However, this could cause a Nix process to block if another process was updating the cache. This was a problem for the flake evaluation cache in particular, since it uses long-running transactions. Thus, concurrent Nix commands operating on the same flake could be blocked for an unbounded amount of time. WAL mode avoids this problem.
|
||||
|
||||
This change required updating the versions of the SQLite caches. For instance, `eval-cache-v5.sqlite` is now `eval-cache-v6.sqlite`.
|
||||
|
||||
- Enable parallel marking in bdwgc [#13708](https://github.com/NixOS/nix/pull/13708)
|
||||
|
||||
Previously marking was done by only one thread, which takes a long time if the heap gets big. Enabling parallel marking speeds up evaluation a lot, for example (on a Ryzen 9 5900X 12-Core):
|
||||
|
||||
* `nix search nixpkgs` from 24.3s to 18.9s.
|
||||
* Evaluating the `NixOS/nix/2.21.2` flake regression test from 86.1s to 71.2s.
|
||||
|
||||
- New command `nix flake prefetch-inputs` [#13565](https://github.com/NixOS/nix/pull/13565)
|
||||
|
||||
This command fetches all inputs of a flake in parallel. This can be a lot faster than the serialized on-demand fetching during regular flake evaluation. The downside is that it may fetch inputs that aren't normally used.
|
||||
|
||||
- Add `warn-short-path-literals` setting [#13489](https://github.com/NixOS/nix/pull/13489)
|
||||
|
||||
This setting, when enabled, causes Nix to emit warnings when encountering relative path literals that don't start with `.` or `/`, for instance suggesting that `foo/bar` should be rewritten to `./foo/bar`.
|
||||
|
||||
- When updating a lock, respect the input's lock file [#13437](https://github.com/NixOS/nix/pull/13437)
|
||||
|
||||
For example, if a flake has a lock for `a` and `a/b`, and we change the flakeref for `a`, previously Nix would fetch the latest version of `b` rather than using the lock for `b` from `a`.
|
||||
|
||||
- Implement support for Git hashing with SHA-256 [#13543](https://github.com/NixOS/nix/pull/13543)
|
||||
|
||||
The experimental support for [Git-hashing](@docroot@/development/experimental-features.md#xp-feature-git-hashing) store objects now also includes support for SHA-256, not just SHA-1, in line with upstream Git.
|
||||
|
||||
## Contributors
|
||||
|
||||
This release was made possible by the following 34 contributors:
|
||||
|
||||
- John Soo [**(@jsoo1)**](https://github.com/jsoo1)
|
||||
- Alan Urmancheev [**(@alurm)**](https://github.com/alurm)
|
||||
- Manse [**(@PedroManse)**](https://github.com/PedroManse)
|
||||
- Pol Dellaiera [**(@drupol)**](https://github.com/drupol)
|
||||
- DavHau [**(@DavHau)**](https://github.com/DavHau)
|
||||
- Leandro Emmanuel Reina Kiperman [**(@kip93)**](https://github.com/kip93)
|
||||
- h0nIg [**(@h0nIg)**](https://github.com/h0nIg)
|
||||
- Philip Taron [**(@philiptaron)**](https://github.com/philiptaron)
|
||||
- Eelco Dolstra [**(@edolstra)**](https://github.com/edolstra)
|
||||
- Connor Baker [**(@ConnorBaker)**](https://github.com/ConnorBaker)
|
||||
- kenji [**(@a-kenji)**](https://github.com/a-kenji)
|
||||
- Oleksandr Knyshuk [**(@k1gen)**](https://github.com/k1gen)
|
||||
- Maciej Krüger [**(@mkg20001)**](https://github.com/mkg20001)
|
||||
- Justin Bailey [**(@jgbailey-well)**](https://github.com/jgbailey-well)
|
||||
- Emily [**(@emilazy)**](https://github.com/emilazy)
|
||||
- Volker Diels-Grabsch [**(@vog)**](https://github.com/vog)
|
||||
- gustavderdrache [**(@gustavderdrache)**](https://github.com/gustavderdrache)
|
||||
- Elliot Cameron [**(@de11n)**](https://github.com/de11n)
|
||||
- Alexander V. Nikolaev [**(@avnik)**](https://github.com/avnik)
|
||||
- tomberek [**(@tomberek)**](https://github.com/tomberek)
|
||||
- Matthew Kenigsberg [**(@mkenigs)**](https://github.com/mkenigs)
|
||||
- Sergei Zimmerman [**(@xokdvium)**](https://github.com/xokdvium)
|
||||
- Cosima Neidahl [**(@OPNA2608)**](https://github.com/OPNA2608)
|
||||
- John Ericson [**(@Ericson2314)**](https://github.com/Ericson2314)
|
||||
- m4dc4p [**(@m4dc4p)**](https://github.com/m4dc4p)
|
||||
- Graham Christensen [**(@grahamc)**](https://github.com/grahamc)
|
||||
- Jason Yundt [**(@Jayman2000)**](https://github.com/Jayman2000)
|
||||
- Jens Petersen [**(@juhp)**](https://github.com/juhp)
|
||||
- the-sun-will-rise-tomorrow [**(@the-sun-will-rise-tomorrow)**](https://github.com/the-sun-will-rise-tomorrow)
|
||||
- Farid Zakaria [**(@fzakaria)**](https://github.com/fzakaria)
|
||||
- AGawas [**(@aln730)**](https://github.com/aln730)
|
||||
- Robert Hensing [**(@roberth)**](https://github.com/roberth)
|
||||
- Dmitry Bogatov [**(@KAction)**](https://github.com/KAction)
|
||||
- Jörg Thalheim [**(@Mic92)**](https://github.com/Mic92)
|
||||
- Philipp Otterbein
|
||||
|
|
@ -48,6 +48,6 @@
|
|||
|
||||
* `nix run` is now stricter in what it accepts: members of the `apps`
|
||||
flake output are now required to be apps (as defined in [the
|
||||
manual](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-run.html#apps)),
|
||||
manual](https://nix.dev/manual/nix/stable/command-ref/new-cli/nix3-run.html#apps)),
|
||||
and members of `packages` or `legacyPackages` must be derivations
|
||||
(not apps).
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ This is where Nix distinguishes itself.
|
|||
|
||||
## Store Derivation {#store-derivation}
|
||||
|
||||
A derivation is a specification for running an executable on precisely defined input to produce on more [store objects][store object].
|
||||
A derivation is a specification for running an executable on precisely defined input to produce one or more [store objects][store object].
|
||||
These store objects are known as the derivation's *outputs*.
|
||||
|
||||
Derivations are *built*, in which case the process is spawned according to the spec, and when it exits, required to leave behind files which will (after post-processing) become the outputs of the derivation.
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
types_dir = custom_target(
|
||||
command : [
|
||||
python.full_path(),
|
||||
'@INPUT0@',
|
||||
'@OUTPUT@',
|
||||
'--'
|
||||
] + nix_eval_for_docs + [
|
||||
'--expr',
|
||||
'import @INPUT1@ (builtins.fromJSON (builtins.readFile ./@INPUT2@)).stores',
|
||||
command : [ python.full_path(), '@INPUT0@', '@OUTPUT@', '--' ] + nix_eval_for_docs + [
|
||||
'--expr', 'import @INPUT1@ (builtins.fromJSON (builtins.readFile ./@INPUT2@)).stores',
|
||||
],
|
||||
input : [
|
||||
'../../remove_before_wrapper.py',
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ The graph of references excluding self-references thus forms a [directed acyclic
|
|||
|
||||
[directed acyclic graph]: @docroot@/glossary.md#gloss-directed-acyclic-graph
|
||||
|
||||
We can take the [transitive closure] of the references graph, which any pair of store objects have an edge not if there is a single reference from the first to the second, but a path of one or more references from the first to the second.
|
||||
We can take the [transitive closure] of the references graph, in which any pair of store objects have an edge if a *path* of one or more references exists from the first to the second object.
|
||||
(A single reference always forms a path which is one reference long, but longer paths may connect objects which have no direct reference between them.)
|
||||
The *requisites* of a store object are all store objects reachable by paths of references which start with given store object's references.
|
||||
|
||||
[transitive closure]: https://en.wikipedia.org/wiki/Transitive_closure
|
||||
|
|
|
|||
64
docker.nix
64
docker.nix
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
# Core dependencies
|
||||
pkgs,
|
||||
lib,
|
||||
dockerTools,
|
||||
runCommand,
|
||||
buildPackages,
|
||||
pkgs ? import <nixpkgs> { },
|
||||
lib ? pkgs.lib,
|
||||
dockerTools ? pkgs.dockerTools,
|
||||
runCommand ? pkgs.runCommand,
|
||||
buildPackages ? pkgs.buildPackages,
|
||||
# Image configuration
|
||||
name ? "nix",
|
||||
tag ? "latest",
|
||||
|
|
@ -28,24 +28,24 @@
|
|||
},
|
||||
Cmd ? [ (lib.getExe bashInteractive) ],
|
||||
# Default Packages
|
||||
nix,
|
||||
bashInteractive,
|
||||
coreutils-full,
|
||||
gnutar,
|
||||
gzip,
|
||||
gnugrep,
|
||||
which,
|
||||
curl,
|
||||
less,
|
||||
wget,
|
||||
man,
|
||||
cacert,
|
||||
findutils,
|
||||
iana-etc,
|
||||
gitMinimal,
|
||||
openssh,
|
||||
nix ? pkgs.nix,
|
||||
bashInteractive ? pkgs.bashInteractive,
|
||||
coreutils-full ? pkgs.coreutils-full,
|
||||
gnutar ? pkgs.gnutar,
|
||||
gzip ? pkgs.gzip,
|
||||
gnugrep ? pkgs.gnugrep,
|
||||
which ? pkgs.which,
|
||||
curl ? pkgs.curl,
|
||||
less ? pkgs.less,
|
||||
wget ? pkgs.wget,
|
||||
man ? pkgs.man,
|
||||
cacert ? pkgs.cacert,
|
||||
findutils ? pkgs.findutils,
|
||||
iana-etc ? pkgs.iana-etc,
|
||||
gitMinimal ? pkgs.gitMinimal,
|
||||
openssh ? pkgs.openssh,
|
||||
# Other dependencies
|
||||
shadow,
|
||||
shadow ? pkgs.shadow,
|
||||
}:
|
||||
let
|
||||
defaultPkgs = [
|
||||
|
|
@ -65,10 +65,10 @@ let
|
|||
iana-etc
|
||||
gitMinimal
|
||||
openssh
|
||||
] ++ extraPkgs;
|
||||
]
|
||||
++ extraPkgs;
|
||||
|
||||
users =
|
||||
{
|
||||
users = {
|
||||
|
||||
root = {
|
||||
uid = 0;
|
||||
|
|
@ -111,8 +111,7 @@ let
|
|||
}) (lib.lists.range 1 32)
|
||||
);
|
||||
|
||||
groups =
|
||||
{
|
||||
groups = {
|
||||
root.gid = 0;
|
||||
nixbld.gid = 30000;
|
||||
nobody.gid = 65534;
|
||||
|
|
@ -184,11 +183,14 @@ let
|
|||
} " = ";
|
||||
};
|
||||
|
||||
nixConfContents = toConf {
|
||||
nixConfContents = toConf (
|
||||
{
|
||||
sandbox = false;
|
||||
build-users-group = "nixbld";
|
||||
trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ];
|
||||
};
|
||||
}
|
||||
// nixConf
|
||||
);
|
||||
|
||||
userHome = if uid == 0 then "/root" else "/home/${uname}";
|
||||
|
||||
|
|
@ -279,7 +281,10 @@ let
|
|||
|
||||
# may get replaced by pkgs.dockerTools.caCertificates
|
||||
mkdir -p $out/etc/ssl/certs
|
||||
# Old NixOS compatibility.
|
||||
ln -s /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt $out/etc/ssl/certs
|
||||
# NixOS canonical location
|
||||
ln -s /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt $out/etc/ssl/certs/ca-certificates.crt
|
||||
|
||||
cat $passwdContentsPath > $out/etc/passwd
|
||||
echo "" >> $out/etc/passwd
|
||||
|
|
@ -308,6 +313,7 @@ let
|
|||
# see doc/manual/source/command-ref/files/profiles.md
|
||||
ln -s ${profile} $out/nix/var/nix/profiles/default-1-link
|
||||
ln -s /nix/var/nix/profiles/default-1-link $out/nix/var/nix/profiles/default
|
||||
ln -s /nix/var/nix/profiles/default $out${userHome}/.nix-profile
|
||||
|
||||
# see doc/manual/source/command-ref/files/channels.md
|
||||
ln -s ${channel} $out/nix/var/nix/profiles/per-user/${uname}/channels-1-link
|
||||
|
|
|
|||
8
flake.lock
generated
8
flake.lock
generated
|
|
@ -63,16 +63,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1747179050,
|
||||
"narHash": "sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY=",
|
||||
"lastModified": 1756178832,
|
||||
"narHash": "sha256-O2CIn7HjZwEGqBrwu9EU76zlmA5dbmna7jL1XUmAId8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "adaa24fbf46737f3f1b5497bf64bae750f82942e",
|
||||
"rev": "d98ce345cdab58477ca61855540999c86577d19d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"ref": "nixos-25.05-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
|||
308
flake.nix
308
flake.nix
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
description = "The purely functional package manager";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05-small";
|
||||
|
||||
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
||||
inputs.nixpkgs-23-11.url = "github:NixOS/nixpkgs/a62e6edd6d5e1fa0329b8653c801147986f8d446";
|
||||
|
|
@ -131,31 +131,107 @@
|
|||
}
|
||||
);
|
||||
|
||||
overlayFor =
|
||||
getStdenv: final: prev:
|
||||
/**
|
||||
Produce the `nixComponents` and `nixDependencies` package sets (scopes) for
|
||||
a given `pkgs` and `getStdenv`.
|
||||
*/
|
||||
packageSetsFor =
|
||||
let
|
||||
stdenv = getStdenv final;
|
||||
in
|
||||
/**
|
||||
Removes a prefix from the attribute names of a set of splices.
|
||||
This is a completely uninteresting and exists for compatibility only.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
renameSplicesFrom "pkgs" { pkgsBuildBuild = ...; ... }
|
||||
=> { buildBuild = ...; ... }
|
||||
```
|
||||
*/
|
||||
renameSplicesFrom = prefix: x: {
|
||||
buildBuild = x."${prefix}BuildBuild";
|
||||
buildHost = x."${prefix}BuildHost";
|
||||
buildTarget = x."${prefix}BuildTarget";
|
||||
hostHost = x."${prefix}HostHost";
|
||||
hostTarget = x."${prefix}HostTarget";
|
||||
targetTarget = x."${prefix}TargetTarget";
|
||||
};
|
||||
|
||||
/**
|
||||
Adds a prefix to the attribute names of a set of splices.
|
||||
This is a completely uninteresting and exists for compatibility only.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
renameSplicesTo "self" { buildBuild = ...; ... }
|
||||
=> { selfBuildBuild = ...; ... }
|
||||
```
|
||||
*/
|
||||
renameSplicesTo = prefix: x: {
|
||||
"${prefix}BuildBuild" = x.buildBuild;
|
||||
"${prefix}BuildHost" = x.buildHost;
|
||||
"${prefix}BuildTarget" = x.buildTarget;
|
||||
"${prefix}HostHost" = x.hostHost;
|
||||
"${prefix}HostTarget" = x.hostTarget;
|
||||
"${prefix}TargetTarget" = x.targetTarget;
|
||||
};
|
||||
|
||||
/**
|
||||
Takes a function `f` and returns a function that applies `f` pointwise to each splice.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
mapSplices (x: x * 10) { buildBuild = 1; buildHost = 2; ... }
|
||||
=> { buildBuild = 10; buildHost = 20; ... }
|
||||
```
|
||||
*/
|
||||
mapSplices =
|
||||
f:
|
||||
{
|
||||
nixStable = prev.nix;
|
||||
buildBuild,
|
||||
buildHost,
|
||||
buildTarget,
|
||||
hostHost,
|
||||
hostTarget,
|
||||
targetTarget,
|
||||
}:
|
||||
{
|
||||
buildBuild = f buildBuild;
|
||||
buildHost = f buildHost;
|
||||
buildTarget = f buildTarget;
|
||||
hostHost = f hostHost;
|
||||
hostTarget = f hostTarget;
|
||||
targetTarget = f targetTarget;
|
||||
};
|
||||
|
||||
in
|
||||
args@{
|
||||
pkgs,
|
||||
getStdenv ? pkgs: pkgs.stdenv,
|
||||
}:
|
||||
let
|
||||
nixComponentsSplices = mapSplices (
|
||||
pkgs': (packageSetsFor (args // { pkgs = pkgs'; })).nixComponents
|
||||
) (renameSplicesFrom "pkgs" pkgs);
|
||||
nixDependenciesSplices = mapSplices (
|
||||
pkgs': (packageSetsFor (args // { pkgs = pkgs'; })).nixDependencies
|
||||
) (renameSplicesFrom "pkgs" pkgs);
|
||||
|
||||
# A new scope, so that we can use `callPackage` to inject our own interdependencies
|
||||
# without "polluting" the top level "`pkgs`" attrset.
|
||||
# This also has the benefit of providing us with a distinct set of packages
|
||||
# we can iterate over.
|
||||
# The `2` suffix is here because otherwise it interferes with `nixVersions.latest`, which is used in daemon compat tests.
|
||||
nixComponents2 =
|
||||
nixComponents =
|
||||
lib.makeScopeWithSplicing'
|
||||
{
|
||||
inherit (final) splicePackages;
|
||||
inherit (final.nixDependencies2) newScope;
|
||||
inherit (pkgs) splicePackages;
|
||||
inherit (nixDependencies) newScope;
|
||||
}
|
||||
{
|
||||
otherSplices = final.generateSplicesForMkScope "nixComponents2";
|
||||
otherSplices = renameSplicesTo "self" nixComponentsSplices;
|
||||
f = import ./packaging/components.nix {
|
||||
inherit (final) lib;
|
||||
inherit (pkgs) lib;
|
||||
inherit officialRelease;
|
||||
pkgs = final;
|
||||
inherit pkgs;
|
||||
src = self;
|
||||
maintainers = [ ];
|
||||
};
|
||||
|
|
@ -163,29 +239,71 @@
|
|||
|
||||
# The dependencies are in their own scope, so that they don't have to be
|
||||
# in Nixpkgs top level `pkgs` or `nixComponents2`.
|
||||
# The `2` suffix is here because otherwise it interferes with `nixVersions.latest`, which is used in daemon compat tests.
|
||||
nixDependencies2 =
|
||||
nixDependencies =
|
||||
lib.makeScopeWithSplicing'
|
||||
{
|
||||
inherit (final) splicePackages;
|
||||
inherit (final) newScope; # layered directly on pkgs, unlike nixComponents2 above
|
||||
inherit (pkgs) splicePackages;
|
||||
inherit (pkgs) newScope; # layered directly on pkgs, unlike nixComponents2 above
|
||||
}
|
||||
{
|
||||
otherSplices = final.generateSplicesForMkScope "nixDependencies2";
|
||||
otherSplices = renameSplicesTo "self" nixDependenciesSplices;
|
||||
f = import ./packaging/dependencies.nix {
|
||||
inherit inputs stdenv;
|
||||
inherit inputs pkgs;
|
||||
stdenv = getStdenv pkgs;
|
||||
};
|
||||
};
|
||||
|
||||
# If the package set is largely empty, we should(?) return empty sets
|
||||
# This is what most package sets in Nixpkgs do. Otherwise, we get
|
||||
# an error message that indicates that some stdenv attribute is missing,
|
||||
# and indeed it will be missing, as seemingly `pkgsTargetTarget` is
|
||||
# very incomplete.
|
||||
fixup = lib.mapAttrs (k: v: if !(pkgs ? nix) then { } else v);
|
||||
in
|
||||
fixup {
|
||||
inherit nixDependencies;
|
||||
inherit nixComponents;
|
||||
};
|
||||
|
||||
overlayFor =
|
||||
getStdenv: final: prev:
|
||||
let
|
||||
packageSets = packageSetsFor {
|
||||
inherit getStdenv;
|
||||
pkgs = final;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
nixStable = prev.nix;
|
||||
|
||||
# The `2` suffix is here because otherwise it interferes with `nixVersions.latest`, which is used in daemon compat tests.
|
||||
nixComponents2 = packageSets.nixComponents;
|
||||
|
||||
# The dependencies are in their own scope, so that they don't have to be
|
||||
# in Nixpkgs top level `pkgs` or `nixComponents2`.
|
||||
# The `2` suffix is here because otherwise it interferes with `nixVersions.latest`, which is used in daemon compat tests.
|
||||
nixDependencies2 = packageSets.nixDependencies;
|
||||
|
||||
nix = final.nixComponents2.nix-cli;
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
# A Nixpkgs overlay that overrides the 'nix' and
|
||||
# 'nix-perl-bindings' packages.
|
||||
overlays.default = overlayFor (p: p.stdenv);
|
||||
overlays.internal = overlayFor (p: p.stdenv);
|
||||
|
||||
/**
|
||||
A Nixpkgs overlay that sets `nix` to something like `packages.<system>.nix-everything`,
|
||||
except dependencies aren't taken from (flake) `nix.inputs.nixpkgs`, but from the Nixpkgs packages
|
||||
where the overlay is used.
|
||||
*/
|
||||
overlays.default =
|
||||
final: prev:
|
||||
let
|
||||
packageSets = packageSetsFor { pkgs = final; };
|
||||
in
|
||||
{
|
||||
nix = packageSets.nixComponents.nix-everything;
|
||||
};
|
||||
|
||||
hydraJobs = import ./packaging/hydra.nix {
|
||||
inherit
|
||||
|
|
@ -202,43 +320,11 @@
|
|||
|
||||
checks = forAllSystems (
|
||||
system:
|
||||
{
|
||||
installerScriptForGHA = self.hydraJobs.installerScriptForGHA.${system};
|
||||
installTests = self.hydraJobs.installTests.${system};
|
||||
nixpkgsLibTests = self.hydraJobs.tests.nixpkgsLibTests.${system};
|
||||
rl-next =
|
||||
let
|
||||
(import ./ci/gha/tests {
|
||||
inherit system;
|
||||
pkgs = nixpkgsFor.${system}.native;
|
||||
in
|
||||
pkgs.buildPackages.runCommand "test-rl-next-release-notes" { } ''
|
||||
LANG=C.UTF-8 ${pkgs.changelog-d}/bin/changelog-d ${./doc/manual/rl-next} >$out
|
||||
'';
|
||||
repl-completion = nixpkgsFor.${system}.native.callPackage ./tests/repl-completion.nix { };
|
||||
|
||||
/**
|
||||
Checks for our packaging expressions.
|
||||
This shouldn't build anything significant; just check that things
|
||||
(including derivations) are _set up_ correctly.
|
||||
*/
|
||||
packaging-overriding =
|
||||
let
|
||||
pkgs = nixpkgsFor.${system}.native;
|
||||
nix = self.packages.${system}.nix;
|
||||
in
|
||||
assert (nix.appendPatches [ pkgs.emptyFile ]).libs.nix-util.src.patches == [ pkgs.emptyFile ];
|
||||
if pkgs.stdenv.buildPlatform.isDarwin then
|
||||
lib.warn "packaging-overriding check currently disabled because of a permissions issue on macOS" pkgs.emptyFile
|
||||
else
|
||||
# If this fails, something might be wrong with how we've wired the scope,
|
||||
# or something could be broken in Nixpkgs.
|
||||
pkgs.testers.testEqualContents {
|
||||
assertion = "trivial patch does not change source contents";
|
||||
expected = "${./.}";
|
||||
actual =
|
||||
# Same for all components; nix-util is an arbitrary pick
|
||||
(nix.appendPatches [ pkgs.emptyFile ]).libs.nix-util.src;
|
||||
};
|
||||
}
|
||||
nixFlake = self;
|
||||
}).topLevel
|
||||
// (lib.optionalAttrs (builtins.elem system linux64BitSystems)) {
|
||||
dockerImage = self.hydraJobs.dockerImage.${system};
|
||||
}
|
||||
|
|
@ -251,58 +337,20 @@
|
|||
# Add "passthru" tests
|
||||
//
|
||||
flatMapAttrs
|
||||
(
|
||||
{
|
||||
# Run all tests with UBSAN enabled. Running both with ubsan and
|
||||
# without doesn't seem to have much immediate benefit for doubling
|
||||
# the GHA CI workaround.
|
||||
#
|
||||
# TODO: Work toward enabling "address,undefined" if it seems feasible.
|
||||
# This would maybe require dropping Boost coroutines and ignoring intentional
|
||||
# memory leaks with detect_leaks=0.
|
||||
"" = rec {
|
||||
nixpkgs = nixpkgsFor.${system}.native;
|
||||
nixComponents = nixpkgs.nixComponents2.overrideScope (
|
||||
nixCompFinal: nixCompPrev: {
|
||||
mesonComponentOverrides = _finalAttrs: prevAttrs: {
|
||||
mesonFlags =
|
||||
(prevAttrs.mesonFlags or [ ])
|
||||
# TODO: Macos builds instrumented with ubsan take very long
|
||||
# to run functional tests.
|
||||
++ lib.optionals (!nixpkgs.stdenv.hostPlatform.isDarwin) [
|
||||
(lib.mesonOption "b_sanitize" "undefined")
|
||||
];
|
||||
"" = {
|
||||
pkgs = nixpkgsFor.${system}.native;
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
// lib.optionalAttrs (!nixpkgsFor.${system}.native.stdenv.hostPlatform.isDarwin) {
|
||||
# TODO: enable static builds for darwin, blocked on:
|
||||
# https://github.com/NixOS/nixpkgs/issues/320448
|
||||
# TODO: disabled to speed up GHA CI.
|
||||
# "static-" = {
|
||||
# nixpkgs = nixpkgsFor.${system}.native.pkgsStatic;
|
||||
# };
|
||||
}
|
||||
)
|
||||
(
|
||||
nixpkgsPrefix:
|
||||
{
|
||||
nixpkgs,
|
||||
nixComponents ? nixpkgs.nixComponents2,
|
||||
}:
|
||||
flatMapAttrs nixComponents (
|
||||
pkgName: pkg:
|
||||
flatMapAttrs pkg.tests or { } (
|
||||
testName: test: {
|
||||
"${nixpkgsPrefix}${pkgName}-${testName}" = test;
|
||||
}
|
||||
)
|
||||
)
|
||||
// lib.optionalAttrs (nixpkgs.stdenv.hostPlatform == nixpkgs.stdenv.buildPlatform) {
|
||||
"${nixpkgsPrefix}nix-functional-tests" = nixComponents.nix-functional-tests;
|
||||
nixpkgsPrefix: args:
|
||||
(import ./ci/gha/tests (
|
||||
args
|
||||
// {
|
||||
nixFlake = self;
|
||||
componentTestsPrefix = nixpkgsPrefix;
|
||||
}
|
||||
)).componentTests
|
||||
)
|
||||
// devFlake.checks.${system} or { }
|
||||
);
|
||||
|
|
@ -465,5 +513,53 @@
|
|||
default = self.devShells.${system}.native;
|
||||
}
|
||||
);
|
||||
|
||||
lib = {
|
||||
/**
|
||||
Creates a package set for a given Nixpkgs instance and stdenv.
|
||||
|
||||
# Inputs
|
||||
|
||||
- `pkgs`: The Nixpkgs instance to use.
|
||||
|
||||
- `getStdenv`: _Optional_ A function that takes a package set and returns the stdenv to use.
|
||||
This needs to be a function in order to support cross compilation - the `pkgs` passed to `getStdenv` can be `pkgsBuildHost` or any other variation needed.
|
||||
|
||||
# Outputs
|
||||
|
||||
The return value is a fresh Nixpkgs scope containing all the packages that are defined in the Nix repository,
|
||||
as well as some internals and parameters, which may be subject to change.
|
||||
|
||||
# Example
|
||||
|
||||
```console
|
||||
nix repl> :lf NixOS/nix
|
||||
nix-repl> ps = lib.makeComponents { pkgs = import inputs.nixpkgs { crossSystem = "riscv64-linux"; }; }
|
||||
nix-repl> ps
|
||||
{
|
||||
appendPatches = «lambda appendPatches @ ...»;
|
||||
callPackage = «lambda callPackageWith @ ...»;
|
||||
overrideAllMesonComponents = «lambda overrideSource @ ...»;
|
||||
overrideSource = «lambda overrideSource @ ...»;
|
||||
# ...
|
||||
nix-everything
|
||||
# ...
|
||||
nix-store
|
||||
nix-store-c
|
||||
# ...
|
||||
}
|
||||
```
|
||||
*/
|
||||
makeComponents =
|
||||
{
|
||||
pkgs,
|
||||
getStdenv ? pkgs: pkgs.stdenv,
|
||||
}:
|
||||
|
||||
let
|
||||
packageSets = packageSetsFor { inherit getStdenv pkgs; };
|
||||
in
|
||||
packageSets.nixComponents;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ The team meets twice a week (times are denoted in the [Europe/Amsterdam](https:/
|
|||
- mark it as draft if it is blocked on the contributor
|
||||
- escalate it back to the team by moving it to To discuss, and leaving a comment as to why the issue needs to be discussed again.
|
||||
|
||||
- Work meeting: Mondays 14:00-16:00 Europe/Amsterdam see [calendar](https://calendar.google.com/calendar/u/0/embed?src=b9o52fobqjak8oq8lfkhg3t0qg@group.calendar.google.com).
|
||||
- Work meeting: Mondays 18:00-20:00 Europe/Amsterdam; see [calendar](https://calendar.google.com/calendar/u/0/embed?src=b9o52fobqjak8oq8lfkhg3t0qg@group.calendar.google.com).
|
||||
|
||||
1. Code review on pull requests from [In review](#in-review).
|
||||
2. Other chores and tasks.
|
||||
|
|
|
|||
|
|
@ -185,5 +185,23 @@
|
|||
"gwenn.lebihan7@gmail.com": "gwennlbh",
|
||||
"hey@ewen.works": "gwennlbh",
|
||||
"matt@sturgeon.me.uk": "MattSturgeon",
|
||||
"pbsds@hotmail.com": "pbsds"
|
||||
"pbsds@hotmail.com": "pbsds",
|
||||
"sergei@zimmerman.foo": "xokdvium",
|
||||
"v@njh.eu": "vog",
|
||||
"pedro.manse@dmk3.com.br": "PedroManse",
|
||||
"arnavgawas707@gmail.com": "aln730",
|
||||
"mkg20001@gmail.com": "mkg20001",
|
||||
"avn@avnik.info": "avnik",
|
||||
"olk@disr.it": "k1gen",
|
||||
"108410815+alurm@users.noreply.github.com": "alurm",
|
||||
"kaction.cc@gmail.com": "KAction",
|
||||
"juhpetersen@gmail.com": "juhp",
|
||||
"opna2608@protonmail.com": "OPNA2608",
|
||||
"jgbailey@gmail.com": "m4dc4p",
|
||||
"justin.bailey@well.co": "jgbailey-well",
|
||||
"130508846+de11n@users.noreply.github.com": "de11n",
|
||||
"ConnorBaker01@Gmail.com": "ConnorBaker",
|
||||
"jsoo1@asu.edu": "jsoo1",
|
||||
"hsngrmpf+github@gmail.com": "DavHau",
|
||||
"matthew@floxdev.com": "mkenigs"
|
||||
}
|
||||
|
|
@ -162,5 +162,20 @@
|
|||
"pbsds": "Peder Bergebakken Sundt",
|
||||
"egorkonovalov": "Egor Konovalov",
|
||||
"jayeshv": "jayeshv",
|
||||
"vcunat": "Vladim\u00edr \u010cun\u00e1t"
|
||||
"vcunat": "Vladim\u00edr \u010cun\u00e1t",
|
||||
"mkenigs": "Matthew Kenigsberg",
|
||||
"alurm": "Alan Urmancheev",
|
||||
"jgbailey-well": "Justin Bailey",
|
||||
"k1gen": "Oleksandr Knyshuk",
|
||||
"juhp": "Jens Petersen",
|
||||
"de11n": "Elliot Cameron",
|
||||
"jsoo1": "John Soo",
|
||||
"m4dc4p": null,
|
||||
"PedroManse": "Manse",
|
||||
"OPNA2608": "Cosima Neidahl",
|
||||
"mkg20001": "Maciej Kr\u00fcger",
|
||||
"avnik": "Alexander V. Nikolaev",
|
||||
"DavHau": null,
|
||||
"aln730": "AGawas",
|
||||
"vog": "Volker Diels-Grabsch"
|
||||
}
|
||||
|
|
@ -37,117 +37,28 @@
|
|||
fi
|
||||
''}";
|
||||
};
|
||||
meson-format = {
|
||||
meson-format =
|
||||
let
|
||||
meson = pkgs.meson.overrideAttrs {
|
||||
doCheck = false;
|
||||
doInstallCheck = false;
|
||||
patches = [
|
||||
(pkgs.fetchpatch {
|
||||
url = "https://github.com/mesonbuild/meson/commit/38d29b4dd19698d5cad7b599add2a69b243fd88a.patch";
|
||||
hash = "sha256-PgPBvGtCISKn1qQQhzBW5XfknUe91i5XGGBcaUK4yeE=";
|
||||
})
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
files = "(meson.build|meson.options)$";
|
||||
entry = "${pkgs.writeScript "format-meson" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
for file in "$@"; do
|
||||
${lib.getExe pkgs.meson} format -ic ${../meson.format} "$file"
|
||||
${lib.getExe meson} format -ic ${../meson.format} "$file"
|
||||
done
|
||||
''}";
|
||||
excludes = [
|
||||
# We haven't applied formatting to these files yet
|
||||
''^doc/manual/meson.build$''
|
||||
''^doc/manual/source/command-ref/meson.build$''
|
||||
''^doc/manual/source/development/meson.build$''
|
||||
''^doc/manual/source/language/meson.build$''
|
||||
''^doc/manual/source/meson.build$''
|
||||
''^doc/manual/source/release-notes/meson.build$''
|
||||
''^doc/manual/source/store/meson.build$''
|
||||
''^misc/bash/meson.build$''
|
||||
''^misc/fish/meson.build$''
|
||||
''^misc/launchd/meson.build$''
|
||||
''^misc/meson.build$''
|
||||
''^misc/systemd/meson.build$''
|
||||
''^misc/zsh/meson.build$''
|
||||
''^nix-meson-build-support/$''
|
||||
''^nix-meson-build-support/big-objs/meson.build$''
|
||||
''^nix-meson-build-support/common/meson.build$''
|
||||
''^nix-meson-build-support/deps-lists/meson.build$''
|
||||
''^nix-meson-build-support/export/meson.build$''
|
||||
''^nix-meson-build-support/export-all-symbols/meson.build$''
|
||||
''^nix-meson-build-support/generate-header/meson.build$''
|
||||
''^nix-meson-build-support/libatomic/meson.build$''
|
||||
''^nix-meson-build-support/subprojects/meson.build$''
|
||||
''^scripts/meson.build$''
|
||||
''^src/external-api-docs/meson.build$''
|
||||
''^src/internal-api-docs/meson.build$''
|
||||
''^src/libcmd/include/nix/cmd/meson.build$''
|
||||
''^src/libcmd/meson.build$''
|
||||
''^src/libcmd/nix-meson-build-support$''
|
||||
''^src/libexpr/include/nix/expr/meson.build$''
|
||||
''^src/libexpr/meson.build$''
|
||||
''^src/libexpr/nix-meson-build-support$''
|
||||
''^src/libexpr-c/meson.build$''
|
||||
''^src/libexpr-c/nix-meson-build-support$''
|
||||
''^src/libexpr-test-support/meson.build$''
|
||||
''^src/libexpr-test-support/nix-meson-build-support$''
|
||||
''^src/libexpr-tests/meson.build$''
|
||||
''^src/libexpr-tests/nix-meson-build-support$''
|
||||
''^src/libfetchers/include/nix/fetchers/meson.build$''
|
||||
''^src/libfetchers/meson.build$''
|
||||
''^src/libfetchers/nix-meson-build-support$''
|
||||
''^src/libfetchers-c/meson.build$''
|
||||
''^src/libfetchers-c/nix-meson-build-support$''
|
||||
''^src/libfetchers-tests/meson.build$''
|
||||
''^src/libfetchers-tests/nix-meson-build-support$''
|
||||
''^src/libflake/include/nix/flake/meson.build$''
|
||||
''^src/libflake/meson.build$''
|
||||
''^src/libflake/nix-meson-build-support$''
|
||||
''^src/libflake-c/meson.build$''
|
||||
''^src/libflake-c/nix-meson-build-support$''
|
||||
''^src/libflake-tests/meson.build$''
|
||||
''^src/libflake-tests/nix-meson-build-support$''
|
||||
''^src/libmain/include/nix/main/meson.build$''
|
||||
''^src/libmain/meson.build$''
|
||||
''^src/libmain/nix-meson-build-support$''
|
||||
''^src/libmain-c/meson.build$''
|
||||
''^src/libmain-c/nix-meson-build-support$''
|
||||
''^src/libstore/include/nix/store/meson.build$''
|
||||
''^src/libstore/meson.build$''
|
||||
''^src/libstore/nix-meson-build-support$''
|
||||
''^src/libstore/unix/include/nix/store/meson.build$''
|
||||
''^src/libstore/unix/meson.build$''
|
||||
''^src/libstore/windows/meson.build$''
|
||||
''^src/libstore-c/meson.build$''
|
||||
''^src/libstore-c/nix-meson-build-support$''
|
||||
''^src/libstore-test-support/include/nix/store/tests/meson.build$''
|
||||
''^src/libstore-test-support/meson.build$''
|
||||
''^src/libstore-test-support/nix-meson-build-support$''
|
||||
''^src/libstore-tests/meson.build$''
|
||||
''^src/libstore-tests/nix-meson-build-support$''
|
||||
''^src/libutil/meson.build$''
|
||||
''^src/libutil/nix-meson-build-support$''
|
||||
''^src/libutil/unix/include/nix/util/meson.build$''
|
||||
''^src/libutil/unix/meson.build$''
|
||||
''^src/libutil/windows/meson.build$''
|
||||
''^src/libutil-c/meson.build$''
|
||||
''^src/libutil-c/nix-meson-build-support$''
|
||||
''^src/libutil-test-support/include/nix/util/tests/meson.build$''
|
||||
''^src/libutil-test-support/meson.build$''
|
||||
''^src/libutil-test-support/nix-meson-build-support$''
|
||||
''^src/libutil-tests/meson.build$''
|
||||
''^src/libutil-tests/nix-meson-build-support$''
|
||||
''^src/nix/meson.build$''
|
||||
''^src/nix/nix-meson-build-support$''
|
||||
''^src/perl/lib/Nix/meson.build$''
|
||||
''^src/perl/meson.build$''
|
||||
''^tests/functional/ca/meson.build$''
|
||||
''^tests/functional/common/meson.build$''
|
||||
''^tests/functional/dyn-drv/meson.build$''
|
||||
''^tests/functional/flakes/meson.build$''
|
||||
''^tests/functional/git-hashing/meson.build$''
|
||||
''^tests/functional/local-overlay-store/meson.build$''
|
||||
''^tests/functional/meson.build$''
|
||||
''^src/libcmd/meson.options$''
|
||||
''^src/libexpr/meson.options$''
|
||||
''^src/libstore/meson.options$''
|
||||
''^src/libutil/meson.options$''
|
||||
''^src/libutil-c/meson.options$''
|
||||
''^src/nix/meson.options$''
|
||||
''^src/perl/meson.options$''
|
||||
];
|
||||
};
|
||||
nixfmt-rfc-style = {
|
||||
enable = true;
|
||||
|
|
@ -189,467 +100,6 @@
|
|||
# Don't format vendored code
|
||||
''^doc/manual/redirects\.js$''
|
||||
''^doc/manual/theme/highlight\.js$''
|
||||
|
||||
# We haven't applied formatting to these files yet
|
||||
''^doc/manual/redirects\.js$''
|
||||
''^doc/manual/theme/highlight\.js$''
|
||||
''^src/build-remote/build-remote\.cc$''
|
||||
''^src/libcmd/built-path\.cc$''
|
||||
''^src/libcmd/include/nix/cmd/built-path\.hh$''
|
||||
''^src/libcmd/common-eval-args\.cc$''
|
||||
''^src/libcmd/include/nix/cmd/common-eval-args\.hh$''
|
||||
''^src/libcmd/editor-for\.cc$''
|
||||
''^src/libcmd/installable-attr-path\.cc$''
|
||||
''^src/libcmd/include/nix/cmd/installable-attr-path\.hh$''
|
||||
''^src/libcmd/installable-derived-path\.cc$''
|
||||
''^src/libcmd/include/nix/cmd/installable-derived-path\.hh$''
|
||||
''^src/libcmd/installable-flake\.cc$''
|
||||
''^src/libcmd/include/nix/cmd/installable-flake\.hh$''
|
||||
''^src/libcmd/installable-value\.cc$''
|
||||
''^src/libcmd/include/nix/cmd/installable-value\.hh$''
|
||||
''^src/libcmd/installables\.cc$''
|
||||
''^src/libcmd/include/nix/cmd/installables\.hh$''
|
||||
''^src/libcmd/include/nix/cmd/legacy\.hh$''
|
||||
''^src/libcmd/markdown\.cc$''
|
||||
''^src/libcmd/misc-store-flags\.cc$''
|
||||
''^src/libcmd/repl-interacter\.cc$''
|
||||
''^src/libcmd/include/nix/cmd/repl-interacter\.hh$''
|
||||
''^src/libcmd/repl\.cc$''
|
||||
''^src/libcmd/include/nix/cmd/repl\.hh$''
|
||||
''^src/libexpr-c/nix_api_expr\.cc$''
|
||||
''^src/libexpr-c/nix_api_external\.cc$''
|
||||
''^src/libexpr/attr-path\.cc$''
|
||||
''^src/libexpr/include/nix/expr/attr-path\.hh$''
|
||||
''^src/libexpr/attr-set\.cc$''
|
||||
''^src/libexpr/include/nix/expr/attr-set\.hh$''
|
||||
''^src/libexpr/eval-cache\.cc$''
|
||||
''^src/libexpr/include/nix/expr/eval-cache\.hh$''
|
||||
''^src/libexpr/eval-error\.cc$''
|
||||
''^src/libexpr/include/nix/expr/eval-inline\.hh$''
|
||||
''^src/libexpr/eval-settings\.cc$''
|
||||
''^src/libexpr/include/nix/expr/eval-settings\.hh$''
|
||||
''^src/libexpr/eval\.cc$''
|
||||
''^src/libexpr/include/nix/expr/eval\.hh$''
|
||||
''^src/libexpr/function-trace\.cc$''
|
||||
''^src/libexpr/include/nix/expr/gc-small-vector\.hh$''
|
||||
''^src/libexpr/get-drvs\.cc$''
|
||||
''^src/libexpr/include/nix/expr/get-drvs\.hh$''
|
||||
''^src/libexpr/json-to-value\.cc$''
|
||||
''^src/libexpr/nixexpr\.cc$''
|
||||
''^src/libexpr/include/nix/expr/nixexpr\.hh$''
|
||||
''^src/libexpr/include/nix/expr/parser-state\.hh$''
|
||||
''^src/libexpr/primops\.cc$''
|
||||
''^src/libexpr/include/nix/expr/primops\.hh$''
|
||||
''^src/libexpr/primops/context\.cc$''
|
||||
''^src/libexpr/primops/fetchClosure\.cc$''
|
||||
''^src/libexpr/primops/fetchMercurial\.cc$''
|
||||
''^src/libexpr/primops/fetchTree\.cc$''
|
||||
''^src/libexpr/primops/fromTOML\.cc$''
|
||||
''^src/libexpr/print-ambiguous\.cc$''
|
||||
''^src/libexpr/include/nix/expr/print-ambiguous\.hh$''
|
||||
''^src/libexpr/include/nix/expr/print-options\.hh$''
|
||||
''^src/libexpr/print\.cc$''
|
||||
''^src/libexpr/include/nix/expr/print\.hh$''
|
||||
''^src/libexpr/search-path\.cc$''
|
||||
''^src/libexpr/include/nix/expr/symbol-table\.hh$''
|
||||
''^src/libexpr/value-to-json\.cc$''
|
||||
''^src/libexpr/include/nix/expr/value-to-json\.hh$''
|
||||
''^src/libexpr/value-to-xml\.cc$''
|
||||
''^src/libexpr/include/nix/expr/value-to-xml\.hh$''
|
||||
''^src/libexpr/value/context\.cc$''
|
||||
''^src/libexpr/include/nix/expr/value/context\.hh$''
|
||||
''^src/libfetchers/attrs\.cc$''
|
||||
''^src/libfetchers/cache\.cc$''
|
||||
''^src/libfetchers/include/nix/fetchers/cache\.hh$''
|
||||
''^src/libfetchers/fetch-settings\.cc$''
|
||||
''^src/libfetchers/include/nix/fetchers/fetch-settings\.hh$''
|
||||
''^src/libfetchers/fetch-to-store\.cc$''
|
||||
''^src/libfetchers/fetchers\.cc$''
|
||||
''^src/libfetchers/include/nix/fetchers/fetchers\.hh$''
|
||||
''^src/libfetchers/filtering-source-accessor\.cc$''
|
||||
''^src/libfetchers/include/nix/fetchers/filtering-source-accessor\.hh$''
|
||||
''^src/libfetchers/fs-source-accessor\.cc$''
|
||||
''^src/libfetchers/include/nix/fs-source-accessor\.hh$''
|
||||
''^src/libfetchers/git-utils\.cc$''
|
||||
''^src/libfetchers/include/nix/fetchers/git-utils\.hh$''
|
||||
''^src/libfetchers/github\.cc$''
|
||||
''^src/libfetchers/indirect\.cc$''
|
||||
''^src/libfetchers/memory-source-accessor\.cc$''
|
||||
''^src/libfetchers/path\.cc$''
|
||||
''^src/libfetchers/registry\.cc$''
|
||||
''^src/libfetchers/include/nix/fetchers/registry\.hh$''
|
||||
''^src/libfetchers/tarball\.cc$''
|
||||
''^src/libfetchers/include/nix/fetchers/tarball\.hh$''
|
||||
''^src/libfetchers/git\.cc$''
|
||||
''^src/libfetchers/mercurial\.cc$''
|
||||
''^src/libflake/config\.cc$''
|
||||
''^src/libflake/flake\.cc$''
|
||||
''^src/libflake/include/nix/flake/flake\.hh$''
|
||||
''^src/libflake/flakeref\.cc$''
|
||||
''^src/libflake/include/nix/flake/flakeref\.hh$''
|
||||
''^src/libflake/lockfile\.cc$''
|
||||
''^src/libflake/include/nix/flake/lockfile\.hh$''
|
||||
''^src/libflake/url-name\.cc$''
|
||||
''^src/libmain/common-args\.cc$''
|
||||
''^src/libmain/include/nix/main/common-args\.hh$''
|
||||
''^src/libmain/loggers\.cc$''
|
||||
''^src/libmain/include/nix/main/loggers\.hh$''
|
||||
''^src/libmain/progress-bar\.cc$''
|
||||
''^src/libmain/shared\.cc$''
|
||||
''^src/libmain/include/nix/main/shared\.hh$''
|
||||
''^src/libmain/unix/stack\.cc$''
|
||||
''^src/libstore/binary-cache-store\.cc$''
|
||||
''^src/libstore/include/nix/store/binary-cache-store\.hh$''
|
||||
''^src/libstore/include/nix/store/build-result\.hh$''
|
||||
''^src/libstore/include/nix/store/builtins\.hh$''
|
||||
''^src/libstore/builtins/buildenv\.cc$''
|
||||
''^src/libstore/include/nix/store/builtins/buildenv\.hh$''
|
||||
''^src/libstore/include/nix/store/common-protocol-impl\.hh$''
|
||||
''^src/libstore/common-protocol\.cc$''
|
||||
''^src/libstore/include/nix/store/common-protocol\.hh$''
|
||||
''^src/libstore/include/nix/store/common-ssh-store-config\.hh$''
|
||||
''^src/libstore/content-address\.cc$''
|
||||
''^src/libstore/include/nix/store/content-address\.hh$''
|
||||
''^src/libstore/daemon\.cc$''
|
||||
''^src/libstore/include/nix/store/daemon\.hh$''
|
||||
''^src/libstore/derivations\.cc$''
|
||||
''^src/libstore/include/nix/store/derivations\.hh$''
|
||||
''^src/libstore/derived-path-map\.cc$''
|
||||
''^src/libstore/include/nix/store/derived-path-map\.hh$''
|
||||
''^src/libstore/derived-path\.cc$''
|
||||
''^src/libstore/include/nix/store/derived-path\.hh$''
|
||||
''^src/libstore/downstream-placeholder\.cc$''
|
||||
''^src/libstore/include/nix/store/downstream-placeholder\.hh$''
|
||||
''^src/libstore/dummy-store\.cc$''
|
||||
''^src/libstore/export-import\.cc$''
|
||||
''^src/libstore/filetransfer\.cc$''
|
||||
''^src/libstore/include/nix/store/filetransfer\.hh$''
|
||||
''^src/libstore/include/nix/store/gc-store\.hh$''
|
||||
''^src/libstore/globals\.cc$''
|
||||
''^src/libstore/include/nix/store/globals\.hh$''
|
||||
''^src/libstore/http-binary-cache-store\.cc$''
|
||||
''^src/libstore/legacy-ssh-store\.cc$''
|
||||
''^src/libstore/include/nix/store/legacy-ssh-store\.hh$''
|
||||
''^src/libstore/include/nix/store/length-prefixed-protocol-helper\.hh$''
|
||||
''^src/libstore/linux/personality\.cc$''
|
||||
''^src/libstore/linux/include/nix/store/personality\.hh$''
|
||||
''^src/libstore/local-binary-cache-store\.cc$''
|
||||
''^src/libstore/local-fs-store\.cc$''
|
||||
''^src/libstore/include/nix/store/local-fs-store\.hh$''
|
||||
''^src/libstore/log-store\.cc$''
|
||||
''^src/libstore/include/nix/store/log-store\.hh$''
|
||||
''^src/libstore/machines\.cc$''
|
||||
''^src/libstore/include/nix/store/machines\.hh$''
|
||||
''^src/libstore/make-content-addressed\.cc$''
|
||||
''^src/libstore/include/nix/store/make-content-addressed\.hh$''
|
||||
''^src/libstore/misc\.cc$''
|
||||
''^src/libstore/names\.cc$''
|
||||
''^src/libstore/include/nix/store/names\.hh$''
|
||||
''^src/libstore/nar-accessor\.cc$''
|
||||
''^src/libstore/include/nix/store/nar-accessor\.hh$''
|
||||
''^src/libstore/nar-info-disk-cache\.cc$''
|
||||
''^src/libstore/include/nix/store/nar-info-disk-cache\.hh$''
|
||||
''^src/libstore/nar-info\.cc$''
|
||||
''^src/libstore/include/nix/store/nar-info\.hh$''
|
||||
''^src/libstore/outputs-spec\.cc$''
|
||||
''^src/libstore/include/nix/store/outputs-spec\.hh$''
|
||||
''^src/libstore/parsed-derivations\.cc$''
|
||||
''^src/libstore/path-info\.cc$''
|
||||
''^src/libstore/include/nix/store/path-info\.hh$''
|
||||
''^src/libstore/path-references\.cc$''
|
||||
''^src/libstore/include/nix/store/path-regex\.hh$''
|
||||
''^src/libstore/path-with-outputs\.cc$''
|
||||
''^src/libstore/path\.cc$''
|
||||
''^src/libstore/include/nix/store/path\.hh$''
|
||||
''^src/libstore/pathlocks\.cc$''
|
||||
''^src/libstore/include/nix/store/pathlocks\.hh$''
|
||||
''^src/libstore/profiles\.cc$''
|
||||
''^src/libstore/include/nix/store/profiles\.hh$''
|
||||
''^src/libstore/realisation\.cc$''
|
||||
''^src/libstore/include/nix/store/realisation\.hh$''
|
||||
''^src/libstore/remote-fs-accessor\.cc$''
|
||||
''^src/libstore/include/nix/store/remote-fs-accessor\.hh$''
|
||||
''^src/libstore/include/nix/store/remote-store-connection\.hh$''
|
||||
''^src/libstore/remote-store\.cc$''
|
||||
''^src/libstore/include/nix/store/remote-store\.hh$''
|
||||
''^src/libstore/s3-binary-cache-store\.cc$''
|
||||
''^src/libstore/include/nix/store/s3\.hh$''
|
||||
''^src/libstore/serve-protocol-impl\.cc$''
|
||||
''^src/libstore/include/nix/store/serve-protocol-impl\.hh$''
|
||||
''^src/libstore/serve-protocol\.cc$''
|
||||
''^src/libstore/include/nix/store/serve-protocol\.hh$''
|
||||
''^src/libstore/sqlite\.cc$''
|
||||
''^src/libstore/include/nix/store/sqlite\.hh$''
|
||||
''^src/libstore/ssh-store\.cc$''
|
||||
''^src/libstore/ssh\.cc$''
|
||||
''^src/libstore/include/nix/store/ssh\.hh$''
|
||||
''^src/libstore/store-api\.cc$''
|
||||
''^src/libstore/include/nix/store/store-api\.hh$''
|
||||
''^src/libstore/include/nix/store/store-dir-config\.hh$''
|
||||
''^src/libstore/build/derivation-building-goal\.cc$''
|
||||
''^src/libstore/include/nix/store/build/derivation-building-goal\.hh$''
|
||||
''^src/libstore/build/derivation-goal\.cc$''
|
||||
''^src/libstore/include/nix/store/build/derivation-goal\.hh$''
|
||||
''^src/libstore/build/drv-output-substitution-goal\.cc$''
|
||||
''^src/libstore/include/nix/store/build/drv-output-substitution-goal\.hh$''
|
||||
''^src/libstore/build/entry-points\.cc$''
|
||||
''^src/libstore/build/goal\.cc$''
|
||||
''^src/libstore/include/nix/store/build/goal\.hh$''
|
||||
''^src/libstore/unix/build/hook-instance\.cc$''
|
||||
''^src/libstore/unix/build/derivation-builder\.cc$''
|
||||
''^src/libstore/unix/include/nix/store/build/derivation-builder\.hh$''
|
||||
''^src/libstore/build/substitution-goal\.cc$''
|
||||
''^src/libstore/include/nix/store/build/substitution-goal\.hh$''
|
||||
''^src/libstore/build/worker\.cc$''
|
||||
''^src/libstore/include/nix/store/build/worker\.hh$''
|
||||
''^src/libstore/builtins/fetchurl\.cc$''
|
||||
''^src/libstore/builtins/unpack-channel\.cc$''
|
||||
''^src/libstore/gc\.cc$''
|
||||
''^src/libstore/local-overlay-store\.cc$''
|
||||
''^src/libstore/include/nix/store/local-overlay-store\.hh$''
|
||||
''^src/libstore/local-store\.cc$''
|
||||
''^src/libstore/include/nix/store/local-store\.hh$''
|
||||
''^src/libstore/unix/user-lock\.cc$''
|
||||
''^src/libstore/unix/include/nix/store/user-lock\.hh$''
|
||||
''^src/libstore/optimise-store\.cc$''
|
||||
''^src/libstore/unix/pathlocks\.cc$''
|
||||
''^src/libstore/posix-fs-canonicalise\.cc$''
|
||||
''^src/libstore/include/nix/store/posix-fs-canonicalise\.hh$''
|
||||
''^src/libstore/uds-remote-store\.cc$''
|
||||
''^src/libstore/include/nix/store/uds-remote-store\.hh$''
|
||||
''^src/libstore/windows/build\.cc$''
|
||||
''^src/libstore/include/nix/store/worker-protocol-impl\.hh$''
|
||||
''^src/libstore/worker-protocol\.cc$''
|
||||
''^src/libstore/include/nix/store/worker-protocol\.hh$''
|
||||
''^src/libutil-c/nix_api_util_internal\.h$''
|
||||
''^src/libutil/archive\.cc$''
|
||||
''^src/libutil/include/nix/util/archive\.hh$''
|
||||
''^src/libutil/args\.cc$''
|
||||
''^src/libutil/include/nix/util/args\.hh$''
|
||||
''^src/libutil/include/nix/util/args/root\.hh$''
|
||||
''^src/libutil/include/nix/util/callback\.hh$''
|
||||
''^src/libutil/canon-path\.cc$''
|
||||
''^src/libutil/include/nix/util/canon-path\.hh$''
|
||||
''^src/libutil/include/nix/util/chunked-vector\.hh$''
|
||||
''^src/libutil/include/nix/util/closure\.hh$''
|
||||
''^src/libutil/include/nix/util/comparator\.hh$''
|
||||
''^src/libutil/compute-levels\.cc$''
|
||||
''^src/libutil/include/nix/util/config-impl\.hh$''
|
||||
''^src/libutil/configuration\.cc$''
|
||||
''^src/libutil/include/nix/util/configuration\.hh$''
|
||||
''^src/libutil/current-process\.cc$''
|
||||
''^src/libutil/include/nix/util/current-process\.hh$''
|
||||
''^src/libutil/english\.cc$''
|
||||
''^src/libutil/include/nix/util/english\.hh$''
|
||||
''^src/libutil/error\.cc$''
|
||||
''^src/libutil/include/nix/util/error\.hh$''
|
||||
''^src/libutil/include/nix/util/exit\.hh$''
|
||||
''^src/libutil/experimental-features\.cc$''
|
||||
''^src/libutil/include/nix/util/experimental-features\.hh$''
|
||||
''^src/libutil/file-content-address\.cc$''
|
||||
''^src/libutil/include/nix/util/file-content-address\.hh$''
|
||||
''^src/libutil/file-descriptor\.cc$''
|
||||
''^src/libutil/include/nix/util/file-descriptor\.hh$''
|
||||
''^src/libutil/include/nix/util/file-path-impl\.hh$''
|
||||
''^src/libutil/include/nix/util/file-path\.hh$''
|
||||
''^src/libutil/file-system\.cc$''
|
||||
''^src/libutil/include/nix/util/file-system\.hh$''
|
||||
''^src/libutil/include/nix/util/finally\.hh$''
|
||||
''^src/libutil/include/nix/util/fmt\.hh$''
|
||||
''^src/libutil/fs-sink\.cc$''
|
||||
''^src/libutil/include/nix/util/fs-sink\.hh$''
|
||||
''^src/libutil/git\.cc$''
|
||||
''^src/libutil/include/nix/util/git\.hh$''
|
||||
''^src/libutil/hash\.cc$''
|
||||
''^src/libutil/include/nix/util/hash\.hh$''
|
||||
''^src/libutil/hilite\.cc$''
|
||||
''^src/libutil/include/nix/util/hilite\.hh$''
|
||||
''^src/libutil/source-accessor\.hh$''
|
||||
''^src/libutil/include/nix/util/json-impls\.hh$''
|
||||
''^src/libutil/json-utils\.cc$''
|
||||
''^src/libutil/include/nix/util/json-utils\.hh$''
|
||||
''^src/libutil/linux/cgroup\.cc$''
|
||||
''^src/libutil/linux/linux-namespaces\.cc$''
|
||||
''^src/libutil/logging\.cc$''
|
||||
''^src/libutil/include/nix/util/logging\.hh$''
|
||||
''^src/libutil/memory-source-accessor\.cc$''
|
||||
''^src/libutil/include/nix/util/memory-source-accessor\.hh$''
|
||||
''^src/libutil/include/nix/util/pool\.hh$''
|
||||
''^src/libutil/position\.cc$''
|
||||
''^src/libutil/include/nix/util/position\.hh$''
|
||||
''^src/libutil/posix-source-accessor\.cc$''
|
||||
''^src/libutil/include/nix/util/posix-source-accessor\.hh$''
|
||||
''^src/libutil/include/nix/util/processes\.hh$''
|
||||
''^src/libutil/include/nix/util/ref\.hh$''
|
||||
''^src/libutil/references\.cc$''
|
||||
''^src/libutil/include/nix/util/references\.hh$''
|
||||
''^src/libutil/regex-combinators\.hh$''
|
||||
''^src/libutil/serialise\.cc$''
|
||||
''^src/libutil/include/nix/util/serialise\.hh$''
|
||||
''^src/libutil/include/nix/util/signals\.hh$''
|
||||
''^src/libutil/signature/local-keys\.cc$''
|
||||
''^src/libutil/include/nix/util/signature/local-keys\.hh$''
|
||||
''^src/libutil/signature/signer\.cc$''
|
||||
''^src/libutil/include/nix/util/signature/signer\.hh$''
|
||||
''^src/libutil/source-accessor\.cc$''
|
||||
''^src/libutil/include/nix/util/source-accessor\.hh$''
|
||||
''^src/libutil/source-path\.cc$''
|
||||
''^src/libutil/include/nix/util/source-path\.hh$''
|
||||
''^src/libutil/include/nix/util/split\.hh$''
|
||||
''^src/libutil/suggestions\.cc$''
|
||||
''^src/libutil/include/nix/util/suggestions\.hh$''
|
||||
''^src/libutil/include/nix/util/sync\.hh$''
|
||||
''^src/libutil/terminal\.cc$''
|
||||
''^src/libutil/include/nix/util/terminal\.hh$''
|
||||
''^src/libutil/thread-pool\.cc$''
|
||||
''^src/libutil/include/nix/util/thread-pool\.hh$''
|
||||
''^src/libutil/include/nix/util/topo-sort\.hh$''
|
||||
''^src/libutil/include/nix/util/types\.hh$''
|
||||
''^src/libutil/unix/file-descriptor\.cc$''
|
||||
''^src/libutil/unix/file-path\.cc$''
|
||||
''^src/libutil/unix/processes\.cc$''
|
||||
''^src/libutil/unix/include/nix/util/signals-impl\.hh$''
|
||||
''^src/libutil/unix/signals\.cc$''
|
||||
''^src/libutil/unix-domain-socket\.cc$''
|
||||
''^src/libutil/unix/users\.cc$''
|
||||
''^src/libutil/include/nix/util/url-parts\.hh$''
|
||||
''^src/libutil/url\.cc$''
|
||||
''^src/libutil/include/nix/util/url\.hh$''
|
||||
''^src/libutil/users\.cc$''
|
||||
''^src/libutil/include/nix/util/users\.hh$''
|
||||
''^src/libutil/util\.cc$''
|
||||
''^src/libutil/include/nix/util/util\.hh$''
|
||||
''^src/libutil/include/nix/util/variant-wrapper\.hh$''
|
||||
''^src/libutil/widecharwidth/widechar_width\.h$'' # vendored source
|
||||
''^src/libutil/windows/file-descriptor\.cc$''
|
||||
''^src/libutil/windows/file-path\.cc$''
|
||||
''^src/libutil/windows/processes\.cc$''
|
||||
''^src/libutil/windows/users\.cc$''
|
||||
''^src/libutil/windows/windows-error\.cc$''
|
||||
''^src/libutil/windows/include/nix/util/windows-error\.hh$''
|
||||
''^src/libutil/xml-writer\.cc$''
|
||||
''^src/libutil/include/nix/util/xml-writer\.hh$''
|
||||
''^src/nix-build/nix-build\.cc$''
|
||||
''^src/nix-channel/nix-channel\.cc$''
|
||||
''^src/nix-collect-garbage/nix-collect-garbage\.cc$''
|
||||
''^src/nix-env/buildenv.nix$''
|
||||
''^src/nix-env/nix-env\.cc$''
|
||||
''^src/nix-env/user-env\.cc$''
|
||||
''^src/nix-env/user-env\.hh$''
|
||||
''^src/nix-instantiate/nix-instantiate\.cc$''
|
||||
''^src/nix-store/dotgraph\.cc$''
|
||||
''^src/nix-store/graphml\.cc$''
|
||||
''^src/nix-store/nix-store\.cc$''
|
||||
''^src/nix/add-to-store\.cc$''
|
||||
''^src/nix/app\.cc$''
|
||||
''^src/nix/build\.cc$''
|
||||
''^src/nix/bundle\.cc$''
|
||||
''^src/nix/cat\.cc$''
|
||||
''^src/nix/config-check\.cc$''
|
||||
''^src/nix/config\.cc$''
|
||||
''^src/nix/copy\.cc$''
|
||||
''^src/nix/derivation-add\.cc$''
|
||||
''^src/nix/derivation-show\.cc$''
|
||||
''^src/nix/derivation\.cc$''
|
||||
''^src/nix/develop\.cc$''
|
||||
''^src/nix/diff-closures\.cc$''
|
||||
''^src/nix/dump-path\.cc$''
|
||||
''^src/nix/edit\.cc$''
|
||||
''^src/nix/eval\.cc$''
|
||||
''^src/nix/flake\.cc$''
|
||||
''^src/nix/fmt\.cc$''
|
||||
''^src/nix/hash\.cc$''
|
||||
''^src/nix/log\.cc$''
|
||||
''^src/nix/ls\.cc$''
|
||||
''^src/nix/main\.cc$''
|
||||
''^src/nix/make-content-addressed\.cc$''
|
||||
''^src/nix/nar\.cc$''
|
||||
''^src/nix/optimise-store\.cc$''
|
||||
''^src/nix/path-from-hash-part\.cc$''
|
||||
''^src/nix/path-info\.cc$''
|
||||
''^src/nix/prefetch\.cc$''
|
||||
''^src/nix/profile\.cc$''
|
||||
''^src/nix/realisation\.cc$''
|
||||
''^src/nix/registry\.cc$''
|
||||
''^src/nix/repl\.cc$''
|
||||
''^src/nix/run\.cc$''
|
||||
''^src/nix/run\.hh$''
|
||||
''^src/nix/search\.cc$''
|
||||
''^src/nix/sigs\.cc$''
|
||||
''^src/nix/store-copy-log\.cc$''
|
||||
''^src/nix/store-delete\.cc$''
|
||||
''^src/nix/store-gc\.cc$''
|
||||
''^src/nix/store-info\.cc$''
|
||||
''^src/nix/store-repair\.cc$''
|
||||
''^src/nix/store\.cc$''
|
||||
''^src/nix/unix/daemon\.cc$''
|
||||
''^src/nix/upgrade-nix\.cc$''
|
||||
''^src/nix/verify\.cc$''
|
||||
''^src/nix/why-depends\.cc$''
|
||||
|
||||
''^tests/functional/plugins/plugintest\.cc''
|
||||
''^tests/functional/test-libstoreconsumer/main\.cc''
|
||||
''^tests/nixos/ca-fd-leak/sender\.c''
|
||||
''^tests/nixos/ca-fd-leak/smuggler\.c''
|
||||
''^tests/nixos/user-sandboxing/attacker\.c''
|
||||
''^src/libexpr-test-support/include/nix/expr/tests/libexpr\.hh''
|
||||
''^src/libexpr-test-support/tests/value/context\.cc''
|
||||
''^src/libexpr-test-support/include/nix/expr/tests/value/context\.hh''
|
||||
''^src/libexpr-tests/derived-path\.cc''
|
||||
''^src/libexpr-tests/error_traces\.cc''
|
||||
''^src/libexpr-tests/eval\.cc''
|
||||
''^src/libexpr-tests/json\.cc''
|
||||
''^src/libexpr-tests/main\.cc''
|
||||
''^src/libexpr-tests/primops\.cc''
|
||||
''^src/libexpr-tests/search-path\.cc''
|
||||
''^src/libexpr-tests/trivial\.cc''
|
||||
''^src/libexpr-tests/value/context\.cc''
|
||||
''^src/libexpr-tests/value/print\.cc''
|
||||
''^src/libfetchers-tests/public-key\.cc''
|
||||
''^src/libflake-tests/flakeref\.cc''
|
||||
''^src/libflake-tests/url-name\.cc''
|
||||
''^src/libstore-test-support/tests/derived-path\.cc''
|
||||
''^src/libstore-test-support/include/nix/store/tests/derived-path\.hh''
|
||||
''^src/libstore-test-support/include/nix/store/tests/nix_api_store\.hh''
|
||||
''^src/libstore-test-support/tests/outputs-spec\.cc''
|
||||
''^src/libstore-test-support/include/nix/store/tests/outputs-spec\.hh''
|
||||
''^src/libstore-test-support/path\.cc''
|
||||
''^src/libstore-test-support/include/nix/store/tests/path\.hh''
|
||||
''^src/libstore-test-support/include/nix/store/tests/protocol\.hh''
|
||||
''^src/libstore-tests/common-protocol\.cc''
|
||||
''^src/libstore-tests/content-address\.cc''
|
||||
''^src/libstore-tests/derivation\.cc''
|
||||
''^src/libstore-tests/derived-path\.cc''
|
||||
''^src/libstore-tests/downstream-placeholder\.cc''
|
||||
''^src/libstore-tests/machines\.cc''
|
||||
''^src/libstore-tests/nar-info-disk-cache\.cc''
|
||||
''^src/libstore-tests/nar-info\.cc''
|
||||
''^src/libstore-tests/outputs-spec\.cc''
|
||||
''^src/libstore-tests/path-info\.cc''
|
||||
''^src/libstore-tests/path\.cc''
|
||||
''^src/libstore-tests/serve-protocol\.cc''
|
||||
''^src/libstore-tests/worker-protocol\.cc''
|
||||
''^src/libutil-test-support/include/nix/util/tests/characterization\.hh''
|
||||
''^src/libutil-test-support/hash\.cc''
|
||||
''^src/libutil-test-support/include/nix/util/tests/hash\.hh''
|
||||
''^src/libutil-tests/args\.cc''
|
||||
''^src/libutil-tests/canon-path\.cc''
|
||||
''^src/libutil-tests/chunked-vector\.cc''
|
||||
''^src/libutil-tests/closure\.cc''
|
||||
''^src/libutil-tests/compression\.cc''
|
||||
''^src/libutil-tests/config\.cc''
|
||||
''^src/libutil-tests/file-content-address\.cc''
|
||||
''^src/libutil-tests/git\.cc''
|
||||
''^src/libutil-tests/hash\.cc''
|
||||
''^src/libutil-tests/hilite\.cc''
|
||||
''^src/libutil-tests/json-utils\.cc''
|
||||
''^src/libutil-tests/logging\.cc''
|
||||
''^src/libutil-tests/lru-cache\.cc''
|
||||
''^src/libutil-tests/pool\.cc''
|
||||
''^src/libutil-tests/references\.cc''
|
||||
''^src/libutil-tests/suggestions\.cc''
|
||||
''^src/libutil-tests/url\.cc''
|
||||
''^src/libutil-tests/xml-writer\.cc''
|
||||
];
|
||||
};
|
||||
shellcheck = {
|
||||
|
|
@ -723,8 +173,6 @@
|
|||
''^tests/functional/gc-concurrent\.sh$''
|
||||
''^tests/functional/gc-concurrent2\.builder\.sh$''
|
||||
''^tests/functional/gc-non-blocking\.sh$''
|
||||
''^tests/functional/git-hashing/common\.sh$''
|
||||
''^tests/functional/git-hashing/simple\.sh$''
|
||||
''^tests/functional/hash-convert\.sh$''
|
||||
''^tests/functional/impure-derivations\.sh$''
|
||||
''^tests/functional/impure-eval\.sh$''
|
||||
|
|
@ -800,7 +248,6 @@
|
|||
''^tests/functional/user-envs\.builder\.sh$''
|
||||
''^tests/functional/user-envs\.sh$''
|
||||
''^tests/functional/why-depends\.sh$''
|
||||
''^src/libutil-tests/data/git/check-data\.sh$''
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if ! type -p pre-commit &>/dev/null; then
|
||||
echo "format.sh: pre-commit not found. Please use \`nix develop\`.";
|
||||
echo "format.sh: pre-commit not found. Please use \`nix develop -c ./maintainers/format.sh\`.";
|
||||
exit 1;
|
||||
fi;
|
||||
if test -z "$_NIX_PRE_COMMIT_HOOKS_CONFIG"; then
|
||||
echo "format.sh: _NIX_PRE_COMMIT_HOOKS_CONFIG not set. Please use \`nix develop\`.";
|
||||
echo "format.sh: _NIX_PRE_COMMIT_HOOKS_CONFIG not set. Please use \`nix develop -c ./maintainers/format.sh\`.";
|
||||
exit 1;
|
||||
fi;
|
||||
pre-commit run --config "$_NIX_PRE_COMMIT_HOOKS_CONFIG" --all-files
|
||||
|
||||
while ! pre-commit run --config "$_NIX_PRE_COMMIT_HOOKS_CONFIG" --all-files; do
|
||||
if [ "${1:-}" != "--until-stable" ]; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
|
|
@ -3,5 +3,9 @@
|
|||
|
||||
- https://github.com/NixOS/nixos-homepage/
|
||||
- https://github.com/orgs/NixOS/teams/nix-team
|
||||
- Matrix room
|
||||
- Matrix rooms
|
||||
- [private] Nix maintainer team
|
||||
- Nix ∪ Lix devs (also private)
|
||||
- any open security issues if present and needed
|
||||
|
||||
- Team member should subscribe to notifications for the [Nix development category on Discourse](https://discourse.nixos.org/c/dev/nix/50)
|
||||
|
|
|
|||
58
maintainers/release-notes-todo
Executable file
58
maintainers/release-notes-todo
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
# debug:
|
||||
# set -x
|
||||
|
||||
START_REF="${1}"
|
||||
END_REF="${2:-upstream/master}"
|
||||
|
||||
# Get the merge base
|
||||
MERGE_BASE=$(git merge-base "$START_REF" "$END_REF")
|
||||
unset START_REF
|
||||
|
||||
# Get date range
|
||||
START_DATE=$(git show -s --format=%cI "$MERGE_BASE")
|
||||
END_DATE=$(git show -s --format=%cI "$END_REF")
|
||||
|
||||
echo "Checking PRs merged between $START_DATE and $END_DATE" >&2
|
||||
|
||||
# Get all commits between merge base and HEAD
|
||||
COMMITS=$(git rev-list "$MERGE_BASE..$END_REF")
|
||||
|
||||
# Convert to set for fast lookup
|
||||
declare -A commit_set
|
||||
for commit in $COMMITS; do
|
||||
commit_set["$commit"]=1
|
||||
done
|
||||
|
||||
# Get the current changelog
|
||||
LOG_DONE="$(changelog-d doc/manual/rl-next)"
|
||||
is_done(){
|
||||
local nr="$1"
|
||||
echo "$LOG_DONE" | grep -E "^- .*/pull/$nr)"
|
||||
}
|
||||
|
||||
# Query merged PRs in date range
|
||||
gh pr list \
|
||||
--repo NixOS/nix \
|
||||
--state merged \
|
||||
--limit 1000 \
|
||||
--json number,title,author,mergeCommit \
|
||||
--search "merged:$START_DATE..$END_DATE" | \
|
||||
jq -r '.[] | [.number, .mergeCommit.oid, .title, .author.login] | @tsv' | \
|
||||
while IFS=$'\t' read -r pr_num merge_commit _title author; do
|
||||
# Check if this PR's merge commit is in our branch
|
||||
if [[ -n "${commit_set[$merge_commit]:-}" ]]; then
|
||||
# Full detail, not suitable for comment due to mass ping and duplicate title
|
||||
# echo "- #$pr_num $_title (@$author)"
|
||||
echo "- #$pr_num ($author)"
|
||||
if is_done "$pr_num"
|
||||
then
|
||||
echo " - [x] has note"
|
||||
else
|
||||
echo " - [ ] has note"
|
||||
fi
|
||||
echo " - [ ] skip"
|
||||
fi
|
||||
done
|
||||
|
|
@ -24,11 +24,18 @@ release:
|
|||
* In a checkout of the Nix repo, make sure you're on `master` and run
|
||||
`git pull`.
|
||||
|
||||
* Compile a release notes to-do list by running
|
||||
|
||||
```console
|
||||
$ ./maintainers/release-notes-todo PREV_RELEASE HEAD
|
||||
```
|
||||
|
||||
* Compile the release notes by running
|
||||
|
||||
```console
|
||||
$ export VERSION=X.YY
|
||||
$ git checkout -b release-notes
|
||||
$ export GITHUB_TOKEN=...
|
||||
$ ./maintainers/release-notes
|
||||
```
|
||||
|
||||
|
|
@ -39,10 +46,6 @@ release:
|
|||
* Proof-read / edit / rearrange the release notes if needed. Breaking changes
|
||||
and highlights should go to the top.
|
||||
|
||||
* Run `maintainers/release-credits` to make sure the credits script works
|
||||
and produces a sensible output. Some emails might not automatically map to
|
||||
a GitHub handle.
|
||||
|
||||
* Push.
|
||||
|
||||
```console
|
||||
|
|
@ -130,6 +133,8 @@ release:
|
|||
|
||||
Commit and push this to the maintenance branch.
|
||||
|
||||
* Create a backport label.
|
||||
|
||||
* Bump the version of `master`:
|
||||
|
||||
```console
|
||||
|
|
@ -137,6 +142,7 @@ release:
|
|||
$ git pull
|
||||
$ NEW_VERSION=2.13.0
|
||||
$ echo $NEW_VERSION > .version
|
||||
$ ... edit .mergify.yml to add the previous version ...
|
||||
$ git checkout -b bump-$NEW_VERSION
|
||||
$ git commit -a -m 'Bump version'
|
||||
$ git push --set-upstream origin bump-$NEW_VERSION
|
||||
|
|
@ -144,10 +150,6 @@ release:
|
|||
|
||||
Make a pull request and auto-merge it.
|
||||
|
||||
* Create a backport label.
|
||||
|
||||
* Add the new backport label to `.mergify.yml`.
|
||||
|
||||
* Post an [announcement on Discourse](https://discourse.nixos.org/c/announcements/8), including the contents of
|
||||
`rl-$VERSION.md`.
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ project(
|
|||
subproject_dir : 'src',
|
||||
default_options : [
|
||||
'localstatedir=/nix/var',
|
||||
# hack for trailing newline
|
||||
],
|
||||
meson_version : '>= 1.1',
|
||||
)
|
||||
|
|
@ -29,7 +28,7 @@ subproject('nix')
|
|||
if get_option('doc-gen')
|
||||
subproject('internal-api-docs')
|
||||
subproject('external-api-docs')
|
||||
if not meson.is_cross_build()
|
||||
if meson.can_run_host_binaries()
|
||||
subproject('nix-manual')
|
||||
endif
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -20,3 +20,10 @@ option(
|
|||
value : true,
|
||||
description : 'Build language bindings (e.g. Perl)',
|
||||
)
|
||||
|
||||
option(
|
||||
'benchmarks',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Build benchmarks (requires gbenchmark)',
|
||||
)
|
||||
|
|
|
|||
10
misc/freebsd/meson.build
Normal file
10
misc/freebsd/meson.build
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
configure_file(
|
||||
input : 'nix-daemon.in',
|
||||
output : 'nix-daemon',
|
||||
install : true,
|
||||
install_dir : get_option('prefix') / 'etc/rc.d',
|
||||
install_mode : 'rwxr-xr-x',
|
||||
configuration : {
|
||||
'bindir' : bindir,
|
||||
},
|
||||
)
|
||||
49
misc/freebsd/nix-daemon.in
Normal file
49
misc/freebsd/nix-daemon.in
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: nix_daemon
|
||||
# REQUIRE: DAEMON
|
||||
# KEYWORD: shutdown
|
||||
#
|
||||
# Add the following lines to /etc/rc.conf to enable nix-daemon:
|
||||
#
|
||||
# nix_daemon_enable="YES"
|
||||
#
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. /etc/rc.subr
|
||||
|
||||
name="nix_daemon"
|
||||
# shellcheck disable=SC2034
|
||||
rcvar="nix_daemon_enable"
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: "${nix_daemon_enable:=NO}"
|
||||
|
||||
command="@bindir@/nix-daemon"
|
||||
command_args=""
|
||||
pidfile="/var/run/nix-daemon.pid"
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
start_cmd="${name}_start"
|
||||
# shellcheck disable=SC2034
|
||||
stop_cmd="${name}_stop"
|
||||
|
||||
nix_daemon_start() {
|
||||
echo "Starting ${name}."
|
||||
# command_args is intentionally unquoted to allow multiple arguments
|
||||
# shellcheck disable=SC2086
|
||||
/usr/sbin/daemon -c -f -p "${pidfile}" "${command}" ${command_args}
|
||||
}
|
||||
|
||||
nix_daemon_stop() {
|
||||
if [ -f "${pidfile}" ]; then
|
||||
echo "Stopping ${name}."
|
||||
kill -TERM "$(cat "${pidfile}")"
|
||||
rm -f "${pidfile}"
|
||||
else
|
||||
echo "${name} is not running."
|
||||
fi
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
||||
|
|
@ -9,3 +9,7 @@ endif
|
|||
if host_machine.system() == 'darwin'
|
||||
subdir('launchd')
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'freebsd'
|
||||
subdir('freebsd')
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -18,3 +18,25 @@ add_project_arguments(
|
|||
'-Wno-deprecated-declarations',
|
||||
language : 'cpp',
|
||||
)
|
||||
|
||||
# GCC doesn't benefit much from precompiled headers.
|
||||
do_pch = cxx.get_id() == 'clang'
|
||||
|
||||
# This is a clang-only option for improving build times.
|
||||
# It forces the instantiation of templates in the PCH itself and
|
||||
# not every translation unit it's included in.
|
||||
# It's available starting from clang 11, which is old enough to not
|
||||
# bother checking the version.
|
||||
# This feature helps in particular with the expensive nlohmann::json template
|
||||
# instantiations in libutil and libstore.
|
||||
if cxx.get_id() == 'clang'
|
||||
add_project_arguments('-fpch-instantiate-templates', language : 'cpp')
|
||||
endif
|
||||
|
||||
# Clang gets grumpy about missing libasan symbols if -shared-libasan is not
|
||||
# passed when building shared libs, at least on Linux
|
||||
if cxx.get_id() == 'clang' and ('address' in get_option('b_sanitize') or 'undefined' in get_option(
|
||||
'b_sanitize',
|
||||
))
|
||||
add_project_link_arguments('-shared-libasan', language : 'cpp')
|
||||
endif
|
||||
|
|
|
|||
19
nix-meson-build-support/default-system-cpu/meson.build
Normal file
19
nix-meson-build-support/default-system-cpu/meson.build
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# This attempts to translate meson cpu_family and cpu_name specified via
|
||||
# --cross-file [1] into a nix *system double*. Nixpkgs mostly respects ([2]) the
|
||||
# conventions outlined in [1].
|
||||
#
|
||||
# [1]: https://mesonbuild.com/Reference-tables.html#cpu-families
|
||||
# [2]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/lib/meson.nix
|
||||
|
||||
nix_system_cpu = {'ppc64' : 'powerpc64', 'ppc' : 'powerpc', 'x86' : 'i686'}.get(
|
||||
host_machine.cpu_family(),
|
||||
host_machine.cpu_family(),
|
||||
)
|
||||
|
||||
if (host_machine.cpu_family() in [ 'ppc64', 'ppc' ]) and host_machine.endian() == 'little'
|
||||
nix_system_cpu += 'le'
|
||||
elif host_machine.cpu_family() in [ 'mips64', 'mips' ] and host_machine.endian() == 'little'
|
||||
nix_system_cpu += 'el'
|
||||
elif host_machine.cpu_family() == 'arm'
|
||||
nix_system_cpu = host_machine.cpu()
|
||||
endif
|
||||
|
|
@ -14,7 +14,7 @@ extra_pkg_config_variables = get_variable('extra_pkg_config_variables', {})
|
|||
|
||||
extra_cflags = []
|
||||
if not meson.project_name().endswith('-c')
|
||||
extra_cflags += ['-std=c++2a']
|
||||
extra_cflags += [ '-std=c++23' ]
|
||||
endif
|
||||
|
||||
import('pkgconfig').generate(
|
||||
|
|
@ -29,10 +29,13 @@ import('pkgconfig').generate(
|
|||
variables : extra_pkg_config_variables,
|
||||
)
|
||||
|
||||
meson.override_dependency(meson.project_name(), declare_dependency(
|
||||
meson.override_dependency(
|
||||
meson.project_name(),
|
||||
declare_dependency(
|
||||
include_directories : include_dirs,
|
||||
link_with : this_library,
|
||||
compile_args : ['-std=c++2a'],
|
||||
compile_args : [ '-std=c++23' ],
|
||||
dependencies : deps_public_subproject + deps_public,
|
||||
variables : extra_pkg_config_variables,
|
||||
))
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,11 @@ bash = find_program('bash', native: true)
|
|||
|
||||
gen_header = generator(
|
||||
bash,
|
||||
arguments : [ '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ],
|
||||
arguments : [
|
||||
'-c',
|
||||
'{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"',
|
||||
'_ignored_argv0',
|
||||
'@OUTPUT@',
|
||||
],
|
||||
output : '@PLAINNAME@.gen.hh',
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
# This is needed for std::atomic on some platforms
|
||||
# We did not manage to test this reliably on all platforms, so we hardcode
|
||||
# it for now.
|
||||
if host_machine.cpu_family() == 'arm'
|
||||
if host_machine.cpu_family() in [ 'arm', 'ppc' ]
|
||||
deps_other += cxx.find_library('atomic')
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ runCommand "nix-binary-tarball-${version}" env ''
|
|||
substitute ${../scripts/install-systemd-multi-user.sh} $TMPDIR/install-systemd-multi-user.sh \
|
||||
--subst-var-by nix ${nix} \
|
||||
--subst-var-by cacert ${cacert}
|
||||
substitute ${../scripts/install-freebsd-multi-user.sh} $TMPDIR/install-freebsd-multi-user.sh \
|
||||
--subst-var-by nix ${nix} \
|
||||
--subst-var-by cacert ${cacert}
|
||||
substitute ${../scripts/install-multi-user.sh} $TMPDIR/install-multi-user \
|
||||
--subst-var-by nix ${nix} \
|
||||
--subst-var-by cacert ${cacert}
|
||||
|
|
@ -48,6 +51,7 @@ runCommand "nix-binary-tarball-${version}" env ''
|
|||
shellcheck $TMPDIR/create-darwin-volume.sh
|
||||
shellcheck $TMPDIR/install-darwin-multi-user.sh
|
||||
shellcheck $TMPDIR/install-systemd-multi-user.sh
|
||||
shellcheck $TMPDIR/install-freebsd-multi-user.sh
|
||||
|
||||
# SC1091: Don't panic about not being able to source
|
||||
# /etc/profile
|
||||
|
|
@ -64,6 +68,7 @@ runCommand "nix-binary-tarball-${version}" env ''
|
|||
chmod +x $TMPDIR/create-darwin-volume.sh
|
||||
chmod +x $TMPDIR/install-darwin-multi-user.sh
|
||||
chmod +x $TMPDIR/install-systemd-multi-user.sh
|
||||
chmod +x $TMPDIR/install-freebsd-multi-user.sh
|
||||
chmod +x $TMPDIR/install-multi-user
|
||||
dir=nix-${version}-${system}
|
||||
fn=$out/$dir.tar.xz
|
||||
|
|
@ -82,6 +87,7 @@ runCommand "nix-binary-tarball-${version}" env ''
|
|||
$TMPDIR/create-darwin-volume.sh \
|
||||
$TMPDIR/install-darwin-multi-user.sh \
|
||||
$TMPDIR/install-systemd-multi-user.sh \
|
||||
$TMPDIR/install-freebsd-multi-user.sh \
|
||||
$TMPDIR/install-multi-user \
|
||||
$TMPDIR/reginfo \
|
||||
$(cat ${installerClosureInfo}/store-paths)
|
||||
|
|
|
|||
|
|
@ -148,7 +148,8 @@ let
|
|||
nativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
] ++ prevAttrs.nativeBuildInputs or [ ];
|
||||
]
|
||||
++ prevAttrs.nativeBuildInputs or [ ];
|
||||
mesonCheckFlags = prevAttrs.mesonCheckFlags or [ ] ++ [
|
||||
"--print-errorlogs"
|
||||
];
|
||||
|
|
@ -365,18 +366,33 @@ in
|
|||
|
||||
nix-cmd = callPackage ../src/libcmd/package.nix { };
|
||||
|
||||
/**
|
||||
The Nix command line interface. Note that this does not include its tests, whereas `nix-everything` does.
|
||||
*/
|
||||
nix-cli = callPackage ../src/nix/package.nix { version = fineVersion; };
|
||||
|
||||
nix-functional-tests = callPackage ../tests/functional/package.nix {
|
||||
version = fineVersion;
|
||||
};
|
||||
|
||||
/**
|
||||
The manual as would be published on https://nix.dev/reference/nix-manual
|
||||
*/
|
||||
nix-manual = callPackage ../doc/manual/package.nix { version = fineVersion; };
|
||||
/**
|
||||
Doxygen pages for C++ code
|
||||
*/
|
||||
nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { version = fineVersion; };
|
||||
/**
|
||||
Doxygen pages for the public C API
|
||||
*/
|
||||
nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { version = fineVersion; };
|
||||
|
||||
nix-perl-bindings = callPackage ../src/perl/package.nix { };
|
||||
|
||||
/**
|
||||
Combined package that has the CLI, libraries, and (assuming non-cross, no overrides) it requires that all tests succeed.
|
||||
*/
|
||||
nix-everything = callPackage ../packaging/everything.nix { } // {
|
||||
# Note: no `passthru.overrideAllMesonComponents` etc
|
||||
# This would propagate into `nix.overrideAttrs f`, but then discard
|
||||
|
|
|
|||
|
|
@ -10,27 +10,8 @@
|
|||
stdenv,
|
||||
}:
|
||||
|
||||
let
|
||||
prevStdenv = stdenv;
|
||||
in
|
||||
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
|
||||
stdenv = if prevStdenv.isDarwin && prevStdenv.isx86_64 then darwinStdenv else prevStdenv;
|
||||
|
||||
# Fix the following error with the default x86_64-darwin SDK:
|
||||
#
|
||||
# error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer
|
||||
#
|
||||
# Despite the use of the 10.13 deployment target here, the aligned
|
||||
# allocation function Clang uses with this setting actually works
|
||||
# all the way back to 10.6.
|
||||
# NOTE: this is not just a version constraint, but a request to make Darwin
|
||||
# provide this version level of support. Removing this minimum version
|
||||
# request will regress the above error.
|
||||
darwinStdenv = pkgs.overrideSDK prevStdenv { darwinMinVersion = "10.13"; };
|
||||
|
||||
in
|
||||
scope: {
|
||||
inherit stdenv;
|
||||
|
|
@ -50,8 +31,40 @@ scope: {
|
|||
requiredSystemFeatures = [ ];
|
||||
};
|
||||
|
||||
boehmgc = pkgs.boehmgc.override {
|
||||
boehmgc =
|
||||
(pkgs.boehmgc.override {
|
||||
enableLargeConfig = true;
|
||||
}).overrideAttrs
|
||||
(attrs: {
|
||||
# Increase the initial mark stack size to avoid stack
|
||||
# overflows, since these inhibit parallel marking (see
|
||||
# GC_mark_some()). To check whether the mark stack is too
|
||||
# small, run Nix with GC_PRINT_STATS=1 and look for messages
|
||||
# such as `Mark stack overflow`, `No room to copy back mark
|
||||
# stack`, and `Grew mark stack to ... frames`.
|
||||
NIX_CFLAGS_COMPILE = "-DINITIAL_MARK_STACK_SIZE=1048576";
|
||||
});
|
||||
|
||||
lowdown = pkgs.lowdown.overrideAttrs (prevAttrs: rec {
|
||||
version = "2.0.2";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://kristaps.bsd.lv/lowdown/snapshots/lowdown-${version}.tar.gz";
|
||||
hash = "sha512-cfzhuF4EnGmLJf5EGSIbWqJItY3npbRSALm+GarZ7SMU7Hr1xw0gtBFMpOdi5PBar4TgtvbnG4oRPh+COINGlA==";
|
||||
};
|
||||
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ pkgs.buildPackages.bmake ];
|
||||
postInstall =
|
||||
lib.replaceStrings [ "lowdown.so.1" "lowdown.1.dylib" ] [ "lowdown.so.2" "lowdown.2.dylib" ]
|
||||
prevAttrs.postInstall;
|
||||
});
|
||||
|
||||
toml11 = pkgs.toml11.overrideAttrs rec {
|
||||
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.
|
||||
|
|
@ -62,6 +75,7 @@ scope: {
|
|||
"--with-context"
|
||||
"--with-coroutine"
|
||||
"--with-iostreams"
|
||||
"--with-url"
|
||||
];
|
||||
enableIcu = false;
|
||||
}).overrideAttrs
|
||||
|
|
|
|||
|
|
@ -71,8 +71,7 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
|||
# We use this shell with the local checkout, not unpackPhase.
|
||||
src = null;
|
||||
|
||||
env =
|
||||
{
|
||||
env = {
|
||||
# For `make format`, to work without installing pre-commit
|
||||
_NIX_PRE_COMMIT_HOOKS_CONFIG = "${(pkgs.formats.yaml { }).generate "pre-commit-config.yaml"
|
||||
modular.pre-commit.settings.rawConfig
|
||||
|
|
@ -113,19 +112,23 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
|||
) pkgs.buildPackages.mesonEmulatorHook
|
||||
++ [
|
||||
pkgs.buildPackages.cmake
|
||||
pkgs.buildPackages.gnused
|
||||
pkgs.buildPackages.shellcheck
|
||||
pkgs.buildPackages.changelog-d
|
||||
modular.pre-commit.settings.package
|
||||
(pkgs.writeScriptBin "pre-commit-hooks-install" modular.pre-commit.settings.installationScript)
|
||||
pkgs.buildPackages.nixfmt-rfc-style
|
||||
pkgs.buildPackages.gdb
|
||||
]
|
||||
++ lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) (
|
||||
lib.hiPrio pkgs.buildPackages.clang-tools
|
||||
)
|
||||
++ lib.optional stdenv.hostPlatform.isLinux pkgs.buildPackages.mold-wrapped;
|
||||
|
||||
buildInputs =
|
||||
attrs.buildInputs or [ ]
|
||||
buildInputs = [
|
||||
pkgs.gbenchmark
|
||||
]
|
||||
++ attrs.buildInputs or [ ]
|
||||
++ pkgs.nixComponents2.nix-util.buildInputs
|
||||
++ pkgs.nixComponents2.nix-store.buildInputs
|
||||
++ pkgs.nixComponents2.nix-store-tests.externalBuildInputs
|
||||
|
|
|
|||
|
|
@ -47,8 +47,7 @@
|
|||
}:
|
||||
|
||||
let
|
||||
libs =
|
||||
{
|
||||
libs = {
|
||||
inherit
|
||||
nix-util
|
||||
nix-util-c
|
||||
|
|
@ -65,7 +64,8 @@ let
|
|||
nix-cmd
|
||||
;
|
||||
}
|
||||
// lib.optionalAttrs
|
||||
//
|
||||
lib.optionalAttrs
|
||||
(!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform)
|
||||
{
|
||||
# Currently fails in static build
|
||||
|
|
@ -127,8 +127,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
*/
|
||||
dontFixup = true;
|
||||
|
||||
checkInputs =
|
||||
[
|
||||
checkInputs = [
|
||||
# Make sure the unit tests have passed
|
||||
nix-util-tests.tests.run
|
||||
nix-store-tests.tests.run
|
||||
|
|
@ -139,8 +138,8 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
# Make sure the functional tests have passed
|
||||
nix-functional-tests
|
||||
]
|
||||
++ lib.optionals
|
||||
(!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform)
|
||||
++
|
||||
lib.optionals (!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform)
|
||||
[
|
||||
# Perl currently fails in static build
|
||||
# TODO: Split out tests into a separate derivation?
|
||||
|
|
|
|||
|
|
@ -223,10 +223,17 @@ in
|
|||
dockerImage = lib.genAttrs linux64BitSystems (system: self.packages.${system}.dockerImage);
|
||||
|
||||
# # Line coverage analysis.
|
||||
# coverage = nixpkgsFor.x86_64-linux.native.nix.override {
|
||||
# pname = "nix-coverage";
|
||||
# withCoverageChecks = true;
|
||||
# };
|
||||
coverage =
|
||||
(import ./../ci/gha/tests rec {
|
||||
withCoverage = true;
|
||||
pkgs = nixpkgsFor.x86_64-linux.nativeForStdenv.clangStdenv;
|
||||
nixComponents = pkgs.nixComponents2;
|
||||
nixFlake = null;
|
||||
getStdenv = p: p.clangStdenv;
|
||||
}).codeCoverage.coverageReports.overrideAttrs
|
||||
{
|
||||
name = "nix-coverage"; # For historical consistency
|
||||
};
|
||||
|
||||
# Nix's manual
|
||||
manual = nixpkgsFor.x86_64-linux.native.nixComponents2.nix-manual;
|
||||
|
|
@ -240,7 +247,9 @@ in
|
|||
# System tests.
|
||||
tests =
|
||||
import ../tests/nixos {
|
||||
inherit lib nixpkgs nixpkgsFor;
|
||||
inherit lib nixpkgs;
|
||||
pkgs = nixpkgsFor.x86_64-linux.native;
|
||||
nixComponents = nixpkgsFor.x86_64-linux.native.nixComponents2;
|
||||
inherit (self.inputs) nixpkgs-23-11;
|
||||
}
|
||||
// {
|
||||
|
|
|
|||
173
scripts/install-freebsd-multi-user.sh
Normal file
173
scripts/install-freebsd-multi-user.sh
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# System specific settings
|
||||
# FreeBSD typically uses UIDs from 1001+ for regular users,
|
||||
# so we'll use a range that's unlikely to conflict
|
||||
export NIX_FIRST_BUILD_UID="${NIX_FIRST_BUILD_UID:-30001}"
|
||||
export NIX_BUILD_GROUP_ID="${NIX_BUILD_GROUP_ID:-30000}"
|
||||
export NIX_BUILD_USER_NAME_TEMPLATE="nixbld%d"
|
||||
|
||||
# FreeBSD service paths
|
||||
readonly SERVICE_SRC=/etc/rc.d/nix-daemon
|
||||
readonly SERVICE_DEST=/usr/local/etc/rc.d/nix-daemon
|
||||
|
||||
poly_cure_artifacts() {
|
||||
:
|
||||
}
|
||||
|
||||
poly_service_installed_check() {
|
||||
if [ -f "$SERVICE_DEST" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
poly_service_uninstall_directions() {
|
||||
cat <<EOF
|
||||
$1. Delete the rc.d service
|
||||
|
||||
sudo service nix-daemon stop
|
||||
sudo rm -f $SERVICE_DEST
|
||||
sudo sysrc -x nix_daemon_enable
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
poly_service_setup_note() {
|
||||
cat <<EOF
|
||||
- link the nix-daemon rc.d service to $SERVICE_DEST
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
poly_extra_try_me_commands() {
|
||||
cat <<EOF
|
||||
$ sudo service nix-daemon start
|
||||
EOF
|
||||
}
|
||||
|
||||
poly_configure_nix_daemon_service() {
|
||||
task "Setting up the nix-daemon rc.d service"
|
||||
|
||||
# Ensure the rc.d directory exists
|
||||
_sudo "to create the rc.d directory" \
|
||||
mkdir -p /usr/local/etc/rc.d
|
||||
|
||||
# Link the pre-installed rc.d script
|
||||
_sudo "to set up the nix-daemon service" \
|
||||
ln -sfn "/nix/var/nix/profiles/default$SERVICE_SRC" "$SERVICE_DEST"
|
||||
|
||||
_sudo "to enable the nix-daemon service" \
|
||||
sysrc nix_daemon_enable=YES
|
||||
|
||||
_sudo "to start the nix-daemon" \
|
||||
service nix-daemon start
|
||||
}
|
||||
|
||||
poly_group_exists() {
|
||||
pw group show "$1" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
poly_group_id_get() {
|
||||
pw group show "$1" | cut -d: -f3
|
||||
}
|
||||
|
||||
poly_create_build_group() {
|
||||
_sudo "Create the Nix build group, $NIX_BUILD_GROUP_NAME" \
|
||||
pw groupadd -n "$NIX_BUILD_GROUP_NAME" -g "$NIX_BUILD_GROUP_ID" >&2
|
||||
}
|
||||
|
||||
poly_user_exists() {
|
||||
pw user show "$1" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
poly_user_id_get() {
|
||||
pw user show "$1" | cut -d: -f3
|
||||
}
|
||||
|
||||
poly_user_hidden_get() {
|
||||
# FreeBSD doesn't have a concept of hidden users like macOS
|
||||
echo "0"
|
||||
}
|
||||
|
||||
poly_user_hidden_set() {
|
||||
# No-op on FreeBSD
|
||||
true
|
||||
}
|
||||
|
||||
poly_user_home_get() {
|
||||
pw user show "$1" | cut -d: -f9
|
||||
}
|
||||
|
||||
poly_user_home_set() {
|
||||
_sudo "in order to give $1 a safe home directory" \
|
||||
pw usermod -n "$1" -d "$2"
|
||||
}
|
||||
|
||||
poly_user_note_get() {
|
||||
pw user show "$1" | cut -d: -f8
|
||||
}
|
||||
|
||||
poly_user_note_set() {
|
||||
_sudo "in order to give $1 a useful comment" \
|
||||
pw usermod -n "$1" -c "$2"
|
||||
}
|
||||
|
||||
poly_user_shell_get() {
|
||||
pw user show "$1" | cut -d: -f10
|
||||
}
|
||||
|
||||
poly_user_shell_set() {
|
||||
_sudo "in order to prevent $1 from logging in" \
|
||||
pw usermod -n "$1" -s "$2"
|
||||
}
|
||||
|
||||
poly_user_in_group_check() {
|
||||
groups "$1" 2>/dev/null | grep -q "\<$2\>"
|
||||
}
|
||||
|
||||
poly_user_in_group_set() {
|
||||
_sudo "Add $1 to the $2 group" \
|
||||
pw groupmod -n "$2" -m "$1"
|
||||
}
|
||||
|
||||
poly_user_primary_group_get() {
|
||||
pw user show "$1" | cut -d: -f4
|
||||
}
|
||||
|
||||
poly_user_primary_group_set() {
|
||||
_sudo "to let the nix daemon use this user for builds" \
|
||||
pw usermod -n "$1" -g "$2"
|
||||
}
|
||||
|
||||
poly_create_build_user() {
|
||||
username=$1
|
||||
uid=$2
|
||||
builder_num=$3
|
||||
|
||||
_sudo "Creating the Nix build user, $username" \
|
||||
pw useradd \
|
||||
-n "$username" \
|
||||
-u "$uid" \
|
||||
-g "$NIX_BUILD_GROUP_NAME" \
|
||||
-G "$NIX_BUILD_GROUP_NAME" \
|
||||
-d /var/empty \
|
||||
-s /sbin/nologin \
|
||||
-c "Nix build user $builder_num"
|
||||
}
|
||||
|
||||
poly_prepare_to_install() {
|
||||
# FreeBSD-specific preparation steps
|
||||
:
|
||||
}
|
||||
|
||||
poly_configure_default_profile_targets() {
|
||||
# FreeBSD-specific profile locations
|
||||
# FreeBSD uses /usr/local/etc for third-party shell configurations
|
||||
# Include both profile (for login shells) and bashrc (for interactive shells)
|
||||
echo "/usr/local/etc/profile /usr/local/etc/bashrc /usr/local/etc/profile.d/nix.sh /usr/local/etc/zshrc"
|
||||
}
|
||||
|
|
@ -33,7 +33,8 @@ readonly NIX_BUILD_GROUP_NAME="nixbld"
|
|||
readonly NIX_ROOT="/nix"
|
||||
readonly NIX_EXTRA_CONF=${NIX_EXTRA_CONF:-}
|
||||
|
||||
readonly PROFILE_TARGETS=("/etc/bashrc" "/etc/profile.d/nix.sh" "/etc/zshrc" "/etc/bash.bashrc" "/etc/zsh/zshrc")
|
||||
# PROFILE_TARGETS will be set later after OS-specific scripts are loaded
|
||||
PROFILE_TARGETS=()
|
||||
readonly PROFILE_BACKUP_SUFFIX=".backup-before-nix"
|
||||
readonly PROFILE_NIX_FILE="$NIX_ROOT/var/nix/profiles/default/etc/profile.d/nix-daemon.sh"
|
||||
|
||||
|
|
@ -99,6 +100,14 @@ is_os_darwin() {
|
|||
fi
|
||||
}
|
||||
|
||||
is_os_freebsd() {
|
||||
if [ "$(uname -s)" = "FreeBSD" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
contact_us() {
|
||||
echo "You can open an issue at"
|
||||
echo "https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md"
|
||||
|
|
@ -498,6 +507,10 @@ You have aborted the installation.
|
|||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
if is_os_freebsd; then
|
||||
ok "Detected FreeBSD, will set up rc.d service for nix-daemon"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_report() {
|
||||
|
|
@ -834,8 +847,13 @@ install_from_extracted_nix() {
|
|||
(
|
||||
cd "$EXTRACTED_NIX_PATH"
|
||||
|
||||
if is_os_darwin || is_os_freebsd; then
|
||||
_sudo "to copy the basic Nix files to the new store at $NIX_ROOT/store" \
|
||||
cp -RPp ./store/* "$NIX_ROOT/store/"
|
||||
else
|
||||
_sudo "to copy the basic Nix files to the new store at $NIX_ROOT/store" \
|
||||
cp -RP --preserve=ownership,timestamps ./store/* "$NIX_ROOT/store/"
|
||||
fi
|
||||
|
||||
_sudo "to make the new store non-writable at $NIX_ROOT/store" \
|
||||
chmod -R ugo-w "$NIX_ROOT/store/"
|
||||
|
|
@ -984,11 +1002,22 @@ main() {
|
|||
# shellcheck source=./install-systemd-multi-user.sh
|
||||
. "$EXTRACTED_NIX_PATH/install-systemd-multi-user.sh" # most of this works on non-systemd distros also
|
||||
check_required_system_specific_settings "install-systemd-multi-user.sh"
|
||||
elif is_os_freebsd; then
|
||||
# shellcheck source=./install-freebsd-multi-user.sh
|
||||
. "$EXTRACTED_NIX_PATH/install-freebsd-multi-user.sh"
|
||||
check_required_system_specific_settings "install-freebsd-multi-user.sh"
|
||||
else
|
||||
failure "Sorry, I don't know what to do on $(uname)"
|
||||
fi
|
||||
|
||||
|
||||
# Set profile targets after OS-specific scripts are loaded
|
||||
if command -v poly_configure_default_profile_targets > /dev/null 2>&1; then
|
||||
PROFILE_TARGETS=($(poly_configure_default_profile_targets))
|
||||
else
|
||||
PROFILE_TARGETS=("/etc/bashrc" "/etc/profile.d/nix.sh" "/etc/zshrc" "/etc/bash.bashrc" "/etc/zsh/zshrc")
|
||||
fi
|
||||
|
||||
welcome_to_nix
|
||||
|
||||
if ! is_root; then
|
||||
|
|
|
|||
|
|
@ -26,8 +26,10 @@ if [ -z "$HOME" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
OS="$(uname -s)"
|
||||
|
||||
# macOS support for 10.12.6 or higher
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if [ "$OS" = "Darwin" ]; then
|
||||
IFS='.' read -r macos_major macos_minor macos_patch << EOF
|
||||
$(sw_vers -productVersion)
|
||||
EOF
|
||||
|
|
@ -39,11 +41,11 @@ EOF
|
|||
fi
|
||||
|
||||
# Determine if we could use the multi-user installer or not
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
echo "Note: a multi-user installation is possible. See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation" >&2
|
||||
if [ "$OS" = "Linux" ] || [ "$OS" = "FreeBSD" ]; then
|
||||
echo "Note: a multi-user installation is possible. See https://nix.dev/manual/nix/stable/installation/installing-binary.html#multi-user-installation" >&2
|
||||
fi
|
||||
|
||||
case "$(uname -s)" in
|
||||
case "$OS" in
|
||||
"Darwin")
|
||||
INSTALL_MODE=daemon;;
|
||||
*)
|
||||
|
|
@ -60,7 +62,7 @@ while [ $# -gt 0 ]; do
|
|||
ACTION=install
|
||||
;;
|
||||
--no-daemon)
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if [ "$OS" = "Darwin" ]; then
|
||||
printf '\e[1;31mError: --no-daemon installs are no-longer supported on Darwin/macOS!\e[0m\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -96,7 +98,7 @@ while [ $# -gt 0 ]; do
|
|||
echo " providing multi-user support and better isolation for local builds."
|
||||
echo " Both for security and reproducibility, this method is recommended if"
|
||||
echo " supported on your platform."
|
||||
echo " See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation"
|
||||
echo " See https://nix.dev/manual/nix/stable/installation/installing-binary.html#multi-user-installation"
|
||||
echo ""
|
||||
echo " --no-daemon: Simple, single-user installation that does not require root and is"
|
||||
echo " trivial to uninstall."
|
||||
|
|
@ -123,6 +125,13 @@ while [ $# -gt 0 ]; do
|
|||
done
|
||||
|
||||
if [ "$INSTALL_MODE" = "daemon" ]; then
|
||||
# Check for bash on systems that don't have it by default
|
||||
if [ "$OS" = "FreeBSD" ] && ! command -v bash >/dev/null 2>&1; then
|
||||
printf '\e[1;31mError: bash is required for multi-user installation but was not found.\e[0m\n' >&2
|
||||
printf 'Please install bash first:\n' >&2
|
||||
printf ' pkg install bash\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
printf '\e[1;31mSwitching to the Multi-user Installer\e[0m\n'
|
||||
exec "$self/install-multi-user" $ACTION
|
||||
exit 0
|
||||
|
|
@ -144,7 +153,7 @@ if ! [ -e "$dest" ]; then
|
|||
fi
|
||||
|
||||
if ! [ -w "$dest" ]; then
|
||||
echo "$0: directory $dest exists, but is not writable by you. This could indicate that another user has already performed a single-user installation of Nix on this system. If you wish to enable multi-user support see https://nixos.org/manual/nix/stable/installation/multi-user.html. If you wish to continue with a single-user install for $USER please run 'chown -R $USER $dest' as root." >&2
|
||||
echo "$0: directory $dest exists, but is not writable by you. This could indicate that another user has already performed a single-user installation of Nix on this system. If you wish to enable multi-user support see https://nix.dev/manual/nix/stable/installation/multi-user.html. If you wish to continue with a single-user install for $USER please run 'chown -R $USER $dest' as root." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -167,7 +176,11 @@ for i in $(cd "$self/store" >/dev/null && echo ./*); do
|
|||
rm -rf "$i_tmp"
|
||||
fi
|
||||
if ! [ -e "$dest/store/$i" ]; then
|
||||
if [ "$OS" = "Darwin" ] || [ "$OS" = "FreeBSD" ]; then
|
||||
cp -RPp "$self/store/$i" "$i_tmp"
|
||||
else
|
||||
cp -RP --preserve=ownership,timestamps "$self/store/$i" "$i_tmp"
|
||||
fi
|
||||
chmod -R a-w "$i_tmp"
|
||||
chmod +w "$i_tmp"
|
||||
mv "$i_tmp" "$dest/store/$i"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ configure_file(
|
|||
output : 'nix-profile.sh',
|
||||
configuration : {
|
||||
'localstatedir' : localstatedir,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
foreach rc : [ '.sh', '.fish', '-daemon.sh', '-daemon.fish' ]
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
if [[ ! -d out ]]; then
|
||||
echo "run prepare-installer-for-github-actions first"
|
||||
exit 1
|
||||
fi
|
||||
cd out
|
||||
PORT=${PORT:-8126}
|
||||
nohup python -m http.server "$PORT" >/dev/null 2>&1 &
|
||||
pid=$!
|
||||
|
||||
while ! curl -s "http://localhost:$PORT"; do
|
||||
sleep 1
|
||||
if ! kill -0 $pid; then
|
||||
echo "Failed to start http server"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo 'To install nix, run the following command:'
|
||||
echo "sh <(curl http://localhost:$PORT/install) --tarball-url-prefix http://localhost:$PORT"
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
project('nix-external-api-docs',
|
||||
project(
|
||||
'nix-external-api-docs',
|
||||
version : files('.version'),
|
||||
meson_version : '>= 1.1',
|
||||
license : 'LGPL-2.1-or-later',
|
||||
|
|
|
|||
|
|
@ -57,9 +57,7 @@ INPUT = \
|
|||
@src@/libutil/args \
|
||||
@src@/libutil-tests \
|
||||
@src@/libutil-test-support/tests \
|
||||
@src@/nix \
|
||||
@src@/nix-env \
|
||||
@src@/nix-store
|
||||
@src@/nix
|
||||
|
||||
# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
|
||||
# in the source code. If set to NO, only conditional compilation will be
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
project('nix-internal-api-docs',
|
||||
project(
|
||||
'nix-internal-api-docs',
|
||||
version : files('.version'),
|
||||
meson_version : '>= 1.1',
|
||||
license : 'LGPL-2.1-or-later',
|
||||
|
|
|
|||
|
|
@ -10,23 +10,13 @@
|
|||
namespace nix {
|
||||
|
||||
// Custom implementation to avoid `ref` ptr equality
|
||||
GENERATE_CMP_EXT(
|
||||
,
|
||||
std::strong_ordering,
|
||||
SingleBuiltPathBuilt,
|
||||
*me->drvPath,
|
||||
me->output);
|
||||
GENERATE_CMP_EXT(, std::strong_ordering, SingleBuiltPathBuilt, *me->drvPath, me->output);
|
||||
|
||||
// Custom implementation to avoid `ref` ptr equality
|
||||
|
||||
// TODO no `GENERATE_CMP_EXT` because no `std::set::operator<=>` on
|
||||
// Darwin, per header.
|
||||
GENERATE_EQUAL(
|
||||
,
|
||||
BuiltPathBuilt ::,
|
||||
BuiltPathBuilt,
|
||||
*me->drvPath,
|
||||
me->outputs);
|
||||
GENERATE_EQUAL(, BuiltPathBuilt ::, BuiltPathBuilt, *me->drvPath, me->outputs);
|
||||
|
||||
StorePath SingleBuiltPath::outPath() const
|
||||
{
|
||||
|
|
@ -34,8 +24,8 @@ StorePath SingleBuiltPath::outPath() const
|
|||
overloaded{
|
||||
[](const SingleBuiltPath::Opaque & p) { return p.path; },
|
||||
[](const SingleBuiltPath::Built & b) { return b.output.second; },
|
||||
}, raw()
|
||||
);
|
||||
},
|
||||
raw());
|
||||
}
|
||||
|
||||
StorePathSet BuiltPath::outPaths() const
|
||||
|
|
@ -49,8 +39,8 @@ StorePathSet BuiltPath::outPaths() const
|
|||
res.insert(path);
|
||||
return res;
|
||||
},
|
||||
}, raw()
|
||||
);
|
||||
},
|
||||
raw());
|
||||
}
|
||||
|
||||
SingleDerivedPath::Built SingleBuiltPath::Built::discardOutputPath() const
|
||||
|
|
@ -65,14 +55,10 @@ SingleDerivedPath SingleBuiltPath::discardOutputPath() const
|
|||
{
|
||||
return std::visit(
|
||||
overloaded{
|
||||
[](const SingleBuiltPath::Opaque & p) -> SingleDerivedPath {
|
||||
return p;
|
||||
[](const SingleBuiltPath::Opaque & p) -> SingleDerivedPath { return p; },
|
||||
[](const SingleBuiltPath::Built & b) -> SingleDerivedPath { return b.discardOutputPath(); },
|
||||
},
|
||||
[](const SingleBuiltPath::Built & b) -> SingleDerivedPath {
|
||||
return b.discardOutputPath();
|
||||
},
|
||||
}, raw()
|
||||
);
|
||||
raw());
|
||||
}
|
||||
|
||||
nlohmann::json BuiltPath::Built::toJSON(const StoreDirConfig & store) const
|
||||
|
|
@ -97,16 +83,12 @@ nlohmann::json SingleBuiltPath::Built::toJSON(const StoreDirConfig & store) cons
|
|||
|
||||
nlohmann::json SingleBuiltPath::toJSON(const StoreDirConfig & store) const
|
||||
{
|
||||
return std::visit([&](const auto & buildable) {
|
||||
return buildable.toJSON(store);
|
||||
}, raw());
|
||||
return std::visit([&](const auto & buildable) { return buildable.toJSON(store); }, raw());
|
||||
}
|
||||
|
||||
nlohmann::json BuiltPath::toJSON(const StoreDirConfig & store) const
|
||||
{
|
||||
return std::visit([&](const auto & buildable) {
|
||||
return buildable.toJSON(store);
|
||||
}, raw());
|
||||
return std::visit([&](const auto & buildable) { return buildable.toJSON(store); }, raw());
|
||||
}
|
||||
|
||||
RealisedPath::Set BuiltPath::toRealisedPaths(Store & store) const
|
||||
|
|
@ -116,18 +98,16 @@ RealisedPath::Set BuiltPath::toRealisedPaths(Store & store) const
|
|||
overloaded{
|
||||
[&](const BuiltPath::Opaque & p) { res.insert(p.path); },
|
||||
[&](const BuiltPath::Built & p) {
|
||||
auto drvHashes =
|
||||
staticOutputHashes(store, store.readDerivation(p.drvPath->outPath()));
|
||||
auto drvHashes = staticOutputHashes(store, store.readDerivation(p.drvPath->outPath()));
|
||||
for (auto & [outputName, outputPath] : p.outputs) {
|
||||
if (experimentalFeatureSettings.isEnabled(
|
||||
Xp::CaDerivations)) {
|
||||
if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) {
|
||||
auto drvOutput = get(drvHashes, outputName);
|
||||
if (!drvOutput)
|
||||
throw Error(
|
||||
"the derivation '%s' has unrealised output '%s' (derived-path.cc/toRealisedPaths)",
|
||||
store.printStorePath(p.drvPath->outPath()), outputName);
|
||||
auto thisRealisation = store.queryRealisation(
|
||||
DrvOutput{*drvOutput, outputName});
|
||||
store.printStorePath(p.drvPath->outPath()),
|
||||
outputName);
|
||||
auto thisRealisation = store.queryRealisation(DrvOutput{*drvOutput, outputName});
|
||||
assert(thisRealisation); // We’ve built it, so we must
|
||||
// have the realisation
|
||||
res.insert(*thisRealisation);
|
||||
|
|
@ -141,4 +121,4 @@ RealisedPath::Set BuiltPath::toRealisedPaths(Store & store) const
|
|||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@ void InstallableValueCommand::run(ref<Store> store, ref<Installable> installable
|
|||
run(store, installableValue);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -402,4 +402,4 @@ void MixOutLinkBase::createOutLinksMaybe(const std::vector<BuiltPathWithResult>
|
|||
createOutLinks(outLink, toBuiltPaths(buildables), *store2);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@
|
|||
#include "nix/fetchers/fetch-to-store.hh"
|
||||
#include "nix/cmd/compatibility-settings.hh"
|
||||
#include "nix/expr/eval-settings.hh"
|
||||
#include "nix/store/globals.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
||||
fetchers::Settings fetchSettings;
|
||||
|
||||
static GlobalConfig::Register rFetchSettings(&fetchSettings);
|
||||
|
|
@ -49,17 +49,14 @@ EvalSettings evalSettings {
|
|||
|
||||
static GlobalConfig::Register rEvalSettings(&evalSettings);
|
||||
|
||||
|
||||
flake::Settings flakeSettings;
|
||||
|
||||
static GlobalConfig::Register rFlakeSettings(&flakeSettings);
|
||||
|
||||
|
||||
CompatibilitySettings compatibilitySettings{};
|
||||
|
||||
static GlobalConfig::Register rCompatibilitySettings(&compatibilitySettings);
|
||||
|
||||
|
||||
MixEvalArgs::MixEvalArgs()
|
||||
{
|
||||
addFlag({
|
||||
|
|
@ -67,7 +64,9 @@ MixEvalArgs::MixEvalArgs()
|
|||
.description = "Pass the value *expr* as the argument *name* to Nix functions.",
|
||||
.category = category,
|
||||
.labels = {"name", "expr"},
|
||||
.handler = {[&](std::string name, std::string expr) { autoArgs.insert_or_assign(name, AutoArg{AutoArgExpr{expr}}); }},
|
||||
.handler = {[&](std::string name, std::string expr) {
|
||||
autoArgs.insert_or_assign(name, AutoArg{AutoArgExpr{expr}});
|
||||
}},
|
||||
});
|
||||
|
||||
addFlag({
|
||||
|
|
@ -75,7 +74,9 @@ MixEvalArgs::MixEvalArgs()
|
|||
.description = "Pass the string *string* as the argument *name* to Nix functions.",
|
||||
.category = category,
|
||||
.labels = {"name", "string"},
|
||||
.handler = {[&](std::string name, std::string s) { autoArgs.insert_or_assign(name, AutoArg{AutoArgString{s}}); }},
|
||||
.handler = {[&](std::string name, std::string s) {
|
||||
autoArgs.insert_or_assign(name, AutoArg{AutoArgString{s}});
|
||||
}},
|
||||
});
|
||||
|
||||
addFlag({
|
||||
|
|
@ -83,7 +84,9 @@ MixEvalArgs::MixEvalArgs()
|
|||
.description = "Pass the contents of file *path* as the argument *name* to Nix functions.",
|
||||
.category = category,
|
||||
.labels = {"name", "path"},
|
||||
.handler = {[&](std::string name, std::string path) { autoArgs.insert_or_assign(name, AutoArg{AutoArgFile{path}}); }},
|
||||
.handler = {[&](std::string name, std::string path) {
|
||||
autoArgs.insert_or_assign(name, AutoArg{AutoArgFile{path}});
|
||||
}},
|
||||
.completer = completePath,
|
||||
});
|
||||
|
||||
|
|
@ -107,18 +110,14 @@ MixEvalArgs::MixEvalArgs()
|
|||
)",
|
||||
.category = category,
|
||||
.labels = {"path"},
|
||||
.handler = {[&](std::string s) {
|
||||
lookupPath.elements.emplace_back(LookupPath::Elem::parse(s));
|
||||
}},
|
||||
.handler = {[&](std::string s) { lookupPath.elements.emplace_back(LookupPath::Elem::parse(s)); }},
|
||||
});
|
||||
|
||||
addFlag({
|
||||
.longName = "impure",
|
||||
.description = "Allow access to mutable paths and repositories.",
|
||||
.category = category,
|
||||
.handler = {[&]() {
|
||||
evalSettings.pureEval = false;
|
||||
}},
|
||||
.handler = {[&]() { evalSettings.pureEval = false; }},
|
||||
});
|
||||
|
||||
addFlag({
|
||||
|
|
@ -130,7 +129,8 @@ MixEvalArgs::MixEvalArgs()
|
|||
auto from = parseFlakeRef(fetchSettings, _from, std::filesystem::current_path().string());
|
||||
auto to = parseFlakeRef(fetchSettings, _to, std::filesystem::current_path().string());
|
||||
fetchers::Attrs extraAttrs;
|
||||
if (to.subdir != "") extraAttrs["dir"] = to.subdir;
|
||||
if (to.subdir != "")
|
||||
extraAttrs["dir"] = to.subdir;
|
||||
fetchers::overrideRegistry(from.input, to.input, extraAttrs);
|
||||
}},
|
||||
.completer = {[&](AddCompletions & completions, size_t, std::string_view prefix) {
|
||||
|
|
@ -156,20 +156,21 @@ Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
|||
auto res = state.buildBindings(autoArgs.size());
|
||||
for (auto & [name, arg] : autoArgs) {
|
||||
auto v = state.allocValue();
|
||||
std::visit(overloaded {
|
||||
std::visit(
|
||||
overloaded{
|
||||
[&](const AutoArgExpr & arg) {
|
||||
state.mkThunk_(*v, state.parseExprFromString(arg.expr, compatibilitySettings.nixShellShebangArgumentsRelativeToScript ? state.rootPath(absPath(getCommandBaseDir())) : state.rootPath(".")));
|
||||
state.mkThunk_(
|
||||
*v,
|
||||
state.parseExprFromString(
|
||||
arg.expr,
|
||||
compatibilitySettings.nixShellShebangArgumentsRelativeToScript
|
||||
? state.rootPath(absPath(getCommandBaseDir()))
|
||||
: state.rootPath(".")));
|
||||
},
|
||||
[&](const AutoArgString & arg) {
|
||||
v->mkString(arg.s);
|
||||
},
|
||||
[&](const AutoArgFile & arg) {
|
||||
v->mkString(readFile(arg.path.string()));
|
||||
},
|
||||
[&](const AutoArgStdin & arg) {
|
||||
v->mkString(readFile(STDIN_FILENO));
|
||||
}
|
||||
}, arg);
|
||||
[&](const AutoArgString & arg) { v->mkString(arg.s); },
|
||||
[&](const AutoArgFile & arg) { v->mkString(readFile(arg.path.string())); },
|
||||
[&](const AutoArgStdin & arg) { v->mkString(readFile(STDIN_FILENO)); }},
|
||||
arg);
|
||||
res.insert(state.symbols.create(name), v);
|
||||
}
|
||||
return res.finish();
|
||||
|
|
@ -178,15 +179,8 @@ Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
|||
SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * baseDir)
|
||||
{
|
||||
if (EvalSettings::isPseudoUrl(s)) {
|
||||
auto accessor = fetchers::downloadTarball(
|
||||
state.store,
|
||||
state.fetchSettings,
|
||||
EvalSettings::resolvePseudoUrl(s));
|
||||
auto storePath = fetchToStore(
|
||||
state.fetchSettings,
|
||||
*state.store,
|
||||
SourcePath(accessor),
|
||||
FetchMode::Copy);
|
||||
auto accessor = fetchers::downloadTarball(state.store, state.fetchSettings, EvalSettings::resolvePseudoUrl(s));
|
||||
auto storePath = fetchToStore(state.fetchSettings, *state.store, SourcePath(accessor), FetchMode::Copy);
|
||||
return state.storePath(storePath);
|
||||
}
|
||||
|
||||
|
|
@ -195,11 +189,7 @@ SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * bas
|
|||
auto flakeRef = parseFlakeRef(fetchSettings, std::string(s.substr(6)), {}, true, false);
|
||||
auto [accessor, lockedRef] = flakeRef.resolve(state.store).lazyFetch(state.store);
|
||||
auto storePath = nix::fetchToStore(
|
||||
state.fetchSettings,
|
||||
*state.store,
|
||||
SourcePath(accessor),
|
||||
FetchMode::Copy,
|
||||
lockedRef.input.getName());
|
||||
state.fetchSettings, *state.store, SourcePath(accessor), FetchMode::Copy, lockedRef.input.getName());
|
||||
state.allowPath(storePath);
|
||||
return state.storePath(storePath);
|
||||
}
|
||||
|
|
@ -213,4 +203,4 @@ SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * bas
|
|||
return state.rootPath(baseDir ? absPath(s, *baseDir) : absPath(s));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -11,14 +11,12 @@ Strings editorFor(const SourcePath & file, uint32_t line)
|
|||
throw Error("cannot open '%s' in an editor because it has no physical path", file);
|
||||
auto editor = getEnv("EDITOR").value_or("cat");
|
||||
auto args = tokenizeString<Strings>(editor);
|
||||
if (line > 0 && (
|
||||
editor.find("emacs") != std::string::npos ||
|
||||
editor.find("nano") != std::string::npos ||
|
||||
editor.find("vim") != std::string::npos ||
|
||||
editor.find("kak") != std::string::npos))
|
||||
if (line > 0
|
||||
&& (editor.find("emacs") != std::string::npos || editor.find("nano") != std::string::npos
|
||||
|| editor.find("vim") != std::string::npos || editor.find("kak") != std::string::npos))
|
||||
args.push_back(fmt("+%d", line));
|
||||
args.push_back(path->string());
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ namespace nix {
|
|||
|
||||
struct SingleBuiltPath;
|
||||
|
||||
struct SingleBuiltPathBuilt {
|
||||
struct SingleBuiltPathBuilt
|
||||
{
|
||||
ref<SingleBuiltPath> drvPath;
|
||||
std::pair<std::string, StorePath> output;
|
||||
|
||||
|
|
@ -22,12 +23,10 @@ struct SingleBuiltPathBuilt {
|
|||
std::strong_ordering operator<=>(const SingleBuiltPathBuilt &) const noexcept;
|
||||
};
|
||||
|
||||
using _SingleBuiltPathRaw = std::variant<
|
||||
DerivedPathOpaque,
|
||||
SingleBuiltPathBuilt
|
||||
>;
|
||||
using _SingleBuiltPathRaw = std::variant<DerivedPathOpaque, SingleBuiltPathBuilt>;
|
||||
|
||||
struct SingleBuiltPath : _SingleBuiltPathRaw {
|
||||
struct SingleBuiltPath : _SingleBuiltPathRaw
|
||||
{
|
||||
using Raw = _SingleBuiltPathRaw;
|
||||
using Raw::Raw;
|
||||
|
||||
|
|
@ -37,7 +36,8 @@ struct SingleBuiltPath : _SingleBuiltPathRaw {
|
|||
bool operator==(const SingleBuiltPath &) const = default;
|
||||
auto operator<=>(const SingleBuiltPath &) const = default;
|
||||
|
||||
inline const Raw & raw() const {
|
||||
inline const Raw & raw() const
|
||||
{
|
||||
return static_cast<const Raw &>(*this);
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +59,8 @@ static inline ref<SingleBuiltPath> staticDrv(StorePath drvPath)
|
|||
*
|
||||
* See 'BuiltPath' for more an explanation.
|
||||
*/
|
||||
struct BuiltPathBuilt {
|
||||
struct BuiltPathBuilt
|
||||
{
|
||||
ref<SingleBuiltPath> drvPath;
|
||||
std::map<std::string, StorePath> outputs;
|
||||
|
||||
|
|
@ -72,16 +73,14 @@ struct BuiltPathBuilt {
|
|||
nlohmann::json toJSON(const StoreDirConfig & store) const;
|
||||
};
|
||||
|
||||
using _BuiltPathRaw = std::variant<
|
||||
DerivedPath::Opaque,
|
||||
BuiltPathBuilt
|
||||
>;
|
||||
using _BuiltPathRaw = std::variant<DerivedPath::Opaque, BuiltPathBuilt>;
|
||||
|
||||
/**
|
||||
* A built path. Similar to a DerivedPath, but enriched with the corresponding
|
||||
* output path(s).
|
||||
*/
|
||||
struct BuiltPath : _BuiltPathRaw {
|
||||
struct BuiltPath : _BuiltPathRaw
|
||||
{
|
||||
using Raw = _BuiltPathRaw;
|
||||
using Raw::Raw;
|
||||
|
||||
|
|
@ -89,10 +88,12 @@ struct BuiltPath : _BuiltPathRaw {
|
|||
using Built = BuiltPathBuilt;
|
||||
|
||||
bool operator==(const BuiltPath &) const = default;
|
||||
|
||||
// TODO libc++ 16 (used by darwin) missing `std::map::operator <=>`, can't do yet.
|
||||
// auto operator <=> (const BuiltPath &) const = default;
|
||||
|
||||
inline const Raw & raw() const {
|
||||
inline const Raw & raw() const
|
||||
{
|
||||
return static_cast<const Raw &>(*this);
|
||||
}
|
||||
|
||||
|
|
@ -104,4 +105,4 @@ struct BuiltPath : _BuiltPathRaw {
|
|||
|
||||
typedef std::vector<BuiltPath> BuiltPaths;
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@ struct InstallableValueCommand : InstallableCommand
|
|||
void run(ref<Store> store, ref<Installable> installable) override;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -13,13 +13,17 @@ namespace nix {
|
|||
|
||||
class Store;
|
||||
|
||||
namespace fetchers { struct Settings; }
|
||||
namespace fetchers {
|
||||
struct Settings;
|
||||
}
|
||||
|
||||
class EvalState;
|
||||
struct CompatibilitySettings;
|
||||
class Bindings;
|
||||
|
||||
namespace flake { struct Settings; }
|
||||
namespace flake {
|
||||
struct Settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Get rid of global settings variables
|
||||
|
|
@ -54,10 +58,23 @@ struct MixEvalArgs : virtual Args, virtual MixRepair
|
|||
std::optional<std::string> evalStoreUrl;
|
||||
|
||||
private:
|
||||
struct AutoArgExpr { std::string expr; };
|
||||
struct AutoArgString { std::string s; };
|
||||
struct AutoArgFile { std::filesystem::path path; };
|
||||
struct AutoArgStdin { };
|
||||
struct AutoArgExpr
|
||||
{
|
||||
std::string expr;
|
||||
};
|
||||
|
||||
struct AutoArgString
|
||||
{
|
||||
std::string s;
|
||||
};
|
||||
|
||||
struct AutoArgFile
|
||||
{
|
||||
std::filesystem::path path;
|
||||
};
|
||||
|
||||
struct AutoArgStdin
|
||||
{};
|
||||
|
||||
using AutoArg = std::variant<AutoArgExpr, AutoArgString, AutoArgFile, AutoArgStdin>;
|
||||
|
||||
|
|
@ -65,8 +82,8 @@ private:
|
|||
};
|
||||
|
||||
/**
|
||||
* @param baseDir Optional [base directory](https://nixos.org/manual/nix/unstable/glossary#gloss-base-directory)
|
||||
* @param baseDir Optional [base directory](https://nix.dev/manual/nix/development/glossary#gloss-base-directory)
|
||||
*/
|
||||
SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * baseDir = nullptr);
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -33,4 +33,4 @@ struct CompatibilitySettings : public Config
|
|||
)"};
|
||||
};
|
||||
|
||||
};
|
||||
}; // namespace nix
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@ namespace nix {
|
|||
*/
|
||||
Strings editorFor(const SourcePath & file, uint32_t line);
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -39,7 +39,10 @@ class InstallableAttrPath : public InstallableValue
|
|||
const std::string & attrPath,
|
||||
ExtendedOutputsSpec extendedOutputsSpec);
|
||||
|
||||
std::string what() const override { return attrPath; };
|
||||
std::string what() const override
|
||||
{
|
||||
return attrPath;
|
||||
};
|
||||
|
||||
std::pair<Value *, PosIdx> toValue(EvalState & state) override;
|
||||
|
||||
|
|
@ -55,4 +58,4 @@ public:
|
|||
ExtendedOutputsSpec extendedOutputsSpec);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@ struct InstallableDerivedPath : Installable
|
|||
DerivedPath derivedPath;
|
||||
|
||||
InstallableDerivedPath(ref<Store> store, DerivedPath && derivedPath)
|
||||
: store(store), derivedPath(std::move(derivedPath))
|
||||
{ }
|
||||
: store(store)
|
||||
, derivedPath(std::move(derivedPath))
|
||||
{
|
||||
}
|
||||
|
||||
std::string what() const override;
|
||||
|
||||
|
|
@ -20,10 +22,8 @@ struct InstallableDerivedPath : Installable
|
|||
|
||||
std::optional<StorePath> getStorePath() override;
|
||||
|
||||
static InstallableDerivedPath parse(
|
||||
ref<Store> store,
|
||||
std::string_view prefix,
|
||||
ExtendedOutputsSpec extendedOutputsSpec);
|
||||
static InstallableDerivedPath
|
||||
parse(ref<Store> store, std::string_view prefix, ExtendedOutputsSpec extendedOutputsSpec);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ struct ExtraPathInfoFlake : ExtraPathInfoValue
|
|||
/**
|
||||
* Extra struct to get around C++ designated initializer limitations
|
||||
*/
|
||||
struct Flake {
|
||||
struct Flake
|
||||
{
|
||||
FlakeRef originalRef;
|
||||
FlakeRef lockedRef;
|
||||
};
|
||||
|
|
@ -26,8 +27,10 @@ struct ExtraPathInfoFlake : ExtraPathInfoValue
|
|||
Flake flake;
|
||||
|
||||
ExtraPathInfoFlake(Value && v, Flake && f)
|
||||
: ExtraPathInfoValue(std::move(v)), flake(std::move(f))
|
||||
{ }
|
||||
: ExtraPathInfoValue(std::move(v))
|
||||
, flake(std::move(f))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct InstallableFlake : InstallableValue
|
||||
|
|
@ -49,7 +52,10 @@ struct InstallableFlake : InstallableValue
|
|||
Strings prefixes,
|
||||
const flake::LockFlags & lockFlags);
|
||||
|
||||
std::string what() const override { return flakeRef.to_string() + "#" + *attrPaths.begin(); }
|
||||
std::string what() const override
|
||||
{
|
||||
return flakeRef.to_string() + "#" + *attrPaths.begin();
|
||||
}
|
||||
|
||||
std::vector<std::string> getActualAttrPaths();
|
||||
|
||||
|
|
@ -61,8 +67,7 @@ struct InstallableFlake : InstallableValue
|
|||
* Get a cursor to every attrpath in getActualAttrPaths() that
|
||||
* exists. However if none exists, throw an exception.
|
||||
*/
|
||||
std::vector<ref<eval_cache::AttrCursor>>
|
||||
getCursors(EvalState & state) override;
|
||||
std::vector<ref<eval_cache::AttrCursor>> getCursors(EvalState & state) override;
|
||||
|
||||
std::shared_ptr<flake::LockedFlake> getLockedFlake() const;
|
||||
|
||||
|
|
@ -82,8 +87,6 @@ static inline FlakeRef defaultNixpkgsFlakeRef()
|
|||
return FlakeRef::fromAttrs(fetchSettings, {{"type", "indirect"}, {"id", "nixpkgs"}});
|
||||
}
|
||||
|
||||
ref<eval_cache::EvalCache> openEvalCache(
|
||||
EvalState & state,
|
||||
std::shared_ptr<flake::LockedFlake> lockedFlake);
|
||||
ref<eval_cache::EvalCache> openEvalCache(EvalState & state, std::shared_ptr<flake::LockedFlake> lockedFlake);
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@ namespace nix {
|
|||
struct PackageInfo;
|
||||
struct SourceExprCommand;
|
||||
|
||||
namespace eval_cache { class EvalCache; class AttrCursor; }
|
||||
namespace eval_cache {
|
||||
class EvalCache;
|
||||
class AttrCursor;
|
||||
} // namespace eval_cache
|
||||
|
||||
struct App
|
||||
{
|
||||
|
|
@ -37,7 +40,8 @@ struct ExtraPathInfoValue : ExtraPathInfo
|
|||
/**
|
||||
* Extra struct to get around C++ designated initializer limitations
|
||||
*/
|
||||
struct Value {
|
||||
struct Value
|
||||
{
|
||||
/**
|
||||
* An optional priority for use with "build envs". See Package
|
||||
*/
|
||||
|
|
@ -61,7 +65,8 @@ struct ExtraPathInfoValue : ExtraPathInfo
|
|||
|
||||
ExtraPathInfoValue(Value && v)
|
||||
: value(std::move(v))
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ExtraPathInfoValue() = default;
|
||||
};
|
||||
|
|
@ -74,7 +79,10 @@ struct InstallableValue : Installable
|
|||
{
|
||||
ref<EvalState> state;
|
||||
|
||||
InstallableValue(ref<EvalState> state) : state(state) {}
|
||||
InstallableValue(ref<EvalState> state)
|
||||
: state(state)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~InstallableValue() {}
|
||||
|
||||
|
|
@ -85,15 +93,13 @@ struct InstallableValue : Installable
|
|||
* However if none exists, throw exception instead of returning
|
||||
* empty vector.
|
||||
*/
|
||||
virtual std::vector<ref<eval_cache::AttrCursor>>
|
||||
getCursors(EvalState & state);
|
||||
virtual std::vector<ref<eval_cache::AttrCursor>> getCursors(EvalState & state);
|
||||
|
||||
/**
|
||||
* Get the first and most preferred cursor this Installable could
|
||||
* refer to, or throw an exception if none exists.
|
||||
*/
|
||||
virtual ref<eval_cache::AttrCursor>
|
||||
getCursor(EvalState & state);
|
||||
virtual ref<eval_cache::AttrCursor> getCursor(EvalState & state);
|
||||
|
||||
UnresolvedApp toApp(EvalState & state);
|
||||
|
||||
|
|
@ -116,7 +122,8 @@ protected:
|
|||
* @result A derived path (with empty info, for now) if the value
|
||||
* matched the above criteria.
|
||||
*/
|
||||
std::optional<DerivedPathWithInfo> trySinglePathToDerivedPaths(Value & v, const PosIdx pos, std::string_view errorCtx);
|
||||
std::optional<DerivedPathWithInfo>
|
||||
trySinglePathToDerivedPaths(Value & v, const PosIdx pos, std::string_view errorCtx);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -168,37 +168,19 @@ struct Installable
|
|||
BuildMode bMode = bmNormal);
|
||||
|
||||
static std::set<StorePath> toStorePathSet(
|
||||
ref<Store> evalStore,
|
||||
ref<Store> store,
|
||||
Realise mode,
|
||||
OperateOn operateOn,
|
||||
const Installables & installables);
|
||||
ref<Store> evalStore, ref<Store> store, Realise mode, OperateOn operateOn, const Installables & installables);
|
||||
|
||||
static std::vector<StorePath> toStorePaths(
|
||||
ref<Store> evalStore,
|
||||
ref<Store> store,
|
||||
Realise mode,
|
||||
OperateOn operateOn,
|
||||
const Installables & installables);
|
||||
ref<Store> evalStore, ref<Store> store, Realise mode, OperateOn operateOn, const Installables & installables);
|
||||
|
||||
static StorePath toStorePath(
|
||||
ref<Store> evalStore,
|
||||
ref<Store> store,
|
||||
Realise mode,
|
||||
OperateOn operateOn,
|
||||
ref<Installable> installable);
|
||||
ref<Store> evalStore, ref<Store> store, Realise mode, OperateOn operateOn, ref<Installable> installable);
|
||||
|
||||
static std::set<StorePath> toDerivations(
|
||||
ref<Store> store,
|
||||
const Installables & installables,
|
||||
bool useDeriver = false);
|
||||
static std::set<StorePath>
|
||||
toDerivations(ref<Store> store, const Installables & installables, bool useDeriver = false);
|
||||
|
||||
static BuiltPaths toBuiltPaths(
|
||||
ref<Store> evalStore,
|
||||
ref<Store> store,
|
||||
Realise mode,
|
||||
OperateOn operateOn,
|
||||
const Installables & installables);
|
||||
ref<Store> evalStore, ref<Store> store, Realise mode, OperateOn operateOn, const Installables & installables);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ struct RegisterLegacyCommand
|
|||
{
|
||||
typedef std::map<std::string, MainFunction> Commands;
|
||||
|
||||
static Commands & commands() {
|
||||
static Commands & commands()
|
||||
{
|
||||
static Commands commands;
|
||||
return commands;
|
||||
}
|
||||
|
|
@ -24,4 +25,4 @@ struct RegisterLegacyCommand
|
|||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@ namespace nix {
|
|||
*/
|
||||
std::string renderMarkdownToTerminal(std::string_view markdown);
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -4,18 +4,22 @@
|
|||
namespace nix::flag {
|
||||
|
||||
Args::Flag hashAlgo(std::string && longName, HashAlgorithm * ha);
|
||||
|
||||
static inline Args::Flag hashAlgo(HashAlgorithm * ha)
|
||||
{
|
||||
return hashAlgo("hash-algo", ha);
|
||||
}
|
||||
|
||||
Args::Flag hashAlgoOpt(std::string && longName, std::optional<HashAlgorithm> * oha);
|
||||
Args::Flag hashFormatWithDefault(std::string && longName, HashFormat * hf);
|
||||
Args::Flag hashFormatOpt(std::string && longName, std::optional<HashFormat> * ohf);
|
||||
|
||||
static inline Args::Flag hashAlgoOpt(std::optional<HashAlgorithm> * oha)
|
||||
{
|
||||
return hashAlgoOpt("hash-algo", oha);
|
||||
}
|
||||
|
||||
Args::Flag fileIngestionMethod(FileIngestionMethod * method);
|
||||
Args::Flag contentAddressMethod(ContentAddressMethod * method);
|
||||
|
||||
}
|
||||
} // namespace nix::flag
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ extern const StringSet networkProxyVariables;
|
|||
*/
|
||||
bool haveNetworkProxyConnection();
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -11,10 +11,11 @@ namespace nix {
|
|||
namespace detail {
|
||||
/** Provides the completion hooks for the repl, without exposing its complete
|
||||
* internals. */
|
||||
struct ReplCompleterMixin {
|
||||
struct ReplCompleterMixin
|
||||
{
|
||||
virtual StringSet completePrefix(const std::string & prefix) = 0;
|
||||
};
|
||||
};
|
||||
}; // namespace detail
|
||||
|
||||
enum class ReplPromptType {
|
||||
ReplPrompt,
|
||||
|
|
@ -40,9 +41,10 @@ public:
|
|||
: historyFile(historyFile)
|
||||
{
|
||||
}
|
||||
|
||||
virtual Guard init(detail::ReplCompleterMixin * repl) override;
|
||||
virtual bool getLine(std::string & input, ReplPromptType promptType) override;
|
||||
virtual ~ReadlineLikeInteracter() override;
|
||||
};
|
||||
|
||||
};
|
||||
}; // namespace nix
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ struct AbstractNixRepl
|
|||
|
||||
AbstractNixRepl(ref<EvalState> state)
|
||||
: state(state)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AbstractNixRepl()
|
||||
{ }
|
||||
virtual ~AbstractNixRepl() {}
|
||||
|
||||
typedef std::vector<std::pair<Value *, std::string>> AnnotatedValues;
|
||||
|
||||
|
|
@ -33,13 +33,11 @@ struct AbstractNixRepl
|
|||
std::function<AnnotatedValues()> getValues,
|
||||
RunNix * runNix = nullptr);
|
||||
|
||||
static ReplExitStatus runSimple(
|
||||
ref<EvalState> evalState,
|
||||
const ValMap & extraEnv);
|
||||
static ReplExitStatus runSimple(ref<EvalState> evalState, const ValMap & extraEnv);
|
||||
|
||||
virtual void initEnv() = 0;
|
||||
|
||||
virtual ReplExitStatus mainLoop() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ InstallableAttrPath::InstallableAttrPath(
|
|||
, v(allocRootValue(v))
|
||||
, attrPath(attrPath)
|
||||
, extendedOutputsSpec(std::move(extendedOutputsSpec))
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<Value *, PosIdx> InstallableAttrPath::toValue(EvalState & state)
|
||||
{
|
||||
|
|
@ -48,11 +49,8 @@ DerivedPathsWithInfo InstallableAttrPath::toDerivedPaths()
|
|||
{
|
||||
auto [v, pos] = toValue(*state);
|
||||
|
||||
if (std::optional derivedPathWithInfo = trySinglePathToDerivedPaths(
|
||||
*v,
|
||||
pos,
|
||||
fmt("while evaluating the attribute '%s'", attrPath)))
|
||||
{
|
||||
if (std::optional derivedPathWithInfo =
|
||||
trySinglePathToDerivedPaths(*v, pos, fmt("while evaluating the attribute '%s'", attrPath))) {
|
||||
return {*derivedPathWithInfo};
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +68,8 @@ DerivedPathsWithInfo InstallableAttrPath::toDerivedPaths()
|
|||
if (!drvPath)
|
||||
throw Error("'%s' is not a derivation", what());
|
||||
|
||||
auto newOutputs = std::visit(overloaded {
|
||||
auto newOutputs = std::visit(
|
||||
overloaded{
|
||||
[&](const ExtendedOutputsSpec::Default & d) -> OutputsSpec {
|
||||
StringSet outputsToInstall;
|
||||
for (auto & output : packageInfo.queryOutputs(false, true))
|
||||
|
|
@ -79,10 +78,9 @@ DerivedPathsWithInfo InstallableAttrPath::toDerivedPaths()
|
|||
outputsToInstall.insert("out");
|
||||
return OutputsSpec::Names{std::move(outputsToInstall)};
|
||||
},
|
||||
[&](const ExtendedOutputsSpec::Explicit & e) -> OutputsSpec {
|
||||
return e;
|
||||
[&](const ExtendedOutputsSpec::Explicit & e) -> OutputsSpec { return e; },
|
||||
},
|
||||
}, extendedOutputsSpec.raw);
|
||||
extendedOutputsSpec.raw);
|
||||
|
||||
auto [iter, didInsert] = byDrvPath.emplace(*drvPath, newOutputs);
|
||||
|
||||
|
|
@ -93,7 +91,8 @@ DerivedPathsWithInfo InstallableAttrPath::toDerivedPaths()
|
|||
DerivedPathsWithInfo res;
|
||||
for (auto & [drvPath, outputs] : byDrvPath)
|
||||
res.push_back({
|
||||
.path = DerivedPath::Built {
|
||||
.path =
|
||||
DerivedPath::Built{
|
||||
.drvPath = makeConstantStorePathRef(drvPath),
|
||||
.outputs = outputs,
|
||||
},
|
||||
|
|
@ -115,10 +114,12 @@ InstallableAttrPath InstallableAttrPath::parse(
|
|||
ExtendedOutputsSpec extendedOutputsSpec)
|
||||
{
|
||||
return {
|
||||
state, cmd, v,
|
||||
state,
|
||||
cmd,
|
||||
v,
|
||||
prefix == "." ? "" : std::string{prefix},
|
||||
std::move(extendedOutputsSpec),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -21,12 +21,11 @@ std::optional<StorePath> InstallableDerivedPath::getStorePath()
|
|||
return derivedPath.getBaseStorePath();
|
||||
}
|
||||
|
||||
InstallableDerivedPath InstallableDerivedPath::parse(
|
||||
ref<Store> store,
|
||||
std::string_view prefix,
|
||||
ExtendedOutputsSpec extendedOutputsSpec)
|
||||
InstallableDerivedPath
|
||||
InstallableDerivedPath::parse(ref<Store> store, std::string_view prefix, ExtendedOutputsSpec extendedOutputsSpec)
|
||||
{
|
||||
auto derivedPath = std::visit(overloaded {
|
||||
auto derivedPath = std::visit(
|
||||
overloaded{
|
||||
// If the user did not use ^, we treat the output more
|
||||
// liberally: we accept a symlink chain or an actual
|
||||
// store path.
|
||||
|
|
@ -45,11 +44,12 @@ InstallableDerivedPath InstallableDerivedPath::parse(
|
|||
.outputs = outputSpec,
|
||||
};
|
||||
},
|
||||
}, extendedOutputsSpec.raw);
|
||||
},
|
||||
extendedOutputsSpec.raw);
|
||||
return InstallableDerivedPath{
|
||||
store,
|
||||
std::move(derivedPath),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -47,8 +47,11 @@ static std::string showAttrPaths(const std::vector<std::string> & paths)
|
|||
{
|
||||
std::string s;
|
||||
for (const auto & [n, i] : enumerate(paths)) {
|
||||
if (n > 0) s += n + 1 == paths.size() ? " or " : ", ";
|
||||
s += '\''; s += i; s += '\'';
|
||||
if (n > 0)
|
||||
s += n + 1 == paths.size() ? " or " : ", ";
|
||||
s += '\'';
|
||||
s += i;
|
||||
s += '\'';
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
@ -62,12 +65,12 @@ InstallableFlake::InstallableFlake(
|
|||
Strings attrPaths,
|
||||
Strings prefixes,
|
||||
const flake::LockFlags & lockFlags)
|
||||
: InstallableValue(state),
|
||||
flakeRef(flakeRef),
|
||||
attrPaths(fragment == "" ? attrPaths : Strings{(std::string) fragment}),
|
||||
prefixes(fragment == "" ? Strings{} : prefixes),
|
||||
extendedOutputsSpec(std::move(extendedOutputsSpec)),
|
||||
lockFlags(lockFlags)
|
||||
: InstallableValue(state)
|
||||
, flakeRef(flakeRef)
|
||||
, attrPaths(fragment == "" ? attrPaths : Strings{(std::string) fragment})
|
||||
, prefixes(fragment == "" ? Strings{} : prefixes)
|
||||
, extendedOutputsSpec(std::move(extendedOutputsSpec))
|
||||
, lockFlags(lockFlags)
|
||||
{
|
||||
if (cmd && cmd->getAutoArgs(*state)->size())
|
||||
throw UsageError("'--arg' and '--argstr' are incompatible with flakes");
|
||||
|
|
@ -87,18 +90,14 @@ DerivedPathsWithInfo InstallableFlake::toDerivedPaths()
|
|||
auto v = attr->forceValue();
|
||||
|
||||
if (std::optional derivedPathWithInfo = trySinglePathToDerivedPaths(
|
||||
v,
|
||||
noPos,
|
||||
fmt("while evaluating the flake output attribute '%s'", attrPath)))
|
||||
{
|
||||
v, noPos, fmt("while evaluating the flake output attribute '%s'", attrPath))) {
|
||||
return {*derivedPathWithInfo};
|
||||
} else {
|
||||
throw Error(
|
||||
"expected flake output attribute '%s' to be a derivation or path but found %s: %s",
|
||||
attrPath,
|
||||
showType(v),
|
||||
ValuePrinter(*this->state, v, errorPrintOptions)
|
||||
);
|
||||
ValuePrinter(*this->state, v, errorPrintOptions));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,24 +105,26 @@ DerivedPathsWithInfo InstallableFlake::toDerivedPaths()
|
|||
|
||||
std::optional<NixInt::Inner> priority;
|
||||
|
||||
if (attr->maybeGetAttr(state->sOutputSpecified)) {
|
||||
} else if (auto aMeta = attr->maybeGetAttr(state->sMeta)) {
|
||||
if (attr->maybeGetAttr(state->s.outputSpecified)) {
|
||||
} else if (auto aMeta = attr->maybeGetAttr(state->s.meta)) {
|
||||
if (auto aPriority = aMeta->maybeGetAttr("priority"))
|
||||
priority = aPriority->getInt().value;
|
||||
}
|
||||
|
||||
return {{
|
||||
.path = DerivedPath::Built {
|
||||
.path =
|
||||
DerivedPath::Built{
|
||||
.drvPath = makeConstantStorePathRef(std::move(drvPath)),
|
||||
.outputs = std::visit(overloaded {
|
||||
.outputs = std::visit(
|
||||
overloaded{
|
||||
[&](const ExtendedOutputsSpec::Default & d) -> OutputsSpec {
|
||||
StringSet outputsToInstall;
|
||||
if (auto aOutputSpecified = attr->maybeGetAttr(state->sOutputSpecified)) {
|
||||
if (auto aOutputSpecified = attr->maybeGetAttr(state->s.outputSpecified)) {
|
||||
if (aOutputSpecified->getBool()) {
|
||||
if (auto aOutputName = attr->maybeGetAttr("outputName"))
|
||||
outputsToInstall = {aOutputName->getString()};
|
||||
}
|
||||
} else if (auto aMeta = attr->maybeGetAttr(state->sMeta)) {
|
||||
} else if (auto aMeta = attr->maybeGetAttr(state->s.meta)) {
|
||||
if (auto aOutputsToInstall = aMeta->maybeGetAttr("outputsToInstall"))
|
||||
for (auto & s : aOutputsToInstall->getListOfStrings())
|
||||
outputsToInstall.insert(s);
|
||||
|
|
@ -134,10 +135,9 @@ DerivedPathsWithInfo InstallableFlake::toDerivedPaths()
|
|||
|
||||
return OutputsSpec::Names{std::move(outputsToInstall)};
|
||||
},
|
||||
[&](const ExtendedOutputsSpec::Explicit & e) -> OutputsSpec {
|
||||
return e;
|
||||
[&](const ExtendedOutputsSpec::Explicit & e) -> OutputsSpec { return e; },
|
||||
},
|
||||
}, extendedOutputsSpec.raw),
|
||||
extendedOutputsSpec.raw),
|
||||
},
|
||||
.info = make_ref<ExtraPathInfoFlake>(
|
||||
ExtraPathInfoValue::Value{
|
||||
|
|
@ -157,8 +157,7 @@ std::pair<Value *, PosIdx> InstallableFlake::toValue(EvalState & state)
|
|||
return {&getCursor(state)->forceValue(), noPos};
|
||||
}
|
||||
|
||||
std::vector<ref<eval_cache::AttrCursor>>
|
||||
InstallableFlake::getCursors(EvalState & state)
|
||||
std::vector<ref<eval_cache::AttrCursor>> InstallableFlake::getCursors(EvalState & state)
|
||||
{
|
||||
auto evalCache = openEvalCache(state, getLockedFlake());
|
||||
|
||||
|
|
@ -181,11 +180,7 @@ InstallableFlake::getCursors(EvalState & state)
|
|||
}
|
||||
|
||||
if (res.size() == 0)
|
||||
throw Error(
|
||||
suggestions,
|
||||
"flake '%s' does not provide attribute %s",
|
||||
flakeRef,
|
||||
showAttrPaths(attrPaths));
|
||||
throw Error(suggestions, "flake '%s' does not provide attribute %s", flakeRef, showAttrPaths(attrPaths));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
@ -196,8 +191,8 @@ std::shared_ptr<flake::LockedFlake> InstallableFlake::getLockedFlake() const
|
|||
flake::LockFlags lockFlagsApplyConfig = lockFlags;
|
||||
// FIXME why this side effect?
|
||||
lockFlagsApplyConfig.applyNixConfig = true;
|
||||
_lockedFlake = std::make_shared<flake::LockedFlake>(lockFlake(
|
||||
flakeSettings, *state, flakeRef, lockFlagsApplyConfig));
|
||||
_lockedFlake =
|
||||
std::make_shared<flake::LockedFlake>(lockFlake(flakeSettings, *state, flakeRef, lockFlagsApplyConfig));
|
||||
}
|
||||
return _lockedFlake;
|
||||
}
|
||||
|
|
@ -216,4 +211,4 @@ FlakeRef InstallableFlake::nixpkgsFlakeRef() const
|
|||
return defaultNixpkgsFlakeRef();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -4,17 +4,14 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
std::vector<ref<eval_cache::AttrCursor>>
|
||||
InstallableValue::getCursors(EvalState & state)
|
||||
std::vector<ref<eval_cache::AttrCursor>> InstallableValue::getCursors(EvalState & state)
|
||||
{
|
||||
auto evalCache =
|
||||
std::make_shared<nix::eval_cache::EvalCache>(std::nullopt, state,
|
||||
[&]() { return toValue(state).first; });
|
||||
std::make_shared<nix::eval_cache::EvalCache>(std::nullopt, state, [&]() { return toValue(state).first; });
|
||||
return {evalCache->getRoot()};
|
||||
}
|
||||
|
||||
ref<eval_cache::AttrCursor>
|
||||
InstallableValue::getCursor(EvalState & state)
|
||||
ref<eval_cache::AttrCursor> InstallableValue::getCursor(EvalState & state)
|
||||
{
|
||||
/* Although getCursors should return at least one element, in case it doesn't,
|
||||
bound check to avoid an undefined behavior for vector[0] */
|
||||
|
|
@ -42,12 +39,14 @@ ref<InstallableValue> InstallableValue::require(ref<Installable> installable)
|
|||
return ref{castedInstallable};
|
||||
}
|
||||
|
||||
std::optional<DerivedPathWithInfo> InstallableValue::trySinglePathToDerivedPaths(Value & v, const PosIdx pos, std::string_view errorCtx)
|
||||
std::optional<DerivedPathWithInfo>
|
||||
InstallableValue::trySinglePathToDerivedPaths(Value & v, const PosIdx pos, std::string_view errorCtx)
|
||||
{
|
||||
if (v.type() == nPath) {
|
||||
auto storePath = fetchToStore(state->fetchSettings, *state->store, v.path(), FetchMode::Copy);
|
||||
return {{
|
||||
.path = DerivedPath::Opaque {
|
||||
.path =
|
||||
DerivedPath::Opaque{
|
||||
.path = std::move(storePath),
|
||||
},
|
||||
.info = make_ref<ExtraPathInfo>(),
|
||||
|
|
@ -56,13 +55,13 @@ std::optional<DerivedPathWithInfo> InstallableValue::trySinglePathToDerivedPaths
|
|||
|
||||
else if (v.type() == nString) {
|
||||
return {{
|
||||
.path = DerivedPath::fromSingle(
|
||||
state->coerceToSingleDerivedPath(pos, v, errorCtx)),
|
||||
.path = DerivedPath::fromSingle(state->coerceToSingleDerivedPath(pos, v, errorCtx)),
|
||||
.info = make_ref<ExtraPathInfo>(),
|
||||
}};
|
||||
}
|
||||
|
||||
else return std::nullopt;
|
||||
else
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ MixFlakeOptions::MixFlakeOptions()
|
|||
.category = category,
|
||||
.handler = {[&]() {
|
||||
lockFlags.recreateLockFile = true;
|
||||
warn("'--recreate-lock-file' is deprecated and will be removed in a future version; use 'nix flake update' instead.");
|
||||
warn(
|
||||
"'--recreate-lock-file' is deprecated and will be removed in a future version; use 'nix flake update' instead.");
|
||||
}},
|
||||
});
|
||||
|
||||
|
|
@ -158,9 +159,7 @@ MixFlakeOptions::MixFlakeOptions()
|
|||
.description = "Write the given lock file instead of `flake.lock` within the top-level flake.",
|
||||
.category = category,
|
||||
.labels = {"flake-lock-path"},
|
||||
.handler = {[&](std::string lockFilePath) {
|
||||
lockFlags.outputLockFilePath = lockFilePath;
|
||||
}},
|
||||
.handler = {[&](std::string lockFilePath) { lockFlags.outputLockFilePath = lockFilePath; }},
|
||||
.completer = completePath,
|
||||
});
|
||||
|
||||
|
|
@ -179,10 +178,16 @@ MixFlakeOptions::MixFlakeOptions()
|
|||
for (auto & [inputName, input] : flake.lockFile.root->inputs) {
|
||||
auto input2 = flake.lockFile.findInput({inputName}); // resolve 'follows' nodes
|
||||
if (auto input3 = std::dynamic_pointer_cast<const flake::LockedNode>(input2)) {
|
||||
fetchers::Attrs extraAttrs;
|
||||
|
||||
if (!input3->lockedRef.subdir.empty()) {
|
||||
extraAttrs["dir"] = input3->lockedRef.subdir;
|
||||
}
|
||||
|
||||
overrideRegistry(
|
||||
fetchers::Input::fromAttrs(fetchSettings, {{"type", "indirect"}, {"id", inputName}}),
|
||||
input3->lockedRef.input,
|
||||
{});
|
||||
extraAttrs);
|
||||
}
|
||||
}
|
||||
}},
|
||||
|
|
@ -209,7 +214,8 @@ SourceExprCommand::SourceExprCommand()
|
|||
|
||||
addFlag({
|
||||
.longName = "expr",
|
||||
.description = "Interpret [*installables*](@docroot@/command-ref/new-cli/nix.md#installables) as attribute paths relative to the Nix expression *expr*.",
|
||||
.description =
|
||||
"Interpret [*installables*](@docroot@/command-ref/new-cli/nix.md#installables) as attribute paths relative to the Nix expression *expr*.",
|
||||
.category = installablesCategory,
|
||||
.labels = {"expr"},
|
||||
.handler = {&expr},
|
||||
|
|
@ -220,8 +226,7 @@ MixReadOnlyOption::MixReadOnlyOption()
|
|||
{
|
||||
addFlag({
|
||||
.longName = "read-only",
|
||||
.description =
|
||||
"Do not instantiate each evaluated derivation. "
|
||||
.description = "Do not instantiate each evaluated derivation. "
|
||||
"This improves performance, but can cause errors when accessing "
|
||||
"store paths of derivations during evaluation.",
|
||||
.handler = {&settings.readOnlyMode, true},
|
||||
|
|
@ -230,22 +235,17 @@ MixReadOnlyOption::MixReadOnlyOption()
|
|||
|
||||
Strings SourceExprCommand::getDefaultFlakeAttrPaths()
|
||||
{
|
||||
return {
|
||||
"packages." + settings.thisSystem.get() + ".default",
|
||||
"defaultPackage." + settings.thisSystem.get()
|
||||
};
|
||||
return {"packages." + settings.thisSystem.get() + ".default", "defaultPackage." + settings.thisSystem.get()};
|
||||
}
|
||||
|
||||
Strings SourceExprCommand::getDefaultFlakeAttrPathPrefixes()
|
||||
{
|
||||
return {
|
||||
// As a convenience, look for the attribute in
|
||||
return {// As a convenience, look for the attribute in
|
||||
// 'outputs.packages'.
|
||||
"packages." + settings.thisSystem.get() + ".",
|
||||
// As a temporary hack until Nixpkgs is properly converted
|
||||
// to provide a clean 'packages' set, look in 'legacyPackages'.
|
||||
"legacyPackages." + settings.thisSystem.get() + "."
|
||||
};
|
||||
"legacyPackages." + settings.thisSystem.get() + "."};
|
||||
}
|
||||
|
||||
Args::CompleterClosure SourceExprCommand::getCompleteInstallable()
|
||||
|
|
@ -263,10 +263,7 @@ void SourceExprCommand::completeInstallable(AddCompletions & completions, std::s
|
|||
|
||||
evalSettings.pureEval = false;
|
||||
auto state = getEvalState();
|
||||
auto e =
|
||||
state->parseExprFromFile(
|
||||
resolveExprPath(
|
||||
lookupFileArg(*state, *file)));
|
||||
auto e = state->parseExprFromFile(resolveExprPath(lookupFileArg(*state, *file)));
|
||||
|
||||
Value root;
|
||||
state->eval(e, root);
|
||||
|
|
@ -341,11 +338,12 @@ void completeFlakeRefWithFragment(
|
|||
auto flakeRefS = std::string(prefix.substr(0, hash));
|
||||
|
||||
// TODO: ideally this would use the command base directory instead of assuming ".".
|
||||
auto flakeRef = parseFlakeRef(fetchSettings, expandTilde(flakeRefS), std::filesystem::current_path().string());
|
||||
auto flakeRef =
|
||||
parseFlakeRef(fetchSettings, expandTilde(flakeRefS), std::filesystem::current_path().string());
|
||||
|
||||
auto evalCache = openEvalCache(*evalState,
|
||||
std::make_shared<flake::LockedFlake>(lockFlake(
|
||||
flakeSettings, *evalState, flakeRef, lockFlags)));
|
||||
auto evalCache = openEvalCache(
|
||||
*evalState,
|
||||
std::make_shared<flake::LockedFlake>(lockFlake(flakeSettings, *evalState, flakeRef, lockFlags)));
|
||||
|
||||
auto root = evalCache->getRoot();
|
||||
|
||||
|
|
@ -369,7 +367,8 @@ void completeFlakeRefWithFragment(
|
|||
}
|
||||
|
||||
auto attr = root->findAlongAttrPath(attrPath);
|
||||
if (!attr) continue;
|
||||
if (!attr)
|
||||
continue;
|
||||
|
||||
for (auto & attr2 : (*attr)->getAttrs()) {
|
||||
if (hasPrefix(evalState->symbols[attr2], lastAttr)) {
|
||||
|
|
@ -377,7 +376,9 @@ void completeFlakeRefWithFragment(
|
|||
/* Strip the attrpath prefix. */
|
||||
attrPath2.erase(attrPath2.begin(), attrPath2.begin() + attrPathPrefix.size());
|
||||
// FIXME: handle names with dots
|
||||
completions.add(flakeRefS + "#" + prefixRoot + concatStringsSep(".", evalState->symbols.resolve(attrPath2)));
|
||||
completions.add(
|
||||
flakeRefS + "#" + prefixRoot
|
||||
+ concatStringsSep(".", evalState->symbols.resolve(attrPath2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -387,7 +388,8 @@ void completeFlakeRefWithFragment(
|
|||
if (fragment.empty()) {
|
||||
for (auto & attrPath : defaultFlakeAttrPaths) {
|
||||
auto attr = root->findAlongAttrPath(parseAttrPath(*evalState, attrPath));
|
||||
if (!attr) continue;
|
||||
if (!attr)
|
||||
continue;
|
||||
completions.add(flakeRefS + "#" + prefixRoot);
|
||||
}
|
||||
}
|
||||
|
|
@ -427,14 +429,12 @@ DerivedPathWithInfo Installable::toDerivedPath()
|
|||
{
|
||||
auto buildables = toDerivedPaths();
|
||||
if (buildables.size() != 1)
|
||||
throw Error("installable '%s' evaluates to %d derivations, where only one is expected", what(), buildables.size());
|
||||
throw Error(
|
||||
"installable '%s' evaluates to %d derivations, where only one is expected", what(), buildables.size());
|
||||
return std::move(buildables[0]);
|
||||
}
|
||||
|
||||
static StorePath getDeriver(
|
||||
ref<Store> store,
|
||||
const Installable & i,
|
||||
const StorePath & drvPath)
|
||||
static StorePath getDeriver(ref<Store> store, const Installable & i, const StorePath & drvPath)
|
||||
{
|
||||
auto derivers = store->queryValidDerivers(drvPath);
|
||||
if (derivers.empty())
|
||||
|
|
@ -443,15 +443,12 @@ static StorePath getDeriver(
|
|||
return *derivers.begin();
|
||||
}
|
||||
|
||||
ref<eval_cache::EvalCache> openEvalCache(
|
||||
EvalState & state,
|
||||
std::shared_ptr<flake::LockedFlake> lockedFlake)
|
||||
ref<eval_cache::EvalCache> openEvalCache(EvalState & state, std::shared_ptr<flake::LockedFlake> lockedFlake)
|
||||
{
|
||||
auto fingerprint = evalSettings.useEvalCache && evalSettings.pureEval
|
||||
? lockedFlake->getFingerprint(state.store, state.fetchSettings)
|
||||
: std::nullopt;
|
||||
auto rootLoader = [&state, lockedFlake]()
|
||||
{
|
||||
auto rootLoader = [&state, lockedFlake]() {
|
||||
/* For testing whether the evaluation cache is
|
||||
complete. */
|
||||
if (getEnv("NIX_ALLOW_EVAL").value_or("1") == "0")
|
||||
|
|
@ -471,7 +468,10 @@ ref<eval_cache::EvalCache> openEvalCache(
|
|||
if (fingerprint) {
|
||||
auto search = state.evalCaches.find(fingerprint.value());
|
||||
if (search == state.evalCaches.end()) {
|
||||
search = state.evalCaches.emplace(fingerprint.value(), make_ref<nix::eval_cache::EvalCache>(fingerprint, state, rootLoader)).first;
|
||||
search =
|
||||
state.evalCaches
|
||||
.emplace(fingerprint.value(), make_ref<nix::eval_cache::EvalCache>(fingerprint, state, rootLoader))
|
||||
.first;
|
||||
}
|
||||
return search->second;
|
||||
} else {
|
||||
|
|
@ -479,8 +479,7 @@ ref<eval_cache::EvalCache> openEvalCache(
|
|||
}
|
||||
}
|
||||
|
||||
Installables SourceExprCommand::parseInstallables(
|
||||
ref<Store> store, std::vector<std::string> ss)
|
||||
Installables SourceExprCommand::parseInstallables(ref<Store> store, std::vector<std::string> ss)
|
||||
{
|
||||
Installables result;
|
||||
|
||||
|
|
@ -501,12 +500,10 @@ Installables SourceExprCommand::parseInstallables(
|
|||
if (file == "-") {
|
||||
auto e = state->parseStdin();
|
||||
state->eval(e, *vFile);
|
||||
}
|
||||
else if (file) {
|
||||
} else if (file) {
|
||||
auto dir = absPath(getCommandBaseDir());
|
||||
state->evalFile(lookupFileArg(*state, *file, &dir), *vFile);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Path dir = absPath(getCommandBaseDir());
|
||||
auto e = state->parseExprFromString(*expr, state->rootPath(dir));
|
||||
state->eval(e, *vFile);
|
||||
|
|
@ -515,8 +512,7 @@ Installables SourceExprCommand::parseInstallables(
|
|||
for (auto & s : ss) {
|
||||
auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse(s);
|
||||
result.push_back(
|
||||
make_ref<InstallableAttrPath>(
|
||||
InstallableAttrPath::parse(
|
||||
make_ref<InstallableAttrPath>(InstallableAttrPath::parse(
|
||||
state, *this, vFile, std::move(prefix), std::move(extendedOutputsSpec))));
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +528,8 @@ Installables SourceExprCommand::parseInstallables(
|
|||
|
||||
if (prefix.find('/') != std::string::npos) {
|
||||
try {
|
||||
result.push_back(make_ref<InstallableDerivedPath>(
|
||||
result.push_back(
|
||||
make_ref<InstallableDerivedPath>(
|
||||
InstallableDerivedPath::parse(store, prefix, extendedOutputsSpec.raw)));
|
||||
continue;
|
||||
} catch (BadStorePath &) {
|
||||
|
|
@ -543,9 +540,10 @@ Installables SourceExprCommand::parseInstallables(
|
|||
}
|
||||
|
||||
try {
|
||||
auto [flakeRef, fragment] = parseFlakeRefWithFragment(
|
||||
fetchSettings, std::string { prefix }, absPath(getCommandBaseDir()));
|
||||
result.push_back(make_ref<InstallableFlake>(
|
||||
auto [flakeRef, fragment] =
|
||||
parseFlakeRefWithFragment(fetchSettings, std::string{prefix}, absPath(getCommandBaseDir()));
|
||||
result.push_back(
|
||||
make_ref<InstallableFlake>(
|
||||
this,
|
||||
getEvalState(),
|
||||
std::move(flakeRef),
|
||||
|
|
@ -566,8 +564,7 @@ Installables SourceExprCommand::parseInstallables(
|
|||
return result;
|
||||
}
|
||||
|
||||
ref<Installable> SourceExprCommand::parseInstallable(
|
||||
ref<Store> store, const std::string & installable)
|
||||
ref<Installable> SourceExprCommand::parseInstallable(ref<Store> store, const std::string & installable)
|
||||
{
|
||||
auto installables = parseInstallables(store, {installable});
|
||||
assert(installables.size() == 1);
|
||||
|
|
@ -578,9 +575,7 @@ static SingleBuiltPath getBuiltPath(ref<Store> evalStore, ref<Store> store, cons
|
|||
{
|
||||
return std::visit(
|
||||
overloaded{
|
||||
[&](const SingleDerivedPath::Opaque & bo) -> SingleBuiltPath {
|
||||
return SingleBuiltPath::Opaque { bo.path };
|
||||
},
|
||||
[&](const SingleDerivedPath::Opaque & bo) -> SingleBuiltPath { return SingleBuiltPath::Opaque{bo.path}; },
|
||||
[&](const SingleDerivedPath::Built & bfd) -> SingleBuiltPath {
|
||||
auto drvPath = getBuiltPath(evalStore, store, *bfd.drvPath);
|
||||
// Resolving this instead of `bfd` will yield the same result, but avoid duplicative work.
|
||||
|
|
@ -599,11 +594,7 @@ static SingleBuiltPath getBuiltPath(ref<Store> evalStore, ref<Store> store, cons
|
|||
}
|
||||
|
||||
std::vector<BuiltPathWithResult> Installable::build(
|
||||
ref<Store> evalStore,
|
||||
ref<Store> store,
|
||||
Realise mode,
|
||||
const Installables & installables,
|
||||
BuildMode bMode)
|
||||
ref<Store> evalStore, ref<Store> store, Realise mode, const Installables & installables, BuildMode bMode)
|
||||
{
|
||||
std::vector<BuiltPathWithResult> res;
|
||||
for (auto & [_, builtPathWithResult] : build2(evalStore, store, mode, installables, bMode))
|
||||
|
|
@ -611,9 +602,7 @@ std::vector<BuiltPathWithResult> Installable::build(
|
|||
return res;
|
||||
}
|
||||
|
||||
static void throwBuildErrors(
|
||||
std::vector<KeyedBuildResult> & buildResults,
|
||||
const Store & store)
|
||||
static void throwBuildErrors(std::vector<KeyedBuildResult> & buildResults, const Store & store)
|
||||
{
|
||||
std::vector<KeyedBuildResult> failed;
|
||||
for (auto & buildResult : buildResults) {
|
||||
|
|
@ -630,7 +619,8 @@ static void throwBuildErrors(
|
|||
StringSet failedPaths;
|
||||
for (; failedResult != failed.end(); failedResult++) {
|
||||
if (!failedResult->errorMsg.empty()) {
|
||||
logError(ErrorInfo{
|
||||
logError(
|
||||
ErrorInfo{
|
||||
.level = lvlError,
|
||||
.msg = failedResult->errorMsg,
|
||||
});
|
||||
|
|
@ -643,11 +633,7 @@ static void throwBuildErrors(
|
|||
}
|
||||
|
||||
std::vector<std::pair<ref<Installable>, BuiltPathWithResult>> Installable::build2(
|
||||
ref<Store> evalStore,
|
||||
ref<Store> store,
|
||||
Realise mode,
|
||||
const Installables & installables,
|
||||
BuildMode bMode)
|
||||
ref<Store> evalStore, ref<Store> store, Realise mode, const Installables & installables, BuildMode bMode)
|
||||
{
|
||||
if (mode == Realise::Nothing)
|
||||
settings.readOnlyMode = true;
|
||||
|
|
@ -678,22 +664,25 @@ std::vector<std::pair<ref<Installable>, BuiltPathWithResult>> Installable::build
|
|||
|
||||
for (auto & path : pathsToBuild) {
|
||||
for (auto & aux : backmap[path]) {
|
||||
std::visit(overloaded {
|
||||
std::visit(
|
||||
overloaded{
|
||||
[&](const DerivedPath::Built & bfd) {
|
||||
auto outputs = resolveDerivedPath(*store, bfd, &*evalStore);
|
||||
res.push_back({aux.installable, {
|
||||
.path = BuiltPath::Built {
|
||||
.drvPath = make_ref<SingleBuiltPath>(getBuiltPath(evalStore, store, *bfd.drvPath)),
|
||||
res.push_back(
|
||||
{aux.installable,
|
||||
{.path =
|
||||
BuiltPath::Built{
|
||||
.drvPath =
|
||||
make_ref<SingleBuiltPath>(getBuiltPath(evalStore, store, *bfd.drvPath)),
|
||||
.outputs = outputs,
|
||||
},
|
||||
.info = aux.info}});
|
||||
},
|
||||
[&](const DerivedPath::Opaque & bo) {
|
||||
res.push_back({aux.installable, {
|
||||
.path = BuiltPath::Opaque { bo.path },
|
||||
.info = aux.info}});
|
||||
res.push_back({aux.installable, {.path = BuiltPath::Opaque{bo.path}, .info = aux.info}});
|
||||
},
|
||||
}, path.raw());
|
||||
},
|
||||
path.raw());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -707,26 +696,30 @@ std::vector<std::pair<ref<Installable>, BuiltPathWithResult>> Installable::build
|
|||
throwBuildErrors(buildResults, *store);
|
||||
for (auto & buildResult : buildResults) {
|
||||
for (auto & aux : backmap[buildResult.path]) {
|
||||
std::visit(overloaded {
|
||||
std::visit(
|
||||
overloaded{
|
||||
[&](const DerivedPath::Built & bfd) {
|
||||
std::map<std::string, StorePath> outputs;
|
||||
for (auto & [outputName, realisation] : buildResult.builtOutputs)
|
||||
outputs.emplace(outputName, realisation.outPath);
|
||||
res.push_back({aux.installable, {
|
||||
.path = BuiltPath::Built {
|
||||
.drvPath = make_ref<SingleBuiltPath>(getBuiltPath(evalStore, store, *bfd.drvPath)),
|
||||
res.push_back(
|
||||
{aux.installable,
|
||||
{.path =
|
||||
BuiltPath::Built{
|
||||
.drvPath =
|
||||
make_ref<SingleBuiltPath>(getBuiltPath(evalStore, store, *bfd.drvPath)),
|
||||
.outputs = outputs,
|
||||
},
|
||||
.info = aux.info,
|
||||
.result = buildResult}});
|
||||
},
|
||||
[&](const DerivedPath::Opaque & bo) {
|
||||
res.push_back({aux.installable, {
|
||||
.path = BuiltPath::Opaque { bo.path },
|
||||
.info = aux.info,
|
||||
.result = buildResult}});
|
||||
res.push_back(
|
||||
{aux.installable,
|
||||
{.path = BuiltPath::Opaque{bo.path}, .info = aux.info, .result = buildResult}});
|
||||
},
|
||||
}, buildResult.path.raw());
|
||||
},
|
||||
buildResult.path.raw());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -741,11 +734,7 @@ std::vector<std::pair<ref<Installable>, BuiltPathWithResult>> Installable::build
|
|||
}
|
||||
|
||||
BuiltPaths Installable::toBuiltPaths(
|
||||
ref<Store> evalStore,
|
||||
ref<Store> store,
|
||||
Realise mode,
|
||||
OperateOn operateOn,
|
||||
const Installables & installables)
|
||||
ref<Store> evalStore, ref<Store> store, Realise mode, OperateOn operateOn, const Installables & installables)
|
||||
{
|
||||
if (operateOn == OperateOn::Output) {
|
||||
BuiltPaths res;
|
||||
|
|
@ -764,10 +753,7 @@ BuiltPaths Installable::toBuiltPaths(
|
|||
}
|
||||
|
||||
StorePathSet Installable::toStorePathSet(
|
||||
ref<Store> evalStore,
|
||||
ref<Store> store,
|
||||
Realise mode, OperateOn operateOn,
|
||||
const Installables & installables)
|
||||
ref<Store> evalStore, ref<Store> store, Realise mode, OperateOn operateOn, const Installables & installables)
|
||||
{
|
||||
StorePathSet outPaths;
|
||||
for (auto & path : toBuiltPaths(evalStore, store, mode, operateOn, installables)) {
|
||||
|
|
@ -778,10 +764,7 @@ StorePathSet Installable::toStorePathSet(
|
|||
}
|
||||
|
||||
StorePaths Installable::toStorePaths(
|
||||
ref<Store> evalStore,
|
||||
ref<Store> store,
|
||||
Realise mode, OperateOn operateOn,
|
||||
const Installables & installables)
|
||||
ref<Store> evalStore, ref<Store> store, Realise mode, OperateOn operateOn, const Installables & installables)
|
||||
{
|
||||
StorePaths outPaths;
|
||||
for (auto & path : toBuiltPaths(evalStore, store, mode, operateOn, installables)) {
|
||||
|
|
@ -792,10 +775,7 @@ StorePaths Installable::toStorePaths(
|
|||
}
|
||||
|
||||
StorePath Installable::toStorePath(
|
||||
ref<Store> evalStore,
|
||||
ref<Store> store,
|
||||
Realise mode, OperateOn operateOn,
|
||||
ref<Installable> installable)
|
||||
ref<Store> evalStore, ref<Store> store, Realise mode, OperateOn operateOn, ref<Installable> installable)
|
||||
{
|
||||
auto paths = toStorePathSet(evalStore, store, mode, operateOn, {installable});
|
||||
|
||||
|
|
@ -805,28 +785,23 @@ StorePath Installable::toStorePath(
|
|||
return *paths.begin();
|
||||
}
|
||||
|
||||
StorePathSet Installable::toDerivations(
|
||||
ref<Store> store,
|
||||
const Installables & installables,
|
||||
bool useDeriver)
|
||||
StorePathSet Installable::toDerivations(ref<Store> store, const Installables & installables, bool useDeriver)
|
||||
{
|
||||
StorePathSet drvPaths;
|
||||
|
||||
for (const auto & i : installables)
|
||||
for (const auto & b : i->toDerivedPaths())
|
||||
std::visit(overloaded {
|
||||
std::visit(
|
||||
overloaded{
|
||||
[&](const DerivedPath::Opaque & bo) {
|
||||
drvPaths.insert(
|
||||
bo.path.isDerivation()
|
||||
? bo.path
|
||||
: useDeriver
|
||||
? getDeriver(store, *i, bo.path)
|
||||
bo.path.isDerivation() ? bo.path
|
||||
: useDeriver ? getDeriver(store, *i, bo.path)
|
||||
: throw Error("argument '%s' did not evaluate to a derivation", i->what()));
|
||||
},
|
||||
[&](const DerivedPath::Built & bfd) {
|
||||
drvPaths.insert(resolveDerivedPath(*store, *bfd.drvPath));
|
||||
[&](const DerivedPath::Built & bfd) { drvPaths.insert(resolveDerivedPath(*store, *bfd.drvPath)); },
|
||||
},
|
||||
}, b.path.raw());
|
||||
b.path.raw());
|
||||
|
||||
return drvPaths;
|
||||
}
|
||||
|
|
@ -861,10 +836,7 @@ std::vector<FlakeRef> RawInstallablesCommand::getFlakeRefsForCompletion()
|
|||
std::vector<FlakeRef> res;
|
||||
res.reserve(rawInstallables.size());
|
||||
for (const auto & i : rawInstallables)
|
||||
res.push_back(parseFlakeRefWithFragment(
|
||||
fetchSettings,
|
||||
expandTilde(i),
|
||||
absPath(getCommandBaseDir())).first);
|
||||
res.push_back(parseFlakeRefWithFragment(fetchSettings, expandTilde(i), absPath(getCommandBaseDir())).first);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -883,12 +855,7 @@ void RawInstallablesCommand::run(ref<Store> store)
|
|||
|
||||
std::vector<FlakeRef> InstallableCommand::getFlakeRefsForCompletion()
|
||||
{
|
||||
return {
|
||||
parseFlakeRefWithFragment(
|
||||
fetchSettings,
|
||||
expandTilde(_installable),
|
||||
absPath(getCommandBaseDir())).first
|
||||
};
|
||||
return {parseFlakeRefWithFragment(fetchSettings, expandTilde(_installable), absPath(getCommandBaseDir())).first};
|
||||
}
|
||||
|
||||
void InstallablesCommand::run(ref<Store> store, std::vector<std::string> && rawInstallables)
|
||||
|
|
@ -928,4 +895,4 @@ BuiltPaths toBuiltPaths(const std::vector<BuiltPathWithResult> & builtPathsWithR
|
|||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue