forked from lix-project/lix
Compare commits
88 commits
6a945e1d2b
...
e8c56569e1
Author | SHA1 | Date | |
---|---|---|---|
Artemis Tosini | e8c56569e1 | ||
Artemis Tosini | 45dfda81c8 | ||
Artemis Tosini | b953f8f781 | ||
Qyriad | ec768df004 | ||
jade | 1659404626 | ||
jade | e0748377dc | ||
Qyriad | 766e718f67 | ||
Qyriad | 06e65e537b | ||
jade | 8f9bcd20eb | ||
Linus Heckemann | 609b721425 | ||
Pierre Bourdon | 6e59b4b407 | ||
Pierre Bourdon | a3256a9375 | ||
72d85acba4 | |||
Nikodem Rabuliński | 5d3910330d | ||
Nikodem Rabuliński | cc3674ea93 | ||
Qyriad | c55e93ca23 | ||
Qyriad | d374a9908f | ||
raito | b8cb7abcf0 | ||
Linus Heckemann | 5312e60be6 | ||
Qyriad | e54d4c9381 | ||
jade | c7ca87461d | ||
jade | 7081889faa | ||
jade | adedac70fa | ||
Linus Heckemann | 82de36f77a | ||
jade | a75d7a5777 | ||
alois31 | ff08d95420 | ||
713cd7e9e7 | |||
Lunaphied | d4b7e6baca | ||
jade | ac78c1dcd5 | ||
terru - | 0c6cb34de6 | ||
alois31 | cf756fdf3c | ||
jade | a6b33cb3b2 | ||
jade | 0f99ed43f1 | ||
jade | e6e5cacabe | ||
Linus Heckemann | 3df013597d | ||
jade | 2f104bbe3b | ||
jade | 533d469875 | ||
Qyriad | 260db1ea64 | ||
jade | c161687b5f | ||
jade | 18aa3e1d57 | ||
jade | 53d40888ff | ||
Maximilian Bosch | 3d78b4847e | ||
Maximilian Bosch | 6abac7aacc | ||
Ilya K | da95bf8c82 | ||
Maximilian Bosch | ce82067566 | ||
Qyriad | 6475793678 | ||
jade | 7575db522e | ||
Qyriad | 2760818f06 | ||
Qyriad | eac3546d50 | ||
Qyriad | 68937f2b64 | ||
jade | 285bc67318 | ||
031d924116 | |||
jade | 26b3a1b9ce | ||
Qyriad | 218630a241 | ||
jade | 562ff516ab | ||
Qyriad | afeaa2371c | ||
Mario Rodas | c71f21da3a | ||
eldritch horrors | dd4a2c1759 | ||
Tom Hubrecht | a39ba22ff7 | ||
Tom Hubrecht | f0eb650ee8 | ||
Tom Hubrecht | d73c40ff3d | ||
Tom Hubrecht | 74513483bc | ||
Tom Hubrecht | 93ebb3e7df | ||
Tom Hubrecht | 8b6d2d3915 | ||
Tom Hubrecht | f79ee66646 | ||
Tom Hubrecht | b910551120 | ||
Tom Hubrecht | 5b5a75979a | ||
Tom Hubrecht | e81ed5f12d | ||
Tom Hubrecht | 2473e1253d | ||
Tom Hubrecht | 9a52e4688c | ||
Tom Hubrecht | 8cd9aa24a8 | ||
Tom Hubrecht | 6b5078c815 | ||
Tom Hubrecht | 81bdf8d2d6 | ||
terru - | d8e452a91b | ||
terru - | 71b32bb87c | ||
Tom Hubrecht | 6fd6795bc4 | ||
Mario Rodas | ec5f025ec2 | ||
terru - | 7a12bc2007 | ||
terru - | 0b91a4b0ec | ||
Qyriad | 2cd1ef2201 | ||
Qyriad | ec5039653d | ||
eldritch horrors | ed6b3165ea | ||
Qyriad | 742c62a6eb | ||
Qyriad | 9f16a20f3d | ||
Maximilian Bosch | 5986a720d4 | ||
Qyriad | ebd00b2d0b | ||
Artemis Tosini | 53e2b0740c | ||
8220da8a53 |
129
.gitignore
vendored
129
.gitignore
vendored
|
@ -1,128 +1,5 @@
|
|||
Makefile.config
|
||||
perl/Makefile.config
|
||||
|
||||
# /
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/precompiled-headers.h.gch
|
||||
/config.*
|
||||
/configure
|
||||
/stamp-h1
|
||||
/svn-revision
|
||||
/libtool
|
||||
/config
|
||||
|
||||
# /doc/manual/
|
||||
/doc/manual/*.1
|
||||
/doc/manual/*.5
|
||||
/doc/manual/*.8
|
||||
/doc/manual/generated/*
|
||||
/doc/manual/nix.json
|
||||
/doc/manual/conf-file.json
|
||||
/doc/manual/language.json
|
||||
/doc/manual/xp-features.json
|
||||
/doc/manual/src/command-ref/experimental-features-shortlist.md
|
||||
/doc/manual/src/contributing/experimental-feature-descriptions.md
|
||||
/doc/manual/src/release-notes/rl-next-generated.md
|
||||
|
||||
# /scripts/
|
||||
/scripts/nix-profile.sh
|
||||
/scripts/nix-profile-daemon.sh
|
||||
/scripts/nix-profile.fish
|
||||
/scripts/nix-profile-daemon.fish
|
||||
|
||||
# /src/libexpr/
|
||||
/src/libexpr/lexer-tab.cc
|
||||
/src/libexpr/lexer-tab.hh
|
||||
/src/libexpr/parser-tab.cc
|
||||
/src/libexpr/parser-tab.hh
|
||||
/src/libexpr/parser-tab.output
|
||||
/src/libexpr/nix.tbl
|
||||
/src/libexpr/tests
|
||||
/tests/unit/libexpr/libnixexpr-tests
|
||||
|
||||
# /src/libstore/
|
||||
*.gen.*
|
||||
/src/libstore/tests
|
||||
/tests/unit/libstore/libnixstore-tests
|
||||
|
||||
# /src/libutil/
|
||||
/src/libutil/tests
|
||||
/tests/unit/libutil/libnixutil-tests
|
||||
|
||||
/src/nix/nix
|
||||
|
||||
/src/nix/doc
|
||||
|
||||
# /src/nix-env/
|
||||
/src/nix-env/nix-env
|
||||
|
||||
# /src/nix-instantiate/
|
||||
/src/nix-instantiate/nix-instantiate
|
||||
|
||||
# /src/nix-store/
|
||||
/src/nix-store/nix-store
|
||||
|
||||
/src/nix-prefetch-url/nix-prefetch-url
|
||||
|
||||
/src/nix-collect-garbage/nix-collect-garbage
|
||||
|
||||
# /src/nix-channel/
|
||||
/src/nix-channel/nix-channel
|
||||
|
||||
# /src/nix-build/
|
||||
/src/nix-build/nix-build
|
||||
|
||||
/src/nix-copy-closure/nix-copy-closure
|
||||
|
||||
/src/error-demo/error-demo
|
||||
|
||||
/src/build-remote/build-remote
|
||||
|
||||
# /tests/functional/
|
||||
/tests/functional/test-tmp
|
||||
/tests/functional/common/vars-and-functions.sh
|
||||
/tests/functional/result*
|
||||
/tests/functional/restricted-innocent
|
||||
/tests/functional/shell
|
||||
/tests/functional/shell.drv
|
||||
/tests/functional/config.nix
|
||||
/tests/functional/ca/config.nix
|
||||
/tests/functional/dyn-drv/config.nix
|
||||
/tests/functional/repl-result-out
|
||||
/tests/functional/debugger-test-out
|
||||
/tests/functional/test-libstoreconsumer/test-libstoreconsumer
|
||||
|
||||
# /tests/functional/lang/
|
||||
/tests/functional/lang/*.out
|
||||
/tests/functional/lang/*.out.xml
|
||||
/tests/functional/lang/*.err
|
||||
/tests/functional/lang/*.ast
|
||||
|
||||
/perl/lib/Nix/Config.pm
|
||||
/perl/lib/Nix/Store.cc
|
||||
|
||||
/misc/systemd/nix-daemon.service
|
||||
/misc/systemd/nix-daemon.socket
|
||||
/misc/systemd/nix-daemon.conf
|
||||
/misc/upstart/nix-daemon.conf
|
||||
|
||||
/src/resolve-system-dependencies/resolve-system-dependencies
|
||||
|
||||
outputs/
|
||||
|
||||
*.a
|
||||
*.o
|
||||
*.o.tmp
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
*.exe
|
||||
*.dep
|
||||
*~
|
||||
*.pc
|
||||
*.plist
|
||||
|
||||
# GNU Global
|
||||
GPATH
|
||||
GRTAGS
|
||||
|
@ -132,17 +9,11 @@ GTAGS
|
|||
# ccls
|
||||
/.ccls-cache
|
||||
|
||||
# auto-generated compilation database
|
||||
compile_commands.json
|
||||
|
||||
nix-rust/target
|
||||
|
||||
result
|
||||
result-*
|
||||
|
||||
.vscode/
|
||||
.direnv/
|
||||
.envrc.local
|
||||
|
||||
# clangd and possibly more
|
||||
.cache/
|
||||
|
|
|
@ -6,14 +6,14 @@ Read more about us at https://lix.systems.
|
|||
|
||||
## Installation
|
||||
|
||||
On Linux and macOS the easiest way to install Nix is to run the following shell command
|
||||
On Linux and macOS the easiest way to install Lix is to run the following shell command
|
||||
(as a user other than root):
|
||||
|
||||
```console
|
||||
$ curl -sSf -L https://install.lix.systems/lix | sh -s -- install
|
||||
```
|
||||
|
||||
For systems that **already have Nix installed**, such as NixOS systems, read our [install page](https://lix.systems/install)
|
||||
For systems that **already have a Nix implementation installed**, such as NixOS systems, read our [install page](https://lix.systems/install)
|
||||
|
||||
## Building And Developing
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@ additional-js = ["redirects.js"]
|
|||
# to just submit a Gerrit CL by the web for trivial stuff.
|
||||
edit-url-template = "https://github.com/lix-project/lix/tree/main/doc/manual/{path}"
|
||||
git-repository-url = "https://git.lix.systems/lix-project/lix"
|
||||
# Folding by default would prevent things like "Ctrl+F for nix-env" from working
|
||||
# trivially, but the user should be able to fold if they want to.
|
||||
fold.enable = true
|
||||
fold.level = 30
|
||||
|
||||
# Handles replacing @docroot@ with a path to ./src relative to that markdown file,
|
||||
# {{#include handlebars}}, and the @generated@ syntax used within these. it mostly
|
||||
|
|
|
@ -36,6 +36,10 @@ artemist:
|
|||
display_name: Artemis Tosini
|
||||
forgejo: artemist
|
||||
|
||||
cole-h:
|
||||
display_name: Cole Helbling
|
||||
github: cole-h
|
||||
|
||||
edolstra:
|
||||
display_name: Eelco Dolstra
|
||||
github: edolstra
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
---
|
||||
synopsis: Show all FOD errors with `nix build --keep-going`
|
||||
credits: [ma27]
|
||||
category: Improvements
|
||||
cls: [1108]
|
||||
---
|
||||
|
||||
`nix build --keep-going` now behaves consistently with `nix-build --keep-going`. This means
|
||||
|
|
30
doc/manual/rl-next/fix-silent-unknown-options.md
Normal file
30
doc/manual/rl-next/fix-silent-unknown-options.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
synopsis: Warn on unknown settings anywhere in the command line
|
||||
prs: 10701
|
||||
credits: [cole-h]
|
||||
category: Improvements
|
||||
---
|
||||
|
||||
All `nix` commands will now properly warn when an unknown option is specified anywhere in the command line.
|
||||
|
||||
Before:
|
||||
|
||||
```console
|
||||
$ nix-instantiate --option foobar baz --expr '{}'
|
||||
warning: unknown setting 'foobar'
|
||||
$ nix-instantiate '{}' --option foobar baz --expr
|
||||
$ nix eval --expr '{}' --option foobar baz
|
||||
{ }
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```console
|
||||
$ nix-instantiate --option foobar baz --expr '{}'
|
||||
warning: unknown setting 'foobar'
|
||||
$ nix-instantiate '{}' --option foobar baz --expr
|
||||
warning: unknown setting 'foobar'
|
||||
$ nix eval --expr '{}' --option foobar baz
|
||||
warning: unknown setting 'foobar'
|
||||
{ }
|
||||
```
|
|
@ -137,7 +137,7 @@ You can also build Lix for one of the [supported platforms](#platforms).
|
|||
|
||||
Lix can be built for various platforms, as specified in [`flake.nix`]:
|
||||
|
||||
[`flake.nix`]: https://github.com/nixos/nix/blob/master/flake.nix
|
||||
[`flake.nix`]: https://git.lix.systems/lix-project/lix/src/branch/main/flake.nix
|
||||
|
||||
- `x86_64-linux`
|
||||
- `x86_64-darwin`
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# Obtaining the Source
|
||||
|
||||
The most recent sources of Nix can be obtained from its [Git
|
||||
repository](https://github.com/NixOS/nix). For example, the following
|
||||
The most recent sources of Lix can be obtained from its [Git
|
||||
repository](https://git.lix.systems/lix-project/lix). For example, the following
|
||||
command will check out the latest revision into a directory called
|
||||
`nix`:
|
||||
|
||||
```console
|
||||
$ git clone https://github.com/NixOS/nix
|
||||
$ git clone https://git.lix.systems/lix-project/lix
|
||||
```
|
||||
|
||||
Likewise, specific releases can be obtained from the
|
||||
[tags](https://github.com/NixOS/nix/tags) of the repository.
|
||||
[tags](https://git.lix.systems/lix-project/lix/tags) of the repository.
|
||||
|
|
|
@ -7,3 +7,14 @@ These constants are built into the Nix language evaluator:
|
|||
{{#include @generated@/language/builtin-constants.md}}
|
||||
|
||||
</dl>
|
||||
|
||||
## Things which might be mistaken for constants
|
||||
|
||||
<dl>
|
||||
<dt><code>__curPos</code></dt>
|
||||
<dd>
|
||||
|
||||
This is not a constant but a [context-dependent keyword](@docroot@/language/constructs.md#keywords-__curPos)
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
|
@ -380,3 +380,70 @@ let a = 1; in let a = 2; in let a = 3; in let a = 4; in ...
|
|||
|
||||
Comments can be single-line, started with a `#` character, or
|
||||
inline/multi-line, enclosed within `/* ... */`.
|
||||
|
||||
## Context-dependent keywords
|
||||
|
||||
<dl>
|
||||
<dt id="keywords-__curPos">
|
||||
<a href="#keywords-__curPos"><code>__curPos</code></a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
A quasi-constant which will be replaced with an attribute set describing
|
||||
the location where `__curPos` was used, with attributes `file`, `line`,
|
||||
and `column`. For example, `import ./file.nix` will result in
|
||||
|
||||
```nix
|
||||
{
|
||||
column = 1;
|
||||
file = "/path/to/some/file.nix";
|
||||
line = 1;
|
||||
}
|
||||
```
|
||||
|
||||
assuming `file.nix` contains nothing but `__curPos`.
|
||||
|
||||
In context without a source file (such as `nix-repl`), it will always
|
||||
be replaced with `null`:
|
||||
|
||||
```nix-repl
|
||||
nix-repl> __curPos
|
||||
null
|
||||
```
|
||||
|
||||
While it may vaguely look like a builtin, this is a very different beast
|
||||
that is handled directly by the parser. It thus cannot be shadowed,
|
||||
bound to a different name, and is also not available under
|
||||
[`builtins`](@docroot@/language/builtin-constants.md#builtins-builtins).
|
||||
|
||||
```nix-repl
|
||||
nix-repl> let __curPos = "no"; in __curPos
|
||||
null
|
||||
```
|
||||
|
||||
Despite this `__curPos`, much like `or`, may still be used as an identifier,
|
||||
it is only treated specially when it appears as an unqualified name:
|
||||
|
||||
```nix-repl
|
||||
nix-repl> { __curPos = 1; }.__curPos
|
||||
1
|
||||
```
|
||||
|
||||
</dd>
|
||||
|
||||
<dt id="keywords-or">
|
||||
<a href="#keywords-or"><code>or</code></a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
`or` is used in [Attribute selection](@docroot@/language/operators.html#attribute-selection),
|
||||
where it is a keyword.
|
||||
|
||||
However, it is not a keyword in some other contexts, and can be used as
|
||||
a binding name in attribute sets, let-bindings, non-initial function
|
||||
application position, and as a label in attribute paths.
|
||||
|
||||
Its use as anything other than a keyword is discouraged.
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
|
@ -22,7 +22,7 @@ to subsequent chapters.
|
|||
$ curl -sSf -L https://install.lix.systems/lix | sh -s -- install
|
||||
```
|
||||
|
||||
For systems that **already have Nix installed**, such as NixOS systems, read our [install page](https://lix.systems/install)
|
||||
For systems that **already have a Nix implementation installed**, such as NixOS systems, read our [install page](https://lix.systems/install)
|
||||
|
||||
The install script will use `sudo`, so make sure you have sufficient rights.
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@
|
|||
system: binaryTarball nixpkgsFor.${system}.native.nix nixpkgsFor.${system}.native
|
||||
);
|
||||
|
||||
# docker image with Nix inside
|
||||
# docker image with Lix inside
|
||||
dockerImage = lib.genAttrs linux64BitSystems (system: self.packages.${system}.dockerImage);
|
||||
|
||||
# API docs for Nix's unstable internal C++ interfaces.
|
||||
|
@ -336,7 +336,7 @@
|
|||
};
|
||||
in
|
||||
pkgs.runCommand "docker-image-tarball-${version}"
|
||||
{ meta.description = "Docker image with Nix for ${system}"; }
|
||||
{ meta.description = "Docker image with Lix for ${system}"; }
|
||||
''
|
||||
mkdir -p $out/nix-support
|
||||
image=$out/image.tar.gz
|
||||
|
|
40
meson.build
40
meson.build
|
@ -17,6 +17,19 @@
|
|||
#
|
||||
# Finally, src/nix/meson.build defines the Nix command itself, relying on all prior meson files.
|
||||
#
|
||||
# libstore, libexpr, and libfetchers have some special handling to make static builds work.
|
||||
# Their use static constructors for dynamic registration of primops, store backends, etc
|
||||
# gets borked during static link. We can't simply wholesale apply `link_whole :` either,
|
||||
# because these libraries get linked multiple times since Lix's components are transitively
|
||||
# dependent. So instead, each of those libraries have two dependency objects:
|
||||
# liblix{store,expr,fetchers,util} and liblix{store,expr,fetchers,util}_mstatic ("maybe static").
|
||||
# The _mstatic versions should be used in the `dependencies :` arguments to ALL EXECUTABLES
|
||||
# but executables ONLY. When we are not building statically (default_library != 'static'),
|
||||
# they are equivalent. When we are building statically, the _mstatic version will be
|
||||
# `link_whole :` rather than `link_with :`.
|
||||
# FIXME: This hack should be removed when https://git.lix.systems/lix-project/lix/issues/359
|
||||
# is fixed.
|
||||
#
|
||||
# Unit tests are setup in tests/unit/meson.build, under the test suite "check".
|
||||
#
|
||||
# Functional tests are a bit more complicated. Generally they're defined in
|
||||
|
@ -79,6 +92,8 @@ if not fs.is_absolute(sysconfdir)
|
|||
sysconfdir = '/' / sysconfdir
|
||||
endif
|
||||
|
||||
is_static = get_option('default_library') == 'static'
|
||||
|
||||
# All of this has to go before the rest of the dependency checking,
|
||||
# so that internal-api-docs can be built with -Denable-build=false
|
||||
|
||||
|
@ -114,6 +129,20 @@ endif
|
|||
|
||||
cxx = meson.get_compiler('cpp')
|
||||
|
||||
|
||||
# clangd breaks when GCC is using precompiled headers lmao
|
||||
# https://git.lix.systems/lix-project/lix/issues/374
|
||||
should_pch = get_option('enable-pch-std')
|
||||
summary('PCH C++ stdlib', should_pch, bool_yn : true)
|
||||
if should_pch
|
||||
# Unlike basically everything else that takes a file, Meson requires the arguments to
|
||||
# cpp_pch : to be strings and doesn't accept files(). So absolute path it is.
|
||||
cpp_pch = [meson.project_source_root() / 'src/pch/precompiled-headers.hh']
|
||||
else
|
||||
cpp_pch = []
|
||||
endif
|
||||
|
||||
|
||||
# Translate some historical and Mesony CPU names to Lixy CPU names.
|
||||
# FIXME(Qyriad): the 32-bit x86 code is not tested right now, because cross compilation for Lix
|
||||
# to those architectures is currently broken for other reasons, namely:
|
||||
|
@ -138,6 +167,7 @@ message('canonical Nix system name:', host_system)
|
|||
|
||||
is_linux = host_machine.system() == 'linux'
|
||||
is_darwin = host_machine.system() == 'darwin'
|
||||
is_freebsd = host_machine.system() == 'freebsd'
|
||||
is_x64 = host_machine.cpu_family() == 'x86_64'
|
||||
|
||||
# Per-platform arguments that you should probably pass to shared_module() invocations.
|
||||
|
@ -203,7 +233,7 @@ openssl = dependency('libcrypto', 'openssl', required : true)
|
|||
deps += openssl
|
||||
|
||||
aws_sdk = dependency('aws-cpp-sdk-core', required : false)
|
||||
aws_sdk_transfer = dependency('aws-cpp-sdk-transfer', required : aws_sdk.found())
|
||||
aws_sdk_transfer = dependency('aws-cpp-sdk-transfer', required : aws_sdk.found(), fallback : ['aws_sdk', 'aws_cpp_sdk_transfer_dep'])
|
||||
if aws_sdk.found()
|
||||
# The AWS pkg-config adds -std=c++11.
|
||||
# https://github.com/aws/aws-sdk-cpp/issues/2673
|
||||
|
@ -230,7 +260,7 @@ if aws_sdk.found()
|
|||
)
|
||||
endif
|
||||
|
||||
aws_s3 = dependency('aws-cpp-sdk-s3', required : false)
|
||||
aws_s3 = dependency('aws-cpp-sdk-s3', required : aws_sdk.found(), fallback : ['aws_sdk', 'aws_cpp_sdk_s3_dep'])
|
||||
if aws_s3.found()
|
||||
# The AWS pkg-config adds -std=c++11.
|
||||
# https://github.com/aws/aws-sdk-cpp/issues/2673
|
||||
|
@ -454,6 +484,12 @@ if cxx.get_linker_id() in ['ld.bfd', 'ld.gold']
|
|||
add_project_link_arguments('-Wl,--no-copy-dt-needed-entries', language : 'cpp')
|
||||
endif
|
||||
|
||||
if is_freebsd
|
||||
# FreeBSD's `environ` is defined in `crt1.o`, not `libc.so`,
|
||||
# so the linker thinks it's undefined
|
||||
add_project_link_arguments('-Wl,-z,undefs', language: 'cpp')
|
||||
endif
|
||||
|
||||
# Generate Chromium tracing files for each compiled file, which enables
|
||||
# maintainers/buildtime_report.sh BUILD-DIR to simply work in clang builds.
|
||||
#
|
||||
|
|
|
@ -64,3 +64,7 @@ option('internal-api-docs', type : 'feature', value : 'auto',
|
|||
option('profile-dir', type : 'string', value : 'etc/profile.d',
|
||||
description : 'the path to install shell profile files',
|
||||
)
|
||||
|
||||
option('enable-pch-std', type : 'boolean', value : true,
|
||||
description : 'whether to use precompiled headers for C++\'s standard library (breaks clangd if you\'re using GCC)',
|
||||
)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
{
|
||||
stdenv,
|
||||
lib,
|
||||
fetchpatch,
|
||||
cmake,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
|
@ -17,6 +18,20 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
sha256 = "sha256-kmgdk634zM0W0OoRoP/RzepArSipa5bNqdVgdZO9gxo=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Both required to work on FreeBSD, see https://github.com/aras-p/ClangBuildAnalyzer/pull/94
|
||||
(fetchpatch {
|
||||
name = "freebsd-ftello.patch";
|
||||
url = "https://github.com/aras-p/ClangBuildAnalyzer/commit/8e7691d54192884bfadcb458225bcff6e2afb260.patch";
|
||||
hash = "sha256-hN9HR/uMyx05T9rVXnlXn9sXphXok7dvLb5MMIvH6ZM=";
|
||||
})
|
||||
(fetchpatch {
|
||||
name = "enkits-update.patch";
|
||||
url = "https://github.com/aras-p/ClangBuildAnalyzer/commit/058150d232fd82ca0aa22e719571603255d5bd68.patch";
|
||||
hash = "sha256-PD13BhQ88icAdCdY1bsZsrRkQgnE8KPcVoIIaAWiNJ4=";
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -87,11 +87,12 @@ pre-commit-run {
|
|||
"file"
|
||||
"header"
|
||||
];
|
||||
# generated files; these will never actually be seen by this
|
||||
# check, and are left here as documentation
|
||||
excludes = [
|
||||
"(parser|lexer)-tab\\.hh$"
|
||||
"\\.gen\\.hh$"
|
||||
''^src/pch/.*$''
|
||||
# generated files; these will never actually be seen by this
|
||||
# check, and are left here as documentation
|
||||
''(parser|lexer)-tab\.hh$''
|
||||
''\.gen\.hh$''
|
||||
];
|
||||
entry = lib.getExe pkgs.check-headers;
|
||||
};
|
||||
|
|
|
@ -13,12 +13,12 @@ let
|
|||
];
|
||||
};
|
||||
|
||||
meta.description = "Distribution-independent Nix bootstrap binaries for ${system}";
|
||||
meta.description = "Distribution-independent Lix bootstrap binaries for ${system}";
|
||||
in
|
||||
buildPackages.runCommand "nix-binary-tarball-${version}" { inherit meta; } ''
|
||||
buildPackages.runCommand "lix-binary-tarball-${version}" { inherit meta; } ''
|
||||
cp ${installerClosureInfo}/registration $TMPDIR/reginfo
|
||||
|
||||
dir=nix-${version}-${system}
|
||||
dir=lix-${version}-${system}
|
||||
fn=$out/$dir.tar.xz
|
||||
mkdir -p $out/nix-support
|
||||
echo "file binary-dist $fn" >> $out/nix-support/hydra-build-products
|
||||
|
|
117
package.nix
117
package.nix
|
@ -43,6 +43,7 @@
|
|||
toml11,
|
||||
util-linuxMinimal ? utillinuxMinimal,
|
||||
utillinuxMinimal ? null,
|
||||
xonsh-unwrapped,
|
||||
xz,
|
||||
|
||||
busybox-sandbox-shell,
|
||||
|
@ -50,7 +51,7 @@
|
|||
# internal fork of nix-doc providing :doc in the repl
|
||||
lix-doc ? __forDefaults.lix-doc,
|
||||
|
||||
pname ? "nix",
|
||||
pname ? "lix",
|
||||
versionSuffix ? "",
|
||||
officialRelease ? false,
|
||||
# Set to true to build the release notes for the next release.
|
||||
|
@ -85,6 +86,7 @@
|
|||
let
|
||||
inherit (__forDefaults) canRunInstalled;
|
||||
inherit (lib) fileset;
|
||||
inherit (stdenv) hostPlatform buildPlatform;
|
||||
|
||||
version = lib.fileContents ./.version + versionSuffix;
|
||||
|
||||
|
@ -143,6 +145,7 @@ let
|
|||
./meson.options
|
||||
./meson
|
||||
./scripts/meson.build
|
||||
./subprojects
|
||||
]);
|
||||
|
||||
functionalTestFiles = fileset.unions [
|
||||
|
@ -167,7 +170,6 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
./boehmgc-coroutine-sp-fallback.diff
|
||||
./doc
|
||||
./misc
|
||||
./precompiled-headers.h
|
||||
./src
|
||||
./COPYING
|
||||
]
|
||||
|
@ -187,23 +189,23 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
dontBuild = false;
|
||||
|
||||
mesonFlags =
|
||||
lib.optionals stdenv.hostPlatform.isLinux [
|
||||
lib.optionals hostPlatform.isLinux [
|
||||
# You'd think meson could just find this in PATH, but busybox is in buildInputs,
|
||||
# which don't actually get added to PATH. And buildInputs is correct over
|
||||
# nativeBuildInputs since this should be a busybox executable on the host.
|
||||
"-Dsandbox-shell=${lib.getExe' busybox-sandbox-shell "busybox"}"
|
||||
]
|
||||
++ lib.optional stdenv.hostPlatform.isStatic "-Denable-embedded-sandbox-shell=true"
|
||||
++ lib.optional hostPlatform.isStatic "-Denable-embedded-sandbox-shell=true"
|
||||
++ lib.optional (finalAttrs.dontBuild) "-Denable-build=false"
|
||||
++ [
|
||||
# mesonConfigurePhase automatically passes -Dauto_features=enabled,
|
||||
# so we must explicitly enable or disable features that we are not passing
|
||||
# dependencies for.
|
||||
(lib.mesonEnable "internal-api-docs" internalApiDocs)
|
||||
(lib.mesonBool "enable-tests" finalAttrs.doCheck)
|
||||
(lib.mesonBool "enable-tests" finalAttrs.finalPackage.doCheck)
|
||||
(lib.mesonBool "enable-docs" canRunInstalled)
|
||||
]
|
||||
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--cross-file=${mesonCrossFile}";
|
||||
++ lib.optional (hostPlatform != buildPlatform) "--cross-file=${mesonCrossFile}";
|
||||
|
||||
# We only include CMake so that Meson can locate toml11, which only ships CMake dependency metadata.
|
||||
dontUseCmakeConfigure = true;
|
||||
|
@ -231,7 +233,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
jq
|
||||
lsof
|
||||
]
|
||||
++ lib.optional stdenv.hostPlatform.isLinux util-linuxMinimal
|
||||
++ lib.optional hostPlatform.isLinux util-linuxMinimal
|
||||
++ lib.optional (!officialRelease && buildUnreleasedNotes) build-release-notes
|
||||
++ lib.optional internalApiDocs doxygen;
|
||||
|
||||
|
@ -251,14 +253,14 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
toml11
|
||||
lix-doc
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
++ lib.optionals hostPlatform.isLinux [
|
||||
libseccomp
|
||||
busybox-sandbox-shell
|
||||
]
|
||||
++ lib.optional internalApiDocs rapidcheck
|
||||
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid
|
||||
++ lib.optional hostPlatform.isx86_64 libcpuid
|
||||
# There have been issues building these dependencies
|
||||
++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) aws-sdk-cpp-nix
|
||||
++ lib.optional (hostPlatform.canExecute buildPlatform) aws-sdk-cpp-nix
|
||||
++ lib.optionals (finalAttrs.dontBuild) maybePropagatedInputs;
|
||||
|
||||
checkInputs = [
|
||||
|
@ -278,18 +280,18 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
};
|
||||
|
||||
preConfigure =
|
||||
lib.optionalString (!finalAttrs.dontBuild && !stdenv.hostPlatform.isStatic) ''
|
||||
lib.optionalString (!finalAttrs.dontBuild && !hostPlatform.isStatic) ''
|
||||
# Copy libboost_context so we don't get all of Boost in our closure.
|
||||
# https://github.com/NixOS/nixpkgs/issues/45462
|
||||
mkdir -p $out/lib
|
||||
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
|
||||
rm -f $out/lib/*.a
|
||||
''
|
||||
+ lib.optionalString (!finalAttrs.dontBuild && stdenv.hostPlatform.isLinux) ''
|
||||
+ lib.optionalString (!finalAttrs.dontBuild && hostPlatform.isLinux && !hostPlatform.isStatic) ''
|
||||
chmod u+w $out/lib/*.so.*
|
||||
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
|
||||
''
|
||||
+ lib.optionalString (!finalAttrs.dontBuild && stdenv.hostPlatform.isDarwin) ''
|
||||
+ lib.optionalString (!finalAttrs.dontBuild && hostPlatform.isDarwin) ''
|
||||
for LIB in $out/lib/*.dylib; do
|
||||
chmod u+w $LIB
|
||||
install_name_tool -id $LIB $LIB
|
||||
|
@ -333,7 +335,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
mkdir -p $doc/nix-support
|
||||
echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isStatic ''
|
||||
+ lib.optionalString hostPlatform.isStatic ''
|
||||
mkdir -p $out/nix-support
|
||||
echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products
|
||||
''
|
||||
|
@ -364,12 +366,12 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
separateDebugInfo = !stdenv.hostPlatform.isStatic && !finalAttrs.dontBuild;
|
||||
separateDebugInfo = !hostPlatform.isStatic && !finalAttrs.dontBuild;
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
# strictoverflow is disabled because we trap on signed overflow instead
|
||||
hardeningDisable = [ "strictoverflow" ] ++ lib.optional stdenv.hostPlatform.isStatic "pie";
|
||||
hardeningDisable = [ "strictoverflow" ] ++ lib.optional hostPlatform.isStatic "pie";
|
||||
|
||||
meta = {
|
||||
mainProgram = "nix";
|
||||
|
@ -398,7 +400,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
contribNotice,
|
||||
}:
|
||||
let
|
||||
glibcFix = lib.optionalAttrs (stdenv.buildPlatform.isLinux && glibcLocales != null) {
|
||||
glibcFix = lib.optionalAttrs (buildPlatform.isLinux && glibcLocales != null) {
|
||||
# Required to make non-NixOS Linux not complain about missing locale files during configure in a dev shell
|
||||
LOCALE_ARCHIVE = "${lib.getLib pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||
};
|
||||
|
@ -407,6 +409,17 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
# default LLVM is newer.
|
||||
clang-tools_llvm = clang-tools.override { inherit llvmPackages; };
|
||||
|
||||
pythonPackages = (
|
||||
p: [
|
||||
p.yapf
|
||||
p.python-frontmatter
|
||||
(p.toPythonModule xonsh-unwrapped)
|
||||
]
|
||||
);
|
||||
# FIXME: This will explode when we switch to 24.05 if we don't backport
|
||||
# https://github.com/NixOS/nixpkgs/pull/317636 first
|
||||
pythonEnv = python3.withPackages pythonPackages;
|
||||
|
||||
# pkgs.mkShell uses pkgs.stdenv by default, regardless of inputsFrom.
|
||||
actualMkShell = mkShell.override { inherit stdenv; };
|
||||
in
|
||||
|
@ -414,14 +427,28 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
glibcFix
|
||||
// {
|
||||
|
||||
inputsFrom = [ finalAttrs ];
|
||||
name = "lix-shell-env";
|
||||
|
||||
# finalPackage is necessary to propagate stuff that is set by mkDerivation itself,
|
||||
# like doCheck.
|
||||
inputsFrom = [ finalAttrs.finalPackage ];
|
||||
|
||||
# For Meson to find Boost.
|
||||
env = finalAttrs.env;
|
||||
|
||||
mesonFlags =
|
||||
# I guess this is necessary because mesonFlags to mkDerivation doesn't propagate in inputsFrom,
|
||||
# which only propagates stuff set in hooks? idk.
|
||||
finalAttrs.mesonFlags
|
||||
# Clangd breaks when GCC is using precompiled headers, so for the devshell specifically
|
||||
# we make precompiled C++ stdlib conditional on using Clang.
|
||||
# https://git.lix.systems/lix-project/lix/issues/374
|
||||
++ [ (lib.mesonBool "enable-pch-std" stdenv.cc.isClang) ];
|
||||
|
||||
packages =
|
||||
lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) clang-tools_llvm
|
||||
lib.optional (stdenv.cc.isClang && hostPlatform == buildPlatform) clang-tools_llvm
|
||||
++ [
|
||||
pythonEnv
|
||||
just
|
||||
nixfmt
|
||||
# Load-bearing order. Must come before clang-unwrapped below, but after clang_tools above.
|
||||
|
@ -433,32 +460,44 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
llvmPackages.clang-unwrapped.dev
|
||||
]
|
||||
++ lib.optional (pre-commit-checks ? enabledPackages) pre-commit-checks.enabledPackages
|
||||
++ lib.optional (lib.meta.availableOn stdenv.buildPlatform clangbuildanalyzer) clangbuildanalyzer
|
||||
++ lib.optional (lib.meta.availableOn buildPlatform clangbuildanalyzer) clangbuildanalyzer
|
||||
++ finalAttrs.checkInputs;
|
||||
|
||||
shellHook = ''
|
||||
PATH=$prefix/bin:$PATH
|
||||
unset PYTHONPATH
|
||||
export MANPATH=$out/share/man:$MANPATH
|
||||
# don't re-run the hook in (other) nested nix-shells
|
||||
function lixShellHook() {
|
||||
# n.b. how the heck does this become -env-env? well, `nix develop` does it:
|
||||
# https://git.lix.systems/lix-project/lix/src/commit/7575db522e9008685c4009423398f6900a16bcce/src/nix/develop.cc#L240-L241
|
||||
# this is, of course, absurd.
|
||||
if [[ $name != lix-shell-env && $name != lix-shell-env-env ]]; then
|
||||
return;
|
||||
fi
|
||||
|
||||
# Make bash completion work.
|
||||
XDG_DATA_DIRS+=:$out/share
|
||||
PATH=$prefix/bin:$PATH
|
||||
unset PYTHONPATH
|
||||
export MANPATH=$out/share/man:$MANPATH
|
||||
|
||||
${lib.optionalString (pre-commit-checks ? shellHook) pre-commit-checks.shellHook}
|
||||
# Allow `touch .nocontribmsg` to turn this notice off.
|
||||
if ! [[ -f .nocontribmsg ]]; then
|
||||
cat ${contribNotice}
|
||||
fi
|
||||
# Make bash completion work.
|
||||
XDG_DATA_DIRS+=:$out/share
|
||||
|
||||
# Install the Gerrit commit-msg hook.
|
||||
# (git common dir is the main .git, including for worktrees)
|
||||
if gitcommondir=$(git rev-parse --git-common-dir 2>/dev/null) && [[ ! -f "$gitcommondir/hooks/commit-msg" ]]; then
|
||||
echo 'Installing Gerrit commit-msg hook (adds Change-Id to commit messages)' >&2
|
||||
mkdir -p "$gitcommondir/hooks"
|
||||
curl -s -Lo "$gitcommondir/hooks/commit-msg" https://gerrit.lix.systems/tools/hooks/commit-msg
|
||||
chmod u+x "$gitcommondir/hooks/commit-msg"
|
||||
fi
|
||||
unset gitcommondir
|
||||
${lib.optionalString (pre-commit-checks ? shellHook) pre-commit-checks.shellHook}
|
||||
# Allow `touch .nocontribmsg` to turn this notice off.
|
||||
if ! [[ -f .nocontribmsg ]]; then
|
||||
cat ${contribNotice}
|
||||
fi
|
||||
|
||||
# Install the Gerrit commit-msg hook.
|
||||
# (git common dir is the main .git, including for worktrees)
|
||||
if gitcommondir=$(git rev-parse --git-common-dir 2>/dev/null) && [[ ! -f "$gitcommondir/hooks/commit-msg" ]]; then
|
||||
echo 'Installing Gerrit commit-msg hook (adds Change-Id to commit messages)' >&2
|
||||
mkdir -p "$gitcommondir/hooks"
|
||||
curl -s -Lo "$gitcommondir/hooks/commit-msg" https://gerrit.lix.systems/tools/hooks/commit-msg
|
||||
chmod u+x "$gitcommondir/hooks/commit-msg"
|
||||
fi
|
||||
unset gitcommondir
|
||||
}
|
||||
|
||||
lixShellHook
|
||||
'';
|
||||
}
|
||||
);
|
||||
|
|
|
@ -29,7 +29,7 @@ NEED_PROG(xz, xz)
|
|||
AC_MSG_CHECKING([whether Perl is recent enough])
|
||||
if ! $perl -e 'open(FOO, "-|", "true"); while (<FOO>) { print; }; close FOO or die;'; then
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR([Your Perl version is too old. Nix requires Perl 5.8.0 or newer.])
|
||||
AC_MSG_ERROR([Your Perl version is too old. Lix requires Perl 5.8.0 or newer.])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "derivations.hh"
|
||||
#include "globals.hh"
|
||||
#include "store-api.hh"
|
||||
#include "util.hh"
|
||||
#include "crypto.hh"
|
||||
|
||||
#include <sodium.h>
|
||||
|
|
10
shell.nix
10
shell.nix
|
@ -1,3 +1,7 @@
|
|||
(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
|
||||
src = ./.;
|
||||
}).shellNix
|
||||
let
|
||||
shell =
|
||||
(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
|
||||
src = ./.;
|
||||
}).shellNix;
|
||||
in
|
||||
shell.default // shell.devShells.${builtins.currentSystem}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
#include <iomanip>
|
||||
#if __APPLE__
|
||||
|
@ -20,9 +21,9 @@
|
|||
#include "local-store.hh"
|
||||
#include "legacy.hh"
|
||||
#include "experimental-features.hh"
|
||||
#include "hash.hh"
|
||||
|
||||
using namespace nix;
|
||||
using std::cin;
|
||||
|
||||
static void handleAlarm(int sig) {
|
||||
}
|
||||
|
@ -35,9 +36,19 @@ std::string escapeUri(std::string uri)
|
|||
|
||||
static std::string currentLoad;
|
||||
|
||||
static std::string makeLockFilename(const std::string & storeUri) {
|
||||
// We include 48 bytes of escaped URI to give an idea of what the lock
|
||||
// is on, then 16 bytes of hash to disambiguate.
|
||||
// This avoids issues with the escaped URI being very long and causing
|
||||
// path too long errors, while also avoiding any possibility of collision
|
||||
// caused by simple truncation.
|
||||
auto hash = hashString(HashType::htSHA256, storeUri).to_string(Base::Base32, false);
|
||||
return escapeUri(storeUri).substr(0, 48) + "-" + hash.substr(0, 16);
|
||||
}
|
||||
|
||||
static AutoCloseFD openSlotLock(const Machine & m, uint64_t slot)
|
||||
{
|
||||
return openLockFile(fmt("%s/%s-%d", currentLoad, escapeUri(m.storeUri), slot), true);
|
||||
return openLockFile(fmt("%s/%s-%d", currentLoad, makeLockFilename(m.storeUri), slot), true);
|
||||
}
|
||||
|
||||
static bool allSupportedLocally(Store & store, const std::set<std::string>& requiredFeatures) {
|
||||
|
@ -263,7 +274,9 @@ connected:
|
|||
auto inputs = readStrings<PathSet>(source);
|
||||
auto wantedOutputs = readStrings<StringSet>(source);
|
||||
|
||||
AutoCloseFD uploadLock = openLockFile(currentLoad + "/" + escapeUri(storeUri) + ".upload-lock", true);
|
||||
auto lockFileName = currentLoad + "/" + makeLockFilename(storeUri) + ".upload-lock";
|
||||
|
||||
AutoCloseFD uploadLock = openLockFile(lockFileName, true);
|
||||
|
||||
{
|
||||
Activity act(*logger, lvlTalkative, actUnknown, fmt("waiting for the upload lock to '%s'", storeUri));
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "common-eval-args.hh"
|
||||
#include "shared.hh"
|
||||
#include "filetransfer.hh"
|
||||
#include "util.hh"
|
||||
#include "eval.hh"
|
||||
#include "fetchers.hh"
|
||||
#include "registry.hh"
|
||||
|
@ -46,7 +45,7 @@ MixEvalArgs::MixEvalArgs()
|
|||
-I /etc/nixos
|
||||
```
|
||||
|
||||
will cause Nix to look for paths relative to `/home/eelco/Dev` and
|
||||
will cause Lix to look for paths relative to `/home/eelco/Dev` and
|
||||
`/etc/nixos`, in that order. This is equivalent to setting the
|
||||
`NIX_PATH` environment variable to
|
||||
|
||||
|
@ -62,7 +61,7 @@ MixEvalArgs::MixEvalArgs()
|
|||
-I /etc/nixos
|
||||
```
|
||||
|
||||
will cause Nix to search for `<nixpkgs/path>` in
|
||||
will cause Lix to search for `<nixpkgs/path>` in
|
||||
`/home/eelco/Dev/nixpkgs-branch/path` and `/etc/nixos/nixpkgs/path`.
|
||||
|
||||
If a path in the Nix search path starts with `http://` or `https://`,
|
||||
|
@ -74,7 +73,7 @@ MixEvalArgs::MixEvalArgs()
|
|||
-I nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz
|
||||
```
|
||||
|
||||
tells Nix to download and use the current contents of the `master`
|
||||
tells Lix to download and use the current contents of the `master`
|
||||
branch in the `nixpkgs` repository.
|
||||
|
||||
The URLs of the tarballs from the official `nixos.org` channels
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "util.hh"
|
||||
#include "editor-for.hh"
|
||||
#include "environment-variables.hh"
|
||||
#include "source-path.hh"
|
||||
|
||||
namespace nix {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "globals.hh"
|
||||
#include "installable-attr-path.hh"
|
||||
#include "outputs-spec.hh"
|
||||
#include "util.hh"
|
||||
#include "command.hh"
|
||||
#include "attr-path.hh"
|
||||
#include "common-eval-args.hh"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "globals.hh"
|
||||
#include "installable-value.hh"
|
||||
#include "outputs-spec.hh"
|
||||
#include "util.hh"
|
||||
#include "command.hh"
|
||||
#include "attr-path.hh"
|
||||
#include "common-eval-args.hh"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "installable-flake.hh"
|
||||
#include "installable-derived-path.hh"
|
||||
#include "outputs-spec.hh"
|
||||
#include "util.hh"
|
||||
#include "command.hh"
|
||||
#include "attr-path.hh"
|
||||
#include "common-eval-args.hh"
|
||||
|
|
|
@ -3,26 +3,21 @@
|
|||
#include "installable-derived-path.hh"
|
||||
#include "installable-attr-path.hh"
|
||||
#include "installable-flake.hh"
|
||||
#include "logging.hh"
|
||||
#include "outputs-spec.hh"
|
||||
#include "util.hh"
|
||||
#include "command.hh"
|
||||
#include "attr-path.hh"
|
||||
#include "common-eval-args.hh"
|
||||
#include "derivations.hh"
|
||||
#include "eval-inline.hh"
|
||||
#include "eval.hh"
|
||||
#include "eval-settings.hh"
|
||||
#include "get-drvs.hh"
|
||||
#include "store-api.hh"
|
||||
#include "shared.hh"
|
||||
#include "flake/flake.hh"
|
||||
#include "eval-cache.hh"
|
||||
#include "url.hh"
|
||||
#include "registry.hh"
|
||||
#include "build-result.hh"
|
||||
|
||||
#include <regex>
|
||||
#include <queue>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
#include "util.hh"
|
||||
#include "path.hh"
|
||||
#include "outputs-spec.hh"
|
||||
#include "derived-path.hh"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "markdown.hh"
|
||||
#include "util.hh"
|
||||
#include "error.hh"
|
||||
#include "finally.hh"
|
||||
#include "terminal.hh"
|
||||
|
||||
#include <sys/queue.h>
|
||||
#include <lowdown.h>
|
||||
|
|
|
@ -54,6 +54,7 @@ libcmd = library(
|
|||
nlohmann_json,
|
||||
lix_doc
|
||||
],
|
||||
cpp_pch : cpp_pch,
|
||||
install : true,
|
||||
# FIXME(Qyriad): is this right?
|
||||
install_rpath : libdir,
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include "error.hh"
|
||||
#include "file-system.hh"
|
||||
#include "logging.hh"
|
||||
#include <csignal>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
@ -18,11 +22,8 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
#include "signals.hh"
|
||||
#include "finally.hh"
|
||||
#include "repl-interacter.hh"
|
||||
#include "util.hh"
|
||||
#include "repl.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "print.hh"
|
||||
#include "progress-bar.hh"
|
||||
#include "gc-small-vector.hh"
|
||||
#include "users.hh"
|
||||
|
||||
#if HAVE_BOEHMGC
|
||||
#define GC_INCLUDE_NEW
|
||||
|
@ -107,6 +108,11 @@ struct NixRepl
|
|||
void initEnv() override;
|
||||
|
||||
virtual StringSet completePrefix(const std::string & prefix) override;
|
||||
|
||||
/**
|
||||
* @exception nix::Error thrown directly if the expression does not evaluate
|
||||
* to a derivation, or evaluates to an invalid derivation.
|
||||
*/
|
||||
StorePath getDerivationPath(Value & v);
|
||||
ProcessLineResult processLine(std::string line);
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "attr-path.hh"
|
||||
#include "eval-inline.hh"
|
||||
#include "util.hh"
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "eval-cache.hh"
|
||||
#include "sqlite.hh"
|
||||
#include "eval.hh"
|
||||
#include "eval-inline.hh"
|
||||
#include "store-api.hh"
|
||||
#include "users.hh"
|
||||
|
||||
namespace nix::eval_cache {
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "file-system.hh"
|
||||
#include "globals.hh"
|
||||
#include "profiles.hh"
|
||||
#include "eval.hh"
|
||||
#include "users.hh"
|
||||
#include "eval-settings.hh"
|
||||
|
||||
namespace nix {
|
||||
|
|
|
@ -71,8 +71,8 @@ struct EvalSettings : Config
|
|||
Setting<bool> enableImportFromDerivation{
|
||||
this, true, "allow-import-from-derivation",
|
||||
R"(
|
||||
By default, Nix allows you to `import` from a derivation, allowing
|
||||
building at evaluation time. With this option set to false, Nix will
|
||||
By default, Lix allows you to `import` from a derivation, allowing
|
||||
building at evaluation time. With this option set to false, Lix will
|
||||
throw an error when evaluating an expression that uses this feature,
|
||||
allowing users to ensure their evaluation will not require any
|
||||
builds to take place.
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "print-options.hh"
|
||||
#include "shared.hh"
|
||||
#include "types.hh"
|
||||
#include "util.hh"
|
||||
#include "store-api.hh"
|
||||
#include "derivations.hh"
|
||||
#include "downstream-placeholder.hh"
|
||||
|
@ -23,6 +22,7 @@
|
|||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include <optional>
|
||||
#include <unistd.h>
|
||||
|
@ -30,7 +30,6 @@
|
|||
#include <sys/resource.h>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
|
||||
#include <sys/resource.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "flake.hh"
|
||||
#include "globals.hh"
|
||||
#include "logging.hh"
|
||||
#include "users.hh"
|
||||
#include "fetch-settings.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "fetchers.hh"
|
||||
#include "finally.hh"
|
||||
#include "fetch-settings.hh"
|
||||
#include "terminal.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "get-drvs.hh"
|
||||
#include "util.hh"
|
||||
#include "eval-inline.hh"
|
||||
#include "derivations.hh"
|
||||
#include "store-api.hh"
|
||||
|
|
|
@ -26,10 +26,9 @@
|
|||
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "nixexpr.hh"
|
||||
#include "parser-tab.hh"
|
||||
#include "strings.hh"
|
||||
|
||||
using namespace nix;
|
||||
|
||||
|
@ -132,9 +131,10 @@ or { return OR_KW; }
|
|||
|
||||
{ID} { yylval->id = {yytext, (size_t) yyleng}; return ID; }
|
||||
{INT} { errno = 0;
|
||||
try {
|
||||
yylval->n = boost::lexical_cast<int64_t>(yytext);
|
||||
} catch (const boost::bad_lexical_cast &) {
|
||||
std::optional<int64_t> numMay = string2Int<int64_t>(yytext);
|
||||
if (numMay.has_value()) {
|
||||
yylval->n = *numMay;
|
||||
} else {
|
||||
throw ParseError(ErrorInfo{
|
||||
.msg = HintFmt("invalid integer '%1%'", yytext),
|
||||
.pos = state->positions[CUR_POS],
|
||||
|
|
|
@ -145,6 +145,7 @@ libexpr = library(
|
|||
include_directories : [
|
||||
'../libmain',
|
||||
],
|
||||
cpp_pch : cpp_pch,
|
||||
install : true,
|
||||
# FIXME(Qyriad): is this right?
|
||||
install_rpath : libdir,
|
||||
|
@ -161,6 +162,16 @@ liblixexpr = declare_dependency(
|
|||
link_with : libexpr,
|
||||
)
|
||||
|
||||
# FIXME: remove when https://git.lix.systems/lix-project/lix/issues/359 is fixed.
|
||||
if is_static
|
||||
liblixexpr_mstatic = declare_dependency(
|
||||
include_directories : include_directories('.'),
|
||||
link_whole : libexpr,
|
||||
)
|
||||
else
|
||||
liblixexpr_mstatic = liblixexpr
|
||||
endif
|
||||
|
||||
# FIXME: not using the pkg-config module because it creates way too many deps
|
||||
# while meson migration is in progress, and we want to not include boost here
|
||||
configure_file(
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
#include "derivations.hh"
|
||||
#include "eval.hh"
|
||||
#include "symbol-table.hh"
|
||||
#include "util.hh"
|
||||
#include "print.hh"
|
||||
#include "escape-string.hh"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <variant>
|
||||
|
||||
#include "finally.hh"
|
||||
#include "util.hh"
|
||||
#include "users.hh"
|
||||
|
||||
#include "nixexpr.hh"
|
||||
#include "eval.hh"
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include "json-to-value.hh"
|
||||
#include "names.hh"
|
||||
#include "path-references.hh"
|
||||
#include "processes.hh"
|
||||
#include "store-api.hh"
|
||||
#include "util.hh"
|
||||
#include "value-to-json.hh"
|
||||
#include "value-to-xml.hh"
|
||||
#include "primops.hh"
|
||||
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <regex>
|
||||
#include <dlfcn.h>
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ static void runFetchClosureWithRewrite(EvalState & state, const PosIdx pos, Stor
|
|||
throw Error({
|
||||
.msg = HintFmt(
|
||||
"The 'toPath' value '%s' is input-addressed, so it can't possibly be the result of rewriting to a content-addressed path.\n\n"
|
||||
"Set 'toPath' to an empty string to make Nix report the correct content-addressed path.",
|
||||
"Set 'toPath' to an empty string to make Lix report the correct content-addressed path.",
|
||||
state.store->printStorePath(toPath)),
|
||||
.pos = state.positions[pos]
|
||||
});
|
||||
|
@ -271,7 +271,7 @@ static RegisterPrimOp primop_fetchClosure({
|
|||
```
|
||||
|
||||
It is possible to fetch an [input-addressed store path](@docroot@/glossary.md#gloss-input-addressed-store-object) and return it as is.
|
||||
However, this is the least preferred way of invoking `fetchClosure`, because it requires that the input-addressed paths are trusted by the Nix configuration.
|
||||
However, this is the least preferred way of invoking `fetchClosure`, because it requires that the input-addressed paths are trusted by the Lix configuration.
|
||||
|
||||
**`builtins.storePath`**
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "print-ambiguous.hh"
|
||||
#include "attr-set.hh"
|
||||
#include "logging.hh"
|
||||
#include "print.hh"
|
||||
#include "eval.hh"
|
||||
#include "signals.hh"
|
||||
#include "escape-string.hh"
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <limits>
|
||||
#include <span>
|
||||
#include <unordered_set>
|
||||
#include <sstream>
|
||||
|
||||
#include "escape-string.hh"
|
||||
#include "print.hh"
|
||||
|
@ -9,6 +10,7 @@
|
|||
#include "english.hh"
|
||||
#include "signals.hh"
|
||||
#include "eval.hh"
|
||||
#include "terminal.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "search-path.hh"
|
||||
#include "util.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "value-to-json.hh"
|
||||
#include "eval-inline.hh"
|
||||
#include "util.hh"
|
||||
#include "signals.hh"
|
||||
#include "store-api.hh"
|
||||
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
#include "value-to-xml.hh"
|
||||
#include "xml-writer.hh"
|
||||
#include "eval-inline.hh"
|
||||
#include "util.hh"
|
||||
#include "signals.hh"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
#include "util.hh"
|
||||
#include "comparator.hh"
|
||||
#include "derived-path.hh"
|
||||
#include "variant-wrapper.hh"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "sqlite.hh"
|
||||
#include "sync.hh"
|
||||
#include "store-api.hh"
|
||||
#include "users.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "types.hh"
|
||||
#include "config.hh"
|
||||
#include "util.hh"
|
||||
|
||||
#include <map>
|
||||
#include <limits>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "source-path.hh"
|
||||
#include "store-api.hh"
|
||||
#include "util.hh"
|
||||
#include "repair-flag.hh"
|
||||
#include "content-address.hh"
|
||||
|
||||
|
|
|
@ -133,10 +133,12 @@ std::pair<Tree, Input> Input::fetch(ref<Store> store) const
|
|||
}
|
||||
|
||||
auto [storePath, input] = [&]() -> std::pair<StorePath, Input> {
|
||||
// *sighs*, we print the base URL, rather than the full URL because the Nixpkgs
|
||||
// fileset lib tests assume that fetching shallow and non-shallow prints exactly the
|
||||
// same stderr...
|
||||
printInfo("fetching %s input '%s'", this->getType(), this->toURL().base);
|
||||
// *sighs*, we print the URL without query params, rather than the full URL
|
||||
// because the Nixpkgs fileset lib tests assume that fetching shallow and
|
||||
// non-shallow prints exactly the same stderr...
|
||||
ParsedURL withoutParams = this->toURL();
|
||||
withoutParams.query.clear();
|
||||
printInfo("fetching %s input '%s'", this->getType(), withoutParams.to_string());
|
||||
try {
|
||||
return scheme->fetch(store, *this);
|
||||
} catch (Error & e) {
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include "fetchers.hh"
|
||||
#include "cache.hh"
|
||||
#include "globals.hh"
|
||||
#include "processes.hh"
|
||||
#include "tarfile.hh"
|
||||
#include "store-api.hh"
|
||||
#include "url-parts.hh"
|
||||
#include "pathlocks.hh"
|
||||
#include "util.hh"
|
||||
#include "users.hh"
|
||||
#include "git.hh"
|
||||
#include "logging.hh"
|
||||
#include "finally.hh"
|
||||
|
@ -402,7 +403,8 @@ struct GitInputScheme : InputScheme
|
|||
logger->pause();
|
||||
Finally restoreLogger([]() { logger->resume(); });
|
||||
runProgram("git", true,
|
||||
{ "-C", *root, "--git-dir", gitDir, "commit", std::string(path.rel()), "-m", *commitMsg });
|
||||
{ "-C", *root, "--git-dir", gitDir, "commit", std::string(path.rel()), "-F", "-" },
|
||||
*commitMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -322,9 +322,15 @@ struct GitLabInputScheme : GitArchiveInputScheme
|
|||
readFile(
|
||||
store->toRealPath(
|
||||
downloadFile(store, url, "source", false, headers).storePath)));
|
||||
auto rev = Hash::parseAny(std::string(json[0]["id"]), htSHA1);
|
||||
debug("HEAD revision for '%s' is %s", url, rev.gitRev());
|
||||
return rev;
|
||||
if (json.is_array() && json.size() >= 1 && json[0]["id"] != nullptr) {
|
||||
auto rev = Hash::parseAny(std::string(json[0]["id"]), htSHA1);
|
||||
debug("HEAD revision for '%s' is %s", url, rev.gitRev());
|
||||
return rev;
|
||||
} else if (json.is_array() && json.size() == 0) {
|
||||
throw Error("No commits returned by GitLab API -- does the ref really exist?");
|
||||
} else {
|
||||
throw Error("Didn't know what to do with response from GitLab: %s", json);
|
||||
}
|
||||
}
|
||||
|
||||
DownloadUrl getDownloadUrl(const Input & input) const override
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "fetchers.hh"
|
||||
#include "cache.hh"
|
||||
#include "globals.hh"
|
||||
#include "tarfile.hh"
|
||||
#include "processes.hh"
|
||||
#include "store-api.hh"
|
||||
#include "url-parts.hh"
|
||||
#include "users.hh"
|
||||
|
||||
#include "fetch-settings.hh"
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ libfetchers = library(
|
|||
liblixutil,
|
||||
nlohmann_json,
|
||||
],
|
||||
cpp_pch : cpp_pch,
|
||||
install : true,
|
||||
# FIXME(Qyriad): is this right?
|
||||
install_rpath : libdir,
|
||||
|
@ -55,3 +56,13 @@ liblixfetchers = declare_dependency(
|
|||
include_directories : include_directories('.'),
|
||||
link_with : libfetchers,
|
||||
)
|
||||
|
||||
# FIXME: remove when https://git.lix.systems/lix-project/lix/issues/359 is fixed.
|
||||
if is_static
|
||||
liblixfetchers_mstatic = declare_dependency(
|
||||
include_directories : include_directories('.'),
|
||||
link_whole : libfetchers,
|
||||
)
|
||||
else
|
||||
liblixfetchers_mstatic = liblixfetchers
|
||||
endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "registry.hh"
|
||||
#include "fetchers.hh"
|
||||
#include "util.hh"
|
||||
#include "users.hh"
|
||||
#include "globals.hh"
|
||||
#include "store-api.hh"
|
||||
#include "local-fs-store.hh"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "args/root.hh"
|
||||
#include "globals.hh"
|
||||
#include "loggers.hh"
|
||||
#include "logging.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
@ -32,7 +33,7 @@ MixCommonArgs::MixCommonArgs(const std::string & programName)
|
|||
|
||||
addFlag({
|
||||
.longName = "option",
|
||||
.description = "Set the Nix configuration setting *name* to *value* (overriding `nix.conf`).",
|
||||
.description = "Set the Lix configuration setting *name* to *value* (overriding `nix.conf`).",
|
||||
.category = miscCategory,
|
||||
.labels = {"name", "value"},
|
||||
.handler = {[this](std::string name, std::string value) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "environment-variables.hh"
|
||||
#include "loggers.hh"
|
||||
#include "progress-bar.hh"
|
||||
#include "util.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ libmain = library(
|
|||
liblixutil,
|
||||
liblixstore,
|
||||
],
|
||||
cpp_pch : cpp_pch,
|
||||
install : true,
|
||||
# FIXME(Qyriad): is this right?
|
||||
install_rpath : libdir,
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#include "progress-bar.hh"
|
||||
#include "util.hh"
|
||||
#include "sync.hh"
|
||||
#include "store-api.hh"
|
||||
#include "names.hh"
|
||||
#include "terminal.hh"
|
||||
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
#include <thread>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
#include "shared.hh"
|
||||
#include "store-api.hh"
|
||||
#include "gc-store.hh"
|
||||
#include "util.hh"
|
||||
#include "signals.hh"
|
||||
#include "loggers.hh"
|
||||
#include "progress-bar.hh"
|
||||
#include "current-process.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
|
@ -282,7 +282,7 @@ void parseCmdLine(const std::string & programName, const Strings & args,
|
|||
void printVersion(const std::string & programName)
|
||||
{
|
||||
std::cout << fmt("%1% (Lix, like Nix) %2%", programName, nixVersion) << std::endl;
|
||||
if (verbosity > lvlNotice) {
|
||||
if (verbosity > lvlInfo) {
|
||||
Strings cfg;
|
||||
#if HAVE_BOEHMGC
|
||||
cfg.push_back("gc");
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
#include "util.hh"
|
||||
#include "args.hh"
|
||||
#include "args/root.hh"
|
||||
#include "common-args.hh"
|
||||
#include "path.hh"
|
||||
#include "derived-path.hh"
|
||||
#include "processes.hh"
|
||||
#include "exit.hh"
|
||||
|
||||
#include <signal.h>
|
||||
|
@ -124,7 +124,7 @@ void detectStackOverflow();
|
|||
*
|
||||
* This is called by the handler installed by detectStackOverflow().
|
||||
*
|
||||
* This gives Nix library consumers a limit opportunity to report the error
|
||||
* This gives Lix library consumers a limit opportunity to report the error
|
||||
* condition. The handler should exit the process.
|
||||
* See defaultStackOverflowHandler() for a reference implementation.
|
||||
*
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <future>
|
||||
#include <regex>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
|
33
src/libstore/build/child.cc
Normal file
33
src/libstore/build/child.cc
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "current-process.hh"
|
||||
#include "logging.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
void commonChildInit()
|
||||
{
|
||||
logger = makeSimpleLogger();
|
||||
|
||||
const static std::string pathNullDevice = "/dev/null";
|
||||
restoreProcessContext(false);
|
||||
|
||||
/* Put the child in a separate session (and thus a separate
|
||||
process group) so that it has no controlling terminal (meaning
|
||||
that e.g. ssh cannot open /dev/tty) and it doesn't receive
|
||||
terminal signals. */
|
||||
if (setsid() == -1)
|
||||
throw SysError("creating a new session");
|
||||
|
||||
/* Dup stderr to stdout. */
|
||||
if (dup2(STDERR_FILENO, STDOUT_FILENO) == -1)
|
||||
throw SysError("cannot dup stderr into stdout");
|
||||
|
||||
/* Reroute stdin to /dev/null. */
|
||||
int fdDevNull = open(pathNullDevice.c_str(), O_RDWR);
|
||||
if (fdDevNull == -1)
|
||||
throw SysError("cannot open '%1%'", pathNullDevice);
|
||||
if (dup2(fdDevNull, STDIN_FILENO) == -1)
|
||||
throw SysError("cannot dup null device into stdin");
|
||||
close(fdDevNull);
|
||||
}
|
||||
|
||||
}
|
11
src/libstore/build/child.hh
Normal file
11
src/libstore/build/child.hh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
namespace nix {
|
||||
|
||||
/**
|
||||
* Common initialisation performed in child processes.
|
||||
*/
|
||||
void commonChildInit();
|
||||
|
||||
}
|
|
@ -5,7 +5,6 @@
|
|||
#include "builtins/buildenv.hh"
|
||||
#include "references.hh"
|
||||
#include "finally.hh"
|
||||
#include "util.hh"
|
||||
#include "archive.hh"
|
||||
#include "compression.hh"
|
||||
#include "common-protocol.hh"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "child.hh"
|
||||
#include "file-system.hh"
|
||||
#include "globals.hh"
|
||||
#include "hook-instance.hh"
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
///@file
|
||||
|
||||
#include "logging.hh"
|
||||
#include "processes.hh"
|
||||
#include "serialise.hh"
|
||||
|
||||
namespace nix {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "builtins/buildenv.hh"
|
||||
#include "path-references.hh"
|
||||
#include "finally.hh"
|
||||
#include "util.hh"
|
||||
#include "archive.hh"
|
||||
#include "compression.hh"
|
||||
#include "daemon.hh"
|
||||
|
@ -15,6 +14,8 @@
|
|||
#include "cgroup.hh"
|
||||
#include "personality.hh"
|
||||
#include "namespaces.hh"
|
||||
#include "child.hh"
|
||||
#include "unix-domain-socket.hh"
|
||||
|
||||
#include <regex>
|
||||
#include <queue>
|
||||
|
@ -63,6 +64,14 @@ extern "C" int sandbox_init_with_parameters(const char *profile, uint64_t flags,
|
|||
|
||||
namespace nix {
|
||||
|
||||
namespace {
|
||||
/**
|
||||
* The system for which Nix is compiled.
|
||||
*/
|
||||
[[gnu::unused]]
|
||||
constexpr const std::string_view nativeSystem = SYSTEM;
|
||||
}
|
||||
|
||||
void handleDiffHook(
|
||||
uid_t uid, uid_t gid,
|
||||
const Path & tryA, const Path & tryB,
|
||||
|
@ -1838,8 +1847,12 @@ void LocalDerivationGoal::runChild()
|
|||
copyFile(path, chrootRootDir + path, { .followSymlinks = true });
|
||||
}
|
||||
|
||||
if (settings.caFile != "")
|
||||
pathsInChroot.try_emplace("/etc/ssl/certs/ca-certificates.crt", settings.caFile, true);
|
||||
if (settings.caFile != "" && pathExists(settings.caFile)) {
|
||||
// For the same reasons as above, copy the CA certificates file too.
|
||||
// It should be even less likely to change during the build than resolv.conf.
|
||||
createDirs(chrootRootDir + "/etc/ssl/certs");
|
||||
copyFile(settings.caFile, chrootRootDir + "/etc/ssl/certs/ca-certificates.crt", { .followSymlinks = true });
|
||||
}
|
||||
}
|
||||
|
||||
for (auto & i : ss) pathsInChroot.emplace(i, i);
|
||||
|
@ -2008,8 +2021,6 @@ void LocalDerivationGoal::runChild()
|
|||
/* Fill in the arguments. */
|
||||
Strings args;
|
||||
|
||||
std::string builder = "invalid";
|
||||
|
||||
#if __APPLE__
|
||||
/* This has to appear before import statements. */
|
||||
std::string sandboxProfile = "(version 1)\n";
|
||||
|
@ -2130,16 +2141,10 @@ void LocalDerivationGoal::runChild()
|
|||
_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
builder = drv->builder;
|
||||
args.push_back(std::string(baseNameOf(drv->builder)));
|
||||
#else
|
||||
if (!drv->isBuiltin()) {
|
||||
builder = drv->builder;
|
||||
args.push_back(std::string(baseNameOf(drv->builder)));
|
||||
}
|
||||
#endif
|
||||
|
||||
args.push_back(std::string(baseNameOf(drv->builder)));
|
||||
|
||||
for (auto & i : drv->args)
|
||||
args.push_back(rewriteStrings(i, inputRewrites));
|
||||
|
||||
|
@ -2193,9 +2198,9 @@ void LocalDerivationGoal::runChild()
|
|||
posix_spawnattr_setbinpref_np(&attrp, 1, &cpu, NULL);
|
||||
}
|
||||
|
||||
posix_spawn(NULL, builder.c_str(), NULL, &attrp, stringsToCharPtrs(args).data(), stringsToCharPtrs(envStrs).data());
|
||||
posix_spawn(NULL, drv->builder.c_str(), NULL, &attrp, stringsToCharPtrs(args).data(), stringsToCharPtrs(envStrs).data());
|
||||
#else
|
||||
execve(builder.c_str(), stringsToCharPtrs(args).data(), stringsToCharPtrs(envStrs).data());
|
||||
execve(drv->builder.c_str(), stringsToCharPtrs(args).data(), stringsToCharPtrs(envStrs).data());
|
||||
#endif
|
||||
|
||||
throw SysError("executing '%1%'", drv->builder);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "derivation-goal.hh"
|
||||
#include "local-store.hh"
|
||||
#include "processes.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -429,6 +429,28 @@ void Worker::waitForInput()
|
|||
GoalPtr goal = j->goal.lock();
|
||||
assert(goal);
|
||||
|
||||
if (goal->exitCode == Goal::ecBusy &&
|
||||
0 != settings.maxSilentTime &&
|
||||
j->respectTimeouts &&
|
||||
after - j->lastOutput >= std::chrono::seconds(settings.maxSilentTime))
|
||||
{
|
||||
goal->timedOut(Error(
|
||||
"%1% timed out after %2% seconds of silence",
|
||||
goal->getName(), settings.maxSilentTime));
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (goal->exitCode == Goal::ecBusy &&
|
||||
0 != settings.buildTimeout &&
|
||||
j->respectTimeouts &&
|
||||
after - j->timeStarted >= std::chrono::seconds(settings.buildTimeout))
|
||||
{
|
||||
goal->timedOut(Error(
|
||||
"%1% timed out after %2% seconds",
|
||||
goal->getName(), settings.buildTimeout));
|
||||
continue;
|
||||
}
|
||||
|
||||
std::set<int> fds2(j->fds);
|
||||
std::vector<unsigned char> buffer(4096);
|
||||
for (auto & k : fds2) {
|
||||
|
@ -455,26 +477,6 @@ void Worker::waitForInput()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (goal->exitCode == Goal::ecBusy &&
|
||||
0 != settings.maxSilentTime &&
|
||||
j->respectTimeouts &&
|
||||
after - j->lastOutput >= std::chrono::seconds(settings.maxSilentTime))
|
||||
{
|
||||
goal->timedOut(Error(
|
||||
"%1% timed out after %2% seconds of silence",
|
||||
goal->getName(), settings.maxSilentTime));
|
||||
}
|
||||
|
||||
else if (goal->exitCode == Goal::ecBusy &&
|
||||
0 != settings.buildTimeout &&
|
||||
j->respectTimeouts &&
|
||||
after - j->timeStarted >= std::chrono::seconds(settings.buildTimeout))
|
||||
{
|
||||
goal->timedOut(Error(
|
||||
"%1% timed out after %2% seconds",
|
||||
goal->getName(), settings.buildTimeout));
|
||||
}
|
||||
}
|
||||
|
||||
if (!waitingForAWhile.empty() && lastWokenUp + std::chrono::seconds(settings.pollInterval) <= after) {
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#include "serialise.hh"
|
||||
#include "util.hh"
|
||||
#include "path-with-outputs.hh"
|
||||
#include "store-api.hh"
|
||||
#include "build-result.hh"
|
||||
#include "common-protocol.hh"
|
||||
#include "common-protocol-impl.hh"
|
||||
#include "archive.hh"
|
||||
#include "derivations.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "crypto.hh"
|
||||
#include "util.hh"
|
||||
#include "file-system.hh"
|
||||
#include "globals.hh"
|
||||
#include "strings.hh"
|
||||
|
||||
#include <sodium.h>
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
#include "types.hh"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "derivations.hh"
|
||||
#include "args.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace nix::daemon {
|
||||
|
||||
Sink & operator << (Sink & sink, const Logger::Fields & fields)
|
||||
|
@ -241,7 +243,7 @@ struct ClientSettings
|
|||
} else if (name == settings.pluginFiles.name) {
|
||||
if (tokenizeString<Paths>(value) != settings.pluginFiles.get())
|
||||
warn("Ignoring the client-specified plugin-files.\n"
|
||||
"The client specifying plugins to the daemon never made sense, and was removed in Nix >=2.14.");
|
||||
"The client specifying plugins to the daemon never made sense, and was removed in Nix.");
|
||||
}
|
||||
else if (trusted
|
||||
|| name == settings.buildTimeout.name
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "store-api.hh"
|
||||
#include "globals.hh"
|
||||
#include "types.hh"
|
||||
#include "util.hh"
|
||||
#include "split.hh"
|
||||
#include "common-protocol.hh"
|
||||
#include "common-protocol-impl.hh"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
#include "util.hh"
|
||||
#include "config.hh"
|
||||
#include "path.hh"
|
||||
#include "outputs-spec.hh"
|
||||
#include "comparator.hh"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "filetransfer.hh"
|
||||
#include "util.hh"
|
||||
#include "namespaces.hh"
|
||||
#include "globals.hh"
|
||||
#include "store-api.hh"
|
||||
#include "s3.hh"
|
||||
|
@ -19,7 +19,6 @@
|
|||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <queue>
|
||||
#include <random>
|
||||
#include <thread>
|
||||
|
@ -51,7 +50,6 @@ struct curlFileTransfer : public FileTransfer
|
|||
std::function<void(TransferItem &, std::string_view data)> dataCallback;
|
||||
CURL * req = 0;
|
||||
bool active = false; // whether the handle has been added to the multi object
|
||||
bool headersProcessed = false;
|
||||
std::string statusMsg;
|
||||
|
||||
unsigned int attempt = 0;
|
||||
|
@ -136,35 +134,11 @@ struct curlFileTransfer : public FileTransfer
|
|||
|
||||
std::exception_ptr writeException;
|
||||
|
||||
std::optional<std::string> getHeader(const char * name)
|
||||
{
|
||||
curl_header * result;
|
||||
auto e = curl_easy_header(req, name, 0, CURLH_HEADER, -1, &result);
|
||||
if (e == CURLHE_OK) {
|
||||
return result->value;
|
||||
} else if (e == CURLHE_MISSING || e == CURLHE_NOHEADERS) {
|
||||
return std::nullopt;
|
||||
} else {
|
||||
throw nix::Error("unexpected error from curl_easy_header(): %i", e);
|
||||
}
|
||||
}
|
||||
|
||||
size_t writeCallback(void * contents, size_t size, size_t nmemb)
|
||||
{
|
||||
const size_t realSize = size * nmemb;
|
||||
|
||||
try {
|
||||
if (!headersProcessed) {
|
||||
if (auto h = getHeader("content-encoding")) {
|
||||
encoding = std::move(*h);
|
||||
}
|
||||
if (auto h = getHeader("accept-ranges"); h && *h == "bytes") {
|
||||
acceptRanges = true;
|
||||
}
|
||||
|
||||
headersProcessed = true;
|
||||
}
|
||||
|
||||
result.bodySize += realSize;
|
||||
|
||||
if (successfulStatuses.count(getHTTPStatus()) && this->dataCallback) {
|
||||
|
@ -200,7 +174,30 @@ struct curlFileTransfer : public FileTransfer
|
|||
statusMsg = trim(match.str(1));
|
||||
acceptRanges = false;
|
||||
encoding = "";
|
||||
headersProcessed = false;
|
||||
} else {
|
||||
auto i = line.find(':');
|
||||
if (i != std::string::npos) {
|
||||
std::string name = toLower(trim(line.substr(0, i)));
|
||||
|
||||
if (name == "etag") {
|
||||
result.etag = trim(line.substr(i + 1));
|
||||
}
|
||||
|
||||
else if (name == "content-encoding")
|
||||
encoding = trim(line.substr(i + 1));
|
||||
|
||||
else if (name == "accept-ranges" && toLower(trim(line.substr(i + 1))) == "bytes")
|
||||
acceptRanges = true;
|
||||
|
||||
else if (name == "link" || name == "x-amz-meta-link") {
|
||||
auto value = trim(line.substr(i + 1));
|
||||
static std::regex linkRegex("<([^>]*)>; rel=\"immutable\"", std::regex::extended | std::regex::icase);
|
||||
if (std::smatch match; std::regex_match(value, match, linkRegex))
|
||||
result.immutableUrl = match.str(1);
|
||||
else
|
||||
debug("got invalid link header '%s'", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return realSize;
|
||||
}
|
||||
|
@ -336,25 +333,6 @@ struct curlFileTransfer : public FileTransfer
|
|||
debug("finished %s of '%s'; curl status = %d, HTTP status = %d, body = %d bytes",
|
||||
request.verb(), request.uri, code, httpStatus, result.bodySize);
|
||||
|
||||
auto link = getHeader("link");
|
||||
if (!link) {
|
||||
link = getHeader("x-amz-meta-link");
|
||||
}
|
||||
if (link) {
|
||||
static std::regex linkRegex(
|
||||
"<([^>]*)>; rel=\"immutable\"", std::regex::extended | std::regex::icase
|
||||
);
|
||||
if (std::smatch match; std::regex_match(*link, match, linkRegex)) {
|
||||
result.immutableUrl = match.str(1);
|
||||
} else {
|
||||
debug("got invalid link header '%s'", *link);
|
||||
}
|
||||
}
|
||||
|
||||
if (auto etag = getHeader("etag")) {
|
||||
result.etag = std::move(*etag);
|
||||
}
|
||||
|
||||
// this has to happen here until we can return an actual future.
|
||||
// wrapping user `callback`s instead is not possible because the
|
||||
// Callback api expects std::functions, and copying Callbacks is
|
||||
|
@ -678,7 +656,7 @@ struct curlFileTransfer : public FileTransfer
|
|||
/* Ugly hack to support s3:// URIs. */
|
||||
if (request.uri.starts_with("s3://")) {
|
||||
// FIXME: do this on a worker thread
|
||||
return std::async(std::launch::deferred, [uri{request.uri}] {
|
||||
return std::async(std::launch::deferred, [uri{request.uri}]() -> FileTransferResult {
|
||||
#if ENABLE_S3
|
||||
auto [bucketName, key, params] = parseS3Uri(uri);
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
#include "logging.hh"
|
||||
#include "serialise.hh"
|
||||
#include "types.hh"
|
||||
#include "hash.hh"
|
||||
#include "config.hh"
|
||||
|
||||
#include <string>
|
||||
|
@ -39,12 +40,12 @@ struct FileTransferSettings : Config
|
|||
this, 300, "stalled-download-timeout",
|
||||
R"(
|
||||
The timeout (in seconds) for receiving data from servers
|
||||
during download. Nix cancels idle downloads after this
|
||||
during download. Lix cancels idle downloads after this
|
||||
timeout's duration.
|
||||
)"};
|
||||
|
||||
Setting<unsigned int> tries{this, 5, "download-attempts",
|
||||
"How often Nix will attempt to download a file before giving up."};
|
||||
"How often Lix will attempt to download a file before giving up."};
|
||||
};
|
||||
|
||||
extern FileTransferSettings fileTransferSettings;
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
#include "derivations.hh"
|
||||
#include "globals.hh"
|
||||
#include "local-store.hh"
|
||||
#include "pathlocks.hh"
|
||||
#include "processes.hh"
|
||||
#include "signals.hh"
|
||||
#include "finally.hh"
|
||||
#include "unix-domain-socket.hh"
|
||||
|
||||
#include <functional>
|
||||
#include <queue>
|
||||
#include <algorithm>
|
||||
#include <regex>
|
||||
#include <random>
|
||||
|
||||
#include <climits>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#include "environment-variables.hh"
|
||||
#include "globals.hh"
|
||||
#include "util.hh"
|
||||
#include "archive.hh"
|
||||
#include "file-system.hh"
|
||||
#include "logging.hh"
|
||||
#include "strings.hh"
|
||||
#include "users.hh"
|
||||
#include "args.hh"
|
||||
#include "abstract-setting-to-json.hh"
|
||||
#include "compute-levels.hh"
|
||||
#include "current-process.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <dlfcn.h>
|
||||
|
@ -25,6 +28,7 @@
|
|||
#include "config-impl.hh"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "processes.hh"
|
||||
#include <curl/curl.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
@ -83,7 +87,7 @@ Settings::Settings()
|
|||
|
||||
/* Set the build hook location
|
||||
|
||||
For builds we perform a self-invocation, so Nix has to be self-aware.
|
||||
For builds we perform a self-invocation, so Lix has to be self-aware.
|
||||
That is, it has to know where it is installed. We don't think it's sentient.
|
||||
|
||||
Normally, nix is installed according to `nixBinDir`, which is set at compile time,
|
||||
|
@ -97,7 +101,7 @@ Settings::Settings()
|
|||
current executable, using `getSelfExe()`.
|
||||
|
||||
As a last resort, we resort to `PATH`. Hopefully we find a `nix` there that's compatible.
|
||||
If you're porting Nix to a new platform, that might be good enough for a while, but
|
||||
If you're porting Lix to a new platform, that might be good enough for a while, but
|
||||
you'll want to improve `getSelfExe()` to work on your platform.
|
||||
*/
|
||||
std::string nixExePath = nixBinDir + "/nix";
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
#include "environment-variables.hh"
|
||||
#include "types.hh"
|
||||
#include "config.hh"
|
||||
#include "util.hh"
|
||||
|
||||
#include <map>
|
||||
#include <limits>
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
Setting<bool> tryFallback{
|
||||
this, false, "fallback",
|
||||
R"(
|
||||
If set to `true`, Nix will fall back to building from source if a
|
||||
If set to `true`, Lix will fall back to building from source if a
|
||||
binary substitute fails. This is equivalent to the `--fallback`
|
||||
flag. The default is `false`.
|
||||
)",
|
||||
|
@ -149,9 +149,9 @@ public:
|
|||
MaxBuildJobsSetting maxBuildJobs{
|
||||
this, 1, "max-jobs",
|
||||
R"(
|
||||
This option defines the maximum number of jobs that Nix will try to
|
||||
This option defines the maximum number of jobs that Lix will try to
|
||||
build in parallel. The default is `1`. The special value `auto`
|
||||
causes Nix to use the number of CPUs in your system. `0` is useful
|
||||
causes Lix to use the number of CPUs in your system. `0` is useful
|
||||
when using remote builders to prevent any local builds (except for
|
||||
`preferLocalBuild` derivation attribute which executes locally
|
||||
regardless). It can be overridden using the `--max-jobs` (`-j`)
|
||||
|
@ -195,11 +195,11 @@ public:
|
|||
Setting<std::string> thisSystem{
|
||||
this, SYSTEM, "system",
|
||||
R"(
|
||||
The system type of the current Nix installation.
|
||||
Nix will only build a given [derivation](@docroot@/language/derivations.md) locally when its `system` attribute equals any of the values specified here or in [`extra-platforms`](#conf-extra-platforms).
|
||||
The system type of the current Lix installation.
|
||||
Lix will only build a given [derivation](@docroot@/language/derivations.md) locally when its `system` attribute equals any of the values specified here or in [`extra-platforms`](#conf-extra-platforms).
|
||||
|
||||
The default value is set when Nix itself is compiled for the system it will run on.
|
||||
The following system types are widely used, as [Nix is actively supported on these platforms](@docroot@/contributing/hacking.md#platforms):
|
||||
The default value is set when Lix itself is compiled for the system it will run on.
|
||||
The following system types are widely used, as [Lix is actively supported on these platforms](@docroot@/contributing/hacking.md#platforms):
|
||||
|
||||
- `x86_64-linux`
|
||||
- `x86_64-darwin`
|
||||
|
@ -210,7 +210,7 @@ public:
|
|||
- `armv7l-linux`
|
||||
|
||||
In general, you do not have to modify this setting.
|
||||
While you can force Nix to run a Darwin-specific `builder` executable on a Linux machine, the result would obviously be wrong.
|
||||
While you can force Lix to run a Darwin-specific `builder` executable on a Linux machine, the result would obviously be wrong.
|
||||
|
||||
This value is available in the Nix language as
|
||||
[`builtins.currentSystem`](@docroot@/language/builtin-constants.md#builtins-currentSystem)
|
||||
|
@ -252,8 +252,8 @@ public:
|
|||
R"(
|
||||
The path to the helper program that executes remote builds.
|
||||
|
||||
Nix communicates with the build hook over `stdio` using a custom protocol to request builds that cannot be performed directly by the Nix daemon.
|
||||
The default value is the internal Nix binary that implements remote building.
|
||||
Lix communicates with the build hook over `stdio` using a custom protocol to request builds that cannot be performed directly by the Nix daemon.
|
||||
The default value is the internal Lix binary that implements remote building.
|
||||
|
||||
> **Important**
|
||||
>
|
||||
|
@ -270,7 +270,7 @@ public:
|
|||
Setting<bool> alwaysAllowSubstitutes{
|
||||
this, false, "always-allow-substitutes",
|
||||
R"(
|
||||
If set to `true`, Nix will ignore the `allowSubstitutes` attribute in
|
||||
If set to `true`, Lix will ignore the `allowSubstitutes` attribute in
|
||||
derivations and always attempt to use available substituters.
|
||||
For more information on `allowSubstitutes`, see [the manual chapter on advanced attributes](../language/advanced-attributes.md).
|
||||
)"};
|
||||
|
@ -278,7 +278,7 @@ public:
|
|||
Setting<bool> buildersUseSubstitutes{
|
||||
this, false, "builders-use-substitutes",
|
||||
R"(
|
||||
If set to `true`, Nix will instruct remote build machines to use
|
||||
If set to `true`, Lix will instruct remote build machines to use
|
||||
their own binary substitutes if available. In practical terms, this
|
||||
means that remote hosts will fetch as many build dependencies as
|
||||
possible from their own substitutes (e.g, from `cache.nixos.org`),
|
||||
|
@ -317,7 +317,7 @@ public:
|
|||
Setting<bool> useSubstitutes{
|
||||
this, true, "substitute",
|
||||
R"(
|
||||
If set to `true` (default), Nix will use binary substitutes if
|
||||
If set to `true` (default), Lix will use binary substitutes if
|
||||
available. This option can be disabled to force building from
|
||||
source.
|
||||
)",
|
||||
|
@ -326,9 +326,9 @@ public:
|
|||
Setting<std::string> buildUsersGroup{
|
||||
this, "", "build-users-group",
|
||||
R"(
|
||||
This options specifies the Unix group containing the Nix build user
|
||||
accounts. In multi-user Nix installations, builds should not be
|
||||
performed by the Nix account since that would allow users to
|
||||
This options specifies the Unix group containing the Lix build user
|
||||
accounts. In multi-user Lix installations, builds should not be
|
||||
performed by the Lix account since that would allow users to
|
||||
arbitrarily modify the Nix store and database by supplying specially
|
||||
crafted builders; and they cannot be performed by the calling user
|
||||
since that would allow him/her to influence the build result.
|
||||
|
@ -338,11 +338,11 @@ public:
|
|||
of the group specified here (as listed in `/etc/group`). Those user
|
||||
accounts should not be used for any other purpose\!
|
||||
|
||||
Nix will never run two builds under the same user account at the
|
||||
Lix will never run two builds under the same user account at the
|
||||
same time. This is to prevent an obvious security hole: a malicious
|
||||
user writing a Nix expression that modifies the build result of a
|
||||
legitimate Nix expression being built by another user. Therefore it
|
||||
is good to have as many Nix build user accounts as you can spare.
|
||||
is good to have as many Lix build user accounts as you can spare.
|
||||
(Remember: uids are cheap.)
|
||||
|
||||
The build users should have permission to create files in the Nix
|
||||
|
@ -351,7 +351,7 @@ public:
|
|||
and its mode should be `1775`.
|
||||
|
||||
If the build users group is empty, builds will be performed under
|
||||
the uid of the Nix process (that is, the uid of the caller if
|
||||
the uid of the Lix process (that is, the uid of the caller if
|
||||
`NIX_REMOTE` is empty, the uid under which the Nix daemon runs if
|
||||
`NIX_REMOTE` is `daemon`). Obviously, this should not be used
|
||||
with a nix daemon accessible to untrusted clients.
|
||||
|
@ -405,7 +405,7 @@ public:
|
|||
Setting<bool> keepLog{
|
||||
this, true, "keep-build-log",
|
||||
R"(
|
||||
If set to `true` (the default), Nix will write the build log of a
|
||||
If set to `true` (the default), Lix will write the build log of a
|
||||
derivation (i.e. the standard output and error of its builder) to
|
||||
the directory `/nix/var/log/nix/drvs`. The build log can be
|
||||
retrieved using the command `nix-store -l path`.
|
||||
|
@ -468,7 +468,7 @@ public:
|
|||
Setting<bool> autoOptimiseStore{
|
||||
this, false, "auto-optimise-store",
|
||||
R"(
|
||||
If set to `true`, Nix automatically detects files in the store
|
||||
If set to `true`, Lix automatically detects files in the store
|
||||
that have identical contents, and replaces them with hard links to
|
||||
a single copy. This saves disk space. If set to `false` (the
|
||||
default), you can still run `nix-store --optimise` to get rid of
|
||||
|
@ -519,7 +519,7 @@ public:
|
|||
network).
|
||||
|
||||
Currently, sandboxing only work on Linux and macOS. The use of a
|
||||
sandbox requires that Nix is run as root (so you should use the
|
||||
sandbox requires that Lix is run as root (so you should use the
|
||||
“build users” feature to perform the actual builds under different
|
||||
users than root).
|
||||
|
||||
|
@ -545,7 +545,7 @@ public:
|
|||
If the source is in the Nix store, then its closure will be added to
|
||||
the sandbox as well.
|
||||
|
||||
Depending on how Nix was built, the default value for this option
|
||||
Depending on how Lix was built, the default value for this option
|
||||
may be empty or provide `/bin/sh` as a bind-mount of `bash`.
|
||||
)",
|
||||
{"build-chroot-dirs", "build-sandbox-paths"}};
|
||||
|
@ -556,7 +556,7 @@ public:
|
|||
Setting<bool> requireDropSupplementaryGroups{this, getuid() == 0, "require-drop-supplementary-groups",
|
||||
R"(
|
||||
Following the principle of least privilege,
|
||||
Nix will attempt to drop supplementary groups when building with sandboxing.
|
||||
Lix will attempt to drop supplementary groups when building with sandboxing.
|
||||
|
||||
However this can fail under some circumstances.
|
||||
For example, if the user lacks the `CAP_SETGID` capability.
|
||||
|
@ -642,7 +642,7 @@ public:
|
|||
A whitespace-separated list of public keys.
|
||||
|
||||
At least one of the following condition must be met
|
||||
for Nix to accept copying a store object from another
|
||||
for Lix to accept copying a store object from another
|
||||
Nix store (such as a substituter):
|
||||
|
||||
- the store object has been signed using a key in the trusted keys list
|
||||
|
@ -665,14 +665,14 @@ public:
|
|||
this, 60 * 60, "tarball-ttl",
|
||||
R"(
|
||||
The number of seconds a downloaded tarball is considered fresh. If
|
||||
the cached tarball is stale, Nix will check whether it is still up
|
||||
to date using the ETag header. Nix will download a new version if
|
||||
the cached tarball is stale, Lix will check whether it is still up
|
||||
to date using the ETag header. Lix will download a new version if
|
||||
the ETag header is unsupported, or the cached ETag doesn't match.
|
||||
|
||||
Setting the TTL to `0` forces Nix to always check if the tarball is
|
||||
Setting the TTL to `0` forces Lix to always check if the tarball is
|
||||
up to date.
|
||||
|
||||
Nix caches tarballs in `$XDG_CACHE_HOME/nix/tarballs`.
|
||||
Lix caches tarballs in `$XDG_CACHE_HOME/nix/tarballs`.
|
||||
|
||||
Files fetched via `NIX_PATH`, `fetchGit`, `fetchMercurial`,
|
||||
`fetchTarball`, and `fetchurl` respect this TTL.
|
||||
|
@ -701,7 +701,7 @@ public:
|
|||
R"(
|
||||
System types of executables that can be run on this machine.
|
||||
|
||||
Nix will only build a given [derivation](@docroot@/language/derivations.md) locally when its `system` attribute equals any of the values specified here or in the [`system` option](#conf-system).
|
||||
Lix will only build a given [derivation](@docroot@/language/derivations.md) locally when its `system` attribute equals any of the values specified here or in the [`system` option](#conf-system).
|
||||
|
||||
Setting this can be useful to build derivations locally on compatible machines:
|
||||
- `i686-linux` executables can be run on `x86_64-linux` machines (set by default)
|
||||
|
@ -748,16 +748,16 @@ public:
|
|||
"substituters",
|
||||
R"(
|
||||
A list of [URLs of Nix stores](@docroot@/command-ref/new-cli/nix3-help-stores.md#store-url-format) to be used as substituters, separated by whitespace.
|
||||
A substituter is an additional [store](@docroot@/glossary.md#gloss-store) from which Nix can obtain [store objects](@docroot@/glossary.md#gloss-store-object) instead of building them.
|
||||
A substituter is an additional [store](@docroot@/glossary.md#gloss-store) from which Lix can obtain [store objects](@docroot@/glossary.md#gloss-store-object) instead of building them.
|
||||
|
||||
Substituters are tried based on their priority value, which each substituter can set independently.
|
||||
Lower value means higher priority.
|
||||
The default is `https://cache.nixos.org`, which has a priority of 40.
|
||||
|
||||
At least one of the following conditions must be met for Nix to use a substituter:
|
||||
At least one of the following conditions must be met for Lix to use a substituter:
|
||||
|
||||
- The substituter is in the [`trusted-substituters`](#conf-trusted-substituters) list
|
||||
- The user calling Nix is in the [`trusted-users`](#conf-trusted-users) list
|
||||
- The user calling Lix is in the [`trusted-users`](#conf-trusted-users) list
|
||||
|
||||
In addition, each store path should be trusted as described in [`trusted-public-keys`](#conf-trusted-public-keys)
|
||||
)",
|
||||
|
@ -866,13 +866,13 @@ public:
|
|||
this, 0, "download-speed",
|
||||
R"(
|
||||
Specify the maximum transfer rate in kilobytes per second you want
|
||||
Nix to use for downloads.
|
||||
Lix to use for downloads.
|
||||
)"};
|
||||
|
||||
Setting<std::string> netrcFile{
|
||||
this, fmt("%s/%s", nixConfDir, "netrc"), "netrc-file",
|
||||
R"(
|
||||
If set to an absolute path to a `netrc` file, Nix will use the HTTP
|
||||
If set to an absolute path to a `netrc` file, Lix will use the HTTP
|
||||
authentication credentials in this file when trying to download from
|
||||
a remote host through HTTP or HTTPS. Defaults to
|
||||
`$NIX_CONF_DIR/netrc`.
|
||||
|
@ -898,7 +898,7 @@ public:
|
|||
this, getDefaultSSLCertFile(), "ssl-cert-file",
|
||||
R"(
|
||||
The path of a file containing CA certificates used to
|
||||
authenticate `https://` downloads. Nix by default will use
|
||||
authenticate `https://` downloads. Lix by default will use
|
||||
the first of the following files that exists:
|
||||
|
||||
1. `/etc/ssl/certs/ca-certificates.crt`
|
||||
|
@ -915,7 +915,7 @@ public:
|
|||
Setting<StringSet> ignoredAcls{
|
||||
this, {"security.selinux", "system.nfs4_acl", "security.csm"}, "ignored-acls",
|
||||
R"(
|
||||
A list of ACLs that should be ignored, normally Nix attempts to
|
||||
A list of ACLs that should be ignored, normally Lix attempts to
|
||||
remove all ACLs from files and directories in the Nix store, but
|
||||
some ACLs like `security.selinux` or `system.nfs4_acl` can't be
|
||||
removed even by root. Therefore it's best to just ignore them.
|
||||
|
@ -926,7 +926,7 @@ public:
|
|||
this, {}, "hashed-mirrors",
|
||||
R"(
|
||||
A list of web servers used by `builtins.fetchurl` to obtain files by
|
||||
hash. Given a hash type *ht* and a base-16 hash *h*, Nix will try to
|
||||
hash. Given a hash type *ht* and a base-16 hash *h*, Lix will try to
|
||||
download the file from *hashed-mirror*/*ht*/*h*. This allows files to
|
||||
be downloaded even if they have disappeared from their original URI.
|
||||
For example, given an example mirror `http://tarballs.nixos.org/`,
|
||||
|
@ -939,7 +939,7 @@ public:
|
|||
}
|
||||
```
|
||||
|
||||
Nix will attempt to download this file from
|
||||
Lix will attempt to download this file from
|
||||
`http://tarballs.nixos.org/sha256/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae`
|
||||
first. If it is not available there, if will try the original URI.
|
||||
)"};
|
||||
|
@ -948,7 +948,7 @@ public:
|
|||
this, 0, "min-free",
|
||||
R"(
|
||||
When free disk space in `/nix/store` drops below `min-free` during a
|
||||
build, Nix performs a garbage-collection until `max-free` bytes are
|
||||
build, Lix performs a garbage-collection until `max-free` bytes are
|
||||
available or there is no more garbage. A value of `0` (the default)
|
||||
disables this feature.
|
||||
)"};
|
||||
|
@ -983,7 +983,7 @@ public:
|
|||
itself, they must be DSOs compatible with the instance of Nix
|
||||
running at the time (i.e. compiled against the same headers, not
|
||||
linked to any incompatible libraries). They should not be linked to
|
||||
any Nix libs directly, as those will be available already at load
|
||||
any Lix libs directly, as those will be available already at load
|
||||
time.
|
||||
|
||||
If an entry in the list is a directory, all files in the directory
|
||||
|
@ -996,7 +996,7 @@ public:
|
|||
Setting<bool> allowSymlinkedStore{
|
||||
this, false, "allow-symlinked-store",
|
||||
R"(
|
||||
If set to `true`, Nix will stop complaining if the store directory
|
||||
If set to `true`, Lix will stop complaining if the store directory
|
||||
(typically /nix/store) contains symlink components.
|
||||
|
||||
This risks making some builds "impure" because builders sometimes
|
||||
|
@ -1009,13 +1009,13 @@ public:
|
|||
Setting<bool> useXDGBaseDirectories{
|
||||
this, false, "use-xdg-base-directories",
|
||||
R"(
|
||||
If set to `true`, Nix will conform to the [XDG Base Directory Specification] for files in `$HOME`.
|
||||
If set to `true`, Lix will conform to the [XDG Base Directory Specification] for files in `$HOME`.
|
||||
The environment variables used to implement this are documented in the [Environment Variables section](@docroot@/command-ref/env-common.md).
|
||||
|
||||
[XDG Base Directory Specification]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
|
||||
> **Warning**
|
||||
> This changes the location of some well-known symlinks that Nix creates, which might break tools that rely on the old, non-XDG-conformant locations.
|
||||
> This changes the location of some well-known symlinks that Lix creates, which might break tools that rely on the old, non-XDG-conformant locations.
|
||||
|
||||
In particular, the following locations change:
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ public:
|
|||
| `~/.nix-defexpr` | `$XDG_STATE_HOME/nix/defexpr` |
|
||||
| `~/.nix-channels` | `$XDG_STATE_HOME/nix/channels` |
|
||||
|
||||
If you already have Nix installed and are using [profiles](@docroot@/package-management/profiles.md) or [channels](@docroot@/command-ref/nix-channel.md), you should migrate manually when you enable this option.
|
||||
If you already have Lix installed and are using [profiles](@docroot@/package-management/profiles.md) or [channels](@docroot@/command-ref/nix-channel.md), you should migrate manually when you enable this option.
|
||||
If `$XDG_STATE_HOME` is not set, use `$HOME/.local/state/nix` instead of `$XDG_STATE_HOME/nix`.
|
||||
This can be achieved with the following shell commands:
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* a glibc git checkout via `rg --pcre2 'define __NR_fchmodat2 (?!452)'`.
|
||||
*
|
||||
* The problem is that glibc 2.39 and libseccomp 2.5.5 are needed to
|
||||
* get the syscall number. However, a Nix built against nixpkgs 23.11
|
||||
* get the syscall number. However, a Lix built against nixpkgs 23.11
|
||||
* (glibc 2.38) should still have the issue fixed without depending
|
||||
* on the build environment.
|
||||
*
|
||||
|
|
|
@ -18,12 +18,12 @@ struct LocalFSStoreConfig : virtual StoreConfig
|
|||
const PathSetting stateDir{this,
|
||||
rootDir.get() ? *rootDir.get() + "/nix/var/nix" : settings.nixStateDir,
|
||||
"state",
|
||||
"Directory where Nix will store state."};
|
||||
"Directory where Lix will store state."};
|
||||
|
||||
const PathSetting logDir{this,
|
||||
rootDir.get() ? *rootDir.get() + "/nix/var/log/nix" : settings.nixLogDir,
|
||||
"log",
|
||||
"directory where Nix will store log files."};
|
||||
"directory where Lix will store log files."};
|
||||
|
||||
const PathSetting realStoreDir{this,
|
||||
rootDir.get() ? *rootDir.get() + "/nix/store" : storeDir, "real",
|
||||
|
|
|
@ -313,13 +313,13 @@ LocalStore::LocalStore(const Params & params)
|
|||
throw Error(
|
||||
"Your Nix store has a database in Berkeley DB format,\n"
|
||||
"which is no longer supported. To convert to the new format,\n"
|
||||
"please upgrade Nix to version 0.12 first.");
|
||||
"please use the original Nix version 0.12 first.");
|
||||
|
||||
if (curSchema < 6)
|
||||
throw Error(
|
||||
"Your Nix store has a database in flat file format,\n"
|
||||
"which is no longer supported. To convert to the new format,\n"
|
||||
"please upgrade Nix to version 1.11 first.");
|
||||
"please use the original Nix version 1.11 first.");
|
||||
|
||||
if (!lockFile(globalLock.get(), ltWrite, false)) {
|
||||
printInfo("waiting for exclusive access to the Nix store...");
|
||||
|
@ -550,7 +550,12 @@ void LocalStore::openDB(State & state, bool create)
|
|||
if (mode == "wal" ) {
|
||||
/* persist the WAL files when the DB connection is closed.
|
||||
* This allows for read-only connections without any write permissions
|
||||
* on the state directory to succeed on a closed database. */
|
||||
* on the state directory to succeed on a closed database. Setting the
|
||||
* journal_size_limit to 2^40 bytes results in the WAL files getting
|
||||
* truncated to 0 on exit and limits the on disk size of the WAL files
|
||||
* to 2^40 bytes following a checkpoint */
|
||||
if (sqlite3_exec(db, "pragma main.journal_size_limit = 1099511627776;", 0, 0, 0) != SQLITE_OK)
|
||||
SQLiteError::throw_(db, "setting journal_size_limit");
|
||||
int enable = 1;
|
||||
if (sqlite3_file_control(db, NULL, SQLITE_FCNTL_PERSIST_WAL, &enable) != SQLITE_OK)
|
||||
SQLiteError::throw_(db, "setting persistent WAL mode");
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
#include "sqlite.hh"
|
||||
|
||||
#include "pathlocks.hh"
|
||||
#include "store-api.hh"
|
||||
#include "indirect-root-store.hh"
|
||||
#include "sync.hh"
|
||||
#include "util.hh"
|
||||
|
||||
#include <chrono>
|
||||
#include <future>
|
||||
|
@ -25,6 +23,9 @@ namespace nix {
|
|||
* 0.7. Version 2 was Nix 0.8 and 0.9. Version 3 is Nix 0.10.
|
||||
* Version 4 is Nix 0.11. Version 5 is Nix 0.12-0.16. Version 6 is
|
||||
* Nix 1.0. Version 7 is Nix 1.3. Version 10 is 2.0.
|
||||
*
|
||||
* Lix started at 2.90, it cannot ever go past version 10 (Nix 2.18),
|
||||
* since doing so will break compatibility with future CppNix versions.
|
||||
*/
|
||||
const int nixSchemaVersion = 10;
|
||||
|
||||
|
@ -51,7 +52,7 @@ struct LocalStoreConfig : virtual LocalFSStoreConfig
|
|||
R"(
|
||||
Allow this store to be opened when its [database](@docroot@/glossary.md#gloss-nix-database) is on a read-only filesystem.
|
||||
|
||||
Normally Nix will attempt to open the store database in read-write mode, even for querying (when write access is not needed), causing it to fail if the database is on a read-only filesystem.
|
||||
Normally Lix will attempt to open the store database in read-write mode, even for querying (when write access is not needed), causing it to fail if the database is on a read-only filesystem.
|
||||
|
||||
Enable read-only mode to disable locking and open the SQLite database with the [`immutable` parameter](https://www.sqlite.org/c3ref/open.html) set.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include "lock.hh"
|
||||
#include "logging.hh"
|
||||
#include "file-system.hh"
|
||||
#include "globals.hh"
|
||||
#include "pathlocks.hh"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "machines.hh"
|
||||
#include "util.hh"
|
||||
#include "globals.hh"
|
||||
#include "store-api.hh"
|
||||
#include "strings.hh"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -140,7 +140,7 @@ static Machine parseBuilderLine(const std::string & line)
|
|||
};
|
||||
|
||||
auto parseFloatField = [&](size_t fieldIndex) {
|
||||
const auto result = string2Int<float>(tokens[fieldIndex]);
|
||||
const auto result = string2Float<float>(tokens[fieldIndex]);
|
||||
if (!result) {
|
||||
throw FormatError("bad machine specification: failed to convert column #%lu in a row: '%s' to 'float'", fieldIndex, line);
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ libstore_sources = files(
|
|||
'store-api.cc',
|
||||
'uds-remote-store.cc',
|
||||
'worker-protocol.cc',
|
||||
'build/child.cc',
|
||||
'build/derivation-goal.cc',
|
||||
'build/drv-output-substitution-goal.cc',
|
||||
'build/entry-points.cc',
|
||||
|
@ -96,6 +97,7 @@ libstore_sources = files(
|
|||
|
||||
libstore_headers = files(
|
||||
'binary-cache-store.hh',
|
||||
'build/child.hh',
|
||||
'build/derivation-goal.hh',
|
||||
'build/drv-output-substitution-goal.hh',
|
||||
'build/goal.hh',
|
||||
|
@ -218,6 +220,7 @@ libstore = library(
|
|||
nlohmann_json,
|
||||
],
|
||||
cpp_args : cpp_args,
|
||||
cpp_pch : cpp_pch,
|
||||
install : true,
|
||||
# FIXME(Qyriad): is this right?
|
||||
install_rpath : libdir,
|
||||
|
@ -231,6 +234,16 @@ liblixstore = declare_dependency(
|
|||
link_with : libstore,
|
||||
)
|
||||
|
||||
# FIXME: remove when https://git.lix.systems/lix-project/lix/issues/359 is fixed.
|
||||
if is_static
|
||||
liblixstore_mstatic = declare_dependency(
|
||||
include_directories : include_directories('.'),
|
||||
link_whole : libstore,
|
||||
)
|
||||
else
|
||||
liblixstore_mstatic = liblixstore
|
||||
endif
|
||||
|
||||
# FIXME: not using the pkg-config module because it creates way too many deps
|
||||
# while meson migration is in progress, and we want to not include boost here
|
||||
configure_file(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "names.hh"
|
||||
#include "util.hh"
|
||||
#include "strings.hh"
|
||||
|
||||
#include <regex>
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include "nar-info-disk-cache.hh"
|
||||
#include "logging.hh"
|
||||
#include "sync.hh"
|
||||
#include "sqlite.hh"
|
||||
#include "globals.hh"
|
||||
#include "users.hh"
|
||||
|
||||
#include <sqlite3.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "util.hh"
|
||||
#include "local-store.hh"
|
||||
#include "globals.hh"
|
||||
#include "signals.hh"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include <regex>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "util.hh"
|
||||
#include "regex-combinators.hh"
|
||||
#include "outputs-spec.hh"
|
||||
#include "path-regex.hh"
|
||||
#include "strings.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#include "path-references.hh"
|
||||
#include "hash.hh"
|
||||
#include "util.hh"
|
||||
#include "archive.hh"
|
||||
|
||||
#include <map>
|
||||
#include <cstdlib>
|
||||
#include <mutex>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue