Commit graph

15996 commits

Author SHA1 Message Date
Jacek Galowicz
d11d7849f7 Use ChildWrapperFunction type and make casts more explicit 2024-01-16 17:00:46 +00:00
Jacek Galowicz
c924147c9d Drop parentheses from thunks 2024-01-16 17:00:46 +00:00
Jacek Galowicz
1885d579db Improve String Handling 2024-01-16 17:00:46 +00:00
Jacek Galowicz
0bc66e529f Use npos member variables instead of full type 2024-01-16 15:17:57 +00:00
Eelco Dolstra
7115edc85a
Merge pull request #8544 from edolstra/handle-missing-gc-socket
LocalStore::addTempRoot(): Handle ENOENT
2024-01-16 16:05:58 +01:00
Robert Hensing
ea6aa5ffd8 Package{,Info}: comments 2024-01-16 15:44:02 +01:00
Robert Hensing
85a1cd9bd5
Merge pull request #9762 from hercules-ci/doc-glossary-package
doc/glossary: Define package and package attribute set
2024-01-16 15:34:59 +01:00
Robert Hensing
65255edc9b DerivationInfo -> PackageInfo
This does not yet resolve the coupling between packages and
derivations, but it makes the code more consistent with the
terminology, and it accentuates places where the coupling is
obvious, such as

         auto drvPath = packageInfo.queryDrvPath();
         if (!drvPath)
             throw Error("'%s' is not a derivation", what());

