Commit Graph
100 Commits
Author SHA1 Message Date
Rebecca Turnerandrootile cb34b56fea tests/functional2: Fix Python LSP by adjusting imports
See: cl/4840

When importing Python modules, we include `functional2` in the module
path, like this:

    from functional2.testlib.fixtures.env import ManagedEnv

This means that python expects to see a file like
`functional2/testlib/fixtures/env.py`. We run `pytest` from `tests/` in
the `justfile` and have `tests/functional2/__init__.py` so `pytest` in
`meson` is able to find these imports.

However, language servers generally consider the `pyproject.toml` to be
the project root, so (e.g.) `pyright` is unable to follow any of the
`functional2` imports, leading to lots of spurious errors.

In cl/4840 I moved `tests/functional2/pyproject.toml` to
`tests/pyproject.toml`, which worked but was considered aesthetically
unappealing.

This diff is much larger but it's a more elegant solution.

Change-Id: I2983c7b87f88f59a4e3521451a9f5acd6a6a6964
2026-01-23 15:06:51 +01:00
Rebecca Turner 80d88ce407 functional2/pyproject.toml: clarify pytest norecursedirs setting
I was pretty confused by this when I saw it, not realizing that `build`
meant `tests/functional2/build` and not the top-level Meson `build`
directory.

Change-Id: I4865f196e5bf029419c6b488e78cbfb46a6a6964
2026-01-02 10:57:43 -08:00
Rebecca Turner 22b33b9d08 package.nix: set $BUILD_TEST_ENV/$BUILD_TEST_SHELL more consistently
cl/4796 introduced a bug where running `just test-functional2` would
hang forever on macOS but `meson test -C build --suite installcheck
functional2` would succeed because of a mismatch between the
`$BUILD_TEST_SHELL` environment variable and the `-Dbuild-test-shell`
build option set in `mesonFlags`.

We can move these definitions to `finalAttrs.buildTestShell` and similar
and use those values in _both_ `mesonFlags` and `env` in order to make
them consistent in all cases.

See: https://gerrit.lix.systems/c/lix/+/4796/comments/50def5b4_fa5671f2
Change-Id: If300bbe46d6269ace29b44156fb4a5196a6a6964
2025-12-30 11:34:44 -08:00
Rebecca Turner bad5a4dcc5 gitignore subprojects/.wraplock
I'm not sure what's creating this file. But something is, so let's
ignore it.

Change-Id: If05fb0851630d827ecb7b75cf2cf0b466a6a6964
2025-12-29 21:24:05 +00:00
Rebecca Turner 3e3573cb58 libutil: reformat tarfile.{cc,hh}
Change-Id: I24670300157213fba787df62931776416a6a6964
2025-12-13 16:35:22 -08:00
Rebecca Turner 3f355b8fd1 .editorconfig: json: init with 4 space indent
Relevant for `version.json`. Noticed while running the 2.93.0 release.

Change-Id: I9f740a3cd412c1d27a76c3feb4e05d89319de3b4
2025-05-15 15:11:57 -07:00
Rebecca Turner 61920dd663 releng: Update README.md documentation
These are (polished versions of) some notes I wrote down while preparing
the 2.93.0 release with Jade.

Fixes: https://git.lix.systems/lix-project/lix/issues/441

Change-Id: Ib7f0b83ce2984a86d3a0c354e707fc6ee569a7ea
2025-05-15 10:47:10 -07:00
rebecca “wiggles” turnerandLix Systems Gerrit fed92d56ee Merge changes Id732c31a,I022583e9,I2f08bd2f,I85090f4c into main
* changes:
  aws s3 cp: Note issue with `--checksum-algorithm=SHA256`
  releng/docker_assemble.py: fix empty `auths` error
  releng: remove unused variables
  releng: ignore `prev-git-branch.txt`
2025-05-14 19:15:53 +00:00
Rebecca Turner a3b3b06a21 aws s3 cp: Note issue with --checksum-algorithm=SHA256
There may or may not be a bug in `garage` here. Previously we added
`--checksum-algorithm=SHA256` here to fix it, but when @rbt was
running the release for 2.93.0, she found it actually made the S3
uploads fail.

If this command is failing, here are some links to investigate.

See: https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/963
See: https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/1017
See: https://github.com/boto/boto3/issues/4392
See: https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-envvars.html#envvars-list-AWS_REQUEST_CHECKSUM_CALCULATION
Change-Id: Id732c31aa715191e78c7f0246e1b74cc202e675c
2025-05-13 12:45:21 -07:00
Rebecca Turner 4611d1f331 releng/docker_assemble.py: fix empty auths error
I had a `~/.docker/config.json` which was missing an `auths` key, which
caused an error. The release automation succesfully ignored the error,
but it was noisy. Using `json_obj.get('auths', {})` instead of
`json_obj['auths']` fixes this `KeyError`.

Change-Id: I022583e9e668bf8ad7bdc1fa5a3305aee2f18d85
2025-05-13 12:18:32 -07:00
Rebecca Turner 2e25580d8d releng: remove unused variables
`lib` and `config` were unused here. In the future maybe we should
integrate `deadnix` or something similar for linting.

Change-Id: I2f08bd2f87f74b90a5f76ea7db7e6d4db1663450
2025-05-13 12:18:31 -07:00
Rebecca Turner 53673b7331 releng: ignore prev-git-branch.txt
This file is created by `python -m releng tag`.

Change-Id: I85090f4c6d9c2ba9a991b47df6a7382b80f7ff52
2025-05-13 12:18:31 -07:00
Rebecca Turner dcb0a97000 release: merge release 2.93.0 back to mainline
This merge commit returns to the previous state prior to the release but leaves the tag in the branch history.
Release created with releng/create_release.xsh

Change-Id: I67db1020490da19f5cf35b04b9ccfe47cfe829d1
2025-05-09 14:48:06 -07:00
Rebecca Turner df214a1db8 release: 2.93.0 "Bici Bici"
Release produced with releng/create_release.xsh

Change-Id: I4471a4e6d2776d2f347ee6dec04d1c61eb8b1898
2025-05-09 14:48:05 -07:00
Rebecca Turner bb0cdf110e release: release notes for 2.93.0
Release created with releng/create_release.xsh

Change-Id: I5a793e632dae1b6fdd4f743c383aca937b048dfc
2025-05-09 14:47:55 -07:00
Rebecca Turner 7593714154 version.json: 2.93.0-dev -> 2.93.0 "Bici Bici"
Change-Id: Ib6c3df3549f01b04ede8f13bfa378dcefb64b15a
2025-05-09 14:47:21 -07:00
rebecca “wiggles” turnerandLix Systems Gerrit 483f377197 Merge "build-release-notes: more blank lines in output" into main 2025-05-07 22:12:17 +00:00
Rebecca Turner 7ae9480d94 build-release-notes: more blank lines in output
This makes it easier to read and copy/paste the contents when preparing
a Lix release blog post.

The output can be read in
`build/doc/manual/src/release-notes/rl-next-generated.md`.

Before:

    ## Breaking changes
    - Release note 1

      Many thanks to ...
    - Release note 2

      Many thanks to ...
    ## Fixes
    - Release note 3

      Many thanks to ...

After:

    ## Breaking changes

    - Release note 1

      Many thanks to ...

    - Release note 2

      Many thanks to ...

    ## Fixes

    - Release note 3

      Many thanks to ...

Change-Id: Ifea5af1bdce7b2315f3b46c17ebb945e99cfb36f
2025-05-07 14:38:00 -07:00
rebecca “wiggles” turnerandLix Systems Gerrit f963bd8295 Merge "getFileContents: Remove unused StringSink" into main 2025-03-18 18:17:22 +00:00
rebecca “wiggles” turnerandLix Systems Gerrit 8934771335 Merge changes I23c99755,I45306148 into main
* changes:
  Remove static initializers for `CommandRegistry`
  RegisterCommand -> CommandRegistry
2025-03-18 18:17:03 +00:00
Rebecca Turnerandeldritch horrors b844ef37fb getFileContents: Remove unused StringSink
In cl/1549, this function was changed from calling `getFile(path, sink)`
to returning `getFile(path)`. As a result, the `StringSink` is no longer
used. However, the sink was still being allocated.

Change-Id: I26c8556f20bc4f922912d8a921e8f47aa2bf975e
2025-03-17 19:15:15 +00:00
rebecca “wiggles” turnerandLix Systems Gerrit 175091efb5 Merge "run.hh: Declare chrootHelper" into main 2025-03-17 19:07:01 +00:00
rebecca “wiggles” turnerandLix Systems Gerrit 366f55303a Merge "justfile: enable just build install test" into main 2025-03-17 17:48:55 +00:00
Rebecca Turner 4d9fe67430 Remove static initializers for CommandRegistry
This removes static initializers for `nix` subcommands. cl/1905 made
the same change but for legacy commands.

See: #359

Change-Id: I23c99755719cef8e73fc720b685d4d1cf9b4ef15
2025-03-17 10:47:31 -07:00
Rebecca Turner b30556f8f1 RegisterCommand -> CommandRegistry
This should be submitted as part of a stack, doesn't make too much sense
on its own, but it's mechanical and it builds it's easy to split it out
of the diff.

Change-Id: I453061482476c72a5fc6fb2662b000d79b87fc1b
2025-03-17 10:47:30 -07:00
Rebecca Turner aa135863fb run.hh: Declare chrootHelper
Change-Id: I94c61e87a7649286c81f1716d60d5a85be876da2
2025-03-17 10:47:26 -07:00
Rebecca Turner 2a336813ad pre-commit: fix stage name warnings
Fixes these warnings:

[WARNING] hook id `check-executables-have-shebangs` uses deprecated
stage names (commit) which will be removed in a future version.
run: `pre-commit migrate-config` to automatically fix this.

Change-Id: Iab7d35999244df0eb4c32541b1f9c6a2dc2f3e28
2025-03-16 22:57:11 +00:00
rebecca “wiggles” turnerandLix Systems Gerrit ccab8cdd30 Merge changes I3fc0f159,I06068cbd,I76405e94,I255e2d94 into main
* changes:
  registerNix* -> registerLegacyNix*
  LegacyCommands -> LegacyCommandRegistry
  Commands -> CommandMap
  RegisterCommand::Commands -> CommandMap
2025-03-16 21:10:17 +00:00
Rebecca Turner e7463af241 justfile: enable just build install test
Previously, only the `install` target in the `justfile` took extra
`*OPTIONS`, which meant you could run `just build install test` (or
`just clean setup build install test` for a clean build). This is much
more convenient than `just build && just install && just test`.

However, sometimes you *do* need extra options for some of those other
targets, so over time they have gained extra arguments. But these
prevent you from chaining the targets together:

    $ just clean setup build install test
    rm -rf build
    meson setup build --prefix="$PWD/outputs/out" $mesonFlags build install test
    usage: meson [-h]
                 {setup,configure,dist,install,introspect,init,test,wrap,subprojects,rewrite,compile,devenv,env2mfile,reprotest,format,fmt,help}
                 ...
    meson: error: unrecognized arguments: install test
    error: Recipe `setup` failed on line 13 with exit code 2

As a compromise, I've renamed the targets with extra arguments to
include a `-custom` suffix, and added aliases for the old targets to
call the `-custom`-suffixed target with no extra arguments.

This makes it possible to run `just build install test` again, but keeps
the ability to run `just build-custom EXTRA_MESON_BUILD_ARGS`.

BONUS:
- Added `test-unit` and `test-integration`, because I always forget the
  arguments to run a particular test suite and the names of those test
  suites.
- Added doc comments to `lint` and `lint-fix`.

Change-Id: I61ec66f5e4d38c12bbae4fa226d7b4cea94579d1
2025-03-15 21:40:56 -07:00
Rebecca Turner d86b857505 registerNix* -> registerLegacyNix*
Once I add `registerNixDaemon` and similar for the new-style commands,
they'll conflict with the old `register*` functions, so let's add
`legacy` to their names.

Change-Id: I3fc0f15985abe43bc1f257be3ebd9021b66055a3
2025-03-15 21:28:15 -07:00
Rebecca Turner 53bf387022 LegacyCommands -> LegacyCommandRegistry
This name made sense at the time, but now I'm looking at making the
corresponding change to `CommandRegistry`, and I don't think `Commands`
is a good name for _that_ type, but I don't want the types to be
mismatched, so here we are.

Change-Id: I06068cbde00f49ff3d720c505a567a152b00b61c
2025-03-15 21:28:15 -07:00
Rebecca Turner 2ecbbc6e33 Commands -> CommandMap
This name, for a different type, is also vague.

Change-Id: I76405e940f3f1761bf0d66ba985d8c1dfc0b2d59
2025-03-15 21:27:22 -07:00
Rebecca Turner f1543bdf62 RegisterCommand::Commands -> CommandMap
This name is vague.

Change-Id: I255e2d94a72193ca1a10f2abf4a3011c75ec9ecf
2025-03-15 21:26:04 -07:00
Rebecca Turner 29732f19a2 pre-commit: add keep-sorted hook
This sorts lines alphabetically between `keep-sorted start` and
`keep-sorted end` markers.

See: https://github.com/google/keep-sorted

Closes #730

Change-Id: Ib36f3da81fcf5e2f588ffb998860456405607eea
2025-03-15 18:03:56 -07:00
Rebecca TurnerandJade Lovelace 761001f58d releng: Document release validation checks
After the release is created, we do some post-release validation for the
Lix packaging in Nixpkgs. This change documents those checks.

NB Most of these should probably be *pre*-release validation checks!

Closes #627.

Change-Id: I773e703582ccc8349987abd1e860a189a437cf3b
2025-03-12 13:52:13 -07:00
Rebecca TurnerandJade Lovelace 20fea96996 Fix piping nix store ls output on macOS
`writeLogsToStderr` uses a static mutex in order to prevent log output
from being interleaved. On macOS, it was possible for a logger in a
non-main thread to call this function after the static mutex was
destructed, leading to strange errors. Deliberately leaking the mutex
prevents the destructor from being called, fixing the issue.

Closes #702

Co-Authored-By: Jade Lovelace <jadel@mercury.com>
Co-Authored-By: eldritch horrors <pennae@lix.systems>

Change-Id: I14c80134cc493972752fad56b7f15fad8e4d5a5b
2025-02-28 18:17:47 -08:00
Rebecca Turner 16df34b295 releng: use aws s3 sync --delete when uploading manual
For the user manual, we don't delete things that are missing when doing
aws s3 sync. This doesn't seem wise. If you delete a page in the manual,
it will stay public and visible.

This adds `--delete` to the `aws s3 sync` commands to fix this issue.

Closes #396

