1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 13:06:01 +01:00
Commit graph

20917 commits

Author SHA1 Message Date
Jeremy Fleischman
7df7bde306
Refactor, extract some shared code into UnresolvedApp::build 2025-04-29 18:40:02 -07:00
Robert Hensing
e14346c7da
Refactor, dedup nix formatter attribute methods 2025-04-29 18:40:02 -07:00
Jeremy Fleischman
ba6b617e75
Add nix formatter build command
`nix formatter build` is sort of like `nix build`: it builds, links, and
prints a path to the formatter program:

    $ nix formatter build
    /nix/store/cb9w44vkhk2x4adfxwgdkkf5gjmm856j-treefmt/bin/treefmt

Note that unlike `nix build`, this prints the full path to the program,
not just the store path (in the example above that would be
`/nix/store/cb9w44vkhk2x4adfxwgdkkf5gjmm856j-treefmt`).

Motivation
----------

I maintain a vim plugin that automatically runs `nix fmt` on files on
save. Since `nix fmt` can be quite slow due to nix evaluation, I choose
to cache the `nix fmt `entrypoint. This was very awkward to do, see the
implementation for details:
7864607231/lua/null-ls/builtins/formatting/nix_flake_fmt.lua (L83-L110).

I recently discovered that my implementation was buggy (it didn't handle
flakes that expose a `formatter` package, such as nixpkgs), so I had to
rework the implementation:
https://github.com/nvimtools/none-ls.nvim/pull/272.

With the new `nix formatter build` command, I can delete all this akward
code, and it will be easier for other folks to build performant editor
integrations for `nix fmt`.
2025-04-29 18:40:02 -07:00
Jeremy Fleischman
5ea7b97147
refactor: create a new nix formatter run command alias for nix fmt
This refactor shouldn't change much except add a new `nix formatter run`
command. This creates space for the new `nix formatter build` command,
which I'll be introducing in the next commit.
2025-04-29 18:40:02 -07:00
Philipp Otterbein
788be3f964 bugfix in getInteger(const nlohmann::json &) and add bounds checks
improve error messages, too
2025-04-30 01:38:48 +02:00
Eelco Dolstra
9099b7dd87
Merge pull request #13109 from trofi/osc-8-xterm-style-fix
libutil: amend OSC 8 escape stripping for xterm-style separator
2025-04-29 22:39:04 +02:00
Jörg Thalheim
0e2dc8774c
Merge pull request #13105 from roberth/refactor-cli-out-link
Factor out `MixOutLinkByDefault`
2025-04-29 21:19:34 +02:00
Graham Christensen
eaae67bb4e
Merge pull request #41 from DeterminateSystems/push-xnskkytzsuom
Generate release notes when proposing a release, clean up templates
2025-04-29 15:39:35 +00:00
Sergei Trofimovich
e322b714dc libutil: amend OSC 8 escape stripping for xterm-style separator
Before the change `nix` was stripping warning flags
reported by `gcc-14` too eagerly:

    $ nix build -f. texinfo4
    error: builder for '/nix/store/i9948l91s3df44ip5jlpp6imbrcs646x-texinfo-4.13a.drv' failed with exit code 2;
           last 25 log lines:
           >  1495 | info_tag (mbi_iterator_t iter, int handle, size_t *plen)
           >       |                                            ~~~~~~~~^~~~
           > window.c:1887:39: error: passing argument 4 of 'printed_representation' from incompatible pointer type []
           >  1887 |                                       &replen);
           >       |                                       ^~~~~~~
           >       |                                       |
           >       |                                       int *

After the change the compiler flag remains:

    $ ~/patched.nix build -f. texinfo4
    error: builder for '/nix/store/i9948l91s3df44ip5jlpp6imbrcs646x-texinfo-4.13a.drv' failed with exit code 2;
       last 25 log lines:
       >  1495 | info_tag (mbi_iterator_t iter, int handle, size_t *plen)
       >       |                                            ~~~~~~~~^~~~
       > window.c:1887:39: error: passing argument 4 of 'printed_representation' from incompatible pointer type [-Wincompatible-pointer-types]
       >  1887 |                                       &replen);
       >       |                                       ^~~~~~~
       >       |                                       |
       >       |                                       int *