... which isn't wrong, and in my opinion, doesn't even look
wrong, because it just reflects the current logic.
However, I do like that we can now start to see in the code that
this coupling is perhaps a bit arbitrary.
After this rename, we can bring the DerivingPath concept into type
and start to lift this limitation.
2024-01-16 15:28:03 +01:00
Eelco Dolstra
d005bade7f connect(): Propagate errno from the child process
This is necessary on macOS since addTempRoot() relies on errno.
2024-01-16 15:26:17 +01:00
Eelco Dolstra
0b1d93d2ba Sleep a bit between attempts to connect to the root server 2024-01-16 15:26:17 +01:00
Robert Hensing
baea5f42c6
doc/glossary: Simplify software package definition
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2024-01-16 14:50:53 +01:00
Eelco Dolstra
302625e83b Merge remote-tracking branch 'origin/master' into handle-missing-gc-socket 2024-01-16 13:18:58 +01:00
Eelco Dolstra
86156d05dd
Merge pull request #9785 from hercules-ci/test-substring-negative
tests/functional/lang: Test substring with negative length
2024-01-16 13:08:07 +01:00
Eelco Dolstra
7e072b6b1e
Merge pull request #9781 from NixOS/dependabot/github_actions/cachix/cachix-action-14
Bump cachix/cachix-action from 13 to 14
2024-01-16 13:05:43 +01:00
Eelco Dolstra
df1a931a45
Merge pull request #9780 from NixOS/dependabot/github_actions/cachix/install-nix-action-25
Bump cachix/install-nix-action from 24 to 25
2024-01-16 13:05:19 +01:00
Robert Hensing
cbc319e9be tests/functional/lang: Test substring with negative length 2024-01-16 12:19:31 +01:00
Robert Hensing
b2deff1947
Merge pull request #9747 from awakesecurity/mz/fix-quadratic-splitString
Fix performance of builtins.substring for empty substrings
2024-01-16 12:18:59 +01:00
dependabot[bot]
bf7754c099
Bump cachix/cachix-action from 13 to 14
Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 13 to 14.
- [Release notes](https://github.com/cachix/cachix-action/releases)
- [Commits](https://github.com/cachix/cachix-action/compare/v13...v14)

---
updated-dependencies:
- dependency-name: cachix/cachix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-15 22:35:15 +00:00
dependabot[bot]
e0a7643086
Bump cachix/install-nix-action from 24 to 25
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 24 to 25.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v24...v25)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-15 22:35:12 +00:00
John Ericson
8a2da82220
Merge pull request #9759 from obsidiansystems/abs-path-string-view
`absPath`: just take a `std::string_view`
2024-01-15 10:22:20 -05:00
Robert Hensing
eeaa188973
Merge pull request #9748 from obsidiansystems/no-rapidcheck-headers
Simplify RapidCheck configure
2024-01-15 14:52:14 +01:00
John Ericson
beed00c04e absPath: just take a std::string_view
1. Slightly more efficient

2. Easier to call

Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2024-01-15 08:21:54 -05:00
John Ericson
9b9ecdee34 Simplify RapidCheck configure
No more `RAPIDCHECK_HEADERS`!
2024-01-15 08:05:05 -05:00
John Ericson
dd42a4e3e9 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/86501af7f1d51915e6c335f90f2cab73d7704ef3' (2024-01-11)
  → 'github:NixOS/nixpkgs/a1982c92d8980a0114372973cbdfe0a307f1bdea' (2024-01-12)
2024-01-15 08:04:46 -05:00
Robert Hensing
268c49264a
Merge pull request #9763 from L-as/avoid-unnecessary-copy
Avoid unnecessary copy of goal log
2024-01-15 08:32:03 +01:00
John Ericson
8d4b67912d
Merge pull request #9768 from obsidiansystems/nix-profile-test-no-outlink
`tests/functional/nix-profile.sh`: Add missing `--no-link`
2024-01-14 16:11:42 -05:00
John Ericson
03a6ca9b25 tests/functional/nix-profile.sh: Add missing --no-link
Otherwise we get a stray `tests/functional/result`, which can cause
spurious failures later.

(I got a failure because the test temp dir effecting the store dir
changed. This caused a test later because Nix didn't want to remove the
old `result` because it wasn't pointing inside the new Nix store.)
2024-01-14 15:27:44 -05:00
John Ericson
7ab0a4c39d
Merge pull request #9757 from obsidiansystems/parser-dodge-windows-macros
Avoid Windows macros in the parser and lexer
2024-01-14 13:36:13 -05:00
Las Safin
f61d951909
Avoid unnecessary copy of goal log
The data was (accidentally?) copied into a std::string,
even though the string is immediately converted into a std::string_view.
The code has been changed to construct a std::string_view directly,
such that one copy less happens.
2024-01-13 19:32:37 +00:00
Cole Helbling
bbcd9fcfc1 Arbitrarily bring back some nix-daemon calls
This means that both `nix daemon` and `nix-daemon` will be (somewhat)
tested.
2024-01-13 11:27:04 -08:00
Robert Hensing
7e5fa5c25c doc/glossary: Define package and package attribute set
A small step towards https://github.com/NixOS/nix/issues/6507

I believe this incomplete definition is one that can be agreed on.
It would be nice to define more, but considering that the issue
also proposes changes to the design, I believe we should hold off
on those.

As for the wording, we're dealing with some very general and vague
terms, that have to be treated with exactly the right amount of
vagueness to be effective.

I start out with a fairly abstract definition of package.
1. to establish a baseline so we know what we're talking about
2. so that we can go in and clarify that we have an extra, Nix-specific
   definition.

"Software" is notoriously ill-defined, so it makes a great qualifier
for package, which we don't really want to pin down either, because
that would just get us lost in discussion.
We can come back to this after we've done 6057 and a few years in a
desert cave.

Then comes the "package attribute set" definition.
I can already hear Valentin say "That's not even Nix's responsibility!"
and on some days I might even agree.
However, in our current reality, we have `nix-env`, `nix-build` and
`nix profile`, which query the `outputName` attribute - among others -
which just don't exist in the derivation.

For those who can't believe what they're reading:

    $ nix-build --expr 'with import ./. {}; bind // {outputName = "lib";}' --no-out-link
    this path will be fetched (1.16 MiB download, 3.72 MiB unpacked):
      /nix/store/rfk6klfx3z972gavxlw6iypnj6j806ma-bind-9.18.21-lib
    copying path '/nix/store/rfk6klfx3z972gavxlw6iypnj6j806ma-bind-9.18.21-lib' from 'https://cache.nixos.org'...
    /nix/store/rfk6klfx3z972gavxlw6iypnj6j806ma-bind-9.18.21-lib

and let me tell you that bind is not a library.

So anyway, that's also proof of why calling this a "derivation attrset" would be wrong, despite the type attribute.
2024-01-13 20:00:06 +01:00
Qyriad
cbd5553d57
doc: provide context in glossary definitions (#9378) 2024-01-13 12:20:08 +01:00
John Ericson
e739a5002d Avoid Windows macros in the parser and lexer
`FLOAT`, `INT`, and `IN` are identifers taken by macros.

The name `IN_KW` is chosen to match `OR_KW`, which is presumably named
that way for the same reason of dodging macros.
2024-01-12 19:51:36 -05:00
John Ericson
381df7b9c9
Merge pull request #9756 from obsidiansystems/readline-on-windows
Newer Nixpkgs, get `readline` on Windows
2024-01-12 19:49:50 -05:00
John Ericson
dd7e7b0a30 Newer Nixpkgs, get readline on Windows
Now `nix repl` an, in principle, work on that platform too.

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/2c9c58e98243930f8cb70387934daa4bc8b00373' (2023-12-31)
  → 'github:NixOS/nixpkgs/86501af7f1d51915e6c335f90f2cab73d7704ef3' (2024-01-11)
2024-01-12 19:19:21 -05:00
John Ericson
3bc1f8f22f
Merge pull request #9752 from 9999years/hacking-filter-tests
Document unit tests in hacking.md
2024-01-12 19:00:19 -05:00
Robert Hensing
15f7bdaf27 CanonPath: Add rel_c_str()
Defensively because isRoot() is also defensive.
2024-01-12 22:55:37 +01:00
Rebecca Turner
f73e50144f
Clarify ambiguity in nix-instantiate man page 2024-01-12 13:53:45 -08:00
Rebecca Turner
2d96c7a51f
Remove outdated reference to y in nix-instantiate man page 2024-01-12 11:27:31 -08:00
Rebecca Turner
b29be1ff57
Document unit tests in hacking.md 2024-01-12 10:47:49 -08:00
John Ericson
c58da62a06
Merge pull request #9737 from obsidiansystems/sys-error-split
Separate `SystemError` from `SysError`
2024-01-12 12:41:36 -05:00
Mel Zuser
1996105e91 added test for empty substring special case 2024-01-12 09:40:21 -08:00
John Ericson
6208ca7209 Separate SystemError from SysError
Most of this is a `catch SysError` -> `catch SystemError` sed. This
is a rather pure-churn change I would like to get out of the way. **The
intersting part is `src/libutil/error.hh`.**

On Unix, we will only throw the `SysError` concrete class, which has
the same constructors that `SystemError` used to have.

On Windows, we will throw `WinError` *and* `SysError`. `WinError`
(which will be created in a later PR), will use a `DWORD` instead of
`int` error value, and `GetLastError()`, which is the Windows equivalent
of the `errno` machinery. Windows will *also* use `SysError` because
Window's "libc" (MSVCRT) implements the POSIX interface, and we use it
too.

As the docs describe, while we *throw* one of the 3 choices above (2
concrete classes or the alias), we should always *catch* `SystemError`.
This ensures no matter how the implementation changes for Windows (e.g.
between `SysError` and `WinError`) the catching logic stays the same
and stays correct.

Co-Authored-By volth <volth@volth.com>
Co-Authored-By Eugene Butler <eugene@eugene4.com>
2024-01-12 12:00:33 -05:00
Mel Zuser
25c889baac Fix performance of builtins.substring for empty substrings
When returning a 0-length substring, avoid calling coerceToString,
since it returns a string_view with the string's length, which is
expensive to compute for large strings.
2024-01-12 08:37:04 -08:00
Robert Hensing
274d887fee fetchTree/git: Cache export-ignore filter 2024-01-12 17:18:56 +01:00
Robert Hensing
d80c582b78 libfetchers: Add CachingFilteringInputAccessor
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2024-01-12 17:16:59 +01:00
Eelco Dolstra
52f949bbf5
Merge pull request #9656 from edolstra/nix-profile-stable-names
Make profile element names stable
2024-01-12 16:59:36 +01:00
Eelco Dolstra
72560f7bbe Add profile migration test 2024-01-12 16:33:15 +01:00
Eelco Dolstra
8c7e2ed77c Update release notes 2024-01-12 16:21:07 +01:00
Robert Hensing
f68ad5acbb fetchTree/git: Don't expose exportIgnore attr 2024-01-12 16:05:36 +01:00