aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2021-06-01Check the CA hash when importing stuff in the local storeregnat
When adding a path to the local store (via `LocalStore::addToStore`), ensure that the `ca` field of the provided `ValidPathInfo` does indeed correspond to the content of the path. Otherwise any untrusted user (or any binary cache) can add arbitrary content-addressed paths to the store (as content-addressed paths don’t need a signature).
2021-06-01Merge pull request #4866 from alyssais/libdlEelco Dolstra
Only link with libdl on Linux
2021-06-01Merge pull request #4864 from jeremyschlatter/fix-typoEelco Dolstra
Fix typo in documentation
2021-06-01Merge pull request #4734 from p01arst0rm/fix-s3-ifdefEelco Dolstra
unified macro style for ENABLE_S3
2021-06-01Only link with libdl on LinuxAlyssa Ross
Linux is (as far as I know) the only mainstream operating system that requires linking with libdl for dlopen. On BSD, libdl doesn't exist, so on non-FreeBSD BSDs linking will currently fail. On macOS, it's apparently just a symlink to libSystem (macOS libc), presumably present for compatibility with things that assume Linux. So the right thing to do here is to only add -ldl on Linux, not to add it for everything that isn't FreeBSD.
2021-06-01Fix typo in documentationJeremy Schlatter
2021-05-29Add .tar.zst support for TarballInputSchemeTimothy Klim
2021-05-28Merge pull request #4849 from NixOS/ca/fix-nix-store--exportEelco Dolstra
Make the Nar hash non modulo
2021-05-26Remove the remaining occurenceses of a NarHash moduloregnat
2021-05-25Make the Nar hash non moduloregnat
It makes much more sense to have the Nar hash be a plain straight hash rather than a hash modulo
2021-05-24fix doc: nix profile info -> nix profile listMichael Adler
Signed-off-by: Michael Adler <therisen06@gmail.com>
2021-05-19Extract a generic `computeClosure` functionregnat
Move the `closure` logic of `computeFSClosure` to its own (templated) function. This doesn’t bring much by itself (except for the ability to properly test the “closure” functionality independently from the rest), but it allows reusing it (in particular for the realisations which will require a very similar closure computation)
2021-05-19Merge pull request #4831 from matthewbauer/fix-extra-slash-in-canon-pathEelco Dolstra
Fix extra slash in canonPath output
2021-05-18Fix extra slash in canonPath outputMatthew Bauer
When you have a symlink like: /tmp -> ./private/tmp you need to resolve ./private/tmp relative to /tmp’s dir: ‘/’. Unlike any other path output by dirOf, / ends with a slash. We don’t want trailing slashes here since we will append another slash in the next comoponent, so clear s like we would if it was a symlink to an absoute path. This should fix at least part of the issue in https://github.com/NixOS/nix/issues/4822, will need confirmation that it actually fixes the problem to close though. Introduced in f3f228700a52857fe6e8632df4e935551ea219ff.
2021-05-18Restore an accidentally suppressed negationregnat
Accidentally removed in ca96f5219489c1002499bfe2c580fdd458219144. This caused `nix run` to systematically fail with ``` error: app program '/nix/store/…' is not in the Nix store ```
2021-05-18Merge pull request #4827 from matthewbauer/run-bashrc-first-in-nix-developEelco Dolstra
Source bashrc first in nix develop
2021-05-17Source bashrc first in nix developMatthew Bauer
~/.bashrc should be sourced first in the rc script so that PATH & other env vars give precedence over the bashrc PATH. Also, in my bashrc I alias rm as: alias rm='rm -Iv' To avoid running this alias (which shows ‘removed '/tmp/nix-shell.*'), we can just prefix rm with command.
2021-05-17Split the parsing of an `App` and its resolvingregnat
That way things (like `nix flake check`) can evaluate the `app` outputs without having to build anything
2021-05-17Merge pull request #4819 from NixOS/ca/fix-nix-runEelco Dolstra
Resolve the program path in `nix run`
2021-05-17Merge pull request #4818 from NixOS/ca/cli-use-builtpathsEelco Dolstra
Enforce the use of properly built paths in libcmd
2021-05-17Resolve the program path in `nix run`regnat
Fix #4768
2021-05-17Enfore the use of properly built paths in libcmdregnat
Replace `DerivedPathWithHints` by a new `BuiltPath` type that serves as a proof that the corresponding path has been built.
2021-05-17sandbox: allow SystemVersionCompat.plist on DarwinEmily
For whatever reason, many programs trying to access SystemVersion.plist also open SystemVersionCompat.plist; this includes Python code and coreutils’ `cat(1)` (but not the native macOS `/bin/cat`). Illustratory `dtruss(1m)` output: open("/System/Library/CoreServices/SystemVersion.plist\0", 0x0, 0x0) = 3 0 open("/System/Library/CoreServices/SystemVersionCompat.plist\0", 0x0, 0x0) = 4 0 I assume this is a Big Sur change relating to the 10.16.x/11.x version compatibility divide and that it’s something along the lines of a hook inside libSystem. Fixes a lot of sandboxed package builds under Big Sur.
2021-05-13Merge pull request #4798 from matthewbauer/relock-wait-for-build-slot-goalsEelco Dolstra
Relock wait for build slot goals
2021-05-13Merge pull request #4801 from matthewbauer/fix-tokenize-output-namesEelco Dolstra
Fix tokenize output names in DerivedPath
2021-05-12Fix tokenize output names in drvMatthew Bauer
This should fix the issue described in https://discourse.nixos.org/t/derivation-does-not-have-wanted-outputs-dev-out/12905. Specifically, we get an error of error: derivation '/nix/store/_.drv' does not have wanted outputs 'dev,out' when a path like /nix/store/_.drv!dev,out is sent to the daemon.
2021-05-12Relock wait for build slot goalsMatthew Bauer
When we don’t have enough free job slots to run a goal, we put it in the waitForBuildSlot list & unlock its output locks. This will continue from where we left off (tryLocalBuild). However, we need the locks to get reacquired when/if the goal ever restarts. So, we need to send it back through tryToBuild to get reqacquire those locks. I think this bug was introduced in https://github.com/NixOS/nix/pull/4570. It leads to some builds starting without proper locks.
2021-05-12DerivedPathWithHints -> BuiltPathregnat
Just a renaming for now
2021-05-12doc: mention Priority for substitutersLorenzo Manacorda
2021-05-10Merge pull request #4781 from NixOS/locally_cache_the_remote_realisationsEelco Dolstra
Add a realisations disk cache
2021-05-10Merge pull request #4787 from Ma27/builtins-ceil-floorEelco Dolstra
Implement `builtins.floor` and `builtins.ceil` using the C library functions internally
2021-05-10Simplify the realisations disk cacheregnat
2021-05-10Remove useless parentsregnat
I never remember the exact syntax of the `switch` statement
2021-05-10primops: math.h -> cmathMaximilian Bosch
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2021-05-10Merge pull request #4776 from NixOS/fix-ca-normalizationEelco Dolstra
Properly normalize the content-addressed paths
2021-05-10Implement `builtins.floor` and `builtins.ceil` using the C library functions ↵Maximilian Bosch
internally Closes #4782 Note: even though the type is internally called `NixFloat`, it's actually a `double`.
2021-05-10Merge pull request #4786 from matthewbauer/mkdir-local-share-nixEelco Dolstra
Create parent for trusted list path before writing
2021-05-08Create parent trusted list path before writingMatthew Bauer
This makes sure that $HOME/.local/share/nix exists before we try to write to it.
2021-05-06Add a realisations disk cacheregnat
Similar to the nar-info disk cache (and using the same db). This makes rebuilds muuch faster. - This works regardless of the ca-derivations experimental feature. I could modify the logic to not touch the db if the flag isn’t there, but given that this is a trash-able local cache, it doesn’t seem to be really worth it. - We could unify the `NARs` and `Realisation` tables to only have one generic kv table. This is left as an exercise to the reader. - I didn’t update the cache db version number as the new schema just adds a new table to the previous one, so the db will be transparently migrated and is backwards-compatible. Fix #4746
2021-05-05Use derivation output name from toDerivationMatthew Bauer
This was previously done in https://github.com/NixOS/nix/pull/4515 but got clobbered away in https://github.com/NixOS/nix/pull/4594. -------------------------------------------------------------------------------- This fixes an issue where derivations with a primary output that is not "out" would fail with: $ nix profile install nixpkgs#sqlite error: opening directory '/nix/store/2a2ydlgyydly5czcc8lg12n6qqkfz863-sqlite-3.34.1-bin': No such file or directory This happens because while derivations produce every output when built, you might not have them if you didn't build the derivation yourself (for instance, the store path was fetch from a binary cache). This uses outputName provided from DerivationInfo which appears to match the first output of the derivation.
2021-05-05Properly normalize the content-addressed pathsregnat
Make sure that their timestamp are always normalized. Otherwise, strange − and non-deterministic − things might happen, like https://github.com/NixOS/nixpkgs/issues/121813 Fix #4775
2021-05-04Fix the double-slash in the realisations pathregnat
Make sure that we always access the realisations under `binaryCacheUrl/realisations` and not `binaryCacheUrl//realisations` Fix #4766
2021-05-03Merge pull request #4750 from NinjaTrappeur/nin-build-dry-run-jsonEelco Dolstra
nix build: make dry-run to print a json output if --json is enabled
2021-05-03Merge pull request #4761 from ↵Eelco Dolstra
emilazy/issue-4658-mark-impure-host-deps-as-optional Mark `__impureHostDeps` paths as optional
2021-05-03Bump version number for `DerivedPath` changesMaximilian Bosch
I guess I misunderstood John's initial explanation about why wildcards for outputs are sent to older stores[1]. My `nix-daemon` from 2021-03-26 also has version 1.29, but misses the wildcard[2]. So bumping seems to be the right call. [1] https://github.com/NixOS/nix/pull/4759#issuecomment-830812464 [2] 255d145ba7ac907d1cba8d088da556b591627756
2021-05-02Mark `__impureHostDeps` paths as optionalEmily
Starting in macOS 11, the on-disk dylib bundles are no longer available, but nixpkgs needs to be able to keep compatibility with older versions that require `/usr/lib/libSystem.B.dylib` in `__impureHostDeps`. Allow it to keep backwards compatibility with these versions by marking these dependencies as optional. Fixes #4658.
2021-04-27Merge pull request #4751 from Ma27/storepath-posDomen Kožar
primops/storePath: add trace to pure mode error
2021-04-27primops/storePath: add trace to pure mode errorMaximilian Bosch
As described in #4745 it's otherwise fairly hard to understand where this is coming from. Say you have an expression which uses e.g. `types.package`: ``` nix { outputs = { self, nixpkgs }: { packages.x86_64-linux.hello = let foo = nixpkgs.lib.evalModules { modules = [ { options.foo.bar = with nixpkgs.lib; mkOption { type = types.package; }; } { foo.bar = ./.; } ]; }; in builtins.trace foo.config.foo.bar.outPath nixpkgs.legacyPackages.x86_64-linux.hello; defaultPackage.x86_64-linux = self.packages.x86_64-linux.hello; }; } ``` Then you'll get an error trace like this: ``` error: 'builtins.storePath' is not allowed in pure evaluation mode at /nix/store/p4h2x6r80njkb0j2rc1xjhhl99yri3zb-source/lib/attrsets.nix:328:15: 327| let 328| path' = builtins.storePath path; | ^ 329| res = … while evaluating the attribute 'config.foo.bar.outPath' at /nix/store/p4h2x6r80njkb0j2rc1xjhhl99yri3zb-source/lib/attrsets.nix:332:11: 331| name = sanitizeDerivationName (builtins.substring 33 (-1) (baseNameOf path')); 332| outPath = path'; | ^ 333| outputs = [ "out" ]; … while evaluating the attribute 'packages.x86_64-linux.hello' at /nix/store/6c1rfsqzrhjw1235palzjmf5vihcpci7-source/flake.nix:3:5: 2| { outputs = { self, nixpkgs }: { 3| packages.x86_64-linux.hello = let | ^ 4| foo = nixpkgs.lib.evalModules { ``` Fixes #4745
2021-04-27nix build: make dry-run to print a json output if --json is enabledFélix Baylac-Jacqué
2021-04-23Merge branch 'remove-trailing-spaces' of github.com:NixOS/nixEelco Dolstra