Commit graph

68 commits

Author SHA1 Message Date
Emily
cedaa5bb00 docs: migrate from poetry to uv
Our docs are built with MkDocs, which requires Python and several deps.

Previously those deps were managed with Poetry, which is also written in Python.
This commit replaces Poetry with `uv`, a Rust-based Python
project/package manager, and thus removes several steps from the docs
build process.

Before:

  <install Python>
  <install pipx>
  pipx install poetry
  poetry install
  poetry run -- mkdocs serve

After:

  <install uv>
  uv run mkdocs serve
2024-11-20 06:06:53 +01:00
Joaquín Triñanes
5e8c7660a6 nix: Remove apps output
Some checks are pending
binaries / Build binary artifacts (linux-aarch64-gnu, ubuntu-24.04, aarch64-unknown-linux-gnu) (push) Waiting to run
binaries / Build binary artifacts (linux-aarch64-musl, ubuntu-24.04, aarch64-unknown-linux-musl) (push) Waiting to run
binaries / Build binary artifacts (linux-x86_64-gnu, ubuntu-24.04, x86_64-unknown-linux-gnu) (push) Waiting to run
binaries / Build binary artifacts (linux-x86_64-musl, ubuntu-24.04, x86_64-unknown-linux-musl) (push) Waiting to run
binaries / Build binary artifacts (macos-aarch64, macos-14, aarch64-apple-darwin) (push) Waiting to run
binaries / Build binary artifacts (macos-x86_64, macos-13, x86_64-apple-darwin) (push) Waiting to run
binaries / Build binary artifacts (win-x86_64, windows-2022, x86_64-pc-windows-msvc) (push) Waiting to run
nix / flake check (macos-14) (push) Waiting to run
nix / flake check (ubuntu-latest) (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with Poetry 1.8 (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
It was redundant once mainProgram was set for the package
2024-11-14 12:19:13 -06:00
Joaquín Triñanes
f1a9f62e3d nix: Add meta field to package
The most relevant part (and the reason for this change) is the addition
of the `mainProgram` attribute. This allows getting the executable name
from inside nix expressions with ease:

```
# before
lib.getExe' jujutsu "jj"
# or
"${jujutsu}/bin/jj"
```

```
# now
lib.getExe jujutsu
```
2024-11-14 12:19:13 -06:00
Joaquín Triñanes
49a0c0c802 nix: Use packages instead of buildInputs
Some checks are pending
binaries / Build binary artifacts (linux-aarch64-gnu, ubuntu-24.04, aarch64-unknown-linux-gnu) (push) Waiting to run
binaries / Build binary artifacts (linux-aarch64-musl, ubuntu-24.04, aarch64-unknown-linux-musl) (push) Waiting to run
binaries / Build binary artifacts (linux-x86_64-gnu, ubuntu-24.04, x86_64-unknown-linux-gnu) (push) Waiting to run
binaries / Build binary artifacts (linux-x86_64-musl, ubuntu-24.04, x86_64-unknown-linux-musl) (push) Waiting to run
binaries / Build binary artifacts (macos-aarch64, macos-14, aarch64-apple-darwin) (push) Waiting to run
binaries / Build binary artifacts (macos-x86_64, macos-13, x86_64-apple-darwin) (push) Waiting to run
binaries / Build binary artifacts (win-x86_64, windows-2022, x86_64-pc-windows-msvc) (push) Waiting to run
nix / flake check (macos-14) (push) Waiting to run
nix / flake check (ubuntu-latest) (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with Poetry 1.8 (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
In practice, `packages` sets the value for `nativeBuildInputs`. This has the following advantages:

- `buildInputs` is for runtime dependencies. `nativeBuildInputs` is for
  build dependencies (this usually not an issue unless cross compiling)
- `shellHook`s will actually run, allowing packages to safely append to
  variables like `XDG_DATA_DIRS`
- It's more idiomatic and how it's recommended to be used in the docs
2024-11-03 12:50:44 -06:00
Joaquín Triñanes
a20f3867b6 nix: Add rust-analyzer to devshell 2024-11-03 12:50:44 -06:00
Austin Seipp
4a2983b77e nix: only use rust-src in devShell toolchain
Some checks are pending
binaries / Build binary artifacts (linux-aarch64-gnu, ubuntu-24.04, aarch64-unknown-linux-gnu) (push) Waiting to run
binaries / Build binary artifacts (linux-aarch64-musl, ubuntu-24.04, aarch64-unknown-linux-musl) (push) Waiting to run
binaries / Build binary artifacts (linux-x86_64-gnu, ubuntu-24.04, x86_64-unknown-linux-gnu) (push) Waiting to run
binaries / Build binary artifacts (linux-x86_64-musl, ubuntu-24.04, x86_64-unknown-linux-musl) (push) Waiting to run
binaries / Build binary artifacts (macos-aarch64, macos-14, aarch64-apple-darwin) (push) Waiting to run
binaries / Build binary artifacts (macos-x86_64, macos-13, x86_64-apple-darwin) (push) Waiting to run
binaries / Build binary artifacts (win-x86_64, windows-2022, x86_64-pc-windows-msvc) (push) Waiting to run
nix / flake check (macos-14) (push) Waiting to run
nix / flake check (ubuntu-latest) (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with Poetry 1.8 (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
See the included comment. This helps avoid a large dependency on the rustc
toolchain and helps reduce closure size for Nix users.

Partial revert of 749481e552.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-10-22 20:02:48 -05:00
Austin Seipp
a3ca701556 nix: remove a hack needed for nextest
The relevant upstream issue has been fixed since version 0.9.72,
as noticed by Emily.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-06-30 14:48:39 -05:00
Austin Seipp
fe40c9e364 nix: use -ld_new on macOS devshell
The new parallel macOS linker reduces link time for the debug `jj` binary from
3s to 0.7s on my M2 Macbook Air, which is a significant reduction for nearly
no cost at all. This only assumes that you have a new enough Xcode environment
as your default (where `/usr/bin/ld` resides.)

This change requires Sonoma and Xcode 15, but in theory I think we could target
a lower macOS SDK version in order to produce binaries that are more backwards
compatible, so the only real cost is that developers who also use Nix would
require Sonoma.
2024-06-30 14:48:39 -05:00
Austin Seipp
e2138ca2df nix: include watchman in dev shell
This is useful for testing locally even if you don't have `watchman` elsewhere
on your machine.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-06-25 17:18:09 -05:00
Austin Seipp
b0040830b1 nix: remove spurious rust-analyzer input
This is already included with the `ourRustVersion` expression since it includes
a complete Rust toolchain with all extensions.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-06-25 17:18:09 -05:00
Austin Seipp
f815afd6ab nix: remove spurious flake 'follow' directive
Apparently this isn't needed anymore.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-06-25 17:18:09 -05:00
Austin Seipp
1eac4812c8 nix: zstd-compressed debug sections in devShell
This cuts the size of a final debug binary in half (~250MiB -> 127MiB)
in my dev shell, and saves about 15% of total `target/` directory size
when a full build from scratch happens (2GiB -> 1.7GiB). Let's take an
easy free win.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-06-13 14:02:50 -05:00
Austin Seipp
ad34d10951 nix: parallel rustc frontend in devShell
Only active within `devShell`; the default `.#jujutsu` package is unaffected
by this change. This somewhat increases CPU utilization and has a marginal
improvement on my local compile times, but it's also nice if you have to
recompile from scratch too.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I07ab28991843ca3723185569db5f38f2ed076875
2024-06-13 14:02:50 -05:00
Austin Seipp
749481e552 nix: use the latest rust-nightly toolchain instead of stable
This is a change that does affect the nix built package, and is tested as part
of the CI Matrix, so there is now an actively maintained (by me) nightly build
that can be checked for regressions.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: If9a134de7e1d496d47936259c59f73c4a62a341f
2024-06-13 14:02:50 -05:00
Austin Seipp
fe3ffda7ef nix: fix nix-on-macOS build
When the `jj-proc-macros` crate was introduced, it triggered an underlying
bug in `nextest`, which is the test harness we use in the Nix build. This is
upstream Nextest bug 267. The long and short of it is that `rustc` fails to
find needed libraries whenever the proc macros are loaded.

This can easily be worked around however, by setting
`DYLD_FALLBACK_LIBRARY_PATH` to an appropriate value in the devShell and in the
`preCheck` phase of the main expression.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-02-28 13:56:07 -08:00
Austin Seipp
29e959d18c nix: s/rust-version/ourRustVersion/g
This naming is just more consistent with the surrounding code.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-02-28 13:56:07 -08:00
Austin Seipp
3f7b5a75e7 github(nix): don't build everything twice
When running the `nix build`, the `buildRustPackage` function -- which builds
the `jj` crates -- calls `cargo build --release` with flags like `HOST_CXX`
set. This is called the `buildPhase`. Then, it runs the `checkPhase`, which
calls `cargo nextest`, in our case. However, it does not set `HOST_CXX`, for
some reason.

The intent of `buildRustPackage` is that the `buildPhase` and `checkPhase`
have their compilation options fully aligned so that they reuse the local cargo
`target/` cache directory, avoiding a full recompilation. However, the lack
of `HOST_CXX` above among others causes a cache miss, and a bunch of cascading
recompilations. The net impact is that we compile all of the codebase once in
`buildPhase`, then again in `checkPhase`, making the Nix CI build 2x slower on
average than the other Linux runners; 2-3 minutes versus 7 minutes, on average.

Instead, re-introduce a 'check' into the Flake directly, which overrides the
`jujustsu` package, but stubs out the `buildPhase`. This means it will only run
`checkPhase`, which is what we want. Then, modify the CI to run `nix flake check`
again, like it used to in the past.

Unfortunately, this doesn't fix the cache miss when running `nix build`
yourself, it recompiles from scratch in both phases still. That needs to be
fixed in the future, but it's tolerable for now.

This reverts most of 71a3045032.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-02-24 13:56:03 -06:00
Austin Seipp
c32b68eb83 nix: overwrite, don't append, to $RUSTFLAGS
This matches the behavior of the actual `nix build` more closely, and might also
help Anton, since he was debugging some recompilation issues on his machine,
where `RUSTFLAGS` might have become inconsistent due to VS Code.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-02-21 17:34:11 -06:00
Julien Vincent
23e5fba737 sign: Add SSH backend tests 2024-02-20 00:02:08 +00:00
Julien Vincent
7c11a61c23 sign: GPG backend tests 2024-02-20 00:02:08 +00:00
Alexis (Poliorcetics) Bourget
fb10e3f296 completion: Update docs for new style with positional argument 2024-02-17 19:26:30 +01:00
Austin Seipp
5b517b542e rust: bump MSRV to 1.76.0
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-02-09 15:48:01 -06:00
Austin Seipp
c8271f7617 nix: use mold linker on Linux
Summary: Pure QOL improvement, not that this was too awful as it stood. But this
ultimately makes all builds faster, effectively for free; on my Linux machine,
debug link time for jj-cli goes from 3s to 1s.

This was originally submitted as part of #1864, and backed out as part of #1982,
because the default `mold` package did not have the proper "wrapper script"
that allowed it to find the right external libraries. Using the `mold-wrapped`
package however fixes this.

On top of that, let's go ahead and make `mold` the default linker in the Nix
package/flake as well; this should improve the `nix build` speed since a lot of
tests need to be linked.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-01-21 23:23:54 -06:00
Anton Bulakh
e3a1e5b80e sign: Implement storage for digital commit signatures
Recognize signature metadata from git commit objects, implement
a basic version of that for the native backend.
Extract the signed data (a commit binary repr without the signature) to
be verified later.
2023-11-12 03:37:13 +02:00
Austin Seipp
2401bf9bcd nix: include darwin deps inside devShell, too
Summary: Without `devShell` providing the needed Darwin-specific inputs, `cargo
build` does not work inside a `nix develop` or `direnv` environment; libgit2 in
particular fails on being able to find the Security framework.

The actual `nix build` invocation however *does* work because we correctly
include those dependencies in the package `buildInputs`. So just factor them
out, and use them in both places.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I484bf381ca31c29c4c39fb6d184bdd21
2023-11-04 14:35:39 -05:00
Austin Seipp
4a6ebd0223 nix: fix the rustfmt version by using nightly
Summary: Apparently this was broken. Maybe I broke it. Maybe something upstream
changed and caused a regression. But without it, we get the stable `rustfmt` in
the `nix develop` shell environment, not the nightly version. Fix it.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I602ed8e5691c4d48f8db575d62624955
2023-11-04 13:51:15 -05:00
Austin Seipp
71a3045032 nix: merge (now redundant) flake check with normal build
Summary: Since 066032b6e6 was merged, the `nix flake check` build no longer
overrides the 'cargo test' profile explicitly, to save disk space. The CI seems
to be in a better spot. This will stem the tide for a while hopefully.

However, with that change in place, the `nix flake check` build was
essentially a redundant, nearly-identical copy of a normal `nix build` with no
differentiating features, except: `RUST_BACKTRACE` is set to 1.

Delete all this code, and remove it from the CI matrix, and instead just export
`RUST_BACKTRACE` on the `checkPhase` of the normal `nix build` instead, which is
functionally equivalent.

Also does some minor, no-functional-change touchups to `flake.nix` while I was
there (whitespace, etc.)

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I87336b16e2a0b973343ecbde8ffd7b8f
2023-10-07 22:20:20 -07:00
Austin Seipp
d5b2f8e43f fix: run 'cargo test' under 'nix flake check' with a non-debug profile
Summary: The Nix CI has been failing recently due to (what I assume is) disk
space issues. But only the `flake check` step is failing. Right now, `nix flake
check` runs the Cargo tests with the debug profile to help get more debug info,
which is even heftier in terms of debug info than the normal 'test' profile. For
reference, a single build of 'cargo test' in a clean working copy results in a
15 gigabyte `target/` directory.

Turn off the debug profile for `nix flake check`, which should hopefully stem
the bleeding a bit. I believe the 'test' profile should still have enough
symbols for backtraces, so panics should still be useful.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Idde10ac15847a1ad1e6f4e48a2497eca
2023-10-05 11:48:46 -05:00
Austin Seipp
2e8b824da7 chore(nix): add 'default' features to list of cargo features
Summary: By default, and to be explicit, the local flake turns off default
features. But, 70f6e0a turned off watchman support for the Nix build by
accident. Enable default features so this doesn't happen again.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Ib7dd935eceab328fa5b0333b10368377
2023-09-08 19:38:24 -05:00
Ilya Grigoriev
d3428d63a2 nix: Add poetry to devDependencies for nix develop
This should allow Nix users to build the documentation in
`nix develop` following the instructions in `contributing.md`.

It feels a little weird to add a package manager and ask
people to use it inside nix, but I think it's simpler
than having two sets of instructions and dependencies
to maintain.
2023-08-28 10:43:48 -07:00
Austin Seipp
688029428b backout of commit e212e10dee
Summary: mold apparently breaks linking to several external libraries, meaning
that the `jj` binary is useless as it can't load e.g. `libgit2.so` -- but
somehow I didn't catch it. Backout until a solution can be pinpointed. We can at
least give off a sigh of relief knowing that our link times aren't too bad yet.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I6e1851c339ddc72d32c201a44a7ddc49
2023-08-04 17:38:31 -05:00
Austin Seipp
8cb429d065 chore(rust): bump MSRV to 1.71.0
Summary: Let's be more aggressive about tracking the latest stable Rust release.
There's little benefit to being conservative so early on, especially when no
users seem to have faced any issue with upgrading, or strictly required an old
Rust version.

Right now, just lagging Rust by 1 major release probably seems fine. We're
targeting 1.71.0 to get ahead of the curve, since 1.72.0 will likely release
sometime before the next `jj` release.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I4e691b6ba63b5b9023a75ae0a6917672
2023-07-17 18:38:26 -05:00
Austin Seipp
e212e10dee feat(nix): use mold by default for linking inside 'nix develop'
Summary: Pure QOL improvement, not that this was too awful as it stood. But this
ultimately makes all builds faster, effectively for free; on my Linux machine,
debug link time for jj-cli goes from 3s to 1s.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I5a0d516363635710733e8bee8f208050
2023-07-14 20:29:16 -05:00
Martin von Zweigbergk
152a0683e2 github: enable the watchman feature in pre-built binaries 2023-07-12 17:51:38 +01:00
Austin Seipp
cd4637e51c feat(nix): enable watchman support in nix package
Summary: Nix packages tend to come "full extra pack of batteries"-included, so
adding watchman support makes sense. I'll also want it for my own experiments.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Ia99757bf7a39814529525efe423d527b
2023-07-10 16:05:53 -05:00
Austin Seipp
f1e09e3f3f chore(github): reduce compile time in build, nix, and release workflows
Summary: When building in CI, we just build everything from scratch in the `dev`
profile, so just turn off debuginfo and incremental compilation data. These
aren't reused, but more importantly take up more space and CPU time to generate;
that's more expensive on slower machines and when using The Cloud(TM) to build.

Together, these take a fresh build (`rm -rf target/` ahead of time) from about
40s to 30s on my machine.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Id6e706634dbaf88f6ccd7f457409ad7c
2023-07-10 06:18:38 -05:00
Anton Bulakh
83dd591272 nix: dont install fake binaries and fix dirty jj version 2023-06-25 00:58:13 +03:00
Benjamin Saunders
19a2f2194d nix: remove unnecessary dependencies 2023-05-07 06:56:09 -07:00
Benjamin Saunders
17be937e3d nix: use packaged foreign dependencies in dev shell 2023-05-06 06:08:35 -07:00
Benjamin Saunders
cfadc50cb2 nix: use packaged builds of foreign dependencies
Speeds up the build and reduces the size of the resulting package.
2023-05-05 10:57:18 -07:00
Martin von Zweigbergk
92a911b7a3 cli: rename jj support to jj util
I wasn't quite happy with `jj support` but I couldn't think of
anything better when I moved the commands from `jj debug` in
e2b4d7058d. Thanks to @ilyagr for suggesting `jj util`.
2023-04-12 21:34:47 -07:00
Martin von Zweigbergk
68fb46b2af op_store: drop support for upgrading from Thrift implementation 2023-03-30 20:00:33 -07:00
Anton Bulakh
3c68cfa737 nix: fix shell completions 2023-03-22 06:20:15 +02:00
Martin von Zweigbergk
2495c8f27e cargo: update MSRV to 1.64
We need 1.64 to bump `clap` to `4.1`. We don't really need to upgrade
to that, but being on an older version causes minor confusions like
#1393. Rust 1.64 is very close to 6 months old at this point.
2023-03-17 22:44:29 -07:00
Martin von Zweigbergk
e2b4d7058d cli: move some debug commands to new (non-hidden) support group
The `jj debug` commands are hidden from help and are described as
"Low-level commands not intended for users", but e.g. `jj debug
completion` is intended for users, and should be visible in the help
output.
2023-03-17 06:50:55 -07:00
Michael Forster
567a05d7ec nix: use default list of systems
Most notably this removes the `i686-linux` target, which wasn't added
deliberately and is also not tested.
2023-01-28 07:10:12 +01:00
Michael Forster
3ca26974e6 nix: filter source files
This speeds up the nix build by reducing the number of files that are copied to
the nix store.

Hopefully fixes #1095.
2023-01-28 07:10:12 +01:00
Michael Forster
29db607e10 nix: replace manual system iteration by flake-utils
Let's not reinvent the wheel. This makes the flake more readable, and also would
detect typos in the system list.
2023-01-28 07:10:12 +01:00
Michael Forster
3c0eb21ed1 nix: refactor flake to avoid building jj for the dev shell
We don't actually need `jj` itself in the development shell. But having it in
the overlay significantly increases the time it takes to build the shell.
2023-01-28 07:10:12 +01:00
Martin von Zweigbergk
0b99e5b16e graphlog: enable Sapling's graph styles by default
I would also rename the feature, but I hope we can instead soon make
it a non-optional dependency and delete the feature.
2023-01-27 09:46:57 -08:00