aboutsummaryrefslogtreecommitdiff
path: root/src/nix/command.cc
AgeCommit message (Collapse)Author
2019-11-07Factor out code to handle environment in run into MixEnvironmentmatthew
2019-10-22Add start of 'nix profile' commandEelco Dolstra
2019-10-21Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-10-21Allow content-addressable paths to have referencesEelco Dolstra
This adds a command 'nix make-content-addressable' that rewrites the specified store paths into content-addressable paths. The advantage of such paths is that 1) they can be imported without signatures; 2) they can enable deduplication in cases where derivation changes do not cause output changes (apart from store path hashes). For example, $ nix make-content-addressable -r nixpkgs.cowsay rewrote '/nix/store/g1g31ah55xdia1jdqabv1imf6mcw0nb1-glibc-2.25-49' to '/nix/store/48jfj7bg78a8n4f2nhg269rgw1936vj4-glibc-2.25-49' ... rewrote '/nix/store/qbi6rzpk0bxjw8lw6azn2mc7ynnn455q-cowsay-3.03+dfsg1-16' to '/nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16' We can then copy the resulting closure to another store without signatures: $ nix copy --trusted-public-keys '' ---to ~/my-nix /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16 In order to support self-references in content-addressable paths, these paths are hashed "modulo" self-references, meaning that self-references are zeroed out during hashing. Somewhat annoyingly, this means that the NAR hash stored in the Nix database is no longer necessarily equal to the output of "nix hash-path"; for content-addressable paths, you need to pass the --modulo flag: $ nix path-info --json /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16 | jq -r .[].narHash sha256:0ri611gdilz2c9rsibqhsipbfs9vwcqvs811a52i2bnkhv7w9mgw $ nix hash-path --type sha256 --base32 /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16 1ggznh07khq0hz6id09pqws3a8q9pn03ya3c03nwck1kwq8rclzs $ nix hash-path --type sha256 --base32 /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16 --modulo iq6g2x4q62xp7y7493bibx0qn5w7xz67 0ri611gdilz2c9rsibqhsipbfs9vwcqvs811a52i2bnkhv7w9mgw
2019-09-02nix dev-shell --profile: Support relative pathEelco Dolstra
2019-07-12nix build: Add '--profile' flagEelco Dolstra
This replaces 'nix-env --set'. For example: $ nix build --profile /nix/var/nix/profiles/system \ ~/Misc/eelco-configurations:nixosConfigurations.vyr.config.system.build.toplevel updates the NixOS system profile from a flake. This could have been a separate command (e.g. 'nix set-profile') but 1) '--profile' is pretty similar to '--out-link'; and 2) '--profile' could be useful for other command (like 'nix dev-shell').
2019-06-18Make subcommand construction in MultiCommand lazyEelco Dolstra
2019-02-11Move Command and MultiCommand to libutilEelco Dolstra
2019-02-11MultiCommand: Simplify constructionEelco Dolstra
2018-03-29Remove reference to non-existent manpagesEelco Dolstra
2017-10-24nix: Respect -I, --arg, --argstrEelco Dolstra
Also, random cleanup to argument handling.
2017-10-23Turn $NIX_REMOTE into a configuration optionEelco Dolstra
2017-09-27nix copy: make recursive by defaultEelco Dolstra
2017-09-10nix build: Only download the requested derivation outputsEelco Dolstra
Also some refactoring.
2017-09-08nix copy: Don't open the --from store twiceEelco Dolstra
2017-08-29Hide commands that don't have a descriptionEelco Dolstra
These are assumed to be internal.
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-14StorePathsCommand: Don't build installablesEelco Dolstra
On second though this was annoying. E.g. "nix log nixpkgs.hello" would build/download Hello first, even though the log can be fetched directly from the binary cache. May need to revisit this.
2017-07-14nix: Show help when no arguments are givenEelco Dolstra
Fixes #1464.
2017-05-04nix dump-path: AddEelco Dolstra
This is primarily useful for extracting NARs from other stores (like binary caches), which "nix-store --dump" cannot do.
2017-04-25StorePathCommands: Build installablesEelco Dolstra
So for instance "nix copy --to ... nixpkgs.hello" will build nixpkgs.hello first. It's debatable whether this is a good idea. It seems desirable for commands like "nix copy" but maybe not for commands like "nix path-info".
2017-04-25Make StorePathsCommand a subclass of InstallablesCommandEelco Dolstra
This allows commands like 'nix path-info', 'nix copy', 'nix verify' etc. to work on arbitrary installables. E.g. to copy geeqie to a binary cache: $ nix copy -r --to file:///tmp/binary-cache nixpkgs.geeqie Or to get the closure size of thunderbird: $ nix path-info -S nixpkgs.thunderbird
2017-04-25Restructure installables handling in the "nix" commandEelco Dolstra
2017-03-16nix copy: Make -r option use the "from" storeEelco Dolstra
Previously, we tried to compute the closure in the local store, which obviously doesn't work.
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-11-10Store::computeFSClosure(): Support a set of pathsEelco Dolstra
This way, callers can exploits the parallelism of computeFSClosure() when they have multiple paths that they need the (combined) closure of.
2016-09-02Merge openStore and openStoreAt with default argumentsShea Levy
2016-06-01Make the store directory a member variable of StoreEelco Dolstra
2016-05-04Add a Store::addToStore() variant that accepts a NAREelco Dolstra
As a side effect, this ensures that signatures are propagated when copying paths between stores. Also refactored import/export to make use of this.
2016-04-21nix --help: Show usage examplesEelco Dolstra
2016-04-15Unify "nix verify-paths" and "nix verify-store"Eelco Dolstra
"verify-store" is now simply an "--all" flag to "nix verify". This flag can be used for any other store path command as well (e.g. "nix path-info", "nix copy-sigs", ...).
2016-03-29Add "nix verify-paths" commandEelco Dolstra
Unlike "nix-store --verify-path", this command verifies signatures in addition to store path contents, is multi-threaded (especially useful when verifying binary caches), and has a progress indicator. Example use: $ nix verify-paths --store https://cache.nixos.org -r $(type -p thunderbird) ... [17/132 checked] checking ‘/nix/store/rawakphadqrqxr6zri2rmnxh03gqkrl3-autogen-5.18.6’
2016-03-21nix: Add --store flagEelco Dolstra
This is a bit user-friendlier than using $NIX_REMOTE.
2016-02-25Fix buildEelco Dolstra
2016-02-09Start of new Nix command-line interfaceEelco Dolstra