Commit graph

12006 commits

Author SHA1 Message Date
Eelco Dolstra
f450edc78b
Merge pull request #6104 from rrbutani/master
Fix formatting for options with "machine-specific" defaults
2022-02-16 10:47:51 +01:00
Rahul Butani
d82cf4a016
manual: fix formatting for options with "machine-specific" defaults 2022-02-15 15:44:05 -06:00
Taeer Bar-Yam
f3a2940e70 add descriptive output when creating templates
this includes a `welcomeText` attribute which can be set in the
template, as well as outputing which files were created.
2022-02-15 11:50:14 -05:00
Gabriel Fontes
72e8f94081
add sourcehut input scheme 2022-02-14 23:53:01 -03:00
Eelco Dolstra
94992a9196
Merge pull request #6100 from edolstra/installables-cleanup
InstallableFlake: Default attr paths cleanup
2022-02-14 22:06:11 +01:00
Eelco Dolstra
023e459777 InstallableFlake: Default attr paths cleanup
This removes some duplicated logic, and fixes "nix bundle" parsing its
installable twice.
2022-02-14 21:06:11 +01:00
Eelco Dolstra
744a101a36
Merge pull request #6092 from Kha/sandbox-wo-userns
Fix using sandbox without user namespaces
2022-02-14 11:40:08 +01:00
Sebastian Ullrich
c437e1326d Fix using sandbox without user namespaces 2022-02-12 16:28:36 +01:00
Eelco Dolstra
4d67ecbbb2
Merge pull request #6085 from edolstra/fix-flake-defaults
parseInstallables(): Don't try the flake attr path prefixes when no fragment is specified
2022-02-11 18:00:00 +01:00
Eelco Dolstra
36845dc9a3
Merge pull request #6086 from tomberek/profile_remove
profile: add verbosity
2022-02-11 16:47:11 +01:00
Tom Bereknyei
270fb5f192 profile: add verbosity
warn if there are no matches and give notice of removing packages as
they are found
2022-02-11 10:44:33 -05:00
Eelco Dolstra
cdc90c2776 parseInstallables(): Don't try the flake attr path prefixes when no fragment is specified
Fixes #5880.
2022-02-11 15:50:12 +01:00
Eelco Dolstra
d2f9a081b8 flake.nix: Fix indent 2022-02-11 14:45:46 +01:00
Eelco Dolstra
5b809f9e0e check-hydra-status.sh: Ignore unfinished builds 2022-02-10 21:15:07 +01:00
Maximilian Bosch
5b586575ac
nix/why-depends: fix output when not using --precise
On Nix 2.6 the output of `nix why-depends --all` seems to be somewhat
off:

    $ nix why-depends /nix/store/kn47hayxab8gc01jhr98dwyywbx561aq-nixos-system-roflmayr-21.11.20220207.6c202a9.drv /nix/store/srn5jbs1q30jpybdmxqrwskyny659qgc-nix-2.6.drv --derivation  --extra-experimental-features nix-command  --all
    /nix/store/kn47hayxab8gc01jhr98dwyywbx561aq-nixos-system-roflmayr-21.11.20220207.6c202a9.drv
        └───/nix/store/g8bpgfjhh5vxrdq0w6r6s64f9kkm9z6c-etc.drv
        │   └───/nix/store/hm0jmhp8shbf3cl846a685nv4f5cp3fy-nspawn-inst.drv
        | [...]
            └───/nix/store/2d6q3ygiim9ijl5d4h0qqx6vnjgxywyr-system-units.drv
                └───/nix/store/dil014y1b8qyjhhhf5fpaah5fzdf0bzs-unit-systemd-nspawn-hydra.service.drv
                    └───/nix/store/a9r72wwx8qrxyp7hjydyg0gsrwnn26zb-activate.drv
                        └───/nix/store/99hlc7i4gl77wq087lbhag4hkf3kvssj-nixos-system-hydra-21.11pre-git.drv

