Compare commits
224
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4816b640a2 | ||
|
|
79211b6110 | ||
|
|
f5f9e32f54 | ||
|
|
564593bcb9 | ||
|
|
8ee74792fe | ||
|
|
e82210b3b2 | ||
|
|
625477a7df | ||
|
|
231f3af535 | ||
|
|
cc4aa70e6e | ||
|
|
0bd9d6a28e | ||
|
|
7989e3192d | ||
|
|
1e16a54ee5 | ||
|
|
afade27123 | ||
|
|
c1e2396d58 | ||
|
|
ca94905593 | ||
|
|
e492c64c8e | ||
|
|
e4e8a615fa | ||
|
|
fac34ad20f | ||
|
|
024d3954af | ||
|
|
f0e4af4365 | ||
|
|
5985d67906 | ||
|
|
9bee0fa6ac | ||
|
|
adec28bf85 | ||
|
|
f5e09d9b58 | ||
|
|
f67daa4a87 | ||
|
|
c9211b0b2d | ||
|
|
2fa2c0b09f | ||
|
|
ebf1cf5227 | ||
|
|
3e86d75c9d | ||
|
|
72a548ed6a | ||
|
|
4083eff0c0 | ||
|
|
9c6019dd1a | ||
|
|
82d3662f09 | ||
|
|
01691e1180 | ||
|
|
c0246460a0 | ||
|
|
0c46c2c37f | ||
|
|
58278974b6 | ||
|
|
b853994e7a | ||
|
|
a1b3934a78 | ||
|
|
ae09483498 | ||
|
|
4dcfb36c1e | ||
|
|
2e7bb61a83 | ||
|
|
0eaed891f4 | ||
|
|
6c391b7446 | ||
|
|
d7612f350f | ||
|
|
4fe700b7cb | ||
|
|
3826d51a65 | ||
|
|
615b10cb44 | ||
|
|
e2b984704a | ||
|
|
4c76db8e7c | ||
|
|
08e42e20fa | ||
|
|
1d3ddb21fa | ||
|
|
e3c74f5a13 | ||
|
|
92b10cf3f5 | ||
|
|
2767ae35d9 | ||
|
|
ca86d34077 | ||
|
|
a712445a7a | ||
|
|
52212635db | ||
|
|
bce29ab2cf | ||
|
|
8463fef161 | ||
|
|
d53c7b816b | ||
|
|
4ab579b469 | ||
|
|
0df147b145 | ||
|
|
4ab8ff5b4c | ||
|
|
349d2c58e5 | ||
|
|
bb600e1048 | ||
|
|
088cc176f1 | ||
|
|
4134258c03 | ||
|
|
69fcc2cfc1 | ||
|
|
a92a996dba | ||
|
|
5c0eff24d5 | ||
|
|
03101cc839 | ||
|
|
f3bd18f2b4 | ||
|
|
62018b3a7f | ||
|
|
dc2478fe79 | ||
|
|
8283a20c6a | ||
|
|
051290b155 | ||
|
|
b263bfcecd | ||
|
|
73f6729147 | ||
|
|
1d943f5819 | ||
|
|
aa0dc0d7e7 | ||
|
|
fc33681583 | ||
|
|
f51779ee25 | ||
|
|
c82b67fa05 | ||
|
|
48b600d995 | ||
|
|
0216775ab7 | ||
|
|
d48e04b05a | ||
|
|
b21304fe4c | ||
|
|
3ffeed497a | ||
|
|
da8759bb41 | ||
|
|
f6db80a553 | ||
|
|
1d7ac6603c | ||
|
|
4284497d98 | ||
|
|
e244e32308 | ||
|
|
72c8aa8bb1 | ||
|
|
723656daab | ||
|
|
1cf0fe3186 | ||
|
|
bb9148fd5d | ||
|
|
ccc0a31f39 | ||
|
|
8be1cc6e96 | ||
|
|
347ed8d9ba | ||
|
|
f13aeaf2f1 | ||
|
|
d6973e105c | ||
|
|
3c0a5e0a51 | ||
|
|
695f3bc7e3 | ||
|
|
dc1b2012af | ||
|
|
0fd9ef0cf3 | ||
|
|
d5102ab30c | ||
|
|
0348030ae2 | ||
|
|
048cfb9cd6 | ||
|
|
9fb62805b0 | ||
|
|
3b03872ebf | ||
|
|
97c966cc69 | ||
|
|
9ccbe23056 | ||
|
|
870bb68d38 | ||
|
|
4bc9ae67c7 | ||
|
|
14e355d87d | ||
|
|
79fb9b0d3c | ||
|
|
316fef35dc | ||
|
|
1ed3ae8a9d | ||
|
|
0ef818dd92 | ||
|
|
64c2ee3f45 | ||
|
|
22378ea093 | ||
|
|
408c09a120 | ||
|
|
c736db5320 | ||
|
|
cea85e79ee | ||
|
|
4e776a5be8 | ||
|
|
677b1c0f8f | ||
|
|
f64000e3f4 | ||
|
|
e74ef417db | ||
|
|
4b4895e750 | ||
|
|
1b7ffa53af | ||
|
|
58eabe7479 | ||
|
|
e6f3a193d8 | ||
|
|
26dbda6302 | ||
|
|
48d15ed1fb | ||
|
|
4a2de1dbab | ||
|
|
f155dffe59 | ||
|
|
c940283750 | ||
|
|
14441f9382 | ||
|
|
88275e5723 | ||
|
|
7707d0acad | ||
|
|
766a52ce87 | ||
|
|
2324fe3515 | ||
|
|
b6ca60cb82 | ||
|
|
2600391147 | ||
|
|
1a6f92837a | ||
|
|
14173d761c | ||
|
|
4b6edfcfc7 | ||
|
|
cf7084a67c | ||
|
|
3e7879e6df | ||
|
|
dfcbe70564 | ||
|
|
ed55937002 | ||
|
|
c37df9c87c | ||
|
|
be3a508b74 | ||
|
|
75740fbd75 | ||
|
|
5d3197bb6c | ||
|
|
53ac49f72c | ||
|
|
8e5ca787f4 | ||
|
|
ccf658ed5c | ||
|
|
68839b9545 | ||
|
|
b5289fa130 | ||
|
|
320b2c74ef | ||
|
|
dc769d72cb | ||
|
|
ffe5c1ecb4 | ||
|
|
d8fc55a46e | ||
|
|
a80a5c4dba | ||
|
|
df4e55ffc1 | ||
|
|
7ed0229d1a | ||
|
|
4fb89eb2ea | ||
|
|
6d481efd37 | ||
|
|
e8d780642d | ||
|
|
b21f811ff6 | ||
|
|
0ef6f72c9c | ||
|
|
f93d25c0e7 | ||
|
|
dfb78af184 | ||
|
|
f62b022872 | ||
|
|
41af531392 | ||
|
|
73ebdf2497 | ||
|
|
2c38ad2cfa | ||
|
|
28b74c3143 | ||
|
|
a7fb257ec2 | ||
|
|
920a878eaa | ||
|
|
9d033733f2 | ||
|
|
1030ed1e7d | ||
|
|
2b2c832f0a | ||
|
|
83c43d9311 | ||
|
|
46b6907346 | ||
|
|
b2fb421386 | ||
|
|
4b3ca9bd80 | ||
|
|
0675094861 | ||
|
|
867b69f533 | ||
|
|
e8e9376a7b | ||
|
|
b5f843a565 | ||
|
|
937780ea08 | ||
|
|
0b7f7e4b03 | ||
|
|
6ec88b93ba | ||
|
|
5451ad4a4c | ||
|
|
bd9ce27df0 | ||
|
|
8e35f3ca1e | ||
|
|
d2022189a1 | ||
|
|
d4c6f24e9f | ||
|
|
51c0e6bc63 | ||
|
|
cac8ec3b05 | ||
|
|
2e3ebfb829 | ||
|
|
1b4aa5c1ef | ||
|
|
e74cfc52fe | ||
|
|
11d03893f8 | ||
|
|
73d09e67a7 | ||
|
|
bf320465ae | ||
|
|
90aa2b83b5 | ||
|
|
143bd60136 | ||
|
|
241420a788 | ||
|
|
628d423a12 | ||
|
|
ddd3034909 | ||
|
|
1cce358c40 | ||
|
|
3ba103865d | ||
|
|
9d8d8df729 | ||
|
|
5fe6c53703 | ||
|
|
3c0cd73418 | ||
|
|
6bf940d636 | ||
|
|
4ba3b15a10 | ||
|
|
6e733b0544 | ||
|
|
d60a8ee8b0 |
No files matched your search
@@ -2,3 +2,5 @@
|
||||
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
|
||||
@@ -9,7 +9,7 @@ inputs:
|
||||
install_url:
|
||||
description: "URL of the Nix installer"
|
||||
required: false
|
||||
default: "https://releases.nixos.org/nix/nix-2.30.1/install"
|
||||
default: "https://releases.nixos.org/nix/nix-2.30.2/install"
|
||||
github_token:
|
||||
description: "Github token"
|
||||
required: true
|
||||
|
||||
+27
-27
@@ -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,12 +18,12 @@ jobs:
|
||||
eval:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: ./.github/actions/install-nix-action
|
||||
with:
|
||||
dogfood: true
|
||||
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 }}
|
||||
@@ -48,17 +56,15 @@ jobs:
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: ./.github/actions/install-nix-action
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
dogfood: true
|
||||
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
|
||||
@@ -110,9 +116,9 @@ 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
|
||||
@@ -141,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]
|
||||
@@ -164,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
|
||||
@@ -216,10 +216,10 @@ jobs:
|
||||
vm_tests:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
- uses: ./.github/actions/install-nix-action
|
||||
with:
|
||||
dogfood: true
|
||||
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 }}
|
||||
@@ -237,20 +237,20 @@ 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: ./.github/actions/install-nix-action
|
||||
with:
|
||||
dogfood: true
|
||||
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 }}
|
||||
@@ -265,13 +265,13 @@ jobs:
|
||||
github.event_name == 'push' &&
|
||||
github.ref_name == 'master'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: ./.github/actions/install-nix-action
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
dogfood: true
|
||||
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
|
||||
|
||||
@@ -161,3 +161,14 @@ pull_request_rules:
|
||||
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
|
||||
+41
-23
@@ -2,6 +2,12 @@
|
||||
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,
|
||||
@@ -49,13 +55,11 @@ let
|
||||
};
|
||||
|
||||
# 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"
|
||||
'';
|
||||
preConfigure = prevAttrs.preConfigure or "" + ''
|
||||
mappingFlag=" -fcoverage-prefix-map=$NIX_BUILD_TOP/${finalAttrs.src.name}=${finalAttrs.src}"
|
||||
CFLAGS+="$mappingFlag"
|
||||
CXXFLAGS+="$mappingFlag"
|
||||
'';
|
||||
};
|
||||
|
||||
componentOverrides =
|
||||
@@ -64,18 +68,13 @@ let
|
||||
in
|
||||
|
||||
rec {
|
||||
nixComponents =
|
||||
(nixFlake.lib.makeComponents {
|
||||
inherit pkgs;
|
||||
inherit getStdenv;
|
||||
}).overrideScope
|
||||
(
|
||||
final: prev: {
|
||||
nix-store-tests = prev.nix-store-tests.override { withBenchmarks = true; };
|
||||
nixComponentsInstrumented = nixComponents.overrideScope (
|
||||
final: prev: {
|
||||
nix-store-tests = prev.nix-store-tests.override { withBenchmarks = true; };
|
||||
|
||||
mesonComponentOverrides = lib.composeManyExtensions componentOverrides;
|
||||
}
|
||||
);
|
||||
mesonComponentOverrides = lib.composeManyExtensions componentOverrides;
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
Top-level tests for the flake outputs, as they would be built by hydra.
|
||||
@@ -120,15 +119,15 @@ rec {
|
||||
lib.concatMapAttrs (testName: test: {
|
||||
"${componentTestsPrefix}${pkgName}-${testName}" = test;
|
||||
}) (pkg.tests or { })
|
||||
) nixComponents)
|
||||
) nixComponentsInstrumented)
|
||||
// lib.optionalAttrs (pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform) {
|
||||
"${componentTestsPrefix}nix-functional-tests" = nixComponents.nix-functional-tests;
|
||||
"${componentTestsPrefix}nix-functional-tests" = nixComponentsInstrumented.nix-functional-tests;
|
||||
};
|
||||
|
||||
codeCoverage =
|
||||
let
|
||||
componentsTestsToProfile =
|
||||
(builtins.mapAttrs (n: v: nixComponents.${n}.tests.run) {
|
||||
(builtins.mapAttrs (n: v: nixComponentsInstrumented.${n}.tests.run) {
|
||||
"nix-util-tests" = { };
|
||||
"nix-store-tests" = { };
|
||||
"nix-fetchers-tests" = { };
|
||||
@@ -136,7 +135,7 @@ rec {
|
||||
"nix-flake-tests" = { };
|
||||
})
|
||||
// {
|
||||
inherit (nixComponents) nix-functional-tests;
|
||||
inherit (nixComponentsInstrumented) nix-functional-tests;
|
||||
};
|
||||
|
||||
coverageProfileDrvs = lib.mapAttrs (
|
||||
@@ -170,12 +169,13 @@ rec {
|
||||
|
||||
coverageReports =
|
||||
let
|
||||
nixComponentDrvs = lib.filter (lib.isDerivation) (lib.attrValues nixComponents);
|
||||
nixComponentDrvs = lib.filter (lib.isDerivation) (lib.attrValues nixComponentsInstrumented);
|
||||
in
|
||||
pkgs.runCommand "code-coverage-report"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
pkgs.llvmPackages.libllvm
|
||||
pkgs.jq
|
||||
];
|
||||
__structuredAttrs = true;
|
||||
nixComponents = nixComponentDrvs;
|
||||
@@ -201,6 +201,24 @@ rec {
|
||||
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;
|
||||
|
||||
+17
-18
@@ -46,24 +46,23 @@ mkMesonDerivation (finalAttrs: {
|
||||
];
|
||||
|
||||
# Hack for sake of the dev shell
|
||||
passthru.externalNativeBuildInputs =
|
||||
[
|
||||
meson
|
||||
ninja
|
||||
(lib.getBin lowdown-unsandboxed)
|
||||
mdbook
|
||||
mdbook-linkcheck
|
||||
jq
|
||||
python3
|
||||
rsync
|
||||
changelog-d
|
||||
]
|
||||
++ lib.optionals (!officialRelease) [
|
||||
# When not an official release, we likely have changelog entries that have
|
||||
# yet to be rendered.
|
||||
# When released, these are rendered into a committed file to save a dependency.
|
||||
changelog-d
|
||||
];
|
||||
passthru.externalNativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
(lib.getBin lowdown-unsandboxed)
|
||||
mdbook
|
||||
mdbook-linkcheck
|
||||
jq
|
||||
python3
|
||||
rsync
|
||||
changelog-d
|
||||
]
|
||||
++ lib.optionals (!officialRelease) [
|
||||
# When not an official release, we likely have changelog entries that have
|
||||
# yet to be rendered.
|
||||
# When released, these are rendered into a committed file to save a dependency.
|
||||
changelog-d
|
||||
];
|
||||
|
||||
nativeBuildInputs = finalAttrs.passthru.externalNativeBuildInputs ++ [
|
||||
nix-cli
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
synopsis: "`build-cores = 0` now auto-detects CPU cores"
|
||||
prs: [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.
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
synopsis: "Add support for user@address:port syntax in store URIs"
|
||||
prs: [3425]
|
||||
issues: [7044]
|
||||
---
|
||||
|
||||
It's now possible to specify the port used for the 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 `NIX_SSHOPTS` environment variable, because Nix incorrectly passed the port number together with the host name to the SSH executable. This has now been fixed.
|
||||
|
||||
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`
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
synopsis: "Represent IPv6 RFC4007 ZoneId literals in conformance with RFC6874"
|
||||
prs: [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]`.
|
||||
@@ -138,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>
|
||||
|
||||
|
||||
@@ -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**
|
||||
|
||||
@@ -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
|
||||
@@ -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.
|
||||
|
||||
+51
-52
@@ -65,62 +65,61 @@ let
|
||||
iana-etc
|
||||
gitMinimal
|
||||
openssh
|
||||
] ++ extraPkgs;
|
||||
]
|
||||
++ extraPkgs;
|
||||
|
||||
users =
|
||||
{
|
||||
users = {
|
||||
|
||||
root = {
|
||||
uid = 0;
|
||||
shell = lib.getExe bashInteractive;
|
||||
home = "/root";
|
||||
gid = 0;
|
||||
groups = [ "root" ];
|
||||
description = "System administrator";
|
||||
};
|
||||
|
||||
nobody = {
|
||||
uid = 65534;
|
||||
shell = lib.getExe' shadow "nologin";
|
||||
home = "/var/empty";
|
||||
gid = 65534;
|
||||
groups = [ "nobody" ];
|
||||
description = "Unprivileged account (don't use!)";
|
||||
};
|
||||
|
||||
}
|
||||
// lib.optionalAttrs (uid != 0) {
|
||||
"${uname}" = {
|
||||
uid = uid;
|
||||
shell = lib.getExe bashInteractive;
|
||||
home = "/home/${uname}";
|
||||
gid = gid;
|
||||
groups = [ "${gname}" ];
|
||||
description = "Nix user";
|
||||
};
|
||||
}
|
||||
// lib.listToAttrs (
|
||||
map (n: {
|
||||
name = "nixbld${toString n}";
|
||||
value = {
|
||||
uid = 30000 + n;
|
||||
gid = 30000;
|
||||
groups = [ "nixbld" ];
|
||||
description = "Nix build user ${toString n}";
|
||||
};
|
||||
}) (lib.lists.range 1 32)
|
||||
);
|
||||
|
||||
groups =
|
||||
{
|
||||
root.gid = 0;
|
||||
nixbld.gid = 30000;
|
||||
nobody.gid = 65534;
|
||||
}
|
||||
// lib.optionalAttrs (gid != 0) {
|
||||
"${gname}".gid = gid;
|
||||
root = {
|
||||
uid = 0;
|
||||
shell = lib.getExe bashInteractive;
|
||||
home = "/root";
|
||||
gid = 0;
|
||||
groups = [ "root" ];
|
||||
description = "System administrator";
|
||||
};
|
||||
|
||||
nobody = {
|
||||
uid = 65534;
|
||||
shell = lib.getExe' shadow "nologin";
|
||||
home = "/var/empty";
|
||||
gid = 65534;
|
||||
groups = [ "nobody" ];
|
||||
description = "Unprivileged account (don't use!)";
|
||||
};
|
||||
|
||||
}
|
||||
// lib.optionalAttrs (uid != 0) {
|
||||
"${uname}" = {
|
||||
uid = uid;
|
||||
shell = lib.getExe bashInteractive;
|
||||
home = "/home/${uname}";
|
||||
gid = gid;
|
||||
groups = [ "${gname}" ];
|
||||
description = "Nix user";
|
||||
};
|
||||
}
|
||||
// lib.listToAttrs (
|
||||
map (n: {
|
||||
name = "nixbld${toString n}";
|
||||
value = {
|
||||
uid = 30000 + n;
|
||||
gid = 30000;
|
||||
groups = [ "nixbld" ];
|
||||
description = "Nix build user ${toString n}";
|
||||
};
|
||||
}) (lib.lists.range 1 32)
|
||||
);
|
||||
|
||||
groups = {
|
||||
root.gid = 0;
|
||||
nixbld.gid = 30000;
|
||||
nobody.gid = 65534;
|
||||
}
|
||||
// lib.optionalAttrs (gid != 0) {
|
||||
"${gname}".gid = gid;
|
||||
};
|
||||
|
||||
userToPasswd = (
|
||||
k:
|
||||
{
|
||||
|
||||
Generated
+4
-4
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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)
|
||||
Executable
+58
@@ -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
|
||||
```
|
||||
|
||||
@@ -126,6 +133,8 @@ release:
|
||||
|
||||
Commit and push this to the maintenance branch.
|
||||
|
||||
* Create a backport label.
|
||||
|
||||
* Bump the version of `master`:
|
||||
|
||||
```console
|
||||
@@ -133,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
|
||||
@@ -140,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`.
|
||||
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
)
|
||||
@@ -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
|
||||
@@ -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(
|
||||
@@ -34,7 +34,7 @@ meson.override_dependency(
|
||||
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,
|
||||
),
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -54,12 +54,12 @@ let
|
||||
preConfigure =
|
||||
prevAttrs.preConfigure or ""
|
||||
+
|
||||
# Update the repo-global .version file.
|
||||
# Symlink ./.version points there, but by default only workDir is writable.
|
||||
''
|
||||
chmod u+w ./.version
|
||||
echo ${finalAttrs.version} > ./.version
|
||||
'';
|
||||
# Update the repo-global .version file.
|
||||
# Symlink ./.version points there, but by default only workDir is writable.
|
||||
''
|
||||
chmod u+w ./.version
|
||||
echo ${finalAttrs.version} > ./.version
|
||||
'';
|
||||
};
|
||||
|
||||
localSourceLayer =
|
||||
@@ -148,7 +148,8 @@ let
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
] ++ prevAttrs.nativeBuildInputs or [ ];
|
||||
]
|
||||
++ prevAttrs.nativeBuildInputs or [ ];
|
||||
mesonCheckFlags = prevAttrs.mesonCheckFlags or [ ] ++ [
|
||||
"--print-errorlogs"
|
||||
];
|
||||
|
||||
@@ -64,6 +64,18 @@ scope: {
|
||||
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;
|
||||
});
|
||||
|
||||
# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
|
||||
boost =
|
||||
(pkgs.boost.override {
|
||||
|
||||
+24
-23
@@ -71,17 +71,16 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
||||
# We use this shell with the local checkout, not unpackPhase.
|
||||
src = null;
|
||||
|
||||
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
|
||||
}";
|
||||
}
|
||||
// lib.optionalAttrs stdenv.hostPlatform.isLinux {
|
||||
CC_LD = "mold";
|
||||
CXX_LD = "mold";
|
||||
};
|
||||
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
|
||||
}";
|
||||
}
|
||||
// lib.optionalAttrs stdenv.hostPlatform.isLinux {
|
||||
CC_LD = "mold";
|
||||
CXX_LD = "mold";
|
||||
};
|
||||
|
||||
mesonFlags =
|
||||
map (transformFlag "libutil") (ignoreCrossFile pkgs.nixComponents2.nix-util.mesonFlags)
|
||||
@@ -119,23 +118,25 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
||||
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 =
|
||||
[ pkgs.gbenchmark ]
|
||||
++ attrs.buildInputs or [ ]
|
||||
++ pkgs.nixComponents2.nix-util.buildInputs
|
||||
++ pkgs.nixComponents2.nix-store.buildInputs
|
||||
++ pkgs.nixComponents2.nix-store-tests.externalBuildInputs
|
||||
++ pkgs.nixComponents2.nix-fetchers.buildInputs
|
||||
++ pkgs.nixComponents2.nix-expr.buildInputs
|
||||
++ pkgs.nixComponents2.nix-expr.externalPropagatedBuildInputs
|
||||
++ pkgs.nixComponents2.nix-cmd.buildInputs
|
||||
++ lib.optionals havePerl pkgs.nixComponents2.nix-perl-bindings.externalBuildInputs
|
||||
++ lib.optional havePerl pkgs.perl;
|
||||
buildInputs = [
|
||||
pkgs.gbenchmark
|
||||
]
|
||||
++ attrs.buildInputs or [ ]
|
||||
++ pkgs.nixComponents2.nix-util.buildInputs
|
||||
++ pkgs.nixComponents2.nix-store.buildInputs
|
||||
++ pkgs.nixComponents2.nix-store-tests.externalBuildInputs
|
||||
++ pkgs.nixComponents2.nix-fetchers.buildInputs
|
||||
++ pkgs.nixComponents2.nix-expr.buildInputs
|
||||
++ pkgs.nixComponents2.nix-expr.externalPropagatedBuildInputs
|
||||
++ pkgs.nixComponents2.nix-cmd.buildInputs
|
||||
++ lib.optionals havePerl pkgs.nixComponents2.nix-perl-bindings.externalBuildInputs
|
||||
++ lib.optional havePerl pkgs.perl;
|
||||
}
|
||||
)
|
||||
+31
-32
@@ -47,25 +47,25 @@
|
||||
}:
|
||||
|
||||
let
|
||||
libs =
|
||||
{
|
||||
inherit
|
||||
nix-util
|
||||
nix-util-c
|
||||
nix-store
|
||||
nix-store-c
|
||||
nix-fetchers
|
||||
nix-fetchers-c
|
||||
nix-expr
|
||||
nix-expr-c
|
||||
nix-flake
|
||||
nix-flake-c
|
||||
nix-main
|
||||
nix-main-c
|
||||
nix-cmd
|
||||
;
|
||||
}
|
||||
// lib.optionalAttrs
|
||||
libs = {
|
||||
inherit
|
||||
nix-util
|
||||
nix-util-c
|
||||
nix-store
|
||||
nix-store-c
|
||||
nix-fetchers
|
||||
nix-fetchers-c
|
||||
nix-expr
|
||||
nix-expr-c
|
||||
nix-flake
|
||||
nix-flake-c
|
||||
nix-main
|
||||
nix-main-c
|
||||
nix-cmd
|
||||
;
|
||||
}
|
||||
//
|
||||
lib.optionalAttrs
|
||||
(!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform)
|
||||
{
|
||||
# Currently fails in static build
|
||||
@@ -127,20 +127,19 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
*/
|
||||
dontFixup = true;
|
||||
|
||||
checkInputs =
|
||||
[
|
||||
# Make sure the unit tests have passed
|
||||
nix-util-tests.tests.run
|
||||
nix-store-tests.tests.run
|
||||
nix-expr-tests.tests.run
|
||||
nix-fetchers-tests.tests.run
|
||||
nix-flake-tests.tests.run
|
||||
checkInputs = [
|
||||
# Make sure the unit tests have passed
|
||||
nix-util-tests.tests.run
|
||||
nix-store-tests.tests.run
|
||||
nix-expr-tests.tests.run
|
||||
nix-fetchers-tests.tests.run
|
||||
nix-flake-tests.tests.run
|
||||
|
||||
# Make sure the functional tests have passed
|
||||
nix-functional-tests
|
||||
]
|
||||
++ lib.optionals
|
||||
(!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform)
|
||||
# Make sure the functional tests have passed
|
||||
nix-functional-tests
|
||||
]
|
||||
++
|
||||
lib.optionals (!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform)
|
||||
[
|
||||
# Perl currently fails in static build
|
||||
# TODO: Split out tests into a separate derivation?
|
||||
|
||||
+11
-4
@@ -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;
|
||||
|
||||
@@ -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,7 +847,7 @@ install_from_extracted_nix() {
|
||||
(
|
||||
cd "$EXTRACTED_NIX_PATH"
|
||||
|
||||
if is_os_darwin; then
|
||||
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
|
||||
@@ -989,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
|
||||
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
|
||||
@@ -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
|
||||
@@ -167,7 +176,7 @@ for i in $(cd "$self/store" >/dev/null && echo ./*); do
|
||||
rm -rf "$i_tmp"
|
||||
fi
|
||||
if ! [ -e "$dest/store/$i" ]; then
|
||||
if [ "$(uname -s)" = "Darwin" ]; 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"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#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 {
|
||||
|
||||
|
||||
+10
-2
@@ -37,9 +37,17 @@ static std::string doRenderMarkdownToTerminal(std::string_view markdown)
|
||||
.vmargin = 0,
|
||||
# endif
|
||||
.feat = LOWDOWN_COMMONMARK | LOWDOWN_FENCED | LOWDOWN_DEFLIST | LOWDOWN_TABLES,
|
||||
.oflags = LOWDOWN_TERM_NOLINK,
|
||||
.oflags =
|
||||
# if HAVE_LOWDOWN_1_4
|
||||
LOWDOWN_TERM_NORELLINK // To render full links while skipping relative ones
|
||||
# else
|
||||
LOWDOWN_TERM_NOLINK
|
||||
# endif
|
||||
};
|
||||
|
||||
if (!isTTY())
|
||||
opts.oflags |= LOWDOWN_TERM_NOANSI;
|
||||
|
||||
auto doc = lowdown_doc_new(&opts);
|
||||
if (!doc)
|
||||
throw Error("cannot allocate Markdown document");
|
||||
@@ -65,7 +73,7 @@ static std::string doRenderMarkdownToTerminal(std::string_view markdown)
|
||||
if (!rndr_res)
|
||||
throw Error("allocation error while rendering Markdown");
|
||||
|
||||
return filterANSIEscapes(std::string(buf->data, buf->size), !isTTY());
|
||||
return std::string(buf->data, buf->size);
|
||||
}
|
||||
|
||||
std::string renderMarkdownToTerminal(std::string_view markdown)
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -53,7 +53,8 @@ mkMesonLibrary (finalAttrs: {
|
||||
|
||||
buildInputs = [
|
||||
({ inherit editline readline; }.${readlineFlavor})
|
||||
] ++ lib.optional enableMarkdown lowdown;
|
||||
]
|
||||
++ lib.optional enableMarkdown lowdown;
|
||||
|
||||
propagatedBuildInputs = [
|
||||
nix-util
|
||||
|
||||
+4
-2
@@ -574,14 +574,15 @@ ProcessLineResult NixRepl::processLine(std::string line)
|
||||
for (auto & sub : subs) {
|
||||
auto * logSubP = dynamic_cast<LogStore *>(&*sub);
|
||||
if (!logSubP) {
|
||||
printInfo("Skipped '%s' which does not support retrieving build logs", sub->getUri());
|
||||
printInfo(
|
||||
"Skipped '%s' which does not support retrieving build logs", sub->config.getHumanReadableURI());
|
||||
continue;
|
||||
}
|
||||
auto & logSub = *logSubP;
|
||||
|
||||
auto log = logSub.getBuildLog(drvPath);
|
||||
if (log) {
|
||||
printInfo("got build log for '%s' from '%s'", drvPathRaw, logSub.getUri());
|
||||
printInfo("got build log for '%s' from '%s'", drvPathRaw, logSub.config.getHumanReadableURI());
|
||||
logger->writeToStdout(*log);
|
||||
foundLog = true;
|
||||
break;
|
||||
@@ -915,6 +916,7 @@ ReplExitStatus AbstractNixRepl::runSimple(ref<EvalState> evalState, const ValMap
|
||||
return values;
|
||||
};
|
||||
LookupPath lookupPath = {};
|
||||
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDelete)
|
||||
auto repl = std::make_unique<NixRepl>(
|
||||
lookupPath,
|
||||
openStore(),
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <exception> // Needed by rapidcheck on Darwin
|
||||
#include <rapidcheck.h>
|
||||
|
||||
#include "nix/store/tests/path.hh"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <exception> // Needed by rapidcheck on Darwin
|
||||
#include <rapidcheck/gtest.h>
|
||||
|
||||
#include "nix/store/tests/derived-path.hh"
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
@@ -75,6 +75,7 @@ this_exe = executable(
|
||||
# TODO: -lrapidcheck, see ../libutil-support/build.meson
|
||||
link_args : linker_export_flags + [ '-lrapidcheck' ],
|
||||
install : true,
|
||||
cpp_pch : do_pch ? [ 'pch/precompiled-headers.hh' ] : [],
|
||||
)
|
||||
|
||||
test(
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#include "nix/expr/tests/libexpr.hh"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "nix/expr/eval.hh"
|
||||
#include "nix/expr/eval-inline.hh"
|
||||
#include "nix/store/store-api.hh"
|
||||
#include "nix/store/globals.hh"
|
||||
// Need specialization involving `SymbolStr` just in this one module.
|
||||
#include "nix/util/strings-inline.hh"
|
||||
|
||||
@@ -69,10 +70,10 @@ struct AttrDb
|
||||
{
|
||||
auto state(_state->lock());
|
||||
|
||||
Path cacheDir = getCacheDir() + "/eval-cache-v5";
|
||||
auto cacheDir = std::filesystem::path(getCacheDir()) / "eval-cache-v6";
|
||||
createDirs(cacheDir);
|
||||
|
||||
Path dbPath = cacheDir + "/" + fingerprint.to_string(HashFormat::Base16, false) + ".sqlite";
|
||||
auto dbPath = cacheDir / (fingerprint.to_string(HashFormat::Base16, false) + ".sqlite");
|
||||
|
||||
state->db = SQLite(dbPath);
|
||||
state->db.isCache();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "nix/expr/eval-profiler-settings.hh"
|
||||
#include "nix/util/configuration.hh"
|
||||
#include "nix/util/logging.hh" /* Needs to be included before config-impl.hh */
|
||||
#include "nix/util/config-impl.hh"
|
||||
#include "nix/util/abstract-setting-to-json.hh"
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "nix/util/exit.hh"
|
||||
#include "nix/util/types.hh"
|
||||
#include "nix/util/util.hh"
|
||||
#include "nix/util/environment-variables.hh"
|
||||
#include "nix/store/store-api.hh"
|
||||
#include "nix/store/derivations.hh"
|
||||
#include "nix/store/downstream-placeholder.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@ struct Attr
|
||||
way we keep Attr size at two words with no wasted space. */
|
||||
Symbol name;
|
||||
PosIdx pos;
|
||||
Value * value;
|
||||
Value * value = nullptr;
|
||||
Attr(Symbol name, Value * value, PosIdx pos = noPos)
|
||||
: name(name)
|
||||
, pos(pos)
|
||||
|
||||
@@ -595,12 +595,17 @@ struct ExprOpNot : Expr
|
||||
{ \
|
||||
return pos; \
|
||||
} \
|
||||
};
|
||||
}
|
||||
|
||||
MakeBinOp(ExprOpEq, "==") MakeBinOp(ExprOpNEq, "!=") MakeBinOp(ExprOpAnd, "&&") MakeBinOp(ExprOpOr, "||")
|
||||
MakeBinOp(ExprOpImpl, "->") MakeBinOp(ExprOpUpdate, "//") MakeBinOp(ExprOpConcatLists, "++")
|
||||
MakeBinOp(ExprOpEq, "==");
|
||||
MakeBinOp(ExprOpNEq, "!=");
|
||||
MakeBinOp(ExprOpAnd, "&&");
|
||||
MakeBinOp(ExprOpOr, "||");
|
||||
MakeBinOp(ExprOpImpl, "->");
|
||||
MakeBinOp(ExprOpUpdate, "//");
|
||||
MakeBinOp(ExprOpConcatLists, "++");
|
||||
|
||||
struct ExprConcatStrings : Expr
|
||||
struct ExprConcatStrings : Expr
|
||||
{
|
||||
PosIdx pos;
|
||||
bool forceString;
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -70,13 +70,15 @@ mkMesonLibrary (finalAttrs: {
|
||||
nix-util
|
||||
nix-store
|
||||
nix-fetchers
|
||||
] ++ finalAttrs.passthru.externalPropagatedBuildInputs;
|
||||
]
|
||||
++ finalAttrs.passthru.externalPropagatedBuildInputs;
|
||||
|
||||
# Hack for sake of the dev shell
|
||||
passthru.externalPropagatedBuildInputs = [
|
||||
boost
|
||||
nlohmann_json
|
||||
] ++ lib.optional enableGC boehmgc;
|
||||
]
|
||||
++ lib.optional enableGC boehmgc;
|
||||
|
||||
mesonFlags = [
|
||||
(lib.mesonEnable "gc" enableGC)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "nix/expr/eval-settings.hh"
|
||||
#include "nix/expr/gc-small-vector.hh"
|
||||
#include "nix/expr/json-to-value.hh"
|
||||
#include "nix/store/globals.hh"
|
||||
#include "nix/store/names.hh"
|
||||
#include "nix/store/path-references.hh"
|
||||
#include "nix/store/store-api.hh"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "nix/expr/eval-inline.hh"
|
||||
#include "nix/store/derivations.hh"
|
||||
#include "nix/store/store-api.hh"
|
||||
#include "nix/store/globals.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "nix/store/realisation.hh"
|
||||
#include "nix/store/make-content-addressed.hh"
|
||||
#include "nix/util/url.hh"
|
||||
#include "nix/util/environment-variables.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
@@ -184,7 +185,7 @@ static void prim_fetchClosure(EvalState & state, const PosIdx pos, Value ** args
|
||||
{.msg = HintFmt("attribute '%s' is missing in call to 'fetchClosure'", "fromStore"),
|
||||
.pos = state.positions[pos]});
|
||||
|
||||
auto parsedURL = parseURL(*fromStoreUrl);
|
||||
auto parsedURL = parseURL(*fromStoreUrl, /*lenient=*/true);
|
||||
|
||||
if (parsedURL.scheme != "http" && parsedURL.scheme != "https"
|
||||
&& !(getEnv("_NIX_IN_TEST").has_value() && parsedURL.scheme == "file"))
|
||||
|
||||
@@ -113,7 +113,7 @@ static void fetchTree(
|
||||
auto s = state.coerceToString(attr.pos, *attr.value, context, "", false, false).toOwned();
|
||||
attrs.emplace(
|
||||
state.symbols[attr.name],
|
||||
params.isFetchGit && state.symbols[attr.name] == "url" ? fixGitURL(s) : s);
|
||||
params.isFetchGit && state.symbols[attr.name] == "url" ? fixGitURL(s).to_string() : s);
|
||||
} else if (attr.value->type() == nBool)
|
||||
attrs.emplace(state.symbols[attr.name], Explicit<bool>{attr.value->boolean()});
|
||||
else if (attr.value->type() == nInt) {
|
||||
@@ -175,7 +175,7 @@ static void fetchTree(
|
||||
if (params.isFetchGit) {
|
||||
fetchers::Attrs attrs;
|
||||
attrs.emplace("type", "git");
|
||||
attrs.emplace("url", fixGitURL(url));
|
||||
attrs.emplace("url", fixGitURL(url).to_string());
|
||||
if (!attrs.contains("exportIgnore")
|
||||
&& (!attrs.contains("submodules") || !*fetchers::maybeGetBoolAttr(attrs, "submodules"))) {
|
||||
attrs.emplace("exportIgnore", Explicit<bool>{true});
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -173,4 +173,58 @@ TEST_F(GitUtilsTest, peel_reference)
|
||||
git_repository_free(rawRepo);
|
||||
}
|
||||
|
||||
TEST(GitUtils, isLegalRefName)
|
||||
{
|
||||
ASSERT_TRUE(isLegalRefName("foox"));
|
||||
ASSERT_TRUE(isLegalRefName("1337"));
|
||||
ASSERT_TRUE(isLegalRefName("foo.baz"));
|
||||
ASSERT_TRUE(isLegalRefName("foo/bar/baz"));
|
||||
ASSERT_TRUE(isLegalRefName("foo./bar"));
|
||||
ASSERT_TRUE(isLegalRefName("heads/foo@bar"));
|
||||
ASSERT_TRUE(isLegalRefName("heads/fu\303\237"));
|
||||
ASSERT_TRUE(isLegalRefName("foo-bar-baz"));
|
||||
ASSERT_TRUE(isLegalRefName("branch#"));
|
||||
ASSERT_TRUE(isLegalRefName("$1"));
|
||||
ASSERT_TRUE(isLegalRefName("foo.locke"));
|
||||
|
||||
ASSERT_FALSE(isLegalRefName("refs///heads/foo"));
|
||||
ASSERT_FALSE(isLegalRefName("heads/foo/"));
|
||||
ASSERT_FALSE(isLegalRefName("///heads/foo"));
|
||||
ASSERT_FALSE(isLegalRefName(".foo"));
|
||||
ASSERT_FALSE(isLegalRefName("./foo"));
|
||||
ASSERT_FALSE(isLegalRefName("./foo/bar"));
|
||||
ASSERT_FALSE(isLegalRefName("foo/./bar"));
|
||||
ASSERT_FALSE(isLegalRefName("foo/bar/."));
|
||||
ASSERT_FALSE(isLegalRefName("foo bar"));
|
||||
ASSERT_FALSE(isLegalRefName("foo?bar"));
|
||||
ASSERT_FALSE(isLegalRefName("foo^bar"));
|
||||
ASSERT_FALSE(isLegalRefName("foo~bar"));
|
||||
ASSERT_FALSE(isLegalRefName("foo:bar"));
|
||||
ASSERT_FALSE(isLegalRefName("foo[bar"));
|
||||
ASSERT_FALSE(isLegalRefName("foo/bar/."));
|
||||
ASSERT_FALSE(isLegalRefName(".refs/foo"));
|
||||
ASSERT_FALSE(isLegalRefName("refs/heads/foo."));
|
||||
ASSERT_FALSE(isLegalRefName("heads/foo..bar"));
|
||||
ASSERT_FALSE(isLegalRefName("heads/foo?bar"));
|
||||
ASSERT_FALSE(isLegalRefName("heads/foo.lock"));
|
||||
ASSERT_FALSE(isLegalRefName("heads///foo.lock"));
|
||||
ASSERT_FALSE(isLegalRefName("foo.lock/bar"));
|
||||
ASSERT_FALSE(isLegalRefName("foo.lock///bar"));
|
||||
ASSERT_FALSE(isLegalRefName("heads/v@{ation"));
|
||||
ASSERT_FALSE(isLegalRefName("heads/foo\bar"));
|
||||
|
||||
ASSERT_FALSE(isLegalRefName("@"));
|
||||
ASSERT_FALSE(isLegalRefName("\37"));
|
||||
ASSERT_FALSE(isLegalRefName("\177"));
|
||||
|
||||
ASSERT_FALSE(isLegalRefName("foo/*"));
|
||||
ASSERT_FALSE(isLegalRefName("*/foo"));
|
||||
ASSERT_FALSE(isLegalRefName("foo/*/bar"));
|
||||
ASSERT_FALSE(isLegalRefName("*"));
|
||||
ASSERT_FALSE(isLegalRefName("foo/*/*"));
|
||||
ASSERT_FALSE(isLegalRefName("*/foo/*"));
|
||||
ASSERT_FALSE(isLegalRefName("/foo"));
|
||||
ASSERT_FALSE(isLegalRefName(""));
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
@@ -0,0 +1,200 @@
|
||||
#include "nix/store/store-open.hh"
|
||||
#include "nix/store/globals.hh"
|
||||
#include "nix/fetchers/fetch-settings.hh"
|
||||
#include "nix/fetchers/fetchers.hh"
|
||||
#include "nix/fetchers/git-utils.hh"
|
||||
|
||||
#include <git2.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace {
|
||||
|
||||
template<class T, void (*F)(T *)>
|
||||
struct Deleter
|
||||
{
|
||||
void operator()(T * p) const
|
||||
{
|
||||
if (p)
|
||||
F(p);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T, void (*F)(T *)>
|
||||
using Handle = std::unique_ptr<T, Deleter<T, F>>;
|
||||
|
||||
using RepoHandle = Handle<git_repository, git_repository_free>;
|
||||
using IndexHandle = Handle<git_index, git_index_free>;
|
||||
using TreeHandle = Handle<git_tree, git_tree_free>;
|
||||
using SigHandle = Handle<git_signature, git_signature_free>;
|
||||
using RefHandle = Handle<git_reference, git_reference_free>;
|
||||
using CommitHandle = Handle<git_commit, git_commit_free>;
|
||||
using SubmoduleHandle = Handle<git_submodule, git_submodule_free>;
|
||||
|
||||
#define CHECK_LIBGIT(expr) ASSERT_TRUE((expr) >= 0) << git_error_last()
|
||||
|
||||
static void commitAll(git_repository * repo, const char * msg)
|
||||
{
|
||||
IndexHandle idx;
|
||||
{
|
||||
git_index * raw = nullptr;
|
||||
CHECK_LIBGIT(git_repository_index(&raw, repo));
|
||||
idx.reset(raw);
|
||||
}
|
||||
CHECK_LIBGIT(git_index_add_all(idx.get(), nullptr, 0, nullptr, nullptr));
|
||||
CHECK_LIBGIT(git_index_write(idx.get()));
|
||||
|
||||
git_oid treeId{};
|
||||
CHECK_LIBGIT(git_index_write_tree(&treeId, idx.get()));
|
||||
TreeHandle tree;
|
||||
{
|
||||
git_tree * raw = nullptr;
|
||||
CHECK_LIBGIT(git_tree_lookup(&raw, repo, &treeId));
|
||||
tree.reset(raw);
|
||||
}
|
||||
|
||||
SigHandle sig;
|
||||
{
|
||||
git_signature * raw = nullptr;
|
||||
CHECK_LIBGIT(git_signature_now(&raw, "you", "you@example.com"));
|
||||
sig.reset(raw);
|
||||
}
|
||||
|
||||
git_oid commitId{};
|
||||
if (git_repository_is_empty(repo) == 1) {
|
||||
CHECK_LIBGIT(git_commit_create_v(&commitId, repo, "HEAD", sig.get(), sig.get(), nullptr, msg, tree.get(), 0));
|
||||
CHECK_LIBGIT(git_reference_create(nullptr, repo, "refs/heads/main", &commitId, true, nullptr));
|
||||
CHECK_LIBGIT(git_repository_set_head(repo, "refs/heads/main"));
|
||||
} else {
|
||||
RefHandle head;
|
||||
{
|
||||
git_reference * raw = nullptr;
|
||||
CHECK_LIBGIT(git_repository_head(&raw, repo));
|
||||
head.reset(raw);
|
||||
}
|
||||
CommitHandle parent;
|
||||
{
|
||||
git_commit * raw = nullptr;
|
||||
CHECK_LIBGIT(git_commit_lookup(&raw, repo, git_reference_target(head.get())));
|
||||
parent.reset(raw);
|
||||
}
|
||||
const git_commit * parents[] = {parent.get()};
|
||||
CHECK_LIBGIT(git_commit_create(
|
||||
&commitId,
|
||||
repo,
|
||||
"HEAD",
|
||||
sig.get(),
|
||||
sig.get(),
|
||||
/*message_encoding=*/nullptr,
|
||||
msg,
|
||||
tree.get(),
|
||||
/*parent_count=*/1,
|
||||
&parents[0]));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
using namespace nix;
|
||||
|
||||
class GitTest : public ::testing::Test
|
||||
{
|
||||
std::unique_ptr<AutoDelete> delTmpDir;
|
||||
|
||||
protected:
|
||||
std::filesystem::path tmpDir;
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
tmpDir = createTempDir();
|
||||
delTmpDir = std::make_unique<AutoDelete>(tmpDir, /*recursive=*/true);
|
||||
nix::initLibStore(/*loadConfig=*/false);
|
||||
git_libgit2_init();
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
delTmpDir.reset();
|
||||
}
|
||||
};
|
||||
|
||||
// Regression test for https://github.com/NixOS/nix/issues/13215
|
||||
TEST_F(GitTest, submodulePeriodSupport)
|
||||
{
|
||||
auto storePath = tmpDir / "store";
|
||||
auto repoPath = tmpDir / "repo";
|
||||
auto submodulePath = tmpDir / "submodule";
|
||||
|
||||
// Set up our git directories: one top level and a submodule
|
||||
// the submodule in the .gitmodules has the branch listed as '.'
|
||||
|
||||
// 1) Create sub repo
|
||||
{
|
||||
git_repository * raw = nullptr;
|
||||
CHECK_LIBGIT(git_repository_init(&raw, submodulePath.string().c_str(), /*is_bare=*/0));
|
||||
RepoHandle sub(raw);
|
||||
writeFile(submodulePath / "lib.txt", "hello from submodule\n");
|
||||
commitAll(sub.get(), "init sub");
|
||||
}
|
||||
|
||||
// 2) Create super repo
|
||||
RepoHandle super;
|
||||
{
|
||||
git_repository * raw = nullptr;
|
||||
CHECK_LIBGIT(git_repository_init(&raw, repoPath.string().c_str(), /*is_bare=*/0));
|
||||
super.reset(raw);
|
||||
}
|
||||
|
||||
writeFile(repoPath / "README.md", "# super\n");
|
||||
commitAll(super.get(), "init super");
|
||||
|
||||
// 3) Add submodule at deps/sub
|
||||
{
|
||||
git_repository * raw = nullptr;
|
||||
git_clone_options cloneOpts = GIT_CLONE_OPTIONS_INIT;
|
||||
// clone from local subPath into superPath/deps/sub
|
||||
CHECK_LIBGIT(
|
||||
git_clone(&raw, submodulePath.string().c_str(), (repoPath / "deps" / "sub").string().c_str(), &cloneOpts));
|
||||
RepoHandle sub(raw);
|
||||
}
|
||||
|
||||
// 4) Add submodule and set branch="."
|
||||
SubmoduleHandle sm;
|
||||
{
|
||||
git_submodule * raw = nullptr;
|
||||
CHECK_LIBGIT(git_submodule_add_setup(
|
||||
&raw,
|
||||
super.get(),
|
||||
"../submodule",
|
||||
"deps/sub",
|
||||
/*use_gitlink=*/1));
|
||||
sm.reset(raw);
|
||||
}
|
||||
CHECK_LIBGIT(git_submodule_set_branch(super.get(), git_submodule_name(sm.get()), /*branch=*/"."));
|
||||
CHECK_LIBGIT(git_submodule_sync(sm.get()));
|
||||
|
||||
// 5) Finalize now that the worktree exists; libgit2 can read its HEAD OID
|
||||
CHECK_LIBGIT(git_submodule_add_finalize(sm.get()));
|
||||
// 6) Commit the addition in super
|
||||
commitAll(super.get(), "Add submodule with branch='.'");
|
||||
|
||||
// TODO: Use dummy:// store with MemorySourceAccessor.
|
||||
Path storeTmpDir = createTempDir();
|
||||
auto storeTmpDirAutoDelete = AutoDelete(storeTmpDir, true);
|
||||
ref<Store> store = openStore(storeTmpDir);
|
||||
|
||||
auto settings = fetchers::Settings{};
|
||||
auto input = fetchers::Input::fromAttrs(
|
||||
settings,
|
||||
{
|
||||
{"url", "file://" + repoPath.string()},
|
||||
{"submodules", Explicit{true}},
|
||||
{"type", "git"},
|
||||
{"ref", "main"},
|
||||
});
|
||||
|
||||
auto [accessor, i] = input.getAccessor(store);
|
||||
|
||||
ASSERT_EQ(accessor->readFile(CanonPath("deps/sub/lib.txt")), "hello from submodule\n");
|
||||
}
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
@@ -41,6 +41,7 @@ subdir('nix-meson-build-support/common')
|
||||
sources = files(
|
||||
'access-tokens.cc',
|
||||
'git-utils.cc',
|
||||
'git.cc',
|
||||
'nix_api_fetchers.cc',
|
||||
'public-key.cc',
|
||||
)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
buildPackages,
|
||||
stdenv,
|
||||
mkMesonExecutable,
|
||||
writableTmpDirAsHomeHook,
|
||||
|
||||
nix-fetchers,
|
||||
nix-fetchers-c,
|
||||
@@ -57,18 +58,13 @@ mkMesonExecutable (finalAttrs: {
|
||||
runCommand "${finalAttrs.pname}-run"
|
||||
{
|
||||
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
|
||||
buildInputs = [ writableTmpDirAsHomeHook ];
|
||||
}
|
||||
(
|
||||
lib.optionalString stdenv.hostPlatform.isWindows ''
|
||||
export HOME="$PWD/home-dir"
|
||||
mkdir -p "$HOME"
|
||||
''
|
||||
+ ''
|
||||
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
|
||||
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
|
||||
touch $out
|
||||
''
|
||||
);
|
||||
''
|
||||
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
|
||||
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "nix/store/sqlite.hh"
|
||||
#include "nix/util/sync.hh"
|
||||
#include "nix/store/store-api.hh"
|
||||
#include "nix/store/globals.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
@@ -37,7 +38,7 @@ struct CacheImpl : Cache
|
||||
{
|
||||
auto state(_state.lock());
|
||||
|
||||
auto dbPath = getCacheDir() + "/fetcher-cache-v3.sqlite";
|
||||
auto dbPath = getCacheDir() + "/fetcher-cache-v4.sqlite";
|
||||
createDirs(dirOf(dbPath));
|
||||
|
||||
state->db = SQLite(dbPath);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "nix/util/url.hh"
|
||||
#include "nix/util/users.hh"
|
||||
#include "nix/util/hash.hh"
|
||||
#include "nix/store/ssh.hh"
|
||||
|
||||
#include <git2/attr.h>
|
||||
#include <git2/config.h>
|
||||
@@ -15,20 +16,19 @@
|
||||
|
||||
namespace nix::lfs {
|
||||
|
||||
// if authHeader is "", downloadToSink assumes no auth is expected
|
||||
static void downloadToSink(
|
||||
const std::string & url,
|
||||
const std::string & authHeader,
|
||||
const std::optional<std::string> & authHeader,
|
||||
// FIXME: passing a StringSink is superfluous, we may as well
|
||||
// return a string. Or use an abstract Sink for streaming.
|
||||
StringSink & sink,
|
||||
std::string sha256Expected,
|
||||
size_t sizeExpected)
|
||||
{
|
||||
FileTransferRequest request(url);
|
||||
FileTransferRequest request(parseURL(url));
|
||||
Headers headers;
|
||||
if (!authHeader.empty())
|
||||
headers.push_back({"Authorization", authHeader});
|
||||
if (authHeader.has_value())
|
||||
headers.push_back({"Authorization", *authHeader});
|
||||
request.headers = headers;
|
||||
getFileTransfer()->download(std::move(request), sink);
|
||||
|
||||
@@ -42,30 +42,53 @@ static void downloadToSink(
|
||||
"hash mismatch while fetching %s: expected sha256:%s but got sha256:%s", url, sha256Expected, sha256Actual);
|
||||
}
|
||||
|
||||
static std::string getLfsApiToken(const ParsedURL & url)
|
||||
namespace {
|
||||
|
||||
struct LfsApiInfo
|
||||
{
|
||||
std::string endpoint;
|
||||
std::optional<std::string> authHeader;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static LfsApiInfo getLfsApi(const ParsedURL & url)
|
||||
{
|
||||
assert(url.authority.has_value());
|
||||
if (url.scheme == "ssh") {
|
||||
auto args = getNixSshOpts();
|
||||
|
||||
// FIXME: Not entirely correct.
|
||||
auto [status, output] = runProgram(
|
||||
RunOptions{
|
||||
.program = "ssh",
|
||||
.args = {url.authority->to_string(), "git-lfs-authenticate", url.path, "download"},
|
||||
});
|
||||
if (url.authority->port)
|
||||
args.push_back(fmt("-p%d", *url.authority->port));
|
||||
|
||||
if (output.empty())
|
||||
throw Error(
|
||||
"git-lfs-authenticate: no output (cmd: ssh %s git-lfs-authenticate %s download)",
|
||||
url.authority.value_or(ParsedURL::Authority{}).to_string(),
|
||||
url.path);
|
||||
std::ostringstream hostnameAndUser;
|
||||
if (url.authority->user)
|
||||
hostnameAndUser << *url.authority->user << "@";
|
||||
hostnameAndUser << url.authority->host;
|
||||
args.push_back(std::move(hostnameAndUser).str());
|
||||
|
||||
auto queryResp = nlohmann::json::parse(output);
|
||||
if (!queryResp.contains("header"))
|
||||
throw Error("no header in git-lfs-authenticate response");
|
||||
if (!queryResp["header"].contains("Authorization"))
|
||||
throw Error("no Authorization in git-lfs-authenticate response");
|
||||
args.push_back("--");
|
||||
args.push_back("git-lfs-authenticate");
|
||||
args.push_back(url.path);
|
||||
args.push_back("download");
|
||||
|
||||
return queryResp["header"]["Authorization"].get<std::string>();
|
||||
auto [status, output] = runProgram({.program = "ssh", .args = args});
|
||||
|
||||
if (output.empty())
|
||||
throw Error("git-lfs-authenticate: no output (cmd: 'ssh %s')", concatStringsSep(" ", args));
|
||||
|
||||
auto queryResp = nlohmann::json::parse(output);
|
||||
auto headerIt = queryResp.find("header");
|
||||
if (headerIt == queryResp.end())
|
||||
throw Error("no header in git-lfs-authenticate response");
|
||||
auto authIt = headerIt->find("Authorization");
|
||||
if (authIt == headerIt->end())
|
||||
throw Error("no Authorization in git-lfs-authenticate response");
|
||||
|
||||
return {queryResp.at("href").get<std::string>(), authIt->get<std::string>()};
|
||||
}
|
||||
|
||||
return {url.to_string() + "/info/lfs", std::nullopt};
|
||||
}
|
||||
|
||||
typedef std::unique_ptr<git_config, Deleter<git_config_free>> GitConfig;
|
||||
@@ -156,7 +179,7 @@ Fetch::Fetch(git_repository * repo, git_oid rev)
|
||||
|
||||
const auto remoteUrl = lfs::getLfsEndpointUrl(repo);
|
||||
|
||||
this->url = nix::parseURL(nix::fixGitURL(remoteUrl)).canonicalise();
|
||||
this->url = nix::fixGitURL(remoteUrl).canonicalise();
|
||||
}
|
||||
|
||||
bool Fetch::shouldFetch(const CanonPath & path) const
|
||||
@@ -181,13 +204,14 @@ static nlohmann::json pointerToPayload(const std::vector<Pointer> & items)
|
||||
|
||||
std::vector<nlohmann::json> Fetch::fetchUrls(const std::vector<Pointer> & pointers) const
|
||||
{
|
||||
ParsedURL httpUrl(url);
|
||||
httpUrl.scheme = url.scheme == "ssh" ? "https" : url.scheme;
|
||||
FileTransferRequest request(httpUrl.to_string() + "/info/lfs/objects/batch");
|
||||
auto api = lfs::getLfsApi(this->url);
|
||||
auto url = api.endpoint + "/objects/batch";
|
||||
const auto & authHeader = api.authHeader;
|
||||
FileTransferRequest request(parseURL(url));
|
||||
request.post = true;
|
||||
Headers headers;
|
||||
if (this->url.scheme == "ssh")
|
||||
headers.push_back({"Authorization", lfs::getLfsApiToken(this->url)});
|
||||
if (authHeader.has_value())
|
||||
headers.push_back({"Authorization", *authHeader});
|
||||
headers.push_back({"Content-Type", "application/vnd.git-lfs+json"});
|
||||
headers.push_back({"Accept", "application/vnd.git-lfs+json"});
|
||||
request.headers = headers;
|
||||
@@ -260,11 +284,16 @@ void Fetch::fetch(
|
||||
try {
|
||||
std::string sha256 = obj.at("oid"); // oid is also the sha256
|
||||
std::string ourl = obj.at("actions").at("download").at("href");
|
||||
std::string authHeader = "";
|
||||
if (obj.at("actions").at("download").contains("header")
|
||||
&& obj.at("actions").at("download").at("header").contains("Authorization")) {
|
||||
authHeader = obj["actions"]["download"]["header"]["Authorization"];
|
||||
}
|
||||
auto authHeader = [&]() -> std::optional<std::string> {
|
||||
const auto & download = obj.at("actions").at("download");
|
||||
auto headerIt = download.find("header");
|
||||
if (headerIt == download.end())
|
||||
return std::nullopt;
|
||||
auto authIt = headerIt->find("Authorization");
|
||||
if (authIt == headerIt->end())
|
||||
return std::nullopt;
|
||||
return std::string(*authIt);
|
||||
}();
|
||||
const uint64_t size = obj.at("size");
|
||||
sizeCallback(size);
|
||||
downloadToSink(ourl, authHeader, sink, sha256, size);
|
||||
|
||||
@@ -93,8 +93,11 @@ Hash toHash(const git_oid & oid)
|
||||
|
||||
static void initLibGit2()
|
||||
{
|
||||
if (git_libgit2_init() < 0)
|
||||
throw Error("initialising libgit2: %s", git_error_last()->message);
|
||||
static std::once_flag initialized;
|
||||
std::call_once(initialized, []() {
|
||||
if (git_libgit2_init() < 0)
|
||||
throw Error("initialising libgit2: %s", git_error_last()->message);
|
||||
});
|
||||
}
|
||||
|
||||
git_oid hashToOID(const Hash & hash)
|
||||
@@ -1308,4 +1311,63 @@ GitRepo::WorkdirInfo GitRepo::getCachedWorkdirInfo(const std::filesystem::path &
|
||||
return workdirInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the git reference is valid and normalizes slash '/' sequences.
|
||||
*
|
||||
* Accepts shorthand references (one-level refnames are allowed).
|
||||
*/
|
||||
bool isValidRefNameAllowNormalizations(const std::string & refName)
|
||||
{
|
||||
/* Unfortunately libgit2 doesn't expose the limit in headers, but its internal
|
||||
limit is also 1024. */
|
||||
std::array<char, 1024> normalizedRefBuffer;
|
||||
|
||||
/* It would be nice to have a better API like git_reference_name_is_valid, but
|
||||
* with GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND flag. libgit2 uses it internally
|
||||
* but doesn't expose it in public headers [1].
|
||||
* [1]:
|
||||
* https://github.com/libgit2/libgit2/blob/9d5f1bacc23594c2ba324c8f0d41b88bf0e9ef04/src/libgit2/refs.c#L1362-L1365
|
||||
*/
|
||||
|
||||
auto res = git_reference_normalize_name(
|
||||
normalizedRefBuffer.data(),
|
||||
normalizedRefBuffer.size(),
|
||||
refName.c_str(),
|
||||
GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL | GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND);
|
||||
|
||||
return res == 0;
|
||||
}
|
||||
|
||||
bool isLegalRefName(const std::string & refName)
|
||||
{
|
||||
initLibGit2();
|
||||
|
||||
/* Since `git_reference_normalize_name` is the best API libgit2 has for verifying
|
||||
* reference names with shorthands (see comment in normalizeRefName), we need to
|
||||
* ensure that exceptions to the validity checks imposed by normalization [1] are checked
|
||||
* explicitly.
|
||||
* [1]: https://git-scm.com/docs/git-check-ref-format#Documentation/git-check-ref-format.txt---normalize
|
||||
*/
|
||||
|
||||
/* Check for cases that don't get rejected by libgit2.
|
||||
* FIXME: libgit2 should reject this. */
|
||||
if (refName == "@")
|
||||
return false;
|
||||
|
||||
/* Leading slashes and consecutive slashes are stripped during normalizatiton. */
|
||||
if (refName.starts_with('/') || refName.find("//") != refName.npos)
|
||||
return false;
|
||||
|
||||
/* Refer to libgit2. */
|
||||
if (!isValidRefNameAllowNormalizations(refName))
|
||||
return false;
|
||||
|
||||
/* libgit2 doesn't barf on DEL symbol.
|
||||
* FIXME: libgit2 should reject this. */
|
||||
if (refName.find('\177') != refName.npos)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
+14
-10
@@ -228,16 +228,12 @@ struct GitInputScheme : InputScheme
|
||||
|
||||
maybeGetBoolAttr(attrs, "verifyCommit");
|
||||
|
||||
if (auto ref = maybeGetStrAttr(attrs, "ref")) {
|
||||
if (std::regex_search(*ref, badGitRefRegex))
|
||||
throw BadURL("invalid Git branch/tag name '%s'", *ref);
|
||||
}
|
||||
if (auto ref = maybeGetStrAttr(attrs, "ref"); ref && !isLegalRefName(*ref))
|
||||
throw BadURL("invalid Git branch/tag name '%s'", *ref);
|
||||
|
||||
Input input{settings};
|
||||
input.attrs = attrs;
|
||||
auto url = fixGitURL(getStrAttr(attrs, "url"));
|
||||
parseURL(url);
|
||||
input.attrs["url"] = url;
|
||||
input.attrs["url"] = fixGitURL(getStrAttr(attrs, "url")).to_string();
|
||||
getShallowAttr(input);
|
||||
getSubmodulesAttr(input);
|
||||
getAllRefsAttr(input);
|
||||
@@ -741,8 +737,16 @@ struct GitInputScheme : InputScheme
|
||||
fetchers::Attrs attrs;
|
||||
attrs.insert_or_assign("type", "git");
|
||||
attrs.insert_or_assign("url", resolved);
|
||||
if (submodule.branch != "")
|
||||
attrs.insert_or_assign("ref", submodule.branch);
|
||||
if (submodule.branch != "") {
|
||||
// A special value of . is used to indicate that the name of the branch in the submodule
|
||||
// should be the same name as the current branch in the current repository.
|
||||
// https://git-scm.com/docs/gitmodules
|
||||
if (submodule.branch == ".") {
|
||||
attrs.insert_or_assign("ref", ref);
|
||||
} else {
|
||||
attrs.insert_or_assign("ref", submodule.branch);
|
||||
}
|
||||
}
|
||||
attrs.insert_or_assign("rev", submoduleRev.gitRev());
|
||||
attrs.insert_or_assign("exportIgnore", Explicit<bool>{exportIgnore});
|
||||
attrs.insert_or_assign("submodules", Explicit<bool>{true});
|
||||
@@ -901,7 +905,7 @@ struct GitInputScheme : InputScheme
|
||||
writeString(file.abs(), hashSink);
|
||||
}
|
||||
return makeFingerprint(*repoInfo.workdirInfo.headRev)
|
||||
+ ";d=" + hashSink.finish().first.to_string(HashFormat::Base16, false);
|
||||
+ ";d=" + hashSink.finish().hash.to_string(HashFormat::Base16, false);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace nix::fetchers {
|
||||
|
||||
struct DownloadUrl
|
||||
{
|
||||
std::string url;
|
||||
ParsedURL url;
|
||||
Headers headers;
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ struct GitArchiveInputScheme : InputScheme
|
||||
if (size == 3) {
|
||||
if (std::regex_match(path[2], revRegex))
|
||||
rev = Hash::parseAny(path[2], HashAlgorithm::SHA1);
|
||||
else if (std::regex_match(path[2], refRegex))
|
||||
else if (isLegalRefName(path[2]))
|
||||
ref = path[2];
|
||||
else
|
||||
throw BadURL("in URL '%s', '%s' is not a commit hash or branch/tag name", url, path[2]);
|
||||
@@ -61,7 +61,7 @@ struct GitArchiveInputScheme : InputScheme
|
||||
}
|
||||
}
|
||||
|
||||
if (std::regex_match(rs, refRegex)) {
|
||||
if (isLegalRefName(rs)) {
|
||||
ref = rs;
|
||||
} else {
|
||||
throw BadURL("in URL '%s', '%s' is not a branch/tag name", url, rs);
|
||||
@@ -75,7 +75,7 @@ struct GitArchiveInputScheme : InputScheme
|
||||
throw BadURL("URL '%s' contains multiple commit hashes", url);
|
||||
rev = Hash::parseAny(value, HashAlgorithm::SHA1);
|
||||
} else if (name == "ref") {
|
||||
if (!std::regex_match(value, refRegex))
|
||||
if (!isLegalRefName(value))
|
||||
throw BadURL("URL '%s' contains an invalid branch/tag name", url);
|
||||
if (ref)
|
||||
throw BadURL("URL '%s' contains multiple branch/tag names", url);
|
||||
@@ -420,7 +420,7 @@ struct GitHubInputScheme : GitArchiveInputScheme
|
||||
const auto url =
|
||||
fmt(urlFmt, host, getOwner(input), getRepo(input), input.getRev()->to_string(HashFormat::Base16, false));
|
||||
|
||||
return DownloadUrl{url, headers};
|
||||
return DownloadUrl{parseURL(url), headers};
|
||||
}
|
||||
|
||||
void clone(const Input & input, const Path & destDir) const override
|
||||
@@ -500,7 +500,7 @@ struct GitLabInputScheme : GitArchiveInputScheme
|
||||
input.getRev()->to_string(HashFormat::Base16, false));
|
||||
|
||||
Headers headers = makeHeadersWithAuthTokens(*input.settings, host, input);
|
||||
return DownloadUrl{url, headers};
|
||||
return DownloadUrl{parseURL(url), headers};
|
||||
}
|
||||
|
||||
void clone(const Input & input, const Path & destDir) const override
|
||||
@@ -592,7 +592,7 @@ struct SourceHutInputScheme : GitArchiveInputScheme
|
||||
input.getRev()->to_string(HashFormat::Base16, false));
|
||||
|
||||
Headers headers = makeHeadersWithAuthTokens(*input.settings, host, input);
|
||||
return DownloadUrl{url, headers};
|
||||
return DownloadUrl{parseURL(url), headers};
|
||||
}
|
||||
|
||||
void clone(const Input & input, const Path & destDir) const override
|
||||
|
||||
@@ -157,4 +157,11 @@ struct Setter
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks that the git reference is valid and normalized.
|
||||
*
|
||||
* Accepts shorthand references (one-level refnames are allowed).
|
||||
*/
|
||||
bool isLegalRefName(const std::string & refName);
|
||||
|
||||
} // namespace nix
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "nix/fetchers/fetchers.hh"
|
||||
#include "nix/fetchers/git-utils.hh"
|
||||
#include "nix/util/url-parts.hh"
|
||||
#include "nix/store/path.hh"
|
||||
|
||||
@@ -22,12 +23,12 @@ struct IndirectInputScheme : InputScheme
|
||||
} else if (path.size() == 2) {
|
||||
if (std::regex_match(path[1], revRegex))
|
||||
rev = Hash::parseAny(path[1], HashAlgorithm::SHA1);
|
||||
else if (std::regex_match(path[1], refRegex))
|
||||
else if (isLegalRefName(path[1]))
|
||||
ref = path[1];
|
||||
else
|
||||
throw BadURL("in flake URL '%s', '%s' is not a commit hash or branch/tag name", url, path[1]);
|
||||
} else if (path.size() == 3) {
|
||||
if (!std::regex_match(path[1], refRegex))
|
||||
if (!isLegalRefName(path[1]))
|
||||
throw BadURL("in flake URL '%s', '%s' is not a branch/tag name", url, path[1]);
|
||||
ref = path[1];
|
||||
if (!std::regex_match(path[2], revRegex))
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
@@ -66,6 +66,7 @@ this_library = library(
|
||||
link_args : linker_export_flags,
|
||||
prelink : true, # For C++ static initializers
|
||||
install : true,
|
||||
cpp_pch : do_pch ? [ 'pch/precompiled-headers.hh' ] : [],
|
||||
)
|
||||
|
||||
install_headers(headers, subdir : 'nix/fetchers', preserve_path : true)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "nix/fetchers/fetchers.hh"
|
||||
#include "nix/store/store-api.hh"
|
||||
#include "nix/util/json-utils.hh"
|
||||
@@ -43,7 +43,7 @@ DownloadFileResult downloadFile(
|
||||
if (cached && !cached->expired)
|
||||
return useCached();
|
||||
|
||||
FileTransferRequest request(url);
|
||||
FileTransferRequest request(parseURL(url));
|
||||
request.headers = headers;
|
||||
if (cached)
|
||||
request.expectedETag = getStrAttr(cached->value, "etag");
|
||||
@@ -153,7 +153,7 @@ static DownloadTarballResult downloadTarball_(
|
||||
auto _res = std::make_shared<Sync<FileTransferResult>>();
|
||||
|
||||
auto source = sinkToSource([&](Sink & sink) {
|
||||
FileTransferRequest req(url);
|
||||
FileTransferRequest req(parseURL(url));
|
||||
req.expectedETag = cached ? getStrAttr(cached->value, "etag") : "";
|
||||
getFileTransfer()->download(std::move(req), sink, [_res](FileTransferResult r) { *_res->lock() = r; });
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -57,6 +57,39 @@ TEST(parseFlakeRef, path)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(parseFlakeRef, GitArchiveInput)
|
||||
{
|
||||
experimentalFeatureSettings.experimentalFeatures.get().insert(Xp::Flakes);
|
||||
|
||||
fetchers::Settings fetchSettings;
|
||||
|
||||
{
|
||||
auto s = "github:foo/bar/branch%23"; // branch name with `#`
|
||||
auto flakeref = parseFlakeRef(fetchSettings, s);
|
||||
ASSERT_EQ(flakeref.to_string(), "github:foo/bar/branch%23");
|
||||
}
|
||||
|
||||
{
|
||||
auto s = "github:foo/bar?ref=branch%23"; // branch name with `#`
|
||||
auto flakeref = parseFlakeRef(fetchSettings, s);
|
||||
ASSERT_EQ(flakeref.to_string(), "github:foo/bar/branch%23");
|
||||
}
|
||||
|
||||
{
|
||||
auto s = "github:foo/bar?ref=branch#\"name.with.dot\""; // unescaped quotes `"`
|
||||
auto [flakeref, fragment] = parseFlakeRefWithFragment(fetchSettings, s);
|
||||
ASSERT_EQ(fragment, "\"name.with.dot\"");
|
||||
ASSERT_EQ(flakeref.to_string(), "github:foo/bar/branch");
|
||||
}
|
||||
|
||||
{
|
||||
auto s = "github:foo/bar#\"name.with.dot\""; // unescaped quotes `"`
|
||||
auto [flakeref, fragment] = parseFlakeRefWithFragment(fetchSettings, s);
|
||||
ASSERT_EQ(fragment, "\"name.with.dot\"");
|
||||
ASSERT_EQ(flakeref.to_string(), "github:foo/bar");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(to_string, doesntReencodeUrl)
|
||||
{
|
||||
fetchers::Settings fetchSettings;
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -13,8 +13,9 @@ TEST(getNameFromURL, getNameFromURL)
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:~/repos/nixpkgs#packages.x86_64-linux.Hello")), "Hello");
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:.#nonStandardAttr.mylaptop")), "mylaptop");
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:./repos/myflake#nonStandardAttr.mylaptop")), "mylaptop");
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:./nixpkgs#packages.x86_64-linux.complex^bin,man")), "complex");
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:./myproj#packages.x86_64-linux.default^*")), "myproj");
|
||||
ASSERT_EQ(
|
||||
getNameFromURL(parseURL("path:./nixpkgs#packages.x86_64-linux.complex^bin,man", /*lenient=*/true)), "complex");
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:./myproj#packages.x86_64-linux.default^*", /*lenient=*/true)), "myproj");
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:./myproj#defaultPackage.x86_64-linux")), "myproj");
|
||||
|
||||
ASSERT_EQ(getNameFromURL(parseURL("github:NixOS/nixpkgs#packages.x86_64-linux.hello")), "hello");
|
||||
@@ -80,6 +81,6 @@ TEST(getNameFromURL, getNameFromURL)
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:.")), std::nullopt);
|
||||
ASSERT_EQ(getNameFromURL(parseURL("file:.#")), std::nullopt);
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:.#packages.x86_64-linux.default")), std::nullopt);
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:.#packages.x86_64-linux.default^*")), std::nullopt);
|
||||
ASSERT_EQ(getNameFromURL(parseURL("path:.#packages.x86_64-linux.default^*", /*lenient=*/true)), std::nullopt);
|
||||
}
|
||||
} // namespace nix
|
||||
@@ -82,7 +82,7 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
|
||||
auto succeeds = std::regex_match(url, match, pathFlakeRegex);
|
||||
assert(succeeds);
|
||||
auto path = match[1].str();
|
||||
auto query = decodeQuery(match[3]);
|
||||
auto query = decodeQuery(match[3].str(), /*lenient=*/true);
|
||||
auto fragment = percentDecode(match[5].str());
|
||||
|
||||
if (baseDir) {
|
||||
@@ -210,7 +210,7 @@ std::optional<std::pair<FlakeRef, std::string>> parseURLFlakeRef(
|
||||
bool isFlake)
|
||||
{
|
||||
try {
|
||||
auto parsed = parseURL(url);
|
||||
auto parsed = parseURL(url, /*lenient=*/true);
|
||||
if (baseDir && (parsed.scheme == "path" || parsed.scheme == "git+file") && !isAbsolute(parsed.path))
|
||||
parsed.path = absPath(parsed.path, *baseDir);
|
||||
return fromParsedURL(fetchSettings, std::move(parsed), isFlake);
|
||||
@@ -289,7 +289,7 @@ FlakeRef FlakeRef::canonicalize() const
|
||||
filtering the `dir` query parameter from the URL. */
|
||||
if (auto url = fetchers::maybeGetStrAttr(flakeRef.input.attrs, "url")) {
|
||||
try {
|
||||
auto parsed = parseURL(*url);
|
||||
auto parsed = parseURL(*url, /*lenient=*/true);
|
||||
if (auto dir2 = get(parsed.query, "dir")) {
|
||||
if (flakeRef.subdir != "" && flakeRef.subdir == *dir2)
|
||||
parsed.query.erase("dir");
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -62,7 +62,7 @@ nix_err nix_store_get_uri(nix_c_context * context, Store * store, nix_get_string
|
||||
if (context)
|
||||
context->last_err_code = NIX_OK;
|
||||
try {
|
||||
auto res = store->ptr->getUri();
|
||||
auto res = store->ptr->config.getReference().render(/*withParams=*/true);
|
||||
return call_nix_get_string_callback(res, callback, user_data);
|
||||
}
|
||||
NIXC_CATCH_ERRS
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <regex>
|
||||
|
||||
#include <exception> // Needed by rapidcheck on Darwin
|
||||
#include <rapidcheck.h>
|
||||
|
||||
#include "nix/store/tests/derived-path.hh"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "nix/store/store-api.hh"
|
||||
#include "nix/store/store-open.hh"
|
||||
#include "nix/store/globals.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
///@file
|
||||
|
||||
#include <exception> // Needed by rapidcheck on Darwin
|
||||
#include <rapidcheck/gen/Arbitrary.h>
|
||||
|
||||
#include "nix/store/outputs-spec.hh"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace nix {
|
||||
|
||||
template<class Proto, const char * protocolDir>
|
||||
class ProtoTest : public CharacterizationTest, public LibStoreTest
|
||||
class ProtoTest : public CharacterizationTest
|
||||
{
|
||||
std::filesystem::path unitTestData = getUnitTestData() / protocolDir;
|
||||
|
||||
@@ -18,6 +18,10 @@ class ProtoTest : public CharacterizationTest, public LibStoreTest
|
||||
{
|
||||
return unitTestData / (std::string{testStem + ".bin"});
|
||||
}
|
||||
|
||||
public:
|
||||
Path storeDir = "/nix/store";
|
||||
StoreDirConfig store{storeDir};
|
||||
};
|
||||
|
||||
template<class Proto, const char * protocolDir>
|
||||
@@ -34,7 +38,7 @@ public:
|
||||
T got = ({
|
||||
StringSource from{encoded};
|
||||
Proto::template Serialise<T>::read(
|
||||
*LibStoreTest::store,
|
||||
this->store,
|
||||
typename Proto::ReadConn{
|
||||
.from = from,
|
||||
.version = version,
|
||||
@@ -54,7 +58,7 @@ public:
|
||||
CharacterizationTest::writeTest(testStem, [&]() {
|
||||
StringSink to;
|
||||
Proto::template Serialise<T>::write(
|
||||
*LibStoreTest::store,
|
||||
this->store,
|
||||
typename Proto::WriteConn{
|
||||
.to = to,
|
||||
.version = version,
|
||||
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <rapidcheck/gen/Arbitrary.h>
|
||||
#include <exception> // Needed by rapidcheck on Darwin
|
||||
#include <regex>
|
||||
|
||||
#include <rapidcheck/gen/Arbitrary.h>
|
||||
#include <rapidcheck.h>
|
||||
|
||||
#include "nix/store/path-regex.hh"
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
CharacterizationTest::readTest(testStem, [&](const auto & encoded) {
|
||||
T got = ({
|
||||
StringSource from{encoded};
|
||||
CommonProto::Serialise<T>::read(*store, CommonProto::ReadConn{.from = from});
|
||||
CommonProto::Serialise<T>::read(store, CommonProto::ReadConn{.from = from});
|
||||
});
|
||||
|
||||
ASSERT_EQ(got, expected);
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
{
|
||||
CharacterizationTest::writeTest(testStem, [&]() -> std::string {
|
||||
StringSink to;
|
||||
CommonProto::Serialise<T>::write(*store, CommonProto::WriteConn{.to = to}, decoded);
|
||||
CommonProto::Serialise<T>::write(store, CommonProto::WriteConn{.to = to}, decoded);
|
||||
return to.s;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
Derive([("out","/nix/store/jycqnr8rdfy035ckiwmar4yql406jjh6-firefox-140.0.4","","")],[("/nix/store/01qkwh6g0xqlrchziwa8zm3c8p6s5ylc-krb5-1.21.3.drv",["lib"]),("/nix/store/03ixv9yqpmi015vv0m4gza1d2ac8wql8-libglvnd-1.7.0.drv",["out"]),("/nix/store/2g73b2yd3qhzp774i9svckdnspyrfrn8-firefox-unwrapped-140.0.4.drv",["out"]),("/nix/store/2wf9wi34rvwyq7dxk0xlk41ccll282z0-make-shell-wrapper-hook.drv",["out"]),("/nix/store/3gr22851nw1nj8zmy34961yb3fbr2iz5-libva-2.22.0.drv",["out"]),("/nix/store/7gzk0w5125wqhgp8sh26l3k15lklm82c-policies.json.drv",["out"]),("/nix/store/b3jvr65plcm9nm4wn8ssw2ymnv2zshmq-extract-binary-wrapper-cmd.drv",["out"]),("/nix/store/ck7ckwkvqv49hz5rl8yp52c4v6p2f6vd-pipewire-1.4.6.drv",["out"]),("/nix/store/fm2b1q5m1wrvy237j6x9xcvhxw95wjfp-alsa-lib-1.2.14.drv",["out"]),("/nix/store/fvch7vyklf8gr8i53p9ybv2azyh6q30y-ffmpeg-7.1.1.drv",["lib"]),("/nix/store/ggzpx6yx9xd5h241ri730acdfpdirxjq-mesa-libgbm-25.1.0.drv",["out"]),("/nix/store/hmwbmap5c8zp3kl20bda0qk1dg4f408d-vulkan-loader-1.4.313.0.drv",["out"]),("/nix/store/hy8x576wmvz2fk9a778r05lqdb0dcbl4-speech-dispatcher-0.12.1.drv",["out"]),("/nix/store/knjlgd5nfd7dw45axa6z7w7d7rb11801-pciutils-3.14.0.drv",["out"]),("/nix/store/l7y4nybngpffyndkw8rwx2g3c8dw4yyj-xdg-utils-1.2.1.drv",["out"]),("/nix/store/lh0mbixp7jiz7z8cxfypm8b17lf8z9la-cups-2.4.12.drv",["lib"]),("/nix/store/lmfgw4dz59sdvplfh3zazqmin8d7gh9d-libnotify-0.8.6.drv",["out"]),("/nix/store/m4zp8p8y4wzxg2lhgq43kbgr2xl5l9px-firefox.desktop.drv",["out"]),("/nix/store/n8hy5gvnrw0kzz6cjdhky3rxr0q024sh-jq-1.8.1.drv",["dev"]),("/nix/store/nz0xp44xmbqcp2sfhsgicsswrrb2cpl7-libXScrnSaver-1.2.4.drv",["out"]),("/nix/store/p2nvbwxxiarbqaq26rqrjqkyw8dl0cf4-lndir-1.0.5.drv",["out"]),("/nix/store/p306lljvhw8906r1lxyyk7jn3bckdypn-sndio-1.10.0.drv",["out"]),("/nix/store/pbqbdcp76r373256ajlbp3fankpw5pdh-libpulseaudio-17.0.drv",["out"]),("/nix/store/q27q075ckyjkpqxx8cgvpghcwr0nzz5v-systemd-minimal-libs-257.6.drv",["out"]),("/nix/store/s4b8yadif84kiv8gyr9nxdi6zbg69b4g-bash-5.2p37.drv",["out"]),("/nix/store/sc2pgkzc1s6zp5dp8j7wsd4msilsnijn-stdenv-linux.drv",["out"]),("/nix/store/sy2kn7hwfw0nyvxq7rvzrmvm2ypxs9x6-gtk+3-3.24.49.drv",["dev"]),("/nix/store/v3sc4j11fhsah2ij0wkziw6nd3il9dyy-libjack2-1.9.22.drv",["out"]),("/nix/store/xy07yjv0x8bcdc3lzyq45lrbbz08hg5p-adwaita-icon-theme-48.0.drv",["out"]),("/nix/store/z8v9j1cf6faasgqrw3jw74xjyjiqwk82-libcanberra-0.30.drv",["out"])],["/nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh","/nix/store/vj1c3wf9c11a0qs6p3ymfvrnsdgsdcbq-source-stdenv.sh"],"x86_64-linux","/nix/store/p79bgyzmmmddi554ckwzbqlavbkw07zh-bash-5.2p37/bin/bash",["-e","/nix/store/vj1c3wf9c11a0qs6p3ymfvrnsdgsdcbq-source-stdenv.sh","/nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh"],[("__json","{\"NIX_MAIN_PROGRAM\":\"firefox\",\"buildCommand\":\"if [ ! -x \\\"/nix/store/9ycwpmlavjsjgr0svaqdy0mmjg949nzq-firefox-unwrapped-140.0.4/bin/firefox\\\" ]\\nthen\\n echo \\\"cannot find executable file \\\\`/nix/store/9ycwpmlavjsjgr0svaqdy0mmjg949nzq-firefox-unwrapped-140.0.4/bin/firefox'\\\"\\n exit 1\\nfi\\n\\n#########################\\n# #\\n# EXTRA PREF CHANGES #\\n# #\\n#########################\\n# Link the runtime. The executable itself has to be copied,\\n# because it will resolve paths relative to its true location.\\n# Any symbolic links have to be replicated as well.\\ncd \\\"/nix/store/9ycwpmlavjsjgr0svaqdy0mmjg949nzq-firefox-unwrapped-140.0.4\\\"\\nfind . -type d -exec mkdir -p \\\"$out\\\"/{} \\\\;\\n\\nfind . -type f \\\\( -not -name \\\"firefox\\\" \\\\) -exec ln -sT \\\"/nix/store/9ycwpmlavjsjgr0svaqdy0mmjg949nzq-firefox-unwrapped-140.0.4\\\"/{} \\\"$out\\\"/{} \\\\;\\n\\nfind . -type f \\\\( -name \\\"firefox\\\" -o -name \\\"firefox-bin\\\" \\\\) -print0 | while read -d $'\\\\0' f; do\\n cp -P --no-preserve=mode,ownership --remove-destination \\\"/nix/store/9ycwpmlavjsjgr0svaqdy0mmjg949nzq-firefox-unwrapped-140.0.4/$f\\\" \\\"$out/$f\\\"\\n chmod a+rwx \\\"$out/$f\\\"\\ndone\\n\\n# fix links and absolute references\\n\\nfind . -type l -print0 | while read -d $'\\\\0' l; do\\n target=\\\"$(readlink \\\"$l\\\")\\\"\\n target=${target/#\\\"/nix/store/9ycwpmlavjsjgr0svaqdy0mmjg949nzq-firefox-unwrapped-140.0.4\\\"/\\\"$out\\\"}\\n ln -sfT \\\"$target\\\" \\\"$out/$l\\\"\\ndone\\n\\ncd \\\"$out\\\"\\n\\n\\n# create the wrapper\\n\\nexecutablePrefix=\\\"$out/bin\\\"\\nexecutablePath=\\\"$out/bin/firefox\\\"\\noldWrapperArgs=()\\n\\nif [[ -L $executablePath ]]; then\\n # Symbolic link: wrap the link's target.\\n oldExe=\\\"$(readlink -v --canonicalize-existing \\\"$executablePath\\\")\\\"\\n rm \\\"$executablePath\\\"\\nelif wrapperCmd=$(/nix/store/qczbm5rh1vfkql4jznp1p5lv9nyjz99r-extract-binary-wrapper-cmd \\\"$executablePath\\\"); [[ $wrapperCmd ]]; then\\n # If the executable is a binary wrapper, we need to update its target to\\n # point to $out, but we can't just edit the binary in-place because of length\\n # issues. SLine truncated
|
||||
Derive([("out","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-firefox-140.0.4","","")],[("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-krb5-1.21.3.drv",["lib"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-libglvnd-1.7.0.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-firefox-unwrapped-140.0.4.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-make-shell-wrapper-hook.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-libva-2.22.0.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-policies.json.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-extract-binary-wrapper-cmd.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-pipewire-1.4.6.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-alsa-lib-1.2.14.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-ffmpeg-7.1.1.drv",["lib"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-mesa-libgbm-25.1.0.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-vulkan-loader-1.4.313.0.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-speech-dispatcher-0.12.1.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-pciutils-3.14.0.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-xdg-utils-1.2.1.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-cups-2.4.12.drv",["lib"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-libnotify-0.8.6.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-firefox.desktop.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-jq-1.8.1.drv",["dev"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-libXScrnSaver-1.2.4.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-lndir-1.0.5.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-sndio-1.10.0.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-libpulseaudio-17.0.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-systemd-minimal-libs-257.6.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bash-5.2p37.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-stdenv-linux.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-gtk+3-3.24.49.drv",["dev"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-libjack2-1.9.22.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-adwaita-icon-theme-48.0.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-libcanberra-0.30.drv",["out"])],["/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-default-builder.sh","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-source-stdenv.sh"],"x86_64-linux","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bash-5.2p37/bin/bash",["-e","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-source-stdenv.sh","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-default-builder.sh"],[("__json","{\"NIX_MAIN_PROGRAM\":\"firefox\",\"buildCommand\":\"if [ ! -x \\\"/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-firefox-unwrapped-140.0.4/bin/firefox\\\" ]\\nthen\\n echo \\\"cannot find executable file \\\\`/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-firefox-unwrapped-140.0.4/bin/firefox'\\\"\\n exit 1\\nfi\\n\\n#########################\\n# #\\n# EXTRA PREF CHANGES #\\n# #\\n#########################\\n# Link the runtime. The executable itself has to be copied,\\n# because it will resolve paths relative to its true location.\\n# Any symbolic links have to be replicated as well.\\ncd \\\"/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-firefox-unwrapped-140.0.4\\\"\\nfind . -type d -exec mkdir -p \\\"$out\\\"/{} \\\\;\\n\\nfind . -type f \\\\( -not -name \\\"firefox\\\" \\\\) -exec ln -sT \\\"/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-firefox-unwrapped-140.0.4\\\"/{} \\\"$out\\\"/{} \\\\;\\n\\nfind . -type f \\\\( -name \\\"firefox\\\" -o -name \\\"firefox-bin\\\" \\\\) -print0 | while read -d $'\\\\0' f; do\\n cp -P --no-preserve=mode,ownership --remove-destination \\\"/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-firefox-unwrapped-140.0.4/$f\\\" \\\"$out/$f\\\"\\n chmod a+rwx \\\"$out/$f\\\"\\ndone\\n\\n# fix links and absolute references\\n\\nfind . -type l -print0 | while read -d $'\\\\0' l; do\\n target=\\\"$(readlink \\\"$l\\\")\\\"\\n target=${target/#\\\"/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-firefox-unwrapped-140.0.4\\\"/\\\"$out\\\"}\\n ln -sfT \\\"$target\\\" \\\"$out/$l\\\"\\ndone\\n\\ncd \\\"$out\\\"\\n\\n\\n# create the wrapper\\n\\nexecutablePrefix=\\\"$out/bin\\\"\\nexecutablePath=\\\"$out/bin/firefox\\\"\\noldWrapperArgs=()\\n\\nif [[ -L $executablePath ]]; then\\n # Symbolic link: wrap the link's target.\\n oldExe=\\\"$(readlink -v --canonicalize-existing \\\"$executablePath\\\")\\\"\\n rm \\\"$executablePath\\\"\\nelif wrapperCmd=$(/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-extract-binary-wrapper-cmd \\\"$executablePath\\\"); [[ $wrapperCmd ]]; then\\n # If the executable is a binary wrapper, we need to update its target to\\n # point to $out, but we can't just edit the binary in-place because of length\\n # issues. SLine truncated
|
||||
@@ -1 +1 @@
|
||||
Derive([("out","/nix/store/hhg83gh653wjw4ny49xn92f13v2j1za4-hello-2.12.2","","")],[("/nix/store/1xz4avqqrxqsxw7idz119vdzw837p1n1-version-check-hook.drv",["out"]),("/nix/store/bsv47sbqcar3205il55spxqacxp8j0fj-hello-2.12.2.tar.gz.drv",["out"]),("/nix/store/s4b8yadif84kiv8gyr9nxdi6zbg69b4g-bash-5.2p37.drv",["out"]),("/nix/store/sc2pgkzc1s6zp5dp8j7wsd4msilsnijn-stdenv-linux.drv",["out"])],["/nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh","/nix/store/vj1c3wf9c11a0qs6p3ymfvrnsdgsdcbq-source-stdenv.sh"],"x86_64-linux","/nix/store/p79bgyzmmmddi554ckwzbqlavbkw07zh-bash-5.2p37/bin/bash",["-e","/nix/store/vj1c3wf9c11a0qs6p3ymfvrnsdgsdcbq-source-stdenv.sh","/nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh"],[("NIX_MAIN_PROGRAM","hello"),("__structuredAttrs",""),("buildInputs",""),("builder","/nix/store/p79bgyzmmmddi554ckwzbqlavbkw07zh-bash-5.2p37/bin/bash"),("cmakeFlags",""),("configureFlags",""),("depsBuildBuild",""),("depsBuildBuildPropagated",""),("depsBuildTarget",""),("depsBuildTargetPropagated",""),("depsHostHost",""),("depsHostHostPropagated",""),("depsTargetTarget",""),("depsTargetTargetPropagated",""),("doCheck","1"),("doInstallCheck","1"),("mesonFlags",""),("name","hello-2.12.2"),("nativeBuildInputs","/nix/store/fxzn6kr5anxn5jgh511x56wrg8b3a99a-version-check-hook"),("out","/nix/store/hhg83gh653wjw4ny49xn92f13v2j1za4-hello-2.12.2"),("outputs","out"),("patches",""),("pname","hello"),("postInstallCheck","stat \"${!outputBin}/bin/hello\"\n"),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),("src","/nix/store/dw402azxjrgrzrk6j0p66wkqrab5mwgw-hello-2.12.2.tar.gz"),("stdenv","/nix/store/a13rl87yjhzqrbkc4gb0mrwz2mfkivcf-stdenv-linux"),("strictDeps",""),("system","x86_64-linux"),("version","2.12.2")])
|
||||
Derive([("out","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-hello-2.12.2","","")],[("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-version-check-hook.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-hello-2.12.2.tar.gz.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bash-5.2p37.drv",["out"]),("/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-stdenv-linux.drv",["out"])],["/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-default-builder.sh","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-source-stdenv.sh"],"x86_64-linux","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bash-5.2p37/bin/bash",["-e","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-source-stdenv.sh","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-default-builder.sh"],[("NIX_MAIN_PROGRAM","hello"),("__structuredAttrs",""),("buildInputs",""),("builder","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bash-5.2p37/bin/bash"),("cmakeFlags",""),("configureFlags",""),("depsBuildBuild",""),("depsBuildBuildPropagated",""),("depsBuildTarget",""),("depsBuildTargetPropagated",""),("depsHostHost",""),("depsHostHostPropagated",""),("depsTargetTarget",""),("depsTargetTargetPropagated",""),("doCheck","1"),("doInstallCheck","1"),("mesonFlags",""),("name","hello-2.12.2"),("nativeBuildInputs","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-version-check-hook"),("out","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-hello-2.12.2"),("outputs","out"),("patches",""),("pname","hello"),("postInstallCheck","stat \"${!outputBin}/bin/hello\"\n"),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),("src","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-hello-2.12.2.tar.gz"),("stdenv","/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-stdenv-linux"),("strictDeps",""),("system","x86_64-linux"),("version","2.12.2")])
|
||||
@@ -8,14 +8,14 @@ TEST(HttpBinaryCacheStore, constructConfig)
|
||||
{
|
||||
HttpBinaryCacheStoreConfig config{"http", "foo.bar.baz", {}};
|
||||
|
||||
EXPECT_EQ(config.cacheUri, "http://foo.bar.baz");
|
||||
EXPECT_EQ(config.cacheUri.to_string(), "http://foo.bar.baz");
|
||||
}
|
||||
|
||||
TEST(HttpBinaryCacheStore, constructConfigNoTrailingSlash)
|
||||
{
|
||||
HttpBinaryCacheStoreConfig config{"https", "foo.bar.baz/a/b/", {}};
|
||||
|
||||
EXPECT_EQ(config.cacheUri, "https://foo.bar.baz/a/b");
|
||||
EXPECT_EQ(config.cacheUri.to_string(), "https://foo.bar.baz/a/b");
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
@@ -6,21 +6,25 @@ namespace nix {
|
||||
|
||||
TEST(LegacySSHStore, constructConfig)
|
||||
{
|
||||
LegacySSHStoreConfig config{
|
||||
LegacySSHStoreConfig config(
|
||||
"ssh",
|
||||
"localhost",
|
||||
"me@localhost:2222",
|
||||
StoreConfig::Params{
|
||||
{
|
||||
"remote-program",
|
||||
// TODO #11106, no more split on space
|
||||
"foo bar",
|
||||
},
|
||||
}};
|
||||
});
|
||||
|
||||
EXPECT_EQ(
|
||||
config.remoteProgram.get(),
|
||||
(Strings{
|
||||
"foo",
|
||||
"bar",
|
||||
}));
|
||||
|
||||
EXPECT_EQ(config.getReference().render(/*withParams=*/true), "ssh://me@localhost:2222?remote-program=foo%20bar");
|
||||
EXPECT_EQ(config.getReference().render(/*withParams=*/false), "ssh://me@localhost:2222");
|
||||
}
|
||||
} // namespace nix
|
||||
@@ -1,9 +1,6 @@
|
||||
// FIXME: Odd failures for templates that are causing the PR to break
|
||||
// for now with discussion with @Ericson2314 to comment out.
|
||||
#if 0
|
||||
# include <gtest/gtest.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
# include "nix/store/local-overlay-store.hh"
|
||||
#include "nix/store/local-overlay-store.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
@@ -31,4 +28,3 @@ TEST(LocalOverlayStore, constructConfig_rootPath)
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
#endif
|
||||
@@ -1,15 +1,12 @@
|
||||
// FIXME: Odd failures for templates that are causing the PR to break
|
||||
// for now with discussion with @Ericson2314 to comment out.
|
||||
#if 0
|
||||
# include <gtest/gtest.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
# include "nix/store/local-store.hh"
|
||||
#include "nix/store/local-store.hh"
|
||||
|
||||
// Needed for template specialisations. This is not good! When we
|
||||
// overhaul how store configs work, this should be fixed.
|
||||
# include "nix/util/args.hh"
|
||||
# include "nix/util/config-impl.hh"
|
||||
# include "nix/util/abstract-setting-to-json.hh"
|
||||
#include "nix/util/args.hh"
|
||||
#include "nix/util/config-impl.hh"
|
||||
#include "nix/util/abstract-setting-to-json.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
@@ -37,4 +34,3 @@ TEST(LocalStore, constructConfig_rootPath)
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
#endif
|
||||
@@ -3,7 +3,7 @@ project(
|
||||
'cpp',
|
||||
version : files('.version'),
|
||||
default_options : [
|
||||
'cpp_std=c++2a',
|
||||
'cpp_std=c++23',
|
||||
# TODO(Qyriad): increase the warning level
|
||||
'warning_level=1',
|
||||
'errorlogs=true', # Please print logs for tests that fail
|
||||
@@ -74,6 +74,7 @@ sources = files(
|
||||
'path.cc',
|
||||
'references.cc',
|
||||
's3-binary-cache-store.cc',
|
||||
's3.cc',
|
||||
'serve-protocol.cc',
|
||||
'ssh-store.cc',
|
||||
'store-reference.cc',
|
||||
@@ -94,6 +95,7 @@ this_exe = executable(
|
||||
link_args : linker_export_flags + [ '-lrapidcheck' ],
|
||||
# get main from gtest
|
||||
install : true,
|
||||
cpp_pch : do_pch ? [ 'pch/precompiled-headers.hh' ] : [],
|
||||
)
|
||||
|
||||
test(
|
||||
@@ -127,6 +129,7 @@ if get_option('benchmarks')
|
||||
include_directories : include_dirs,
|
||||
link_args : linker_export_flags,
|
||||
install : true,
|
||||
cpp_pch : do_pch ? [ 'pch/precompiled-headers.hh' ] : [],
|
||||
cpp_args : [
|
||||
'-DNIX_UNIT_TEST_DATA="' + meson.current_source_dir() + '/data"',
|
||||
],
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "nix/store/tests/nix_api_store.hh"
|
||||
#include "nix/util/tests/string_callback.hh"
|
||||
#include "nix/util/url.hh"
|
||||
|
||||
#include "store-tests-config.hh"
|
||||
|
||||
@@ -23,7 +24,13 @@ TEST_F(nix_api_store_test, nix_store_get_uri)
|
||||
std::string str;
|
||||
auto ret = nix_store_get_uri(ctx, store, OBSERVE_STRING(str));
|
||||
ASSERT_EQ(NIX_OK, ret);
|
||||
ASSERT_STREQ("local", str.c_str());
|
||||
auto expectedStoreURI = "local://?"
|
||||
+ nix::encodeQuery({
|
||||
{"log", nixLogDir},
|
||||
{"state", nixStateDir},
|
||||
{"store", nixStoreDir},
|
||||
});
|
||||
ASSERT_EQ(expectedStoreURI, str);
|
||||
}
|
||||
|
||||
TEST_F(nix_api_util_context, nix_store_get_storedir_default)
|
||||
@@ -97,7 +104,7 @@ TEST_F(nix_api_util_context, nix_store_open_dummy)
|
||||
nix_libstore_init(ctx);
|
||||
Store * store = nix_store_open(ctx, "dummy://", nullptr);
|
||||
ASSERT_EQ(NIX_OK, ctx->last_err_code);
|
||||
ASSERT_STREQ("dummy", store->ptr->getUri().c_str());
|
||||
ASSERT_STREQ("dummy://", store->ptr->config.getReference().render(/*withParams=*/true).c_str());
|
||||
|
||||
std::string str;
|
||||
nix_store_get_version(ctx, store, OBSERVE_STRING(str));
|
||||
|
||||
Loaded 100 of 263 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user