Skip to content

Commit 3060a43

Browse files
committed
build(nix): implement rust release workflow and nix package
- CI: Migrated CI from Go to Rust, implementing a multi-platform build matrix for Linux, macOS, and Windows. - CI: Integrated 'rust-cache' and 'rust-toolchain' actions to optimize build times and ensure toolchain consistency. - CI: Added 'libdbus-1-dev' and 'pkg-config' dependencies to the Linux runner for keyring integration support. - Nix: Implemented 'packages.default' using 'buildRustPackage' to provide a production-ready Nix derivation. - Nix: Enhanced 'devShells.default' with 'dbus' and Darwin-specific frameworks for improved cross-platform development. - Nix: Updated flake metadata and description to reflect Oxicord branding. - Docs: Added Nix installation instructions to README.
1 parent 2ea8560 commit 3060a43

3 files changed

Lines changed: 96 additions & 35 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,49 @@
11
name: ci
22
on: [push, pull_request]
33

4+
env:
5+
CARGO_TERM_COLOR: always
6+
47
jobs:
58
build:
69
strategy:
710
fail-fast: false
811
matrix:
9-
# https://docs.github.com/en/actions/using-github-hosted-runners
10-
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-latest, macos-15-intel]
12+
include:
13+
- os: ubuntu-latest
14+
target: x86_64-unknown-linux-gnu
15+
- os: ubuntu-24.04-arm
16+
target: aarch64-unknown-linux-gnu
17+
- os: macos-latest
18+
target: aarch64-apple-darwin
19+
- os: macos-13
20+
target: x86_64-apple-darwin
21+
- os: windows-latest
22+
target: x86_64-pc-windows-msvc
23+
1124
runs-on: ${{ matrix.os }}
25+
1226
steps:
1327
- uses: actions/checkout@v5
1428

15-
- uses: actions/setup-go@v6
29+
- uses: dtolnay/rust-toolchain@stable
1630
with:
17-
go-version: stable
18-
19-
- name: Install libx11-dev for clipboard support
31+
targets: ${{ matrix.target }}
32+
33+
- uses: Swatinem/rust-cache@v2
34+
35+
- name: Install Linux dependencies
2036
if: runner.os == 'Linux'
21-
run: sudo apt install libx11-dev
37+
run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config
2238

23-
- name: Test
24-
run: go test -v ./...
39+
- run: cargo test --release --target ${{ matrix.target }}
2540

26-
- name: Build
27-
run: go build -trimpath -ldflags=-s .
41+
- run: cargo build --release --target ${{ matrix.target }}
2842

2943
- uses: actions/upload-artifact@v4
30-
if: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
44+
if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
3145
with:
3246
name: oxicord_${{ runner.os }}_${{ runner.arch }}
3347
path: |
34-
oxicord
35-
oxicord.exe
36-
37-
- name: Send repository dispatch
38-
if: ${{ runner.os == 'Windows' && github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
39-
env:
40-
GH_TOKEN: ${{ secrets.PAT }}
41-
run: |
42-
gh api --method POST -H "Accept: application/vnd.github+json" -f "event_type=oxicord-ci-completed" /repos/vvirtues/bucket/dispatches
48+
target/${{ matrix.target }}/release/oxicord
49+
target/${{ matrix.target }}/release/oxicord.exe

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ We stand on the shoulders of giants. Here is how Oxicord compares to existing te
4747

4848
## Installation & Configuration
4949

50+
### Nix
51+
52+
```bash
53+
nix run github:linuxmobile/oxicord
54+
```
55+
56+
For development:
57+
58+
```bash
59+
nix develop
60+
```
61+
5062
### Building from Source
5163

5264
```bash

flake.nix

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
description = "Minimalist Rust + Ratatui Development Environment";
2+
description = "Oxicord - Discord TUI client";
33

44
inputs = {
55
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
@@ -10,33 +10,75 @@
1010
};
1111
};
1212

13-
outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }:
14-
flake-utils.lib.eachDefaultSystem (system:
15-
let
16-
overlays = [ (import rust-overlay) ];
13+
outputs = {
14+
self,
15+
nixpkgs,
16+
flake-utils,
17+
rust-overlay,
18+
...
19+
}:
20+
flake-utils.lib.eachDefaultSystem (
21+
system: let
22+
overlays = [(import rust-overlay)];
1723
pkgs = import nixpkgs {
1824
inherit system overlays;
1925
};
2026

2127
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
22-
extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ];
28+
extensions = ["rust-src" "rust-analyzer" "clippy" "rustfmt"];
2329
};
24-
in
25-
{
30+
in {
31+
packages.default = pkgs.rustPlatform.buildRustPackage {
32+
pname = "oxicord";
33+
version = "0.1.5";
34+
35+
src = ./.;
36+
37+
cargoLock = {
38+
lockFile = ./Cargo.lock;
39+
};
40+
41+
nativeBuildInputs = [pkgs.pkg-config];
42+
43+
buildInputs =
44+
[
45+
pkgs.dbus
46+
]
47+
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
48+
pkgs.darwin.apple_sdk.frameworks.Security
49+
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
50+
];
51+
52+
meta = with pkgs.lib; {
53+
description = "A lightweight, secure Discord terminal client";
54+
homepage = "https://github.com/linuxmobile/oxicord";
55+
license = licenses.mit;
56+
maintainers = [];
57+
mainProgram = "oxicord";
58+
platforms = platforms.unix;
59+
};
60+
};
61+
2662
devShells.default = pkgs.mkShell {
2763
packages = [
2864
rustToolchain
2965
pkgs.cargo-watch
3066
pkgs.pkg-config
3167
];
3268

33-
buildInputs = [
34-
pkgs.chafa
35-
pkgs.glib
36-
];
69+
buildInputs =
70+
[
71+
pkgs.dbus
72+
pkgs.chafa
73+
pkgs.glib
74+
]
75+
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
76+
pkgs.darwin.apple_sdk.frameworks.Security
77+
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
78+
];
3779

38-
PKG_CONFIG_PATH = "${pkgs.chafa}/lib/pkgconfig:${pkgs.glib.dev}/lib/pkgconfig";
39-
LD_LIBRARY_PATH = "${pkgs.chafa}/lib:${pkgs.glib.out}/lib";
80+
PKG_CONFIG_PATH = "${pkgs.chafa}/lib/pkgconfig:${pkgs.glib.dev}/lib/pkgconfig:${pkgs.dbus.dev}/lib/pkgconfig";
81+
LD_LIBRARY_PATH = "${pkgs.chafa}/lib:${pkgs.glib.out}/lib:${pkgs.dbus.lib}/lib";
4082
};
4183
}
4284
);

0 commit comments

Comments
 (0)