1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00
Commit graph

9424 commits

Author SHA1 Message Date
Eelco Dolstra c257c82447 Cleanup 2023-11-14 14:47:17 +01:00
Eelco Dolstra 7f576f5dfe Rename UnionInputAccessor to MountedInputAccessor 2023-11-14 14:02:57 +01:00
Eelco Dolstra 21140c987b Fix doxygen comments 2023-11-14 14:02:57 +01:00
Eelco Dolstra 4329bdf6a3 Move comment 2023-11-14 14:02:57 +01:00
Eelco Dolstra 25cf8f1071
src/libfetchers/union-input-accessor.cc: Apply suggestion
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-11-14 13:57:24 +01:00
Eelco Dolstra 38b07d6347
src/libfetchers/git.cc: Apply suggestion
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-11-14 13:38:03 +01:00
Eelco Dolstra d74d2fdaa7 Move statusCallbackTrampoline 2023-11-14 13:35:26 +01:00
Eelco Dolstra 21bb180547 Use libgit2 with ssh-exec support
See https://github.com/libgit2/libgit2/pull/6617. This ensures that we
get support for ~/.ssh/config, known_hosts etc.
2023-11-14 13:30:51 +01:00
Eelco Dolstra cf59ea83ec configure: Check for libgit2 2023-11-10 13:58:59 +01:00
Eelco Dolstra 98a120b8b8 Merge remote-tracking branch 'origin/master' into libgit2 2023-11-09 16:48:41 +01:00
Robert Hensing 12953b942c
Fixup docs 2023-11-09 07:08:56 +01:00
John Ericson f0adb72c23 Mark fetchTree as unstable again
As discussed in our last meeting, we need a bit more time, but we are
"time boxing" the work left to do to ensure there is not unbounded
delay.

Rather than putting it back underneath `flakes`, though, put it
underneath its own `fetch-tree` experimental feature (which `flakes`
includes/implies). This signals our commitment to the plan to stabilize
it first without waiting to go through the rest of Flakes, and also will
give users a "release candidate" when we get closer to stabilization.

This reverts commit 4112dd1fc9.
2023-11-08 23:23:56 -05:00
John Ericson d854e8696b Specify the size of the experimental feature array in a more robust way
See doc comment for details.
2023-11-08 22:58:10 -05:00
Jacek Galowicz df8bfe84cc Fix consts and casts 2023-11-08 17:29:55 +01:00
Jacek Galowicz c581143e0c Use structured binding for json iteration 2023-11-08 17:29:55 +01:00
Jacek Galowicz 77dceb2844 Drop obsolete assert and cast 2023-11-08 17:29:55 +01:00
Jacek Galowicz 6a47629530 Fix initialization of struct members (wrong order) 2023-11-08 17:29:55 +01:00
Robert Hensing ab69dc4da3 Test parseShebangContent round trip 2023-11-07 13:24:01 -05:00
Robert Hensing 589d338776 parseShebangs: Make strings with backtick sequences representable 2023-11-07 13:24:01 -05:00
Robert Hensing ffd414eb75 Fix nix shebang interaction with #8131 overhaul completions 2023-11-07 13:24:01 -05:00
Robert Hensing e91fd837ee Move shebang docs from rl-next to nix.md 2023-11-07 13:24:01 -05:00
Robert Hensing 51bb69535b nix/installables.cc: Use getCommandBaseDir() where possible
These usages of the working directory are perhaps unlikely to
interact with shebangs, but the code is more consistent this way,
and we're less likely to miss usages that do interact.
2023-11-07 13:24:01 -05:00
Robert Hensing 466271568b nix: Parse --file relative to shebang script 2023-11-07 13:24:01 -05:00
Robert Hensing 198bc22e3b nix: Add command baseDir to parse --expr relative to shebang script 2023-11-07 13:24:01 -05:00
Robert Hensing 20ff61ab25 nix: Reserve shebang line syntax and only parse double backtick quotes
Being restrictive about syntax leaves opportunity to improve the
syntax and functionality later.
2023-11-07 13:24:01 -05:00
Robert Hensing cc68ed8ff7 libcmd: lookupFileArg(): add baseDir
This will allow a different base directory to be used, matching
a shebang script location instead of the working directory.
2023-11-07 13:24:01 -05:00
Tom Bereknyei bbeddf0602 fix: refactor parseCmdline interface 2023-11-07 13:24:01 -05:00
Tom Bereknyei e6ed729243 doc: remove reference to nix-shell 2023-11-07 13:24:01 -05:00
Tom Bereknyei 06f3583b1c feat: break out of shebang processing for non-comments 2023-11-07 13:24:01 -05:00
Tom Bereknyei 01f61cefcb Read file incrementally 2023-11-07 13:24:01 -05:00
Tom Bereknyei bfcbf3b5bf doc: shebang release notes, docs, tests
fix: release notes
2023-11-07 13:24:01 -05:00
Eelco Dolstra 5f9b5758b6 src/libutil/util.hh: Formatting 2023-11-07 13:24:01 -05:00
Tom Bereknyei 74210c12fe Shellbang support with flakes
Enables shebang usage of nix shell. All arguments with `#! nix` get
added to the nix invocation. This implementation does NOT set any
additional arguments other than placing the script path itself as the
first argument such that the interpreter can utilize it.

Example below:

```
    #!/usr/bin/env nix
    #! nix shell --quiet
    #! nix nixpkgs#bash
    #! nix nixpkgs#shellcheck
    #! nix nixpkgs#hello
    #! nix --ignore-environment --command bash
    # shellcheck shell=bash
    set -eu
    shellcheck "$0" || exit 1
    function main {
        hello
        echo 0:"$0" 1:"$1" 2:"$2"
    }
    "$@"
```

fix: include programName usage

EDIT: For posterity I've changed shellwords to shellwords2 in order
      not to interfere with other changes during a rebase.
      shellwords2 is removed in a later commit. -- roberth
2023-11-07 13:24:01 -05: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
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
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