aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-04-07Merge pull request #3459 from NixOS/fetchersEelco Dolstra
Backport libfetchers from the flakes branch
2020-04-07CleanupEelco Dolstra
2020-04-07Add FIXMEEelco Dolstra
(cherry picked from commit 2f494531b7811b45f6b76787f225495a14d28a7f)
2020-04-07PathInput: Add some methodsEelco Dolstra
(cherry picked from commit 78ad5b3d91507427fa563f3474dc52da608ad224)
2020-04-07Respect the narHash attribute in more input typesEelco Dolstra
(cherry picked from commit a6ff66b658b61aef80d936f0183447fe4cb46000)
2020-04-07Add 'path' fetcherEelco Dolstra
This fetchers copies a plain directory (i.e. not a Git/Mercurial repository) to the store (or does nothing if the path is already a store path). One use case is to pin the 'nixpkgs' flake used to build the current NixOS system, and prevent it from being garbage-collected, via a system registry entry like this: { "from": { "id": "nixpkgs", "type": "indirect" }, "to": { "type": "path", "path": "/nix/store/rralhl3wj4rdwzjn16g7d93mibvlr521-source", "lastModified": 1585388205, "rev": "b0c285807d6a9f1b7562ec417c24fa1a30ecc31a" }, "exact": true } Note the fake "lastModified" and "rev" attributes that ensure that the flake gives the same evaluation results as the corresponding Git/GitHub inputs. (cherry picked from commit 12f9379123eba828f2ae06f7978a37b7045c2b23)
2020-04-07Backport libfetchers from the flakes branchEelco Dolstra
This provides a pluggable mechanism for defining new fetchers. It adds a builtin function 'fetchTree' that generalizes existing fetchers like 'fetchGit', 'fetchMercurial' and 'fetchTarball'. 'fetchTree' takes a set of attributes, e.g. fetchTree { type = "git"; url = "https://example.org/repo.git"; ref = "some-branch"; rev = "abcdef..."; } The existing fetchers are just wrappers around this. Note that the input attributes to fetchTree are the same as flake input specifications and flake lock file entries. All fetchers share a common cache stored in ~/.cache/nix/fetcher-cache-v1.sqlite. This replaces the ad hoc caching mechanisms in fetchGit and download.cc (e.g. ~/.cache/nix/{tarballs,git-revs*}). This also adds support for Git worktrees (c169ea59049f861aaba429f48b828d0820b74d1d).
2020-04-06Merge pull request #3474 from cole-h/error-on-unsupported-protocolEelco Dolstra
Don't retry on "unsupported protocol" error
2020-04-05Don't retry on "unsupported protocol" errorCole Helbling
When encountering an unsupported protocol, there's no need to retry. Chances are, it won't suddenly be supported between retry attempts; error instead. Otherwise, you see something like the following: $ nix-env -i -f git://git@github.com/foo/bar warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 335 ms warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 604 ms warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 1340 ms warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 2685 ms With this change, you now see: $ nix-env -i -f git://git@github.com/foo/bar error: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1)
2020-04-03Publish a tarball containing the crates we depend onEelco Dolstra
This is needed since we no longer produce a source tarball. (cherry picked from commit bf70a047a0b2da606f65a88f13ce2994065cd9c4)
2020-04-03nix-env: Refuse to operate on a new-style profileEelco Dolstra
This prevents users from accidentally nuking their profile via nix-env. (cherry picked from commit 021634e3e3edb327089d33ab41b743f0a40126da)
2020-04-03Merge pull request #3470 from andir/remove-unusued-attrErrorEelco Dolstra
libexpr: remove unused attrError
2020-04-02libexpr: remove unused attrErrorAndreas Rammhold
The attrError variable is no longer used but still allocated on every call to the findAlongAttrPath function.
2020-03-31Merge pull request #3460 from NixOS/dev-shellEelco Dolstra
Backport 'nix dev-shell' from the flakes branch
2020-03-31Merge pull request #3463 from Ninlives/placeholder-passAsFileEelco Dolstra
fix placeholder not substituted in passAsFile
2020-03-31nix shell -> nix dev-shellEelco Dolstra
2020-03-31fix placeholder not substituted in passAsFilemlatus
2020-03-30Backport 'nix dev-shell' from the flakes branchEelco Dolstra
This also adds a '--profile' option to 'nix build' (replacing 'nix-env --set').
2020-03-30Fix macOS buildEelco Dolstra
2020-03-30Remove global -I flagsEelco Dolstra
(cherry picked from commit 2c692a3b144523bca68dd6de618124ba6c9bb332)
2020-03-25Merge pull request #3445 from gnprice/pr-installer-colorsEelco Dolstra
installer: Fix terminal colors.
2020-03-24installer: Fix terminal colors.Greg Price
The install-multi-user script uses blue, green, and red colors, as well as bold and underline, to add helpful formatting that helps structure its rather voluminous output. Unfortunately, the terminal escape sequences it uses are not quite well-formed. The relevant information is all there, just obscured by some extra noise, a leading parameter `38`. Empirically, the result is: * On macOS, in both Terminal.app and iTerm2, the spurious `38` is ignored, the rest of the escape sequence is applied, and the colors show up as intended. * On Linux, in at least gnome-terminal and xterm, the spurious `38` and the next parameter after it are ignored, and what's left is applied. So in the sequence `38;4;32`, the 4 (underline) is ignored but the 32 (green) takes effect; in a more typical sequence like `38;34`, the 34 (blue) is ignored and nothing happens. These codes are all unchanged since this script's origins as a Darwin-only script -- so the fact that they work fine in common macOS terminals goes some way to explain how the bug arose. Happily, we can make the colors work as intended by just deleting the extra `38;`. Tested in all four terminals mentioned above; the new codes work correctly on all of them, and on the two macOS terminals they work exactly the same as before. --- In a bit more technical detail -- perhaps more than anyone, me included, ever wanted to know, but now that I've gone and learned it I'll write it down anyway :) -- here's what's happening in these codes: An ECMA-48 "control sequence" begins with `\033[` aka "CSI", contains any number of parameters as semicolon-separated decimal numbers (plus sometimes other wrinkles), and ends with a byte from 0x40..0x7e. In our case, with `m` aka "SGR", "Select Graphic Rendition". An SGR control sequence `\033[...m` sets colors, fonts, text styles, etc. In particular a parameter `31` means red, `32` green, `34` blue, `4` underline, and `0` means reset to normal. Those are all we use. There is also a `38`. This is used for setting colors too... but it needs arguments. `38;5;nn` is color nn from a 256-color palette, and `38;2;rr;gg;bb` has the given RGB values. There is no meaning defined for `38;1` or `38;34` etc. On seeing a parameter `38` followed by an unrecognized argument for it, apparently some implementations (as seen on macOS) discard only the `38` and others (as seen on Linux) discard the argument too before resuming.
2020-03-24Misc changes from the flakes branchEelco Dolstra
2020-03-24Fix --refresh with --no-netEelco Dolstra
https://hydra.nixos.org/build/110879699 (cherry picked from commit 5bbe793abf18414878a069399d1759673d693fb6)
2020-03-24nix: Add --refresh as an alias for --tarball-ttl 0Eelco Dolstra
(cherry picked from commit e721f99817bb7154d8098c902e25f84521a90b7f)
2020-03-24nix path-info --json: Print hash in SRI formatEelco Dolstra
(cherry picked from commit 442e665d6d3fcbdee7dece2f62a597142f8784b1)
2020-03-24Pretty-print 'nix why-depends' / 'nix-store -q --tree' outputEelco Dolstra
Extracted from 678301072f05b650dc15c5edb4c25f08f0d6cace.
2020-03-24absPath(): Use std::optionalEelco Dolstra
(cherry picked from commit 1bf9eb21b75f0d93d9c1633ea2e6fdf840047e79)
2020-03-24buildenv: Eliminate global variables, other cleanupEelco Dolstra
(cherry picked from commit b82f75464d1e5ae9a00d8004e5dd7b1ca05059e4)
2020-03-24Fix coverage buildEelco Dolstra
https://hydra.nixos.org/build/110757285 (cherry picked from commit b430a81a1fbf6c792ba49e3aefe46256263430e5)
2020-03-24nix edit: Support non-derivation attributesEelco Dolstra
E.g. $ nix edit .#nixosConfigurations.bla now works. (cherry picked from commit d2032edb2f86e955a8a7724a27c0c3225f386500)
2020-03-24findAlongAttrPath(): Return positionEelco Dolstra
(cherry picked from commit 0b013a54dc570395bed887369f8dd622b8ce337b)
2020-03-24findAlongAttrPath(): Throw AttrPathNotFoundEelco Dolstra
(cherry picked from commit 6b0ca8e803710342af70e257935724c5ad84ca04)
2020-03-24Add function for quoting stringsEelco Dolstra
(cherry picked from commit 7dcf5b011a0942ecf953f2b607c4c8d0e9e652c7)
2020-03-24Use std::string_viewEelco Dolstra
(cherry picked from commit 6529490cc10018d5191e50c482ac1180b96b1a3c)
2020-03-24EvalState::allocAttr(): Add convenience methodEelco Dolstra
(cherry picked from commit c02da997570ac0d9b595d787bea8cb5a4e3cc1f5)
2020-03-24Merge pull request #3441 from gnprice/pr-doc-store-roDomen Kožar
doc: Files in the store have modes 444/555, not 644/755
2020-03-23doc: Files in the store have modes 444/555, not 644/755Greg Price
This line has been this way since it was written, in 9e08f5efe in 2006. I think it was just a small mistake then; Eelco's thesis earlier that year says the permission on each file is set to 0444 or 0555 in a derivation's output as part of the build process. In any case I'm pretty sure that's the behavior now.
2020-03-23Merge pull request #3440 from gnprice/pr-install-roEelco Dolstra
installer: Set files read-only when copying into store
2020-03-23Merge pull request #3429 from LnL7/darwin-sandboxEelco Dolstra
darwin sandbox
2020-03-22installer: Set files read-only when copying into storeGreg Price
After installing Nix, I found that all the files and directories initially copied into the store were writable, with mode 644 or 755: drwxr-xr-x 9 root root 4096 Dec 31 1969 /nix/store/ddmmzn4ggz1f66lwxjy64n89864yj9w9-nix-2.3.3 The reason is that that's how they were in the unpacked tarball, and the install-multi-user script used `rsync -p` without doing anything else to affect the permissions. The plain `install` script for a single-user install takes care to do a `chmod -R a-w` on each store path copied. We could do the same here with one more command; or we can pass `--chmod` to rsync, to have it write the files with the desired modes in the first place. Tested the new `rsync` command on both a Linux machine with a reasonably-modern rsync (3.1.3) and a Mac with its default, ancient, rsync 2.6.9, and it works as expected on both. Thankfully the latter is just new enough to have `--chmod`, which dates to rsync 2.6.7.
2020-03-21Merge pull request #3431 from pmiddend/install-script-test-for-xzDomen Kožar
installer: also test for xz to unpack
2020-03-21installer: also test for xz to unpackPhilipp Middendorf
2020-03-20sandbox: fix /bin/sh on catalinaDaiderd Jordan
Sadly 10.15 changed /bin/sh to a shim which executes bash, this means it can't be used anymore without also opening up the sandbox to allow bash. Failed to exec /bin/bash as variant for /bin/sh (1: Operation not permitted).
2020-03-20sandbox: allow pty devicesDaiderd Jordan
Nix now runs builds with a pseudo-terminal to enable colored build output.
2020-03-20libstore: relax default sandbox-paths on darwinDaiderd Jordan
2020-03-20libstore: disable resolve-system-dependencies hookDaiderd Jordan
This is used to determine the dependency tree of impure libraries so nix knows what paths to open in the sandbox. With the less restrictive defaults it isn't needed anymore.
2020-03-20Merge pull request #3426 from jakobrs/remote-gc-delete-optEelco Dolstra
Remove the --delete option for --gc. Fixes #3343
2020-03-19Remove the --delete option for --gcjakobrs
Running `nix-store --gc --delete` will, as of Nix 2.3.3, simply fail because the --delete option conflicts with the --delete operation. $ nix-store --gc --delete error: only one operation may be specified Try 'nix-store --help' for more information. Furthermore, it has been broken since at least Nix 0.16 (which was released sometime in 2010), which means that any scripts which depend on it should have been broken at least nine years ago. This commit simply formally removes the option. There should be no actual difference in behaviour as far as the user is concerned: it errors with the exact same error message. The manual has been edited to remove any references to the (now gone) --delete option. Other information: * Path for Nix 0.16 used: /nix/store/rp3sgmskn0p0pj1ia2qwd5al6f6pinz4-nix-0.16
2020-03-19nix repl: Put EvalState on the heapEelco Dolstra
See 0629601da1d163a059fa19004256961f8ecdeb78.