-19
.github/workflows/ci-nix.yml
-19
.github/workflows/ci-nix.yml
···
1
-
name: "CI Nix"
2
-
on:
3
-
# Run only when pushing to master branch, and making PRs
4
-
push:
5
-
branches:
6
-
- master
7
-
pull_request:
8
-
jobs:
9
-
build:
10
-
runs-on: ${{ matrix.os }}
11
-
strategy:
12
-
matrix:
13
-
os: [ubuntu-latest, macos-14]
14
-
steps:
15
-
- uses: actions/checkout@v4
16
-
- uses: nixbuild/nix-quick-install-action@v33
17
-
- name: Install omnix
18
-
run: nix --accept-flake-config profile install "github:juspay/omnix"
19
-
- run: om ci
-24
.github/workflows/ci.yml
-24
.github/workflows/ci.yml
···
1
-
on: [push]
2
-
3
-
name: CI
4
-
5
-
jobs:
6
-
check:
7
-
name: Rust project
8
-
runs-on: ubuntu-latest
9
-
steps:
10
-
- uses: actions/checkout@v2
11
-
- name: Install latest nightly
12
-
uses: actions-rs/toolchain@v1
13
-
with:
14
-
toolchain: nightly
15
-
override: true
16
-
components: rustfmt, clippy
17
-
18
-
# `cargo check` command here will use installed `nightly`
19
-
# as it is set as an "override" for current directory
20
-
21
-
- name: Run cargo check
22
-
uses: actions-rs/cargo@v1
23
-
with:
24
-
command: check
+13
-32
README.md
+13
-32
README.md
···
1
-
A template Rust project with fully functional and no-frills Nix support, as well as builtin VSCode configuration to get IDE experience without any manual setup (just [install direnv](https://nixos.asia/en/direnv), open in VSCode and accept the suggestions). It uses [crane](https://crane.dev/), via [rust-flake](https://github.com/juspay/rust-flake).
1
+
# Jacquard
2
2
3
-
> [!NOTE]
4
-
> If you are looking for the original template based on [this blog post](https://srid.ca/rust-nix)'s use of `crate2nix`, browse from [this tag](https://github.com/srid/jacquard/tree/crate2nix). The evolution of this template can be gleaned from [releases](https://github.com/srid/jacquard/releases).
3
+
A suite of Rust crates for the AT Protocol.
5
4
6
-
## Usage
5
+
## Goals
7
6
8
-
You can use [omnix](https://omnix.page/om/init.html)[^omnix] to initialize this template:
9
-
```
10
-
nix run nixpkgs#omnix -- init github:srid/jacquard -o ~/my-rust-project
11
-
```
7
+
- Validated, spec-compliant, easy to work with, and performant baseline types (including typed at:// uris)
8
+
- Batteries-included, but easily replaceable batteries.
9
+
- Easy to extend with custom lexicons
10
+
- lexicon Value type for working with unknown atproto data (dag-cbor or json)
11
+
- order of magnitude less boilerplate than some existing crates
12
+
- either the codegen produces code that's easy to work with, or there are good handwritten wrappers
13
+
- didDoc type with helper methods for getting handles, multikey, and PDS endpoint
14
+
- use as much or as little from the crates as you need
12
15
13
-
[^omnix]: If initializing manually, make sure to:
14
-
- Change `name` in Cargo.toml.
15
-
- Run `cargo generate-lockfile` in the nix shelld
16
-
17
-
## Adapting this template
18
-
19
-
- There are two CI workflows, and one of them uses Nix which is slower (unless you configure a cache) than the other one based on rustup. Pick one or the other depending on your trade-offs.
20
-
21
-
## Development (Flakes)
16
+
## Development
22
17
23
18
This repo uses [Flakes](https://nixos.asia/en/flakes) from the get-go.
24
19
···
33
28
nix build
34
29
```
35
30
36
-
We also provide a [`justfile`](https://just.systems/) for Makefile'esque commands to be run inside of the devShell.
37
-
38
-
## Tips
39
-
40
-
- Run `nix flake update` to update all flake inputs.
41
-
- Run `nix --accept-flake-config run github:juspay/omnix ci` to build _all_ outputs.
42
-
- [pre-commit] hooks will automatically be setup in Nix shell. You can also run `pre-commit run -a` manually to run the hooks (e.g.: to autoformat the project tree using `rustfmt`, `nixpkgs-fmt`, etc.).
43
-
44
-
## Discussion
45
-
46
-
- [Zulip](https://nixos.zulipchat.com/#narrow/stream/413950-nix)
47
-
48
-
## See Also
49
-
50
-
- [nixos.wiki: Packaging Rust projects with nix](https://nixos.wiki/wiki/Rust#Packaging_Rust_projects_with_nix)
31
+
There's also a [`justfile`](https://just.systems/) for Makefile-esque commands to be run inside of the devShell, and you can generally `cargo ...` or `just ...` whatever just fine if you don't want to use Nix and have the prerequisites installed.
+2
-6
crates/jacquard-common/src/types/tid.rs
+2
-6
crates/jacquard-common/src/types/tid.rs
···
100
100
/// timestamps from other sources.
101
101
/// If you are only using a single clock source, you can just specify `0` for `clkid`.
102
102
///
103
-
/// _Warning:_ It's possible that this function will return the same time more than once.
104
-
/// If it's important that these values be unique, you will want to repeatedly call this
105
-
/// function until a different time is returned.
103
+
/// TODO: fix to auto-increment if it would return the same value twice
106
104
pub fn now(clkid: LimitedU32<1023>) -> Self {
107
105
Self::from_datetime(clkid, chrono::Utc::now())
108
106
}
109
107
110
108
/// Construct a new [Tid] that represents the current time with clkid 0.
111
109
///
112
-
/// _Warning:_ It's possible that this function will return the same time more than once.
113
-
/// If it's important that these values be unique, you will want to repeatedly call this
114
-
/// function until a different time is returned.
110
+
/// TODO: fix to auto-increment if it would return the same value twice
115
111
pub fn now_0() -> Self {
116
112
Self::from_datetime(LimitedU32::from_str("0").unwrap(), chrono::Utc::now())
117
113
}