Commit graph

15311 commits

Author SHA1 Message Date
Ana Hobden
867f894289 Populate $XDG_DATA_DIRS with appropriate folder from Nix profile
On non-NixOS systems, the default `nix` install does not populate the
`$XDG_DATA_DIRS`. This populates it and enables things like bash-completion
and `.desktop` file detection for `nix` profile installed packages.

Signed-off-by: Ana Hobden <operator@hoverbear.org>
2023-11-06 20:43:27 +01:00
Mel Zuser
61d6fe059e
Fix boost::bad_format_string exception in builtins.addErrorContext (#9291)
* Fix boost::bad_format_string exception in builtins.addErrorContext

The message passed to addTrace was incorrectly being used as a format
string and this this would cause an exception when the string contained
a '%', which can be hit in places where arbitrary file paths are
interpolated.

* add test
2023-11-06 19:13:40 +00:00
Robert Hensing
1fa87c6aa8
Merge pull request #9283 from obsidiansystems/mememory-source-accessor
Factor out `MemorySourceAccessor`, implement missing features
2023-11-06 19:51:02 +01:00
John Ericson
dcc49744ed
Merge pull request #9293 from ThinkChaos/ssh-misc-improvments
SSH small improvments
2023-11-06 13:33:51 -05:00
John Ericson
dea63bb810
Merge pull request #9299 from tfc/config-improvements
Improvements in src/libutil/config.*
2023-11-06 13:03:54 -05:00
Théophane Hufschmitt
06d0d51895
Merge pull request #9242 from obsidiansystems/path-info-map
Make `nix path-info --json` return an object not array
2023-11-06 18:00:42 +01:00
John Ericson
cc46ea1630 Make nix path-info --json return an object not array
Before it returned a list of JSON objects with store object information,
including the path in each object. Now, it maps the paths to JSON
objects with the metadata sans path.

This matches how `nix derivation show` works.

Quite hillariously, none of our existing functional tests caught this
change to `path-info --json` though they did use it. So just new
functional tests need to be added.
2023-11-06 11:06:31 -05:00
John Ericson
a7212e169b Include compression in the NarInfo JSON format
It was forgotten before.
2023-11-06 11:06:31 -05:00
John Ericson
937e02e7b9 Shuffle ValidPathInfo JSON rendering
`Store::pathInfoToJSON` was a rather baroque functions, being full of
parameters to support both parsed derivations and `nix path-info`. The
common core of each, a simple `dValidPathInfo::toJSON` function, is
factored out, but the rest of the logic is just duplicated and then
specialized to its use-case (at which point it is no longer that
duplicated).

This keeps the human oriented CLI logic (which is currently unstable)
and the core domain logic (export reference graphs with structured
attrs, which is stable), separate, which I think is better.
2023-11-06 11:06:31 -05:00
Jacek Galowicz
a4b7df7bfa More const, scope reductions, move fixes 2023-11-06 16:00:25 +01:00
Jacek Galowicz
f404e9b3b3 Make toJSONObject const 2023-11-06 16:00:25 +01:00
Jacek Galowicz
ad385f9ec4 Minor improvements 2023-11-06 16:00:25 +01:00
Jacek Galowicz
07ac53732b Fix moves in appendOrSet 2023-11-06 16:00:25 +01:00
John Ericson
0b0d1b5214 Add comparison functions for NarInfo
We will need these for tests.
2023-11-06 09:51:21 -05:00
ThinkChaos
2fb49759b8
fix(ssh): log first line of stdout
Spent a while debugging why `nix-copy-closure` wasn't working anymore
and it was my shell RC printing something I added for debug.
Hopefully this can save someone else some time.
2023-11-06 08:46:19 -05:00
ThinkChaos
6472c3bf0d
fix(ssh): extraneous master processes 2023-11-06 08:45:14 -05:00
Eelco Dolstra
28dddde0ac
Merge pull request #9225 from drupol/nixpkgs-pr-107251/make-gnutar-reproducible
fix: make sure `tar` reproducibility flags are set
2023-11-06 10:51:42 +01:00
Robert Hensing
1a14ce8381
Merge pull request #8920 from obsidiansystems/split-util-cchh
Split up `util.{hh,cc}`
2023-11-05 21:53:11 +01:00
John Ericson
ac89bb064a Split up util.{hh,cc}
All OS and IO operations should be moved out, leaving only some misc
portable pure functions.

This is useful to avoid copious CPP when doing things like Windows and
Emscripten ports.

Newly exposed functions to break cycles:

 - `restoreSignals`
 - `updateWindowSize`
2023-11-05 12:20:02 -05:00
John Ericson
2678b51b31 Narrower scope for nativeSystem
I don't think we need a CPP defininition and a header entry, and this
way allows constant expression elimination.
2023-11-05 12:18:28 -05:00
John Ericson
9b880e3e29 Factor out MemorySourceAccessor, implement missing features
The new `MemorySourceAccessor` rather than being a slightly lossy flat
map is a complete in-memory model of file system objects.

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2023-11-04 15:24:20 -04:00
Valentin Gagarin
8e222fbb12
Merge pull request #8848 from BootRhetoric/flake-authentication 2023-11-04 00:23:28 +01:00
BootRhetoric
271932782d
fetchGit and flake: add commit signature verification tests
This adds simple tests of the commit signature verification mechanism of
fetchGit and its flake input wrapper.
OpenSSH is added to the build dependencies since it's needed to create
a key when testing the functionality. It is neither a built- nor a
runtime dependency.
2023-11-03 20:23:31 +01:00
BootRhetoric
098f0615c9
fetchGit and flake: add publicKeys list input
This adds publicKeys as an optional fetcher input attribute to flakes
and builtins.fetchGit to provide a nix interface for the json-encoded
`publicKeys` attribute of the git fetcher.

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-11-03 20:23:31 +01:00
BootRhetoric
6df32889a5
Add git commit verification input attributes
This implements the git input attributes `verifyCommit`, `keytype`,
`publicKey` and `publicKeys` as experimental feature
`verified-fetches`. `publicKeys` should be a json string.
This representation was chosen because all attributes must be of type bool,
int or string so they can be included in flake uris (see definition of
fetchers::Attr).
2023-11-03 20:15:12 +01:00
Robert Hensing
66cb364f58
Merge pull request #9289 from edolstra/fix-warnings
Fix gcc warnings
2023-11-03 12:41:52 +01:00
Eelco Dolstra
b0455e9931 Fix uninitialized variable warnings on i686-linux
https://hydra.nixos.org/build/239849607
2023-11-03 12:04:20 +01:00
Eelco Dolstra
55dd1244d2 parseDerivation(): Fix warning about uninitialized 'version' variable 2023-11-03 12:04:20 +01:00
Eelco Dolstra
e9a857e418
Merge pull request #9288 from edolstra/fix-nar-access-test
Fix nar-access test on macOS
2023-11-03 11:39:48 +01:00
Eelco Dolstra
e5908212e2 Fix nar-access test on macOS 2023-11-03 11:03:58 +01:00
John Ericson
727ada1a41
Merge pull request #9268 from obsidiansystems/systematize-characterization-tests
Systematize characterization tests a bit more
2023-11-02 12:38:28 -04:00
John Ericson
d15c3a33e6 Don't use std::invocable C++ concept yet
It s not supported on all platforms yet. Can revert this once it is.
2023-11-02 12:06:29 -04:00
John Ericson
b107431816 Systematize characterization tests a bit more
Deduplicating code moreover enforcing the pattern means:

 - It is easier to write new characterization tests because less boilerplate

 - It is harder to mess up new tests because there are fewer places to
   make mistakes.

Co-authored-by: Jacek Galowicz <jacek@galowicz.de>
2023-11-02 12:06:08 -04:00
John Ericson
1e61c007be
Merge pull request #9234 from fricklerhandwerk/doc-style-examples
styleguide: add note on highlighting examples and syntax definitions
2023-11-02 09:49:38 -04:00
John Ericson
7f56ed8b90
Merge pull request #9207 from fricklerhandwerk/doc-store-path
document store paths
2023-11-02 09:48:18 -04:00
John Ericson
8c99d40cac
Merge pull request #9232 from fricklerhandwerk/doc-store-object
document store objects in terms of their constituent parts
2023-11-02 09:45:48 -04:00
John Ericson
90de958637
Merge pull request #9265 from obsidiansystems/better-parse-sink
Make `ParseSink` a bit better
2023-11-02 09:28:29 -04:00
Eelco Dolstra
5223114c93
Merge pull request #9269 from edolstra/unify-accessor
Unify `FSAccessor` and `SourceAccessor`
2023-11-02 14:23:10 +01:00
Eelco Dolstra
d26c317b14
Use expect
Co-authored-by: John Ericson <git@JohnEricson.me>
2023-11-02 13:40:54 +01:00
Robert Hensing
a80fb9fa39
Merge pull request #9277 from keszybz/file-permissions
Remove stray executable permissions on source files
2023-11-02 13:19:38 +01:00
Zbigniew Jędrzejewski-Szmek
55ed09c4f2 Remove stray executable permissions on source files
Noticed because of a warning during an rpm build:
*** WARNING: ./usr/src/debug/nix-2.18.1-1.fc40.x86_64/src/nix-copy-closure/nix-copy-closure.cc is executable but has no shebang, removing executable bit
*** WARNING: ./usr/src/debug/nix-2.18.1-1.fc40.x86_64/src/nix-channel/nix-channel.cc is executable but has no shebang, removing executable bit
2023-11-02 09:24:21 +01:00
Valentin Gagarin
d7b7a79f3e document store paths
update the glossary to point to the new page.

since this is a cross-cutting concern, it warrants its own section in
the manual.

Co-authored-by: John Ericson <git@JohnEricson.me>
2023-11-02 06:01:51 +01:00
Valentin Gagarin
4ba8b182be document store objects in terms of their constituent parts
this also rephrases the introductory sentence to be more general, in order to
avoid the same word being repeated in short succession.
2023-11-02 06:01:30 +01:00
John Ericson
12f9719162
Merge pull request #9250 from fricklerhandwerk/fix-anchors
fix anchor in conf-file
2023-11-01 21:30:22 -04:00
John Ericson
d7710a40be flake: Temporarily get Nixpkgs ahead of Hydra
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/31ed632c692e6a36cfc18083b88ece892f863ed4' (2023-09-21)
  → 'github:NixOS/nixpkgs/9eb24edd6a0027fed010ccfe300a9734d029983c' (2023-11-01)
2023-11-01 20:09:55 -04:00
Eelco Dolstra
e47984ce0b
Fix whitespace
Co-authored-by: John Ericson <git@JohnEricson.me>
2023-11-01 20:19:08 +01:00
John Ericson
8d66346293
Merge pull request #9271 from keszybz/if-fix
fix: gcc complains about if which doesn't guard the indented statement
2023-11-01 14:02:33 -04:00
Zbigniew Jędrzejewski-Szmek
eab9292738 fix: gcc complains about if which doesn't guard the indented statement 2023-11-01 18:10:06 +01:00
Eelco Dolstra
2f5c1a27dc LocalStoreAccessor: Reuse PosixSourceAccessor 2023-11-01 17:22:25 +01:00
Eelco Dolstra
1a902f5fa7 Merge FSAccessor into SourceAccessor 2023-11-01 17:09:28 +01:00