Commit Graph

34 Commits

Author SHA1 Message Date
Thomas Eizinger
0617c96b69 chore(nix): follow system release channel (#9784)
In order to avoid glibc mismatches, the dev-shell started by the nix
flake should follow the system channel instead of pinning a version by
itself.
2025-07-04 14:27:53 +00:00
Thomas Eizinger
40f0609d90 ci: lint GitHub workflows with actionlint (#9590)
[`actionlint`](https://github.com/rhysd/actionlint) is a static analysis
tool for GitHub workflows and actions. It detects various issues ahead
of time and runs shellcheck on all `run` blocks. It is worth noting that
this does **not** lint the contents of composite actions so we still
need to be vigilant when working with those.
2025-06-24 08:05:10 +00:00
Thomas Eizinger
faeb958882 refactor: use UniFFI for Android FFI (#9415)
To make our FFI layer between Android and Rust safer, we adopt the
UniFFI tool from Mozilla. UniFFI allows us to create a dedicated crate
(here `client-ffi`) that contains Rust structs annotated with various
attributes. These macros then generate code at compile time that is
built into the shared object. Using a dedicated CLI from the UniFFI
project, we can then generate Kotlin bindings from this shared object.

The primary motivation for this effort is memory safety across the FFI
boundary. Most importantly, we want to ensure that:

- The session pointer is not used after it has been free'd
- Disconnecting the session frees the pointer
- Freeing the session does not happen as part of a callback as that
triggers a cyclic dependency on the Rust side (callbacks are executed on
a runtime and that runtime is dropped as part of dropping the session)

To achieve all of these goals, we move away from callbacks altogether.
UniFFI has great support for async functions. We leverage this support
to expose a `suspend fn` to Android that returns `Event`s. These events
map to the current callback functions. Internally, these events are read
from a channel with a capacity of 1000 events. It is therefore not very
time-critical that the app reads from this channel. `connlib` will
happily continue even if the channel is full. 1000 events should be more
than sufficient though in case the host app cannot immediately process
them. We don't send events very often after all.

This event-based design has major advantages: It allows us to make use
of `AutoCloseable` on the Kotlin side, meaning the `session` pointer is
only ever accessed as part of a `use` block and automatically closed
(and therefore free'd) at the end of the block.

To communicate with the session, we introduce a `TunnelCommand` which
represents all actions that the host app can send to `connlib`. These
are passed through a channel to the `suspend fn` which continuously
listens for events and commands.

Resolves: #9499
Related: #3959

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Jamil Bou Kheir <jamilbk@users.noreply.github.com>
2025-06-17 21:48:34 +00:00
Jamil
1e94afdb98 chore: move terraform/ to private repo (#9421)
Since we'll be adding ops playbooks and other things here, it makes
sense to separate infra from product source.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-05 19:24:06 +00:00
Thomas Eizinger
e05c98bfca ci: update to new cargo sort release (#9354)
The latest release now also sorts workspace dependencies, as well as
different dependency sections. Keeping these things sorted reduces the
chances of merge conflicts when multiple PRs edit these files.
2025-06-02 02:01:09 +00:00
Thomas Eizinger
28283a82c4 build(nix): add dependencies for launching GUI client (#9135)
In order to launch a debug build of the GUI client on NixOS, we need to
add the appindicator dependency and set the library lookup path
correctly.
2025-05-15 00:15:46 +00:00
Thomas Eizinger
f2e9ae51de build(nix): add GUI smoke test tools (#9086) 2025-05-12 13:07:11 +00:00
Thomas Eizinger
35da0a9cc8 chore(nix): bump to 24.11 and remove flake-utils (#8767)
In order to get more recent tools like `cargo deny` that support Rust
2024, we need to bump the nixpkgs release we depend on to 24.11. As part
of doing so, we simplify the flake to not depend on `flake-utils` as we
only build for a single system anyway.
2025-04-13 02:08:42 +00:00
Thomas Eizinger
42d742e3df chore: add bpftools to nix shell env (#8609) 2025-04-02 03:05:24 +00:00
Thomas Eizinger
54274ebdc5 chore: add terraform to the nix config (#8531) 2025-03-28 03:17:10 +00:00
Thomas Eizinger
4cb2b01c26 build(nix): manage Rust installation via rustup (#8235)
Using `rustup` - even on NixOS - is easier to manage the Rust toolchain
as some tools rely on being able to use the `rustup` shims such as
`+nightly` to run a nightly toolchain.
2025-02-24 01:33:13 +00:00
Thomas Eizinger
0e5d91e266 build(nix): use more recent pnpm (#8106)
Updates to `pnpm` 9.
2025-02-13 01:01:23 +00:00
Thomas Eizinger
7ece89b517 chore: bump Rust to 1.84 (#7719) 2025-01-12 17:32:48 +00:00
Thomas Eizinger
c6e7e6192e build(rust): bump Rust to 1.83 (#7409)
Rust 1.83 comes with a bunch of new lints for elidible lifetimes. Those
also trigger in the generated code of `derivative`. That crate is
actually unmaintained so we replace our usages of it with `derive_more`.
2024-11-29 01:04:06 +00:00
Thomas Eizinger
2c26fc9c0e ci: lint Rust dependencies using cargo deny (#7390)
One of Rust's promises is "if it compiles, it works". However, there are
certain situations in which this isn't true. In particular, when using
dynamic typing patterns where trait objects are downcast to concrete
types, having two versions of the same dependency can silently break
things.

This happened in #7379 where I forgot to patch a certain Sentry
dependency. A similar problem exists with our `tracing-stackdriver`
dependency (see #7241).

Lastly, duplicate dependencies increase the compile-times of a project,
so we should aim for having as few duplicate versions of a particular
dependency as possible in our dependency graph.

This PR introduces `cargo deny`, a linter for Rust dependencies. In
addition to linting for duplicate dependencies, it also enforces that
all dependencies are compatible with an allow-list of licenses and it
warns when a dependency is referred to from multiple crates without
introducing a workspace dependency. Thanks to existing tooling
(https://github.com/mainmatter/cargo-autoinherit), transitioning all
dependencies to workspace dependencies was quite easy.

Resolves: #7241.
2024-11-22 00:17:28 +00:00
Thomas Eizinger
25d5280874 chore: update NixOS flake to all building new Tauri app (#7197) 2024-10-31 05:29:32 +00:00
Thomas Eizinger
3365981e1b chore(rust): bump Rust to 1.82 and run cargo update (#7086)
I decided to throw in a `cargo update` as well to bump some of the Git
dependencies.
2024-10-17 22:33:31 +00:00
Thomas Eizinger
d8cf1e9a51 build(nix): install RA into dev-shell (#6688)
Instead of forcing NIx users of the respository (me) to install RA
globally, we can install the equivalent version of whatever Rust version
we depend on.
2024-09-13 20:10:10 +00:00
Thomas Eizinger
89c9946d3c build: bump Rust to 1.81.0 (#6616) 2024-09-09 19:47:16 +00:00
Thomas Eizinger
9173601af4 build(nix): install rust-src as part of toolchain (#6520)
In order for `rust-analyzer` to show the correct version of the Rust
standard library, we need to install `rust-src` together with the
toolchain version that we use in the Nix dev-shell.
2024-08-31 07:05:24 +00:00
Thomas Eizinger
3974bb6614 build(nix): install musl targets in dev-shell (#6493)
To build for musl, the target needs to be installed. Within the Nix
dev-shell, we don't manage versions / components via rustup, thus they
need to be added manually.
2024-08-29 23:43:43 +00:00
Thomas Eizinger
027c136cb5 build(nix): add elixir dependencies to nix-shell (#6464)
In order to run an Elixir language server, Erlang and Elixir need to be
installed.
2024-08-28 04:56:32 +00:00
Reactor Scram
6e24e0201e chore(rust): bump Rust to 1.80 (#6065)
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-07-29 14:16:22 +00:00
Thomas Eizinger
7703daea2e chore(nix): remove env vars from flake (#6058)
This messes with the build cache because the locally run rust-analyzer
doesn't recognise those variables and thus keeps poisoning the cache. If
other Nix users want `mold`, they should set it up in their user
configuration.
2024-07-26 19:51:47 +00:00
Thomas Eizinger
d95c1719aa chore(nix): setup mold linker (#6009)
Also includes some minor tidy-up of the nix flake. `mold` is a much
faster linker and a drop-in replacement for GNU's `ld`.
2024-07-24 04:03:17 +00:00
Thomas Eizinger
f21e9116e2 chore(nix): install android-tools in dev-shell (#5855)
This contains `adb` which is useful for Android development.
2024-07-12 14:27:39 +00:00
Thomas Eizinger
c92dd559f7 chore(rust): format Cargo.toml using cargo-sort (#5851) 2024-07-12 04:57:22 +00:00
Thomas Eizinger
42e6e9593a chore: update Nix scripts to at least build GUI client (#5423)
I tried to run the GUI client on my system but I think my glibc version
is too recent (2.38) and thus, it crashes after clicking on "Login".

These changes to the Nix script are necessary to at least build the
client.
2024-06-18 22:02:53 +00:00
Reactor Scram
1cf10f0c3f chore(rust): bump to Rust 1.79 (#5356)
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-06-16 22:06:18 +00:00
Thomas Eizinger
404299cbe6 build: update Nix dependencies (#5108)
Allows users of the nix dev-shell to use Rust 1.78.
2024-05-23 04:10:29 +00:00
Reactor Scram
3a67eacfbe refactor(linux-client): replace client-tunnel with headless-client which is the same thing (#4516)
Unfortunately I had to keep `linux-client` to get the compatibility
tests to pass. #4578 aims to remove that package.

Please add to this list if you think of anything:

```[tasklist]
# Things that may break that CI/CD won't catch
- [ ] Github release artifacts
- [ ] Knowledge base 
- [ ] Docker images
- [ ] Docker containers
- [ ] Existing `linux-client` users
- [ ] Anything that downloads ghcr artifacts
- [ ] Nix (Not sure if it's built in CI. It had a merge conflict)
```

Refs #4515, and #3712, #3782

I think this is what Thomas and I agreed on in Slack / Github

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-04-10 22:01:55 +00:00
Thomas Eizinger
3951bafb60 chore(nix): add Rust nightly dev-shell and cargo-udeps (#4474) 2024-04-08 12:06:01 +00:00
Thomas Eizinger
ea53ae7a55 feat(snownet): timeout connections if we don't receive a candidate within 10s (#3790)
Previously, we had a dedicated timer for this within the tunnel
implementation. Now that we have control over the internals of our
connection via `snownet`, we can timeout the connection if we don't
receive a candidate from the remote within 10s.
2024-03-09 08:03:57 +00:00
Thomas Eizinger
8d652cb96c chore: add nix scripts (#3771)
Some recent changes to the Rust part of the codebase made it quite
difficult to locally build the project due to tauri's heavy dependencies
on WebKitGTK and other native libraries.

I tried working around this on my local (nix) machine and found it quite
difficult. The cleanest way here is to make use of what Nix calls
"devshells" which give you an environment specifically for hacking on
your project.

Unfortunately, these files need to be tracked in version control and
cannot be ignored (at least I've not found a way to do that). Given that
we already have a lot of clutter in our repository, I put them under
`scripts/nix`.

They are generally useful. I also added a `.envrc` file which
automatically launches the dev-shell. As a result, you have a shell
ready to go with all your dependencies as soon as you `cd` into our
repository (assuming you use `direnv` and it is hooked up with your
shell).

I didn't really want to have any of my local setup leak into the repo
because I think apart from me and @conectado, nobody is using nix, thus
I hope this minimal footprint is an okay compromise.
2024-02-27 23:56:46 +00:00