Change-Id: I6d7fb97bcdab96c0115d6c66fea0310125207df4
2025-02-21 11:45:22 -08:00
Rebecca Turner c263070d37 Fix crash in debugger mode using with
Fixes this crash (#592):

    $ nix repl --debugger
    Lix 2.92.0-dev-pre20241120-66f6dbd debugger
    Type :? for help.
    nix-repl> let x = 4; in __seq x (with x; (x: builtins.break x) 1)
    info: breakpoint reached

    [1]    949722 segmentation fault (core dumped)  nix repl --debugger

Change-Id: I13c72941dc325ff984dcce2a84c01c89b1c552af
2025-02-03 15:22:50 -08:00
Rebecca TurnerandJade Lovelace 608bc6f9af Release process notes
The fruits of a night spent figuring out the Lix release process.

Other notes:
* The release process maybe uses a horrible `builders` setting or
  something to build all the architectures on the CI builders?
* Requires `nix-eval-jobs` (!!!)

Change-Id: Idf758f78326b2ea705e26c3d7f1a4638bc5980c1
2025-01-18 17:09:10 -08:00
rebecca “wiggles” turnerandGerrit Code Review 06996718c3 Merge "repl: tab-complete quoted attribute names" into main 2024-12-11 03:27:15 +00:00
rebecca “wiggles” turnerandGerrit Code Review 0012887310 Merge "Add release note for CTRL-C improvements" into main 2024-10-08 22:15:56 +00:00
Rebecca Turner 0d484aa498 Add release note for CTRL-C improvements
I'm very excited for cl/2016, so others will probably be excited also!
Let's add a release note.

Change-Id: Ic84a4444241aafce4cb6d5a6d1dddb47e7a7dd7b
2024-10-05 10:40:51 -07:00
rebecca “wiggles” turnerandGerrit Code Review 86b213e632 Merge "Split ignoreException to avoid suppressing CTRL-C" into main 2024-10-05 17:33:00 +00:00
rebecca “wiggles” turnerandGerrit Code Review 0b29859cfe Merge "editorconfig: Add meson.build" into main 2024-10-04 16:36:20 +00:00
Rebecca Turner 36073781fb editorconfig: Add meson.build
Change-Id: Ibb59ddc21f5d3ef7fb4c900e3413e426c201334d
2024-10-01 16:09:47 -07:00
Rebecca Turner b63d4a0c62 Remove static initializers for RegisterLegacyCommand
This moves the "legacy"/"nix2" commands under a new `src/legacy/`
directory, instead of being scattered around in a bunch of different
directories.

A new `liblegacy` build target is defined, and the `nix` binary is
linked against it.

Then, `RegisterLegacyCommand` is replaced with `LegacyCommand::add`
calls in functions like `registerNixCollectGarbage()`. These
registration functions are called explicitly in `src/nix/main.cc`.

See: https://git.lix.systems/lix-project/lix/issues/359

Change-Id: Id450ffc3f793374907599cfcc121863b792aac1a
2024-10-01 16:08:58 -07:00
rebecca “wiggles” turnerandGerrit Code Review 0943b214c9 Merge "tests/compression: rewrite" into main 2024-09-18 20:38:18 +00:00
rebecca “wiggles” turnerandGerrit Code Review 8ab5743904 Merge "Remove readline support" into main 2024-09-17 16:36:34 +00:00
Rebecca Turner 7ae0409989 Remove readline support
Lix cannot be built with GNU readline, and we would "rather not" be GPL.

Change-Id: I0e86f0f10dab966ab1d1d467fb61fd2de50c00de
2024-09-16 10:48:20 -07:00
Rebecca Turner df0137226d editline: Vendor cl/1883 patch to recognize Alt+Left/Alt+Right
This vendors the patch added in cl/1883 to avoid GitHub
garbage-collecting the commits we're referring to.

As @emilazy pointed out on GitHub:

> GitHub can garbage‐collect unmerged PR commits if they are later
> force‐pushed, which means that code review in upstreams can cause
> Nixpkgs builds to fail to reproduce in future.

See: https://github.com/NixOS/nixpkgs/pull/341131#discussion_r1753046220
See: https://github.com/troglobit/editline/pull/70
See: https://gerrit.lix.systems/c/lix/+/1883

Change-Id: Ifff522f7f23310d6dbe9efc72fd40be5500ae872
2024-09-11 09:35:00 -07:00
rebecca “wiggles” turnerandGerrit Code Review 24db81eaf2 Merge "repl: Patch editline to recognize Meta-Left & Meta-Right" into main 2024-09-11 01:02:27 +00:00
rebecca “wiggles” turnerandGerrit Code Review cc183fdbc1 Merge "repl-overlays: Provide an elaborate example" into main 2024-09-10 00:17:01 +00:00
rebecca “wiggles” turnerandGerrit Code Review f5ae72d445 Merge "Add getCwd" into main 2024-09-10 00:10:40 +00:00
Rebecca Turner 6de6cae3e7 repl: Patch editline to recognize Meta-Left & Meta-Right
This applies https://github.com/troglobit/editline/pull/70 to our build
of editline, which translates `meta-left` and `meta-right` into
`fd_word` and `bk_word`. This makes `nix repl` soooo much nicer to use!

Note: My terminal renders `meta-left` as `\e\e[C` and `meta-right` as
`\e\e[D`.

Closes https://git.lix.systems/lix-project/lix/issues/501

Change-Id: I048b10cf17231bbf4e6bf38e1d1d8572cedaa194
2024-09-09 15:34:50 -07:00
rebecca “wiggles” turnerandGerrit Code Review 72589e7032 Merge "Test including relative paths in configuration" into main 2024-09-03 18:48:47 +00:00
rebecca “wiggles” turnerandGerrit Code Review 644176a631 Merge "Expand comment on std::string operator+" into main 2024-09-03 18:48:37 +00:00
Rebecca Turner 75c0de3e3c Test including relative paths in configuration
Change-Id: If6c69a5e16d1ccd223fba392890f08f0032fb754
2024-09-01 15:52:48 -07:00
Rebecca Turner fc4a160878 repl-overlays: Provide an elaborate example
This is the repl overlay from my dotfiles, which I think provides a
reasonable and ergonomic set of variables. We can iterate on this over
time, or (perhaps?) provide a sentinel value like `repl-overlays =
<DEFAULT>` to include a "suggested default" overlay like this one.

Change-Id: I8eba3934c50fbac8367111103e66c7375b8d134e
2024-09-01 15:30:58 -07:00
Rebecca Turner b7b1b9723f Clarify that diff-hook no longer needs to be an absolute path
See: https://gerrit.lix.systems/c/lix/+/1864
Change-Id: Ic70bfe42b261a83f2cb68b8f102833b739b8e03a
2024-09-01 15:20:09 -07:00
Rebecca Turner 9d8f433246 Expand comment on std::string operator+
Nuts!

Change-Id: Ib5bc0606d7c86e57ef76dd7bcc89dce91bd3d50a
2024-09-01 15:10:31 -07:00
rebecca “wiggles” turnerandGerrit Code Review 02eb07cfd5 Merge changes I5566a985,I88cf53d3 into main
* changes:
  Support relative and `~/` paths in config settings
  Thread `ApplyConfigOptions` through config parsing
2024-09-01 22:06:36 +00:00
rebecca “wiggles” turnerandGerrit Code Review 422550fd68 Merge "libstore: remove static initializers for Store registrations" into main 2024-08-28 16:43:22 +00:00
rebecca “wiggles” turnerandGerrit Code Review 0dc486a5bf Merge "Fix comment in getHome" into main 2024-08-26 23:17:04 +00:00
Rebecca Turner ca08f1217d rowan: 0.15.15 -> 0.15.16
This fixes an ambiguous pointer comparison warning.

See: https://github.com/rust-analyzer/rowan/pull/162
Change-Id: Iaac2c8cab0051eb97211893ad547d8dfa8fda560
2024-08-26 11:34:43 -07:00
Rebecca Turner 742303dc3a Add getCwd
It's nice for this to be a separate function and not just inline in
`absPath`.

Prepared as part of cl/1865, though I don't think I actually ended up
using it there.

Change-Id: I24d9d4a984cee0af587010baf04b3939a1c147ec
2024-08-26 11:22:07 -07:00
Rebecca Turner 690f07272e Support relative and ~/ paths in config settings
Change-Id: I5566a9858ba255f4ac5051d1368c7dfb24460f0a
2024-08-25 15:54:22 -07:00
Rebecca Turner 5fc6fcb310 Thread ApplyConfigOptions through config parsing
This makes no changes to logic but makes the `ApplyConfigOptions` value
available to consumers.

Change-Id: I88cf53d38faac8472c556aee55c13d0acbd1e5db
2024-08-25 15:54:22 -07:00
rebecca “wiggles” turnerandGerrit Code Review 0582999bd1 Merge "Add ApplyConfigOptions" into main 2024-08-25 22:06:45 +00:00
Rebecca Turner c300efc0e1 Add ApplyConfigOptions
Change-Id: Ic876bcabd0b68e579bbd30ca1755919df43d4813
2024-08-25 12:18:20 -07:00
Rebecca Turner fabc9f29b8 Fix comment in getHome
The logic in the comment is the opposite of the truth.

Change-Id: I64add84539209782ffa46431f3db1fb306d90b3f
2024-08-23 15:15:21 -07:00
rebecca “wiggles” turnerandGerrit Code Review c5949bfe31 Merge "libutil/config: unify path setting types" into main 2024-08-23 22:09:11 +00:00
Rebecca Turner 9845637359 lix-clang-tidy: Require Clang >= 16
Nixpkgs Clang on macOS is 16, not 17.

nix-repl> packages.aarch64-darwin.nix-clangStdenv.stdenv.cc
«derivation /nix/store/ycych9qpim4r42hjkznl8f6zmj0jns45-clang-wrapper-16.0.6.drv»

nix-repl> packages.x86_64-linux.nix-clangStdenv.stdenv.cc
«derivation /nix/store/y48dhgidb2vs230r9ayim14q61xwcdg9-clang-wrapper-17.0.6.drv»

Change-Id: Ib267b8882f80eef4db665fb9df50ae285ea68b2b
2024-08-23 12:17:01 -07:00
rebecca “wiggles” turnerandGerrit Code Review 99845e0e01 Merge "Print top-level errors normally in nix repl" into main 2024-04-10 15:40:03 +00:00
Rebecca Turner 9e7e927837 Print top-level errors normally in nix repl
Previously, errors while printing values in `nix repl` would be printed
in `«error: ...»` brackets rather than displayed normally:

```
nix-repl> legacyPackages.aarch64-darwin.pythonPackages.APScheduler
«error: Package ‘python-2.7.18.7’ in /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/cpython/2.7/default.nix:335 is marked as insecure, refusing to evaluate.»
```

Now, errors will be displayed normally if they're emitted at the
top-level of an expression:

```
nix-repl> legacyPackages.aarch64-darwin.pythonPackages.APScheduler
error:
       … in the condition of the assert statement
         at /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/lib/customisation.nix:268:17:
          267|     in commonAttrs // {
          268|       drvPath = assert condition; drv.drvPath;
             |                 ^
          269|       outPath = assert condition; drv.outPath;

       … in the left operand of the OR (||) operator
         at /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/passthrufun.nix:28:45:
           27|         if lib.isDerivation value then
           28|           lib.extendDerivation (valid value || throw "${name} should use `buildPythonPackage` or `toPythonModule` if it is to be part of the Python packages set.") {} value
             |                                             ^
           29|         else

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: Package ‘python-2.7.18.7’ in /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/cpython/2.7/default.nix:335 is marked as insecure, refusing to evaluate.
```

Errors emitted in nested structures (like e.g. when printing `nixpkgs`)
will still be printed in brackets.

Change-Id: I25aeddf08c017582718cb9772a677bf51b9fc2ad
2024-04-09 08:34:40 -07:00
rebecca “wiggles” turnerandGerrit Code Review a95c62673b Merge "Add repl-overlays" into main 2024-04-09 05:29:48 +00:00
Rebecca Turner 727b43478c Add repl-overlays
Adds a `repl-overlays` option, which specifies files that can overlay
and modify the top-level bindings in `nix repl`. For example, with the
following contents in `~/.config/nix/repl.nix`:

    info: final: prev: let
      optionalAttrs = predicate: attrs:
        if predicate
        then attrs
        else {};
    in
      optionalAttrs (prev ? legacyPackages && prev.legacyPackages ? ${info.currentSystem})
      {
        pkgs = prev.legacyPackages.${info.currentSystem};
      }

We can run `nix repl` and use `pkgs` to refer to `legacyPackages.${currentSystem}`:

    $ nix repl --repl-overlays ~/.config/nix/repl.nix nixpkgs
    Lix 2.90.0
    Type :? for help.
    Loading installable 'flake:nixpkgs#'...
    Added 5 variables.
    Loading 'repl-overlays'...
    Added 6 variables.
    nix-repl> pkgs.bash
    «derivation /nix/store/g08b5vkwwh0j8ic9rkmd8mpj878rk62z-bash-5.2p26.drv»

Change-Id: Ic12e0f2f210b2f46e920c33088dfe1083f42391a
2024-04-08 17:11:47 -07:00
rebecca “wiggles” turnerandGerrit Code Review 5ec256625e Merge "Don't run libstore unit tests in project root" into main 2024-04-08 22:08:34 +00:00
rebecca “wiggles” turnerandGerrit Code Review 3910d4aa68 Merge "Fix REPL test parser nits" into main 2024-04-08 21:52:06 +00:00
Rebecca Turner cfbcf12276 Format Nix code with nixfmt
Change-Id: I61efeb666ff7481c05fcb247168290e86a250151
2024-04-08 13:00:00 -07:00
Rebecca Turner 12f2565f91 Don't run libstore unit tests in project root
This keeps the libstore unit tests from writing
`libstore-unit-tests.xml` to the project root.

Change-Id: I0d9909aabf9f3574cc1e72a5ae81daefba9a394b
2024-04-08 12:43:35 -07:00
Rebecca Turner 4a49a497eb Fix REPL test parser nits
Follow-up to https://gerrit.lix.systems/c/lix/+/546

Change-Id: Ie603f01e5520329bf879e061cea9e3fba45213fd
2024-04-08 11:14:34 -07:00
Rebecca Turner b323340538 Add nixfmt
Change-Id: I7f21695e3971cfd02b2cce0dd016ff6eb3389905
2024-04-08 09:42:34 -07:00
rebecca “wiggles” turnerandGerrit Code Review 4600eabdae Merge "Rename some parse failure tests to parse-fail-*" into main 2024-04-08 06:33:51 +00:00
rebecca “wiggles” turnerandGerrit Code Review 8ed8b9aef0 Merge "Add PathsSetting" into main 2024-04-08 06:31:11 +00:00
Rebecca Turner 6f863e8ccd Add PathsSetting
Change-Id: I1165f6ef033a5f757ca3716d3f8008ba36b01fd0
2024-04-07 18:22:15 -07:00
rebecca “wiggles” turnerandGerrit Code Review 06e11778b5 Merge "Rewrite REPL test parser" into main 2024-04-06 21:36:26 +00:00
Rebecca Turner ee423f391d Rewrite REPL test parser
- Use a recursive descent parser so that it's easy to extend.
- Add `@args` to enable customizing command-line arguments
- Add `@should-start` to enable `nix repl` tests that error before
  entering the REPL
- Make sure to read all stdout output before comparing. This catches
  some extra output we were tossing out before!

Change-Id: I5522555df4c313024ab15cd10f9f04e7293bda3a
2024-04-05 13:14:21 -07:00
Rebecca Turner 5081109592 Fix Boost with make build
This prevents the autotools build from discovering Boost in Homebrew
installation directories on macOS.

Change-Id: I624309165c9371c391fd657424ba4c4f3182b385
2024-04-05 11:09:59 -07:00
rebecca “wiggles” turnerandGerrit Code Review 83d720b730 Merge "Make repl_characterization.cc constants string_views" into main 2024-04-04 23:08:09 +00:00
Rebecca Turner 0fec7d2db6 Rename some parse failure tests to parse-fail-*
These were mistakenly labeled `eval-fail-*`.

Note that the `lang.sh` runner passes `parse-fail-*` tests on stdin, so
filenames are removed from error messages.

Change-Id: I7f3a0d78b6cfa87af29aaa1b7af19d5a57fd4ade
2024-04-04 15:49:30 -07:00
rebecca “wiggles” turnerandGerrit Code Review b44514819b Merge "Add EscapeStringOptions and escapeString tests" into main 2024-04-04 17:41:13 +00:00
Rebecca Turner 84018e1264 Make repl_characterization.cc constants string_views
Change-Id: I96455ee365799ae87d9ab433cf102c691616a45e
2024-04-03 16:25:54 +00:00
Rebecca Turnerandjade ea10fe7ab0 Add EscapeStringOptions and escapeString tests
Change-Id: I86ead2f969c9e03c9edfa51bbc92ee06393fd7d6
2024-04-03 16:25:54 +00:00
rebecca “wiggles” turnerandGerrit Code Review 56c7dfd652 Merge "Add treefmt pre-commit hook" into main 2024-04-03 00:09:09 +00:00
rebecca “wiggles” turnerandGerrit Code Review 71ef7fd428 Merge "Use upstream cachix/git-hooks.nix for pre-commit" into main 2024-04-02 17:20:33 +00:00
Rebecca Turner ca9acf8184 Use upstream cachix/git-hooks.nix for pre-commit
Change-Id: I6bbc7d6da9accd7d2daffa9d780384df7226670e
2024-04-01 10:38:50 -07:00
rebecca “wiggles” turnerandGerrit Code Review 4b730f328e Merge "Add pre-commit checks" into main 2024-03-30 22:26:59 +00:00
Rebecca Turner 655dae03de Add treefmt pre-commit hook
This lets us use different formatters for different filetypes.

Change-Id: Ib52383dd5097c8919a65e299aca2b5a55412223c
2024-03-29 22:57:43 -07:00
Rebecca Turner 2a98ba8b97 Add pre-commit checks
The big ones here are `trim-trailing-whitespace` and `end-of-file-fixer`
(which makes sure that every file ends with exactly one newline
character).

Change-Id: Idca73b640883188f068f9903e013cf0d82aa1123
2024-03-29 22:57:40 -07:00
Rebecca Turnerandjade 0b4e738944 Add a justfile to make meson friendly :)
Change-Id: Id6e4528392266c6f2444e030b67293abe297ed17
2024-03-30 03:03:46 +00:00