about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2014-07-17 nix-daemon: Add trusted-users and allowed-users optionsEelco Dolstra3-3/+48
‘trusted-users’ is a list of users and groups that have elevated rights, such as the ability to specify binary caches. It defaults to ‘root’. A typical value would be ‘@wheel’ to specify all users in the wheel group. ‘allowed-users’ is a list of users and groups that are allowed to connect to the daemon. It defaults to ‘*’. A typical value would be ‘@users’ to specify the ‘users’ group.
2014-07-17 nix-daemon: Show name of connecting userEelco Dolstra1-6/+7
2014-07-17 nix-daemon: Only print connection info if we have SO_PEERCREDEelco Dolstra1-9/+12
2014-07-17 nix-daemon: Fix compat with older clientsEelco Dolstra1-1/+1
2014-07-16 Get rid of a compiler warningEelco Dolstra1-1/+2
2014-07-16 Be more strict about file names in NARsEelco Dolstra1-1/+6
2014-07-16 Handle case collisions on case-insensitive systemsEelco Dolstra3-75/+102
When running NixOps under Mac OS X, we need to be able to import store paths built on Linux into the local Nix store. However, HFS+ is usually case-insensitive, so if there are directories with file names that differ only in case, then importing will fail. The solution is to add a suffix ("~nix~case~hack~<integer>") to colliding files. For instance, if we have a directory containing xt_CONNMARK.h and xt_connmark.h, then the latter will be renamed to "xt_connmark.h~nix~case~hack~1". If a store path is dumped as a NAR, the suffixes are removed. Thus, importing and exporting via a case-insensitive Nix store is round-tripping. So when NixOps calls nix-copy-closure to copy the path to a Linux machine, you get the original file names back. Closes #119.
2014-07-14 build-remote.pl: Fix building multiple output derivationsEelco Dolstra2-2/+3
We were importing paths without sorting them topologically, leading to "path is not valid" errors. See e.g. http://hydra.nixos.org/build/12451761
2014-07-11 build-remote.pl: Use ‘nix-store --serve’ on the remote sideEelco Dolstra3-5/+35
This makes things more efficient (we don't need to use an SSH master connection, and we only start a single remote process) and gets rid of locking issues (the remote nix-store process will keep inputs and outputs locked as long as they're needed). It also makes it more or less secure to connect directly to the root account on the build machine, using a forced command (e.g. ‘command="nix-store --serve --write"’). This bypasses the Nix daemon and is therefore more efficient. Also, don't call nix-store to import the output paths.
2014-07-11 Allow $NIX_BUILD_HOOK to be relative to Nix libexec directoryEelco Dolstra2-3/+5
2014-07-10 Fix broken Pid constructorEelco Dolstra1-5/+2
2014-07-10 Replace message "importing path <...>" with "exporting path <...>"Eelco Dolstra1-2/+2
This causes nix-copy-closure to show what it's doing before rather than after.
2014-07-10 nix-copy-closure -s: Do substitutions via ‘nix-store --serve’Eelco Dolstra2-0/+30
This means we no longer need an SSH master connection, since we only execute a single command on the remote host.
2014-07-10 Remove tabsEelco Dolstra1-3/+3
2014-07-10 Refactoring: Move all fork handling into a higher-order functionEelco Dolstra7-206/+128
C++11 lambdas ftw.
2014-07-10 nix-copy-closure: Restore compression and the progress viewerEelco Dolstra1-2/+47
2014-07-10 Remove maybeVforkEelco Dolstra4-14/+4
2014-07-10 nix-copy-closure: Fix race conditionEelco Dolstra3-57/+62
There is a long-standing race condition when copying a closure to a remote machine, particularly affecting build-remote.pl: the client first asks the remote machine which paths it already has, then copies over the missing paths. If the garbage collector kicks in on the remote machine between the first and second step, the already-present paths may be deleted. The missing paths may then refer to deleted paths, causing nix-copy-closure to fail. The client now performs both steps using a single remote Nix call (using ‘nix-store --serve’), locking all paths in the closure while querying. I changed the --serve protocol a bit (getting rid of QueryCommand), so this breaks the SSH substituter from older versions. But it was marked experimental anyway. Fixes #141.
2014-07-10 Fix security hole in ‘nix-store --serve’Eelco Dolstra1-1/+1
Since it didn't check that the path received from the client is a store path, the client could dump any path in the file system.
2014-07-09 Fix compilation error on some versions of GCCEelco Dolstra2-2/+3
src/libexpr/primops.cc:42:8: error: looser throw specifier for 'virtual nix::InvalidPathError::~InvalidPathError()' src/libexpr/nixexpr.hh:12:1: error: overriding 'virtual nix::EvalError::~EvalError() noexcept (true)' http://hydra.nixos.org/build/12385750
2014-07-04 Add builtin function ‘fromJSON’Eelco Dolstra3-0/+167
Fixes #294.
2014-06-27 Style fixEelco Dolstra1-11/+8
2014-06-27 Add `--json` argument to `nix-instantiate`Paul Colomiets1-6/+17
2014-06-27 allow-arbitrary-code-during-evaluation -> ↵Eelco Dolstra1-1/+1
allow-unsafe-native-code-during-evaluation
2014-06-24 Only add the importNative primop if the ↵Shea Levy3-1/+7
allow-arbitrary-code-during-evaluation option is true (default false)
2014-06-17 Add importNative primopShea Levy2-0/+44
This can be used to import a dynamic shared object and return an arbitrary value, including new primops. This can be used both to test new primops without having to recompile nix every time, and to build specialized primops that probably don't belong upstream (e.g. a function that calls out to gpg to decrypt a nixops secret as-needed). The imported function should initialize the Value & as needed. A single import can define multiple values by creating an attrset or list, of course. An example initialization function might look like: extern "C" void initialize(nix::EvalState & state, nix::Value & v) { v.type = nix::tPrimOp; v.primOp = NEW nix::PrimOp(myFun, 1, state.symbols.create("myFun")); } Then `builtins.importNative ./example.so "initialize"` will evaluate to the primop defined in the myFun function.
2014-06-12 Don't use member initialisersEelco Dolstra1-4/+4
They're a little bit too recent (only supported since GCC 4.7). http://hydra.nixos.org/build/11851475
2014-06-12 Fix bogus warnings about dumping large pathsEelco Dolstra1-2/+2
Also, yay for C++11 non-static initialisers.
2014-06-12 Drop ImportError and FindErrorEelco Dolstra2-6/+0
We're not catching these anywhere.
2014-06-12 findFile: Realise the context of the path attributesShea Levy2-18/+45
2014-06-12 Share code between scopedImport and importShea Levy1-42/+44
In addition to reducing duplication, this fixes both import from derivation and import of derivation for scopedImport
2014-06-10 == operator: Ignore string contextEelco Dolstra2-12/+3
There really is no case I can think of where taking the context into account is useful. Mostly it's just very inconvenient.
2014-06-10 Report daemon OOM betterEelco Dolstra2-9/+19
When copying a large path causes the daemon to run out of memory, you now get: error: Nix daemon out of memory instead of: error: writing to file: Broken pipe
2014-06-10 Print a warning when loading a large path into memoryEelco Dolstra3-4/+33
I.e. if you have a derivation with src = ./huge-directory; you'll get a warning that this is not a good idea.
2014-06-02 nix-env -qa --json: Generate valid JSON even if there are invalid meta attrsEelco Dolstra1-2/+3
2014-05-29 Sort nixPath attributesEelco Dolstra1-0/+1
2014-05-26 Use std::unordered_setEelco Dolstra3-21/+5
2014-05-26 Remove ExprBuiltinEelco Dolstra4-35/+8
It's slower than ExprVar since it doesn't compute a static displacement. Since we're not using the throw primop in the implementation of <...> anymore, it's also not really needed.
2014-05-26 Make the Nix search path declarativeEelco Dolstra5-16/+49
Nix search path lookups like <nixpkgs> are now desugared to ‘findFile nixPath <nixpkgs>’, where ‘findFile’ is a new primop. Thus you can override the search path simply by saying let nixPath = [ { prefix = "nixpkgs"; path = "/my-nixpkgs"; } ]; in ... <nixpkgs> ... In conjunction with ‘scopedImport’ (commit c273c15cb13bb86420dda1e5341a4e19517532b5), the Nix search path can be propagated across imports, e.g. let overrides = { nixPath = [ ... ] ++ builtins.nixPath; import = fn: scopedImport overrides fn; scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; builtins = builtins // overrides; }; in scopedImport overrides ./nixos
2014-05-26 Ensure that -I flags get included in nixPathEelco Dolstra7-17/+32
Also fixes #261.
2014-05-26 Add constant ‘nixPath’Eelco Dolstra1-0/+11
It contains the Nix expression search path as a list of { prefix, path } sets, e.g. [ { path = "/nix/var/nix/profiles/per-user/root/channels/nixos"; prefix = ""; } { path = "/etc/nixos/configuration.nix"; prefix = "nixos-config"; } { path = "/home/eelco/Dev/nix/inst/share/nix/corepkgs"; prefix = "nix"; } ]
2014-05-26 Add primop ‘scopedImport’Eelco Dolstra4-3/+34
‘scopedImport’ works like ‘import’, except that it takes a set of attributes to be added to the lexical scope of the expression, essentially extending or overriding the builtin variables. For instance, the expression scopedImport { x = 1; } ./foo.nix where foo.nix contains ‘x’, will evaluate to 1. This has a few applications: * It allows getting rid of function argument specifications in package expressions. For instance, a package expression like: { stdenv, fetchurl, libfoo }: stdenv.mkDerivation { ... buildInputs = [ libfoo ]; } can now we written as just stdenv.mkDerivation { ... buildInputs = [ libfoo ]; } and imported in all-packages.nix as: bar = scopedImport pkgs ./bar.nix; So whereas we once had dependencies listed in three places (buildInputs, the function, and the call site), they now only need to appear in one place. * It allows overriding builtin functions. For instance, to trace all calls to ‘map’: let overrides = { map = f: xs: builtins.trace "map called!" (map f xs); # Ensure that our override gets propagated by calls to # import/scopedImport. import = fn: scopedImport overrides fn; scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; # Also update ‘builtins’. builtins = builtins // overrides; }; in scopedImport overrides ./bla.nix * Similarly, it allows extending the set of builtin functions. For instance, during Nixpkgs/NixOS evaluation, the Nixpkgs library functions could be added to the default scope. There is a downside: calls to scopedImport are not memoized, unlike import. So importing a file multiple times leads to multiple parsings / evaluations. It would be possible to construct the AST only once, but that would require careful handling of variables/environments.
2014-05-26 Shut up some signedness warningsEelco Dolstra1-2/+2
2014-05-23 Ugly hack to allow --argstr values starting with a dashEelco Dolstra1-0/+7
Fixes #265.
2014-05-21 nix-store -l: Fetch build logs from the InternetEelco Dolstra6-4/+35
If a build log is not available locally, then ‘nix-store -l’ will now try to download it from the servers listed in the ‘log-servers’ option in nix.conf. For instance, if you have: log-servers = http://hydra.nixos.org/log then it will try to get logs from http://hydra.nixos.org/log/<base name of the store path>. So you can do things like: $ nix-store -l $(which xterm) and get a log even if xterm wasn't built locally.
2014-05-15 Provide a more useful error message when a dynamic attr lookup failsShea Levy1-2/+10
2014-05-15 lvlInfo -> lvlTalkativeEelco Dolstra1-1/+1
2014-05-15 nix-store --optimise: Remove bogus statisticsEelco Dolstra3-14/+9
2014-05-15 Remove tabEelco Dolstra1-2/+2
2014-05-15 Merge branch 'master' of github.com:wmertens/nixEelco Dolstra2-8/+80