Eelco Dolstra
61216d32e1
Add 'nix store repair' command
2021-01-13 23:27:39 +01:00
Eelco Dolstra
3da9a9241c
Convert option descriptions to Markdown
2021-01-13 14:18:04 +01:00
Eelco Dolstra
4e9cec79bf
Merge pull request #4444 from matthewbauer/unset-curproc-arch-affinity
...
Set kern.curproc_arch_affinity=0 to escape Rosetta
2021-01-13 12:16:53 +01:00
Eelco Dolstra
fbfa70dc02
Merge pull request #4443 from rickynils/prefer-local-build-respect-zero-max-jobs
...
Don't let 'preferLocalBuild' override 'max-jobs=0'
2021-01-13 12:15:54 +01:00
Rickard Nilsson
0ca1a50132
Remove a redundant condition in DerivationGoal::tryLocalBuild()
2021-01-13 10:13:51 +01:00
Eelco Dolstra
2f463e90ed
Add 'nix profile history' command
...
Replaces 'nix-env --list-generations'. Similar to 'nix profile
diff-closures' but shows only the changes in top-level packages.
2021-01-12 23:53:53 +01:00
Eelco Dolstra
29007f8bc6
nix profile info -> nix profile list
2021-01-12 19:57:05 +01:00
Matthew Bauer
f69820417f
Set kern.curproc_arch_affinity=0 to escape Rosetta
...
By default, once you enter x86_64 Rosetta 2, macOS will try to run
everything in x86_64. So an x86_64 Nix will still try to use x86_64
even when system = aarch64-darwin. To avoid this we can set
kern.curproc_arch_affinity sysctl. With kern.curproc_arch_affinity=0,
we ignore this preference.
This is based on how
https://opensource.apple.com/source/system_cmds/system_cmds-880.40.5/arch.tproj/arch.c.auto.html
works. Completely undocumented, but seems to work!
Note, you can verify this works with this impure Nix expression:
```
{
a = derivation {
name = "a";
system = "aarch64-darwin";
builder = "/bin/sh";
args = [ "-e" (builtins.toFile "builder" ''
[ "$(/usr/bin/arch)" = arm64 ]
[ "$(/usr/bin/arch -arch x86_64 /bin/sh -c /usr/bin/arch)" = i386 ]
[ "$(/usr/bin/arch -arch arm64 /bin/sh -c /usr/bin/arch)" = arm64 ]
/usr/bin/touch $out
'') ];
};
b = derivation {
name = "b";
system = "x86_64-darwin";
builder = "/bin/sh";
args = [ "-e" (builtins.toFile "builder" ''
[ "$(/usr/bin/arch)" = i386 ]
[ "$(/usr/bin/arch -arch x86_64 /bin/sh -c /usr/bin/arch)" = i386 ]
[ "$(/usr/bin/arch -arch arm64 /bin/sh -c /usr/bin/arch)" = arm64 ]
/usr/bin/touch $out
'') ];
};
}
```
2021-01-11 22:40:21 -06:00
Rickard Nilsson
44fd7a05b6
Don't let 'preferLocalBuild' override 'max-jobs=0'
...
This resolves #3810 by changing the behavior of `max-jobs = 0`, so
that specifying the option also avoids local building of derivations
with the attribute `preferLocalBuild = true`.
2021-01-12 01:28:00 +01:00
Eelco Dolstra
6254b1f5d2
Add 'nix store delete' command
2021-01-11 19:46:59 +01:00
Eelco Dolstra
93ad6430ed
nix store prefetch-tarball -> nix flake prefetch
2021-01-11 12:36:39 +01:00
Eelco Dolstra
7480f2bf20
Merge pull request #4435 from DanilaFe/flake-input-types
...
Allow Flake inputs to accept boolean and integer attributes
2021-01-11 11:38:53 +01:00
Eelco Dolstra
fdcd62eec5
Add 'nix store gc' command
2021-01-10 23:29:14 +01:00
Danila
1db3f84bac
Upcase "Boolean" in Flake attribute type error
...
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2021-01-08 16:12:21 -08:00
Eelco Dolstra
e21aee58f6
Fix tests
2021-01-08 14:17:06 +01:00
Eelco Dolstra
17beae299d
Support binary unit prefixes in command line arguments
2021-01-08 12:51:19 +01:00
Eelco Dolstra
6548b89cc4
string2Int(): Return std::optional
2021-01-08 12:22:21 +01:00
Eelco Dolstra
29a445840a
Remove unused mkFlag1
2021-01-08 11:42:44 +01:00
Eelco Dolstra
1d4954e73e
Remove mkFlag integer specialisation
2021-01-08 11:40:36 +01:00
Eelco Dolstra
48a9be2aab
Remove mkIntFlag
2021-01-08 10:44:55 +01:00
Danila Fedorin
ba0f841a07
Use switch statement instead of sequence of ifs
2021-01-08 03:13:42 +00:00
Danila Fedorin
93f1678ec6
Allow Flake inputs to accept boolean and integer attributes
...
I believe that this makes it possible to do things like
Git inputs with submodules, but it also likely applies
to other input types from libfetchers.
2021-01-08 01:53:57 +00:00
Eelco Dolstra
0813350349
Add 'nix store prefetch-{file,tarball}'
...
These replace nix-prefetch-url and nix-prefetch-url --unpack,
respectively.
2021-01-07 21:51:46 +01:00
Eelco Dolstra
0df69d96e0
Make sodium a required dependency
2021-01-06 17:56:53 +01:00
Eelco Dolstra
9374c2baea
Add commands for generating secret/public keys
2021-01-06 17:49:31 +01:00
Eelco Dolstra
555152ffe8
crypto.cc: API cleanup and add generate() / to_string() methods
2021-01-06 17:04:46 +01:00
Eelco Dolstra
146af4ee9b
Move sodium_init() call
2021-01-06 16:43:09 +01:00
Eelco Dolstra
3edcb198e5
Merge pull request #4310 from matthewbauer/rosetta2-extra-platforms
...
Add x86_64-darwin and aarch64 to "extra-platforms" automatically when Rosetta2 is detected
2021-01-06 11:31:13 +01:00
Eelco Dolstra
8af4f886e2
Fix deadlock in LocalStore::addSignatures()
...
Fixes #4367 .
2021-01-05 11:47:29 +01:00
Danila Fedorin
988dd0a65f
Fix conversion from JSON to fetch attributes
...
It appears as through the fetch attribute, which
is simply a variant with 3 elements, implicitly
converts boolean arguments to integers. One must
use Explicit<bool> to correctly populate it with
a boolean. This was missing from the implementation,
and resulted in clearly boolean JSON fields being
treated as numbers.
2021-01-05 02:06:25 +00:00
Eelco Dolstra
368a972a38
Merge pull request #4411 from corngood/env-assert-fix
...
Fix insufficent attribute capacity in user profile
2020-12-30 21:47:21 +01:00
David McFarland
d27eb0ef57
Fix insufficent attribute capacity in user profile
2020-12-30 16:20:03 -04:00
Eelco Dolstra
bff706e27c
Merge pull request #4397 from matthewbauer/support-libcxx10
...
Cast variants fully for libc++10
2020-12-30 21:07:09 +01:00
Matthew Bauer
64904b9d5d
Fixup
2020-12-28 19:40:04 -06:00
Eelco Dolstra
6262a70363
scanForReferences: Remove misleading comment
...
References have always been determined only by the hash part, not the
name or the store prefix.
Fixes #4396 .
2020-12-28 17:21:19 +01:00
Matthew Bauer
ede534a3a1
Merge branch 'master' into support-libcxx10
2020-12-24 14:16:09 -06:00
Matthew Bauer
d4870462f8
Cast variants fully for libc++10
...
libc++10 seems to be stricter on what it allows in variant conversion.
I'm not sure what the rules are here, but this is the minimal change
needed to get through the compilation errors.
2020-12-23 23:41:58 -06:00
Eelco Dolstra
a93916b190
Merge pull request #4336 from NixOS/manpages
...
Documentation for nix subcommands
2020-12-23 21:10:32 +01:00
Eelco Dolstra
5178211e96
Add 'nix' manpage
2020-12-23 18:33:42 +01:00
Eelco Dolstra
26e502ceb5
Add TODO
2020-12-23 18:26:40 +01:00
Eelco Dolstra
1047cb1e53
Command: Remove examples()
2020-12-23 18:26:40 +01:00
Eelco Dolstra
c9279b831e
Add 'nix flake' manpages
2020-12-23 18:26:40 +01:00
Eelco Dolstra
8927cba62f
Merge pull request #4366 from NixOS/readInvalidDerivation-on-remote-caches
...
Use the fs accessor for readInvalidDerivation
2020-12-23 11:55:52 +01:00
Eelco Dolstra
f4a9fb67da
Merge branch 'git-rev-error' of https://github.com/Ma27/nix into master
2020-12-22 16:39:32 +01:00
Eelco Dolstra
e27044216b
Fix tests
2020-12-22 16:23:57 +01:00
Eelco Dolstra
75efa42134
Move <nix/fetchurl.nix> into the nix binary
...
This makes the statically linked nix binary just work, without needing
any additional files.
2020-12-22 14:43:20 +01:00
Eelco Dolstra
5373f4be3b
chrootHelper: Handle symlinks in the root directory
...
This is necessary on Ubuntu where /bin and /lib* are symlinks.
2020-12-22 12:28:50 +01:00
Maximilian Bosch
e54971d019
Document allRefs
argument of builtins.fetchTree
2020-12-22 12:02:08 +01:00
Eelco Dolstra
724b7f4fb6
Don't log from inside the logger
...
This deadlocks ProgressBar, e.g.
# nix run --impure --no-substitute --store '/tmp/nix2?store=/foo' --expr 'derivation { builder = /nix/store/zi90rxslsm4mlr46l2xws1rm94g7pk8p-busybox-1.31.1-x86_64-unknown-linux-musl/bin/busybox; }'
leads to
Thread 1 (Thread 0x7ffff6126e80 (LWP 12250)):
#0 0x00007ffff7215d62 in __lll_lock_wait () from /nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libpthread.so.0
#1 0x00007ffff720e721 in pthread_mutex_lock () from /nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libpthread.so.0
#2 0x00007ffff7ad17fa in __gthread_mutex_lock (__mutex=0x6c5448) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/x86_64-unknown-linux-gnu/bits/gthr-default.h:749
#3 std::mutex::lock (this=0x6c5448) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/bits/std_mutex.h:100
#4 std::unique_lock<std::mutex>::lock (this=0x7fffffff09a8, this=0x7fffffff09a8) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/bits/unique_lock.h:141
#5 std::unique_lock<std::mutex>::unique_lock (__m=..., this=0x7fffffff09a8) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/bits/unique_lock.h:71
#6 nix::Sync<nix::ProgressBar::State, std::mutex>::Lock::Lock (s=0x6c5448, this=0x7fffffff09a0) at src/libutil/sync.hh:45
#7 nix::Sync<nix::ProgressBar::State, std::mutex>::lock (this=0x6c5448) at src/libutil/sync.hh:85
#8 nix::ProgressBar::logEI (this=0x6c5440, ei=...) at src/libmain/progress-bar.cc:131
#9 0x00007ffff7608cfd in nix::Logger::logEI (ei=..., lvl=nix::lvlError, this=0x6c5440) at src/libutil/logging.hh:88
#10 nix::getCodeLines (errPos=...) at src/libutil/error.cc:66
#11 0x00007ffff76073f2 in nix::showErrorInfo (out=..., einfo=..., showTrace=<optimized out>) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/optional:897
#12 0x00007ffff7ad19e7 in nix::ProgressBar::logEI (this=0x6c5440, ei=...) at src/libmain/progress-bar.cc:134
#13 0x00007ffff7ab9d10 in nix::Logger::logEI (ei=..., lvl=nix::lvlError, this=0x6c5440) at src/libutil/logging.hh:88
#14 nix::handleExceptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) (programName="/home/eelco/Dev/nix/outputs/out/bin/nix", fun=...) at src/libmain/shared.cc:328
#15 0x000000000046226b in main (argc=<optimized out>, argv=<optimized out>) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/ext/new_allocator.h:80
2020-12-22 11:15:29 +01:00
Maximilian Bosch
2857b1baaf
Add explicit allRefs = true;
argument to fetchGit
...
Sometimes it's necessary to fetch a git repository at a revision and
it's unknown which ref contains the revision in question. An example
would be a Cargo.lock which only provides the URL and the revision when
using a git repository as build input.
However it's considered a bad practice to perform a full checkout of a
repository since this may take a lot of time and can eat up a lot of
disk space. This patch makes a full checkout explicit by adding an
`allRefs` argument to `builtins.fetchGit` which fetches all refs if
explicitly set to true.
Closes #2409
2020-12-22 10:46:00 +01:00