1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-17 07:52:43 +01:00
Commit graph

11330 commits

Author SHA1 Message Date
mergify[bot]
08cd0acf65
Merge pull request #12210 from NixOS/mergify/bp/2.25-maintenance/pr-11294
parser-state: fix attribute merging (backport #11294)
2025-01-10 20:39:33 +00:00
mergify[bot]
40e35dc567
Merge pull request #12189 from NixOS/mergify/bp/2.25-maintenance/pr-11853
fix(libmain/common-args): do not exceed maximum allowed verbosity (backport #11853)
2025-01-10 18:55:16 +00:00
mergify[bot]
009de1f7ac
Merge pull request #12179 from NixOS/mergify/bp/2.25-maintenance/pr-12103
fix: ignore symlinks in fsync-store-paths (backport #12103)
2025-01-10 18:55:11 +00:00
mergify[bot]
7a7a3d20d1
Merge pull request #12177 from NixOS/mergify/bp/2.25-maintenance/pr-12114
fix documentation of substring (backport #12114)
2025-01-10 18:55:08 +00:00
mergify[bot]
70ab8bbb28
Merge pull request #12175 from NixOS/mergify/bp/2.25-maintenance/pr-12115
libcmd: update to support lowdown-1.4 API (backport #12115)
2025-01-10 18:55:05 +00:00
Eelco Dolstra
c902a299a8
Merge pull request #12164 from NixOS/mergify/bp/2.25-maintenance/pr-12157
parsePathFlakeRefWithFragment(): Handle 'path?query' without a fragment (backport #12157)
2025-01-10 18:11:30 +01:00
Eelco Dolstra
31d6afb476
Merge pull request #12181 from NixOS/mergify/bp/2.25-maintenance/pr-12091
libstore: fixup unformatted uri when S3 getObject fails (backport #12091)
2025-01-10 15:17:50 +01:00
Eelco Dolstra
ef1e704707 Attempt to make the FlakeRef test succeed on macOS
(cherry picked from commit 3ad0f45e79)
2025-01-10 13:37:40 +01:00
Eelco Dolstra
21fe544ed9 Remove unused variable
(cherry picked from commit 1a38e62a09)
2025-01-10 13:37:36 +01:00
Eelco Dolstra
e1178b8a39 parsePathFlakeRefWithFragment(): Add unit tests
(cherry picked from commit 5f7b535b81)
2025-01-10 13:37:32 +01:00
Eelco Dolstra
31fa189123 parsePathFlakeRefWithFragment(): Handle query params in the non-git case
Backported from lazy-trees.

(cherry picked from commit 83ff523865)
2025-01-10 13:37:28 +01:00
Eelco Dolstra
faecb6e306 parsePathFlakeRefWithFragment(): Handle 'path?query' without a fragment
Commands like `nix flake metadata '.?submodules=1'` ignored the query
part of the URL, while `nix build '.?submodules=1#foo'` did work
correctly because of the presence of the fragment part.

(cherry picked from commit 28caa35a97)
2025-01-10 13:37:23 +01:00
Eelco Dolstra
200e3be41a ParsedURL: Remove base field
(cherry picked from commit 4077aa43a8)
2025-01-10 13:37:05 +01:00
Eelco Dolstra
8856b5f2ca ParsedURL: Remove url field
This prevents a 'url' field that is out of sync with the other
fields. You can use to_string() to get the full URL.

(cherry picked from commit f705ce7f9a)
2025-01-10 13:37:00 +01:00
Eelco Dolstra
aa5246bfe3 Drop std::make_pair
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
(cherry picked from commit ebb19cc1cd)
2025-01-10 13:36:43 +01:00
Eelco Dolstra
8b4a89f4bb Clean up flakeref parsing
This factors out some commonality in calling fromURL() and handling
the "dir" parameter into a fromParsedURL() helper function.

(cherry picked from commit 850281908c)
2025-01-10 13:36:37 +01:00
Ryan Hendrickson
5575a2f1c3 parser-state: fix attribute merging
(cherry picked from commit 8034589d7e)
2025-01-10 10:40:07 +00:00
Sergei Zimmerman
2cb2fbbca7 fix(libmain/common-args): do not exceed maximum allowed verbosity
This patch gets rid of UB when verbosity exceeds the maximum logging value of `lvlVomit = 7` and
reaches invalid values (e.g. 8). This is actually triggered in functional tests.
There are too many occurrences to list, but here's one from the UBSAN log:

../src/libstore/gc.cc:610:5: runtime error: load of value 8, which is not a valid value for type 'Verbosity'

(cherry picked from commit b9f8c4af40)
2025-01-10 10:04:40 +00:00
Cole Helbling
8f5ea8b8ca libstore: fixup unformatted uri when S3 getObject fails
(cherry picked from commit b978fa8450)
2025-01-10 09:48:23 +00:00
Yaroslav Bolyukin
24a9c6fad9 fix: ignore symlinks in fsync-store-paths
Fixes: https://github.com/NixOS/nix/issues/12099
(cherry picked from commit 4a91e627a7)
2025-01-10 09:45:22 +00:00
Philipp Otterbein
d54c283821 fix documentation of substring
(cherry picked from commit 1e2cace5f1)
2025-01-10 09:44:18 +00:00
Sergei Trofimovich
bead70acc2 libcmd: update to support lowdown-1.4 API
Upstream change
bab1d75079
moved a few fields from `lowdown_opts` toa  new `lowdown_opts_term`
struct. As a result the build started failing as:

    nix-cmd> [2/17] Compiling C++ object libnixcmd.so.p/markdown.cc.o
    nix-cmd> FAILED: libnixcmd.so.p/markdown.cc.o
    nix-cmd> g++ -Ilibnixcmd.so.p -I. -I.. -I/nix/store/b0bnrk5lacxbpgxgnc28r8q3wcazrgxj-nix-util-2.26.0pre-dev/include/nix -I/nix/store/cxnynq9ykyj4xxv6wf6dw7r0aw5x6n9k-libarchive-3.7.7-dev/include -I/nix/store/bfgjwkcb8snkizx578rzdahi75m8zyh4-nlohmann_json-3.11.3/include -I/nix/store/3sx8bq3sip6j2nv1m5xx4gbdp33v7iy6-nix-store-2.26.0pre-dev/include/nix -I/nix/store/sih2dgqzvsbv7p510lkfmas7s7wbsl4j-nix-fetchers-2.26.0pre-dev/include/nix -I/nix/store/68p8s20fsiiakj7nys7grbaixfnhsdzs-nix-expr-2.26.0pre-dev/include/nix -I/nix/store/gw7wknhzhfzzj9zww2kyi5xrzgf1ndki-boehm-gc-8.2.8-dev/include -I/nix/store/3jwb9j4vnsk5saq3wfyyp9il3mhs41l9-nix-flake-2.26.0pre-dev/include/nix -I/nix/store/8nwjvmq7m48v8g646jrxkikv6x47bc3m-nix-main-2.26.0pre-dev/include/nix -I/nix/store/rb0hzsw5wc1a7daizhpj824mbxlvijrq-lowdown-1.4.0-dev/include -I/nix/store/m388ywpk53fsp8r98brfd7nf1f5sskv0-editline-1.17.1-dev/include -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++2a -include config-util.hh -include config-store.hh -include config-expr.hh -include config-main.hh -include config-cmd.hh -Wdeprecated-copy -Werror=suggest-override -Werror=switch -Werror=switch-enum -Werror=unused-result -Wignored-qualifiers -Wimplicit-fallthrough -Wno-deprecated-declarations -O3 -fPIC -pthread -std=c++2a -std=c++2a -std=c++2a -std=c++2a -std=c++2a -std=c++2a -MD -MQ libnixcmd.so.p/markdown.cc.o -MF libnixcmd.so.p/markdown.cc.o.d -o libnixcmd.so.p/markdown.cc.o -c ../markdown.cc
    nix-cmd> ../markdown.cc: In function 'std::string nix::doRenderMarkdownToTerminal(std::string_view)':
    nix-cmd> ../markdown.cc:28:5: error: 'lowdown_opts' has no non-static data member named 'cols'
    nix-cmd>    28 |     };
    nix-cmd>       |     ^

The change adds version-based conditional to support both pre-1.4 and
1.4 forms of the initialization.

Closes: https://github.com/NixOS/nix/issues/12113
(cherry picked from commit edbfe863ce)
2025-01-10 09:43:18 +00:00
Philipp Otterbein
4bf020de50 toJSON: re-throw serialization exception
(cherry picked from commit 4a2310a3a0)
2025-01-10 09:42:14 +00:00
Jörg Thalheim
b0784dd69b makeParentCanonical: test case where parent is empty
(cherry picked from commit 5a5a86949a)
2025-01-07 06:03:58 +00:00
Robert Hensing
3fbcd8d7ba fix: Resolve CLI parent symlinks before adding to store
Fixes https://github.com/NixOS/nix/issues/11941

(cherry picked from commit ddbbf53767)
2025-01-07 06:03:57 +00:00
Robert Hensing
fdd61cf529 refactor: Don't re-construct SourcePath unnecessarily
(cherry picked from commit c0b64f3377)
2025-01-07 06:03:57 +00:00
Robert Hensing
255379daf1 fix: Handle symlinks and FIFOs in nix hash where possible
Fixes https://github.com/NixOS/nix/issues/11756
Fixes https://github.com/NixOS/nix/issues/11681

(cherry picked from commit 36563c69a4)
2025-01-07 06:03:56 +00:00
Robert Hensing
0213f22650 Add makeParentCanonical()
(cherry picked from commit 69853c067c)
2025-01-07 06:03:55 +00:00
Jason Yundt
f1a4544886 Fix flake.lock/flake.nix mix-up
src/nix/flake.md describes the format of flake.lock files. Before this
change, it said that the original field was “The original input
specification from `flake.lock`[…]” The original input specification is
in flake.nix, not flake.lock.

(cherry picked from commit 51463d2280)
2024-12-16 22:03:50 +00:00
Jörg Thalheim
51166bb388 upgrade-nix: don't double quote path on error
the format error already adds quotes.

(cherry picked from commit ccaa4c259a)
2024-12-15 20:52:06 +00:00
Greg Curtis
e467269a44 Fix nix upgrade-nix profile search
Commit cfe66dbec updated `nix upgrade-nix` to use
`ExecutablePath::load().find`, which broke the logic for finding the
profile associated with the nix executable. The error looks something
like:

```
$ sudo -i nix upgrade-nix --debug
found Nix in '"/nix/store/46p1z0w9ad605kky62dr53z4h24k2a5r-nix-2.25.2/bin/nix"'
found profile '/nix/store/46p1z0w9ad605kky62dr53z4h24k2a5r-nix-2.25.2/bin'
error: directory '"/nix/store/46p1z0w9ad605kky62dr53z4h24k2a5r-nix-2.25.2/bin/nix"' does not appear to be part of a Nix profile
```

This seems to happen for two reasons:

1. The original PATH search resulted in a directory, but `find` returns
   the path to the executable. Fixed by getting the path's parent.
2. The profile symlink cannot be found because
   `ExecutablePath::load().find` canonicalizes the executable path. I
   updated find to normalize the path instead, which seems more in line
   with how other programs resolve paths. I'm not sure if this affects
   other callers though.

I manually tested this on macOS and Linux, and it seemed to fix
upgrading from 2.25.2 to 2.25.3.

(cherry picked from commit 4f831e2be5)
2024-12-15 20:52:05 +00:00
Robert Hensing
2eb816226e Remove redundant warning: prefix from structured build log warning
(cherry picked from commit f3c722cab2)
2024-12-09 21:40:41 +00:00
Robert Hensing
c709ca6e36 Push log source description out of libutil and report build hook @nix warning correctly
(cherry picked from commit 03d4bfd852)
2024-12-09 21:40:32 +00:00
Linus Heckemann
7c98167eab libutil: handle json builder log messages with unexpected format
Before this change, expressions like:

with import <nixpkgs> {};
runCommand "foo" {} ''
  echo '@nix {}' >&$NIX_LOG_FD
''

would result in Lix crashing, because accessing nonexistent fields of
a JSON object throws an exception.

Rather than handling each field individually, we just catch JSON
exceptions wholesale. Since these log messages are an unusual
circumstance, log a warning when this happens.

Fixes #544.

Change-Id: Idc2d8acf6e37046b3ec212f42e29269163dca893
(cherry picked from commit e55cd3beea710db727fd966f265a1b715b7285f3)
(cherry picked from commit ee03fd478e)
2024-12-09 21:40:23 +00:00
Eelco Dolstra
a5ee9a3e99
Resolve conflicts 2024-12-06 12:13:51 +01:00
Eelco Dolstra
0a2545b23a nix hash: Don't print 'nix hash' deprecation message
Fixes #11997.

(cherry picked from commit 408c2faf93)

# Conflicts:
#	src/nix/hash.cc
2024-12-05 22:30:33 +00:00
Eelco Dolstra
97f0c68389 nix hash convert: Don't fail on uppercase base-16 hashes
(cherry picked from commit 33b645cedf)
2024-12-05 22:30:32 +00:00
Eelco Dolstra
26741bcfda nix hash convert: Support SRI hashes that lack trailing '=' characters
Fixes #11996.

(cherry picked from commit 52f1cd0595)
2024-12-05 22:30:32 +00:00
Jörg Thalheim
282bfbdacb
Merge pull request #11973 from NixOS/mergify/bp/2.25-maintenance/pr-11959
more readable errors if symlinks cannot be created (backport #11959)
2024-11-27 08:04:06 +01:00
Jörg Thalheim
14432ea4a2
Merge pull request #11962 from NixOS/mergify/bp/2.25-maintenance/pr-11915
Bump fetcher cache version (backport #11915)
2024-11-27 07:23:52 +01:00
Jörg Thalheim
8d51c90872 more readable errors if symlinks cannot be created
Before:

filesystem error: cannot create symlink: Permission denied [/nix/store/1s2p3a4rs172336hj2l8n20nz74hf71j-nix-eval-jobs-2.24.1.drv] [/1s2p3a4rs172336hj2l8n20nz74hf71j-nix-eval-jobs-2.24.1.drv.tmp-2772352-1316231068]

Now:

creating symlink '/wfxz2q489c811n08cdqj7ywxm3n4z6m5-nix-eval-jobs-2.24.1.drv.tmp-2971297-324653080' -> '/nix/store/wfxz2q489c811n08cdqj7ywxm3n4z6m5-nix-eval-jobs-2.24.1.drv': Permission denied

(cherry picked from commit 5b8728d393)

# Conflicts:
#	src/nix/flake.cc
2024-11-27 07:21:10 +01:00
Eelco Dolstra
118d50992c
Merge pull request #11968 from NixOS/mergify/bp/2.25-maintenance/pr-11878
Remove warning that interpretation of .drv has changed (backport #11878)
2024-11-26 14:51:50 +01:00
Eelco Dolstra
9f9b2ed48c
Merge pull request #11966 from NixOS/mergify/bp/2.25-maintenance/pr-11876
Filter OSC 8 correctly (backport #11876)
2024-11-26 14:10:16 +01:00
Eelco Dolstra
eb50683e81
Merge pull request #11965 from NixOS/mergify/bp/2.25-maintenance/pr-11884
nix path-info: Don't write to std::cout directly (backport #11884)
2024-11-26 13:58:42 +01:00
Robert Hensing
3501c737d3 Remove warning that interpretation of .drv has changed
This was first tagged as 2.15.0, 1½ years ago; plenty of time for
everyone to catch up.

By now, the warning is causing more confusion than that it is helpful,
because passing a `.drv` or `drvPath` has legitimate use cases.

(cherry picked from commit f534a7a524)
2024-11-26 11:27:41 +00:00
Jack Wilsdon
12eff94815 Filter OSC 8 correctly
This allows Nix to use lowdown 1.2.0 which outputs OSC-8 links.

(cherry picked from commit 1301f8434d)
2024-11-26 11:20:35 +00:00
Eelco Dolstra
89f4ac3d2c nix path-info: Don't write to std::cout directly
This interferes with the progress bar, resulting in output like

  evaluating derivation 'git+file:///home/eelco/Dev/nix-master#packages.x86_64-linux.default'/nix/store/zz8v96j5md952x0mxfix12xqnvq5qv5x-nix-2.26.0pre20241114_a95f6ea.drv

(cherry picked from commit 33a0fa882f)
2024-11-26 11:20:35 +00:00
Robert Hensing
4e2824ce93 Bump fetcher cache version
We're getting more reports in https://github.com/NixOS/nix/issues/10985

It appears that something hasn't gone right process-wise.
I find this mistake not to be worth investigating, but rather something
to pay attention to going forward.

Let's nip this in the bud.

Closes https://github.com/NixOS/nix/issues/10985

(cherry picked from commit e948c8e033)
2024-11-26 11:19:29 +00:00
Robert Hensing
3bc3e55736 Fix issue 11892
It seems that I copied the expression for baseDir thoughtlessly and
did not come back to it.

- `baseDir` was only used in the `fromArgs` branch.
- `fromArgs` is true when `packages` is true.

(cherry picked from commit c4b95dbdd1)
2024-11-26 11:19:29 +00:00
John Ericson
355f08a728 Fix argument order in the Windows implementation of getEnvOs
See the build failure in https://github.com/msys2/MINGW-packages/pull/22499
2024-11-12 00:52:17 -05:00