Please note that `[...]-system-units.drv` is supposed to be a direct
child of `[...]-etc.drv`.

The reason for that is that each new level printed by `printNode` is
four spaces off in comparison to `nix why-depends --precise` because the
recursive `printNode()` only prints the path and not the `tree*`-chars in
the case of `--precise` and in this format the path is four spaces further
indented, i.e. on a newline, but on the same level as the path's children, i.e.

    /nix/store/kn47hayxab8gc01jhr98dwyywbx561aq-nixos-system-roflmayr-21.11.20220207.6c202a9.drv
    └───/: …1-p8.drv",["out"]),("/nix/store/g8bpgfjhh5vxrdq0w6r6s64f9kkm9z6c-etc.drv",["out"]),("/nix/store/…
        → /nix/store/g8bpgfjhh5vxrdq0w6r6s64f9kkm9z6c-etc.drv

As you can see `[...]-etc.drv` is a direct child of the root, but four
spaces indented. This logic was directly applied to the code-path with
`precise=false` which resulted in `tree*` being printed four spaces too
deep.

In case of no `--precise`, `hits[hash]` is empty and the path itself
should be printed rather than hits using the same logic as for `hits[hash]`.

With this fix, the output looks correct now:

    /nix/store/kn47hayxab8gc01jhr98dwyywbx561aq-nixos-system-roflmayr-21.11.20220207.6c202a9.drv
    └───/nix/store/g8bpgfjhh5vxrdq0w6r6s64f9kkm9z6c-etc.drv
        ├───/nix/store/hm0jmhp8shbf3cl846a685nv4f5cp3fy-nspawn-inst.drv
        | [...]
        └───/nix/store/2d6q3ygiim9ijl5d4h0qqx6vnjgxywyr-system-units.drv
            └───/nix/store/dil014y1b8qyjhhhf5fpaah5fzdf0bzs-unit-systemd-nspawn-hydra.service.drv
                └───/nix/store/a9r72wwx8qrxyp7hjydyg0gsrwnn26zb-activate.drv
                    └───/nix/store/99hlc7i4gl77wq087lbhag4hkf3kvssj-nixos-system-hydra-21.11pre-git.drv
2022-02-10 14:26:00 +01:00
Eelco Dolstra
b8d57e2883 check-hydra-status.sh: Improve error behaviour 2022-02-10 11:10:58 +01:00
Eelco Dolstra
52f52319ad
Merge pull request #6067 from trofi/revert-6060-prefer-inplace-libs
Revert "mk: prefert inplace library paths to system ones (take 2)"
2022-02-09 14:24:54 +01:00
Sergei Trofimovich
28b9bd784c
Revert "mk: prefert inplace library paths to system ones (take 2)" 2022-02-09 13:00:53 +00:00
Eelco Dolstra
0b3d8e1a29
Merge pull request #6060 from trofi/prefer-inplace-libs
mk: prefert inplace library paths to system ones (take 2)
2022-02-08 19:49:21 +01:00
Sergei Trofimovich
579dcbabd5 mk: prefert inplace library paths to system ones (take 2)
It's a second attempt to merge the change. Previous attempt
was reverted in b976b34a5b.
Since then underlying failure exposed by original change was
fixed by https://github.com/NixOS/nix/pull/5354.

Below goes description of original change:

