aboutsummaryrefslogtreecommitdiff
path: root/src/libmain/shared.hh
AgeCommit message (Collapse)Author
2019-12-10Make the Store API more type-safeEelco Dolstra
Most functions now take a StorePath argument rather than a Path (which is just an alias for std::string). The StorePath constructor ensures that the path is syntactically correct (i.e. it looks like <store-dir>/<base32-hash>-<name>). Similarly, functions like buildPaths() now take a StorePathWithOutputs, rather than abusing Path by adding a '!<outputs>' suffix. Note that the StorePath type is implemented in Rust. This involves some hackery to allow Rust values to be used directly in C++, via a helper type whose destructor calls the Rust type's drop() function. The main issue is the dynamic nature of C++ move semantics: after we have moved a Rust value, we should not call the drop function on the original value. So when we move a value, we set the original value to bitwise zero, and the destructor only calls drop() if the value is not bitwise zero. This should be sufficient for most types. Also lots of minor cleanups to the C++ API to make it more modern (e.g. using std::optional and std::string_view in some places).
2018-02-08Add plugins to make Nix more extensible.Shea Levy
All plugins in plugin-files will be dlopened, allowing them to statically construct instances of the various Register* types Nix supports.
2017-11-14anchor nix::Exit exceptionWill Dietz
2017-10-24nix: Respect -I, --arg, --argstrEelco Dolstra
Also, random cleanup to argument handling.
2017-09-01Fix verbosity level for nix build --dry-runEelco Dolstra
2017-07-30Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2017-07-26nix-build/nix-shell: Eliminate call to nix-instantiate / nix-storeEelco Dolstra
Note that this removes the need for a derivation symlink, so the --drv-path and --add-drv-link flags now do nothing.
2016-11-26Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra
This reverts commit f78126bfd6b6c8477fcdbc09b2f98772dbe9a1e7. There really is no need for such a massive change...
2016-11-25Get rid of unicode quotes (#1140)Guillaume Maudoux
2016-02-25Merge branch 'master' into new-cliEelco Dolstra
2016-02-22Make OpenSSL usage thread-safeEelco Dolstra
OpenSSL can randomly segfault unless we register a callback function to do locking. https://www.openssl.org/docs/manmaster/crypto/threads.html
2016-02-12Merge pull request #762 from ctheune/ctheune-floatsEelco Dolstra
Implement floats
2016-02-09New command line parsing infrastructureEelco Dolstra
2016-02-04StoreAPI -> StoreEelco Dolstra
Calling a class an API is a bit redundant...
2016-02-04Eliminate the "store" global variableEelco Dolstra
Also, move a few free-standing functions into StoreAPI and Derivation. Also, introduce a non-nullable smart pointer, ref<T>, which is just a wrapper around std::shared_ptr ensuring that the pointer is never null. (For reference-counted values, this is better than passing a "T&", because the latter doesn't maintain the refcount. Usually, the caller will have a shared_ptr keeping the value alive, but that's not always the case, e.g., when passing a reference to a std::thread via std::bind.)
2016-01-28printMissing(): Propagate store argumentEelco Dolstra
2016-01-06@eelco's feedback: downgrade to regular float for size, remove unused function.Christian Theune
2016-01-05First hit at providing support for floats in the language.Christian Theune
2015-09-18Shut up clang warningsEelco Dolstra
2015-05-21nix-collect-garbage: Call collectGarbage() internallyEelco Dolstra
2014-08-20Use proper quotes everywhereEelco Dolstra
2014-08-20nix-store -l: Automatically pipe output into $PAGEREelco Dolstra
2014-08-13Refactor option handlingEelco Dolstra
2014-02-17nix-store --gc --max-freed: Support a unit specifierEelco Dolstra
E.g. "--max-freed 10G" means "free ten gigabytes".
2012-11-20nix-store -r: Add ‘--ignore-unknown’ flagEelco Dolstra
This flag causes paths that do not have a known substitute to be quietly ignored. This is mostly useful for Charon, allowing it to speed up deployment by letting a machine use substitutes for all substitutable paths, instead of uploading them. The latter is frequently faster, e.g. if the target machine has a fast Internet connection while the source machine is on a slow ADSL line.
2012-10-03Drop support for running nix-worker in "slave" modeEelco Dolstra
AFAIK nobody uses this, setuid binaries are evil, and there is no good reason why people can't just run the daemon.
2012-10-03When ‘--help’ is given, just run ‘man’ to show the manual pageEelco Dolstra
I.e. do what git does. I'm too lazy to keep the builtin help text up to date :-) Also add ‘--help’ to various commands that lacked it (e.g. nix-collect-garbage).
2012-08-24Include the output name in the GC root linkEelco Dolstra
Output names are now appended to resulting GC symlinks, e.g. by nix-build. For backwards compatibility, if the output is named "out", nothing is appended. E.g. doing "nix-build -A foo" on a derivation that produces outputs "out", "bin" and "dev" will produce symlinks "./result", "./result-bin" and "./result-dev", respectively.
2012-07-18Use "#pragma once" to prevent repeated header file inclusionEelco Dolstra
2012-03-13Ensure that Perl processes delete their entry in the temproots directoryEelco Dolstra
By moving the destructor object to libstore.so, it's also run when download-using-manifests and nix-prefetch-url exit. This prevents them from cluttering /nix/var/nix/temproots with stale files.
2012-03-05nix-worker: put the pid of the caller in argv[1]Eelco Dolstra
This is useful for debugging.
2011-09-06* Added a command ‘nix-store --verify-paths PATHS’ to check whetherEelco Dolstra
the contents of any of the given store paths have been modified. E.g. $ nix-store --verify-path $(nix-store -qR /var/run/current-system) path `/nix/store/m2smyiwbxidlprfxfz4rjlvz2c3mg58y-etc' was modified! expected hash `fc87e271c5fdf179b47939b08ad13440493805584b35e3014109d04d8436e7b8', got `20f1a47281b3c0cbe299ce47ad5ca7340b20ab34246426915fce0ee9116483aa' All paths are checked; the exit code is 1 if any path has been modified, 0 otherwise.
2011-08-31* Eliminate all uses of the global variable ‘store’ from libstore.Eelco Dolstra
This should also fix: nix-instantiate: ./../boost/shared_ptr.hpp:254: T* boost::shared_ptr<T>::operator->() const [with T = nix::StoreAPI]: Assertion `px != 0' failed. which was caused by hashDerivationModulo() calling the ‘store’ object (during store upgrades) before openStore() assigned it.
2011-02-05* Clang compatibility fix. Clang actually checks template definitionsEelco Dolstra
when they are defined
2009-11-24* Templatise getIntArg / string2Int.Eelco Dolstra
2008-08-04* `nix-store --realise': print what paths will be built/downloaded,Eelco Dolstra
just like nix-env. * `nix-store --realise': --dry-run option.
2008-06-18* --max-freed: support values >= 4 GB.Eelco Dolstra
2008-06-18* Garbage collector: option `--max-freed' to stop after at least NEelco Dolstra
bytes have been freed, `--max-links' to stop when the Nix store directory has fewer than N hard links (the latter being important for very large Nix stores on filesystems with a 32000 subdirectories limit).
2008-06-14* nix-worker: clean up the temporary root for the worker processes Eelco Dolstra
in /nix/var/nix/temproots.
2007-01-14* Option --argstr for passing string arguments easily. (NIX-75)Eelco Dolstra
2006-12-04* Daemon mode (`nix-worker --daemon'). Clients connect to the serverEelco Dolstra
via the Unix domain socket in /nix/var/nix/daemon.socket. The server forks a worker process per connection. * readString(): use the heap, not the stack. * Some protocol fixes.
2006-12-03* Doh.Eelco Dolstra
2006-12-03* Removed `build-allow-root'.Eelco Dolstra
* Added `build-users-group', the group under which builds are to be performed. * Check that /nix/store has 1775 permission and is owner by the build-users-group.
2006-09-04* Use a proper namespace.Eelco Dolstra
* Optimise header file usage a bit. * Compile the parser as C++.
2005-02-01* nix-store, nix-instantiate: added an option `--add-root' toEelco Dolstra
immediately add the result as a permanent GC root. This is the only way to prevent a race with the garbage collector. For instance, the old style ln -s $(nix-store -r $(nix-instantiate foo.nix)) \ /nix/var/nix/gcroots/result has two time windows in which the garbage collector can interfere (by GC'ing the derivation and the output, respectively). On the other hand, nix-store --add-root /nix/var/nix/gcroots/result -r \ $(nix-instantiate --add-root /nix/var/nix/gcroots/drv \ foo.nix) is safe. * nix-build: use `--add-root' to prevent GC races.
2003-12-01* Help text for all (non-script) programs, so no more:Eelco Dolstra
$ nix-instantiate --help error: unknown flag `--help` Try `nix-instantiate --help' for more information. :-)
2003-10-20* Refactored the source tree.Eelco Dolstra