Note the difference in flag rendering around the warning.

https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda has a
good sumamry of why it happens. Befomre the change `nix` was handling
just one form or URL separator:

    $ printf '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n'

Now it also handled another for (used by gcc-14`):

    printf '\e]8;;http://example.com\aThis is a link\e]8;;\a\n'

While at it fixed accumulation of trailing escape `\e\\` symbol.
2025-04-29 16:12:18 +01:00
Valentin Gagarin
cb9182f9ed docs: don't mention Haskell
sometimes it's these little things that let beginners stumble at the
first step...

mentioning one potentially foreign concept while introducing an entirely
new concept is asking enough already.
2025-04-29 10:58:34 +02:00
Graham Christensen
282910bff2
Merge pull request #46 from DeterminateSystems/release-v3.4.1/a9837432-a15d-4f23-9bb3-ef09aa99ce3c
Release v3.4.1
2025-04-28 22:50:11 +00:00
Graham Christensen
03e2f2f931
Merge pull request #44 from DeterminateSystems/remove-trailing-slash
Remove trailing slash in Zero to Nix URL
2025-04-28 22:19:40 +00:00
github-actions[bot]
7cf6869f98
Set .version-determinate to 3.4.1 2025-04-28 21:54:55 +00:00
github-actions[bot]
de24714a90
Prepare release v3.4.1 2025-04-28 21:54:52 +00:00
Luc Perkins
71e735385a
Change language around guide 2025-04-28 15:39:38 -03:00
Luc Perkins
506f489dae
Remove other trailing slash 2025-04-28 15:04:29 -03:00
Luc Perkins
2e2d795b46
Remove trailing slash in Zero to Nix URL 2025-04-28 14:52:01 -03:00
Graham Christensen
e44d4b7ec0
Update .github/release-notes.sh 2025-04-28 12:59:02 -04:00
Graham Christensen
e2cce0e026
Update .github/release-notes.sh
Co-authored-by: gustavderdrache <gustavderdrache@gmail.com>
2025-04-28 12:42:48 -04:00
Robert Hensing
2ec1303286
Merge pull request #13103 from obsidiansystems/dedup-static-functions
Delete dead code
2025-04-28 18:00:48 +02:00
John Ericson
46030181d4 Delete dead code
We had multiple copies of some static functions after splitting out
`DerivationBuilder` by mistake.
2025-04-28 11:19:36 -04:00
Robert Hensing
9d1f00e31d Factor out MixOutLinkByDefault 2025-04-28 16:54:00 +02:00
Graham Christensen
5a87809b25
Update .github/release-notes.sh
Co-authored-by: gustavderdrache <gustavderdrache@gmail.com>
2025-04-28 10:29:49 -04:00
mergify[bot]
3d39864b96
Merge pull request #13099 from roberth/doc-evaluation
doc/manual: Add language/evaluation
2025-04-28 08:20:45 +00:00
Jörg Thalheim
4d4a91ab8d
Merge pull request #13101 from NixOS/mergify/bp/2.28-maintenance/pr-13100
allocate SimpleLogger before forking (backport #13100)
2025-04-28 09:48:32 +02:00
Philipp Otterbein
9ba32a2981 allocate SimpleLogger before forking
(cherry picked from commit 4e95f662db)
2025-04-28 07:02:02 +00:00
Eelco Dolstra
5565679b45
Merge pull request #13100 from NaN-git/fix-musl-deadlock
allocate SimpleLogger before forking
2025-04-28 09:01:06 +02:00
Philipp Otterbein
4e95f662db allocate SimpleLogger before forking 2025-04-28 00:46:44 +02:00
Graham Christensen
ce1cca8ebd Allow useless cat. 2025-04-27 17:26:59 -04:00
Graham Christensen
81350e1ffc Update our issue and PR templates to be "us" 2025-04-27 17:19:23 -04:00
Graham Christensen
e057d0d67c Drop upstream CODEOWNERS 2025-04-27 17:19:09 -04:00
Graham Christensen
25ef7a1956 Automatically generate release notes draft during proposal 2025-04-27 17:08:41 -04:00
Graham Christensen
3c5d7822c5 Add a couple markers for injecting new updated content 2025-04-27 16:25:50 -04:00
Robert Hensing
c81202b358
Merge pull request #13096 from NixOS/no-use-registries
getFlake(): Don't use registries for refetching
2025-04-27 00:42:51 +02:00
Robert Hensing
ee59af99f8
Merge pull request #13098 from roberth/fix-string-ctor
Fix flake-c out of bounds access
2025-04-26 18:46:11 +02:00
Graham Christensen
234f790d62
Merge pull request #39 from DeterminateSystems/release-v3.4.0/3dffc8a4-b1ae-48d8-aac3-ae109dc93cda
Release v3.4.0
2025-04-25 21:08:37 +00:00
Graham Christensen
173c742afc
Prep 3.4.0 release notes (#40) 2025-04-25 16:56:57 -04:00
github-actions[bot]
48e976af63
Set .version-determinate to 3.4.0 2025-04-25 20:35:35 +00:00
github-actions[bot]
050e2e07bc
Prepare release v3.4.0 2025-04-25 20:35:32 +00:00
Eelco Dolstra
bbde3da254
Merge pull request #38 from DeterminateSystems/warn-registry-inputs
Warn against the use of indirect flakerefs in flake inputs
2025-04-25 19:58:07 +00:00
Eelco Dolstra
a9c1751e2f
Update src/libflake/flake/flake.cc
Co-authored-by: Graham Christensen <graham@grahamc.com>
2025-04-25 21:51:32 +02:00
Eelco Dolstra
ae5ac8acc1 Limit parallelism 2025-04-25 21:39:05 +02:00
Eelco Dolstra
ca1b2dc617 Warn against the use of indirect flakerefs in flake inputs 2025-04-25 21:16:27 +02:00
Robert Hensing
a525c7e991 doc/manual: Add language/evaluation 2025-04-25 18:06:03 +02:00
Robert Hensing
94916136dc Fix flake-c out of bounds access
The explicit include is needed for clangd to not get confused somehow,
which is also what threw me off initially and made me pick the wrong
constructor.
The (pointer, number, number) constructor first constructs a C string
and then takes a substring from that, but we didn't specify that the
buffer needs to be NUL-terminated, and then what would be the point of
the size argument anyway...

basic_string.h:

>	basic_string(const _Tp& __t, size_type __pos, size_type __n,
>		     const _Alloc& __a = _Alloc())
>	: basic_string(_S_to_string_view(__t).substr(__pos, __n), __a) { }

Valgrind on nixops4/rust/nix-flake tests:

==1344422== Conditional jump or move depends on uninitialised value(s)
==1344422==    at 0x48513E8: strlen (vg_replace_strmem.c:505)
==1344422==    by 0x488E941: UnknownInlinedFun (char_traits.h:391)
==1344422==    by 0x488E941: UnknownInlinedFun (string_view:141)
==1344422==    by 0x488E941: UnknownInlinedFun (basic_string.h:790)
==1344422==    by 0x488E941: nix_flake_reference_and_fragment_from_string (nix_api_flake.cc:81)
==1344422==    by 0x127332: nix_flake::FlakeReference::parse_with_fragment (lib.rs:123)
2025-04-25 17:07:32 +02:00
Eelco Dolstra
97487c58a1
Merge pull request #36 from DeterminateSystems/deprecate-channel-urls
Warn about the use of channel URLs
2025-04-25 15:01:32 +00:00
Eelco Dolstra
88cd82239e Fix the nix-community/patsh/0.2.1 flake regression test (again) 2025-04-25 16:50:02 +02:00
Eelco Dolstra
797c716f74 Suggest fix 2025-04-25 16:05:17 +02:00
mergify[bot]
323e840d17
Merge pull request #13097 from NixOS/mergify/bp/2.28-maintenance/pr-13094
libutil: Add missing format arguments to UsageError ctor (backport #13094)
2025-04-25 14:04:08 +00:00
Sergei Zimmerman
1c9e94789e libutil: Add missing format arguments to UsageError ctor
Once again found by an automated migration to `std::format`.
I've tested that boost::format works fine with `std::string_view`
arguments.

(cherry picked from commit 9fff868e39)
2025-04-25 13:22:58 +00:00