The link failure happens on a system with stable nix-2.3.15
installed in /usr/lib64 (it's libutil.so API differs from master):

```
LANG=C make V=1
g++ -o /home/slyfox/dev/git/nix/src/libstore/libnixstore.so \
    -shared -L/usr/lib64 -Wl,--no-copy-dt-needed-entries \
    src/libstore/binary-cache-store.o ... src/libstore/uds-remote-store.o \
    -lsqlite3 -lcurl -lsodium -pthread -ldl -lseccomp -Wl,-z,defs -Wl,-soname=libnixstore.so
      -Wl,-rpath,/home/slyfox/dev/git/nix/src/libutil -Lsrc/libutil -lnixutil
ld: src/libstore/binary-cache-store.o: in function `nix::BinaryCacheStore::BinaryCacheStore(
    std::map<std::__cxx11::basic_string<char, std::char_traits<char>, ...
nix/src/libstore/binary-cache-store.cc:30: undefined reference to `nix::readFile(
    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ...
...
```

This happens due to `-L/usr/lib64 -Lsrc/libutil` search path ordering.
The change turns it into `-Lsrc/libutil -L/usr/lib64`.

Closes: https://github.com/NixOS/nix/issues/3087
2022-02-07 23:39:33 +00:00
Eelco Dolstra
7c64a9dfd4
Merge pull request #6054 from lincolnauster/lf-reporterr
repl/load-flake: throw error if path isn't specified
2022-02-07 20:44:10 +01:00
Eelco Dolstra
725817c223
Merge pull request #6057 from trofi/fix-daemon-crashes
Make sure no exceptions leave ignoreException()
2022-02-07 20:42:19 +01:00
Sergei Trofimovich
3ec02deb20 Make sure no exceptions leave ignoreException()
I noticed that occasional Ctrl-C leaves *.lock files around.
`nix-daemon`'s journal logs contained crashes like:

    nix-daemon[30416]: terminate called after throwing an instance of 'nix::SysError'
    nix-daemon[30416]:   what():  error: writing to file: Broken pipe

And core dump backtraces pointed at `teriminate()` call from
destructors:

    ...
    _Unwind_Resume ()
    nix::ignoreException() ()
    nix::LocalDerivationGoal::~LocalDerivationGoal()
    ...

    void ignoreException()
    {
        try {
            throw;
        } catch (std::exception & e) {
            printError("error (ignored): %1%", e.what());
        }
    }

The crashes happen when client side closes early and printError() throws
an IO error.

The change wraps `ignoreException()` into blanket `try { ... } catch (...) {}`.

Closes: https://github.com/NixOS/nix/issues/6046
2022-02-07 16:20:56 +00:00
lincoln auster
b1abfcd0c2
fix markup
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2022-02-07 08:35:50 -07:00
Eelco Dolstra
97e02c23bd Fix 'basic_string::_M_construct null not valid' in interrupted download
Fixes #5985.
2022-02-07 10:53:47 +01:00
lincoln auster [they/them]
c23501a3b2 repl/load-flake: throw error if path isn't specified 2022-02-06 16:29:42 -07:00
Robert Hensing
c3b942e0fc Don't hold interruptCallbacks lock during interrupt handling
This changes the representation of the interrupt callback list to
be safe to use during interrupt handling.

Holding a lock while executing arbitrary functions is something to
avoid in general, because of the risk of deadlock.

Such a deadlock occurs in https://github.com/NixOS/nix/issues/3294
where ~CurlDownloader tries to deregister its interrupt callback.

This happens during what seems to be a triggerInterrupt() by the
daemon connection's MonitorFdHup thread. This bit I can not confirm
based on the stack trace though; it's based on reading the code,
so no absolute certainty, but a smoking gun nonetheless.
2022-02-06 13:53:28 +01:00
Eelco Dolstra
4369771870
Merge pull request #6040 from matthewbauer/allow-missing-override-input
Allow missing flake.nix for --override-input target
2022-02-06 13:22:41 +01:00
Eelco Dolstra
3b64569601
Merge pull request #6047 from SuperSandro2000/nix-shell-BASH
nix-shell: set BASH variable to correct shell
2022-02-06 13:19:52 +01:00
Eelco Dolstra
93293fc66b
Merge pull request #6042 from pennae/fix-repl-a
fix nix repl not overriding existing bindings in :a
2022-02-06 13:17:58 +01:00
Eelco Dolstra
9148be6bfc
Merge pull request #6043 from Ma27/fix-comp
completions: pipe stderr to /dev/null
2022-02-06 13:17:05 +01:00
Sandro Jäckel
45eeb2fd6a
nix-shell: set BASH variable to correct shell 2022-02-05 17:56:51 +01:00
Maximilian Bosch
9d840758a8
completions: pipe stderr to /dev/null
This fixes weird issues where e.g.

    nix build -L .#<tab>

deletes the current line from the prompt.
2022-02-04 22:43:16 +01:00
pennae
1daf1babf9 fix nix repl not overriding existing bindings in :a
previously :a would override old bindings of a name with new values if the added
set contained names that were already bound. in nix 2.6 this doesn't happen any
more, which is potentially confusing.

fixes #6041
2022-02-04 15:27:59 +01:00
Matthew Bauer
f222fba4dc Allow missing flake.nix for --override-input target
At this point, we don’t know if the input is a flake or not. So, we
should allow the user to override the input with a directory without a
flake.nix.

Ideally, we could figure whether the input was originally a flake or
not, but that would require instantiating the whole flake. So just
allow it to be missing here, and rely on checks later on to verify the
input for us.
2022-02-03 20:51:47 -06:00
Eelco Dolstra
bd383d1b6f Make most calls to determinePos() lazy 2022-02-04 00:33:21 +01:00
Eelco Dolstra
4c755c3b3f Merge branch 'issue-3505' of https://github.com/kamadorueda/nix 2022-02-04 00:33:13 +01:00
Eelco Dolstra
1aa5994e6d
Merge pull request #5456 from tomberek/bundler_drv
bundle: pass drv attrset instead of path
2022-02-03 23:40:20 +01:00
tomberek
12ff354d01
Merge branch 'master' into bundler_drv 2022-02-03 02:39:18 -05:00
Eelco Dolstra
fcb33440b6
Merge pull request #6036 from tweag/balsoft/and-yet-another-follows-bugfix
Flake follows: resolve all follows to absolute
2022-02-02 22:52:08 +01:00
Alexander Bantyev
169ea0b83f
Flake follows: resolve all follows to absolute
It's not possible in general to know in computeLocks, relative to
which path the follows was intended to be. So, we always resolve
follows to their absolute states when we encounter them (which can
either be in parseFlakeInput or computeLocks' fake input population).

Fixes https://github.com/NixOS/nix/issues/6013
Fixes https://github.com/NixOS/nix/issues/5609
Fixes https://github.com/NixOS/nix/issues/5697 (again)
2022-02-02 21:41:45 +03:00
Eelco Dolstra
17e3f353df Merge branch 'parser-improvements' of https://github.com/pennae/nix 2022-02-02 12:45:44 +01:00
Eelco Dolstra
cd35bbbeef Merge branch 'more-stringviews' of https://github.com/pennae/nix 2022-02-02 12:38:37 +01:00
Eelco Dolstra
73d5f38a47 Require lowdown 0.9.0
Fixes #6021.
2022-02-01 10:44:19 +01:00
Eelco Dolstra
59b6afec07
Merge pull request #6022 from thkoch2001/fix-lowdown_libs
use LOWDOWN_LIBS variable
2022-01-31 13:40:54 +01:00
Eelco Dolstra
cc730bd46b
Merge pull request #5990 from lincolnauster/flakes-nixconfig-docs
flakes: document nixConfig option
2022-01-31 10:21:15 +01:00
Thomas Koch
43509cc69d use LOWDOWN_LIBS variable
fixes: #5931
2022-01-30 20:59:58 +02:00
Eelco Dolstra
08fc3d6552
Merge pull request #6018 from dtzWill/fix/issue-6017
canonPath: fix missing slash when resolving links
2022-01-30 12:32:02 +01:00
Eelco Dolstra
8915f16aab
Merge pull request #6019 from thkoch2001/fix_spelling_mistakes
fix spelling mistakes reported by Debian's lintian tool
2022-01-30 12:31:16 +01:00
Thomas Koch
85b1427662 fix spelling mistakes reported by Debian's lintian tool 2022-01-30 10:51:39 +02:00