aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-04-25feat: add integration with zsh's run-helpmidchildan
2022-04-22Merge pull request #6259 from Artturin/nixbuildaddprintstorepathsThéophane Hufschmitt
nix build: add --print-out-paths flag
2022-04-22Merge remote-tracking branch 'origin/master' into nixbuildaddprintstorepathsThéophane Hufschmitt
2022-04-22Merge pull request #6437 from NixOS/fix-darwin-buildThéophane Hufschmitt
Fix the darwin build
2022-04-22Merge remote-tracking branch 'origin/master' into nixbuildaddprintstorepathsThéophane Hufschmitt
2022-04-22Fix the darwin buildThéophane Hufschmitt
Looks like the auto-merge is indeed quite broken and merges even when the CI fails
2022-04-22Merge pull request #6218 from pennae/pos-symbol-tablesThéophane Hufschmitt
reduce the size of Attr from 3 pointers to 2 on 64 bit machines
2022-04-22Add some tests for ChunkedVectorThéophane Hufschmitt
2022-04-22Move ChunkedVector to its own headerThéophane Hufschmitt
2022-04-22Merge pull request #6436 from flox/tofile_allowThéophane Hufschmitt
fix: builtins.toFile adds path to allowedPaths
2022-04-21fix: builtins.toFile adds path to allowedPathsTom Bereknyei
The produced path is then allowed be imported or utilized elsewhere: ``` assert (43 == import (builtins.toFile "source" "43")); "good" ``` This will still fail on write-only stores.
2022-04-21remove pos<T>pennae
it's no longer needed now that positions aren't really pointers any more.
2022-04-21shrink Attr by 8 bytes on 64bit machinespennae
with position and symbol tables in place we can now shrink Attr by a full pointer with some simple field reordering. since Attr is a very hot struct this has substantial impact on memory use, decreasing GC allocations and heap size by 10-15% each. we also get a ~15% performance improvement due to reduced GC loading. pure parsing has taken a hit over the branch base because positions are now slightly more expensive to create, but overall we get a noticeable improvement. before (on memory-friendliness): Benchmark 1: nix search --no-eval-cache --offline ../nixpkgs hello Time (mean ± σ): 6.960 s ± 0.028 s [User: 5.832 s, System: 0.897 s] Range (min … max): 6.886 s … 7.005 s 20 runs Benchmark 2: nix eval -f ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix Time (mean ± σ): 328.1 ms ± 1.7 ms [User: 295.8 ms, System: 32.2 ms] Range (min … max): 324.9 ms … 331.2 ms 20 runs Benchmark 3: nix eval --raw --impure --expr 'with import <nixpkgs/nixos> {}; system' Time (mean ± σ): 2.688 s ± 0.029 s [User: 2.365 s, System: 0.238 s] Range (min … max): 2.642 s … 2.742 s 20 runs after: Benchmark 1: nix search --no-eval-cache --offline ../nixpkgs hello Time (mean ± σ): 6.902 s ± 0.039 s [User: 5.844 s, System: 0.783 s] Range (min … max): 6.820 s … 6.956 s 20 runs Benchmark 2: nix eval -f ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix Time (mean ± σ): 330.7 ms ± 2.2 ms [User: 300.6 ms, System: 30.0 ms] Range (min … max): 327.5 ms … 334.5 ms 20 runs Benchmark 3: nix eval --raw --impure --expr 'with import <nixpkgs/nixos> {}; system' Time (mean ± σ): 2.330 s ± 0.027 s [User: 2.040 s, System: 0.234 s] Range (min … max): 2.272 s … 2.383 s 20 runs
2022-04-21store Symbols in a table as well, like positionspennae
this slightly increases the amount of memory used for any given symbol, but this increase is more than made up for if the symbol is referenced more than once in the EvalState that holds it. on average every symbol should be referenced at least twice (once to introduce a binding, once to use it), so we expect no increase in memory on average. symbol tables are limited to 2³² entries like position tables, and similar arguments apply to why overflow is not likely: 2³² symbols would require as many string instances (at 24 bytes each) and map entries (at 24 bytes or more each, assuming that the map holds on average at most one item per bucket as the docs say). a full symbol table would require at least 192GB of memory just for symbols, which is well out of reach. (an ofborg eval of nixpks today creates less than a million symbols!)
2022-04-21don't use Symbol in Pos to represent a pathpennae
PosTable deduplicates origin information, so using symbols for paths is no longer necessary. moving away from path Symbols also reduces the usage of symbols for things that are not keys in attribute sets, which will become important in the future when we turn symbols into indices as well.
2022-04-21replace most Pos objects/ptrs with indexes into a position tablepennae
Pos objects are somewhat wasteful as they duplicate the origin file name and input type for each object. on files that produce more than one Pos when parsed this a sizeable waste of memory (one pointer per Pos). the same goes for ptr<Pos> on 64 bit machines: parsing enough source to require 8 bytes to locate a position would need at least 8GB of input and 64GB of expression memory. it's not likely that we'll hit that any time soon, so we can use a uint32_t index to locate positions instead.
2022-04-21make throw*Error member functions of EvalStatepennae
when we introduce position and symbol tables we'll need to do lookups to turn indices into those tables into actual positions/symbols. having the error functions as members of EvalState will avoid a lot of churn for adding lookups into the tables for each caller.
2022-04-21don't use full Pos for findPackageFilename/editorForpennae
only file and line of the returned position were ever used, it wasn't actually used a position. as such we may as well use a path+int pair for only those two values and remove a use of Pos that would not work well with a position table.
2022-04-21remove Bindings::needpennae
a future commit will remove the ability to convert the symbol type used in bindings to strings. since we only have two users we can inline the error check.
2022-04-21remove Symbol::emptypennae
the only use of this function is to determine whether a lambda has a non-set formal, but this use is arguably better served by Symbol::set and using a non-Symbol instead of an empty symbol in the parser when no such formal is present.
2022-04-21turn primop names into stringspennae
we don't *need* symbols here. the only advantage they have over strings is making call-counting slightly faster, but that's a diagnostic feature and thus needn't be optimized. this also fixes a move bug that previously didn't show up: PrimOp structs were accessed after being moved from, which technically invalidates them. previously the names remained valid because Symbol copies on move, but strings are invalidated. we now copy the entire primop struct instead of moving since primop registration happen once and are not performance-sensitive.
2022-04-21Rename fmt test -> hilteEelco Dolstra
2022-04-21Fix fmt testEelco Dolstra
2022-04-21Merge pull request #6433 from edolstra/hiliteEelco Dolstra
Move hiliteMatches into a separate header
2022-04-21Move hiliteMatches into a separate headerEelco Dolstra
This is mostly so that we don't #include <regex> everywhere (which adds quite a bit of compilation time).
2022-04-21Merge pull request #6416 from moduon/feat-opensshEelco Dolstra
feat: include openssh in docker image
2022-04-21Merge pull request #6431 from NixOS/unbreak-my-buildEelco Dolstra
Make the default SQLiteError constructor public
2022-04-21Merge pull request #5479 from NixOS/selfref-caThéophane Hufschmitt
Fix the removal of ca-induced self-references
2022-04-21Merge pull request #6324 from trofi/selfref-ca-indexThéophane Hufschmitt
ca: add sqlite index on `RealisationsRefs(realisationReference)`
2022-04-21Make sure to delete all the realisation refsregnat
Deleting just one will only work in the test cases where I didn’t bother creating too many of them :p
2022-04-21ca: add sqlite index on `RealisationsRefs(realisationReference)`Sergei Trofimovich
Without the change any CA deletion triggers linear scan on large RealisationsRefs table: sqlite>.eqp full sqlite> delete from RealisationsRefs where realisationReference IN ( select id from Realisations where outputPath = 1234567890 ); QUERY PLAN |--SCAN RealisationsRefs `--LIST SUBQUERY 1 `--SEARCH Realisations USING COVERING INDEX IndexRealisationsRefsOnOutputPath (outputPath=?) With the change it gets turned into a lookup: sqlite> CREATE INDEX IndexRealisationsRefsRealisationReference on RealisationsRefs(realisationReference); sqlite> delete from RealisationsRefs where realisationReference IN ( select id from Realisations where outputPath = 1234567890 ); QUERY PLAN |--SEARCH RealisationsRefs USING INDEX IndexRealisationsRefsRealisationReference (realisationReference=?) `--LIST SUBQUERY 1 `--SEARCH Realisations USING COVERING INDEX IndexRealisationsRefsOnOutputPath (outputPath=?)
2022-04-21Disable the selfref-gc test when the daemon is too oldregnat
2022-04-21tests: remove 'ca-references' featureSergei Trofimovich
The feature was ctabilized in d589a6aa8a5d0c9f391400d7e0e209106e89c857.
2022-04-21Fix the gc with indirect self-references via the realisationsregnat
If the derivation `foo` depends on `bar`, and they both have the same output path (because they are CA derivations), then this output path will depend both on the realisation of `foo` and of `bar`, which themselves depend on each other. This confuses SQLite which isn’t able to automatically solve this diamond dependency scheme. Help it by adding a trigger to delete all the references between the relevant realisations. Fix #5320
2022-04-21nix: add (failing) selfreference test for multiple realizationsSergei Trofimovich
The test illustrates failure in issue #5320. Here derivation and it's built input have identical CA sotre path. As a result we generate extraneout reference to build input: $ make installcheck ... ran test tests/selfref-gc.sh... [PASS] ran test tests/ca/selfref-gc.sh... [FAIL] ... deleting '/tmp/.../tests/ca/selfref-gc/store/iqciq1mpg5hc7p6a52fp2bjxbyc9av0v-selfref-gc' deleting '/tmp/...tests/ca/selfref-gc/store/zh0kwpnirw3qbv6dl1ckr1y0kd5aw6ax-selfref-gc.drv' error: executing SQLite statement 'delete from ValidPaths where path = '/tmp/.../tests/ca/selfref-gc/store/fsjq0k146r85lsh01l0icl30rnhv7z72-selfref-gc';': constraint failed (in '/tmp/.../tests/ca/selfref-gc/var/nix/db/db.sqlite')
2022-04-21Make the default SQLiteError constructor publicThéophane Hufschmitt
Otherwise the clang builds fail because the constructor of `SQLiteBusy` inherits it, `SQLiteError::_throw` tries to call it, which fails. Strangely, gcc works fine with it. Not sure what the correct behavior is and who is buggy here, but either way, making it public is at the worst a reasonable workaround
2022-04-21Merge pull request #6430 from NixOS/missing-realisation-error-messageEelco Dolstra
Fix the error message in case of a missing realisation
2022-04-21Fix the error message in case of a missing realisationThéophane Hufschmitt
Don’t say that the derivation is CA as it might happen on a non-ca derivation too. Technically we could always recover _something_ for a purely input-addressed derivation (like we already do when the `ca-derivations` xp feature isn’t enabled), but it seems better to consistently fail − the end-result wouldn’t really make sense anyways in most cases.
2022-04-20Merge pull request #3720 from obsidiansystems/fix-url-formatThéophane Hufschmitt
Avoid `fmt` when constructor already does it
2022-04-20Actually, solve this in a lighter-weight wayJohn Ericson
The templating is very superficial
2022-04-20Move templated functions to `sqlite-impl.hh`John Ericson
This ensures that use-sites properly trigger new monomorphisations on one hand, and on the other hand keeps the main `sqlite.hh` clean and interface-only. I think that is good practice in general, but in this situation in particular we do indeed have `sqlite.hh` users that don't need the `throw_` function.
2022-04-20Merge remote-tracking branch 'upstream/master' into fix-url-formatJohn Ericson
2022-04-20nix build: add --print-out-paths flagArtturin
has the same functionality as default nix-build $ nix-build . -A "bash" -A "bash.dev" -A "tinycc" /nix/store/4nmqxajzaf60yjribkgvj5j54x9yvr1r-bash-5.1-p12 /nix/store/c49i1ggnr5cc8gxmk9xm0cn961z104dn-bash-5.1-p12-dev /nix/store/dbapb08862ajgaax3621fz8hly9fdah3-tcc-0.9.27+date=2022-01-11 $ nix-build . -A "bash" /nix/store/4nmqxajzaf60yjribkgvj5j54x9yvr1r-bash-5.1-p12 $ $HOME/nixgits/nix/result/bin/nix build "nixpkgs#bash" "nixpkgs#bash.dev" "nixpkgs#tinycc" --print-out-paths /nix/store/4nmqxajzaf60yjribkgvj5j54x9yvr1r-bash-5.1-p12 /nix/store/c49i1ggnr5cc8gxmk9xm0cn961z104dn-bash-5.1-p12-dev /nix/store/dbapb08862ajgaax3621fz8hly9fdah3-tcc-0.9.27+date=2022-01-11 $ $HOME/nixgits/nix/result/bin/nix build "nixpkgs#bash" --print-out-paths /nix/store/4nmqxajzaf60yjribkgvj5j54x9yvr1r-bash-5.1-p12
2022-04-20Merge pull request #6425 from yorickvP/fix-6424Théophane Hufschmitt
Add custom to_json and from_json functions for ExperimentalFeature
2022-04-20Add custom to_json and from_json functions for ExperimentalFeatureYorick van Pelt
nix show-config --json was serializing experimental features as ints. nlohmann::json will automatically use these definitions to serialize and deserialize ExperimentalFeatures. Strictly, we don't use the from_json instance yet, it's provided for completeness and hopefully future use.
2022-04-20Merge pull request #6419 from ckiee/repl-build-symlinkEelco Dolstra
nix repl: make symlinks with the :bl command
2022-04-20nix repl: make symlinks with the :bl commandckie
Requested by ppepino on the Matrix: https://matrix.to/#/!KqkRjyTEzAGRiZFBYT:nixos.org/$Tb32BS3rVE2BSULAX4sPm0h6CDewX2hClOTGzTC7gwM?via=nixos.org&via=matrix.org&via=nixos.dev This adds a new command, :bl, which works like :b but also creates a GC root symlink to the various derivation outputs. ckie@cookiemonster ~/git/nix -> ./outputs/out/bin/nix repl Welcome to Nix 2.6.0. Type :? for help. nix-repl> :l <nixpkgs> Added 16118 variables. nix-repl> :b runCommand "hello" {} "echo hi > $out" This derivation produced the following outputs: ./repl-result-out -> /nix/store/kidqq2acdpi05c4a9mlbg2baikmzik44-hello [1 built, 0.0 MiB DL] ckie@cookiemonster ~/git/nix -> cat ./repl-result-out hi
2022-04-19Bump versionEelco Dolstra
2022-04-19Fix 'nix fmt' testEelco Dolstra
2022-04-19Move rl-next.md to rl-2.8.mdEelco Dolstra