Skip to content

Commit a45ca40

Browse files
committed
Swap to Nix based builds and containers
1 parent 85c612b commit a45ca40

3 files changed

Lines changed: 63 additions & 38 deletions

File tree

.github/workflows/docker.yml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,10 @@ on:
66
- 'master'
77

88
jobs:
9-
docker:
10-
runs-on: ubuntu-latest
11-
steps:
12-
-
13-
name: Set up Docker Buildx
14-
uses: docker/setup-buildx-action@v1
15-
-
16-
name: Login to DockerHub
17-
uses: docker/login-action@v1
18-
with:
19-
username: ${{ secrets.DOCKERHUB_USERNAME }}
20-
password: ${{ secrets.DOCKERHUB_TOKEN }}
21-
-
22-
name: Build and push
23-
uses: docker/build-push-action@v2
24-
with:
25-
push: true
26-
platforms: linux/amd64,linux/arm64
27-
tags: |
28-
gnomeddev/discord-tts-bot:latest
29-
gnomeddev/discord-tts-bot:${{ github.sha }}
9+
build-and-push-docker-images:
10+
uses: Discord-TTS/shared-workflows/.github/workflows/docker.yml@v1
11+
with:
12+
repo-name: discord-tts-bot
13+
secrets:
14+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
15+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

flake.lock

Lines changed: 20 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,63 @@
11
{
2+
23
inputs = {
34
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
45
flake-utils.url = "github:numtide/flake-utils";
6+
7+
tts-utils.url = "github:Discord-TTS/shared-workflows";
58
};
9+
610
outputs =
711
{
812
nixpkgs,
913
flake-utils,
14+
tts-utils,
1015
...
1116
}:
1217
flake-utils.lib.eachDefaultSystem (
1318
system:
1419
let
1520
pkgs = import nixpkgs { inherit system; };
16-
in
17-
{
18-
devShell = pkgs.mkShell {
19-
env = {
20-
RUSTC_BOOTSTRAP = "1";
21-
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
21+
22+
pkgDesc = (pkgs.lib.importTOML ./Cargo.toml).package;
23+
botPkg = pkgs.rustPlatform.buildRustPackage {
24+
pname = pkgDesc.name;
25+
version = pkgDesc.version;
26+
meta.mainProgram = pkgDesc.name;
27+
28+
src = pkgs.lib.sources.cleanSource ./.;
29+
cargoLock = {
30+
lockFile = ./Cargo.lock;
31+
outputHashes = {
32+
"audiopus_sys-0.2.2" = "sha256-epzB54105Iihrfyj1HZNGSLOaihLw4rUZsT+rw/sXZs=";
33+
"poise-0.6.1" = "sha256-Cg8Nq4wlun5wksI+5zxYbinrx43IAwB7eA8BcTf+1sE=";
34+
"serenity-0.12.5" = "sha256-C4CpG/dD7RYapr5OEN01U1AFLZA6jFiQ0jqR9ixx3W0=";
35+
"serenity-voice-model-0.2.1" = "sha256-X8KEdROcWC3qFTfbLd9iCWmkurB+6CRRzBfTzxEcIDk=";
36+
"songbird-0.5.0" = "sha256-wacSNkIjA1rsENNPbo/KVDfoMXllrr+vA2pmPxsNzEs=";
37+
};
2238
};
2339

40+
env.RUSTC_BOOTSTRAP = "1";
41+
buildInputs = with pkgs; [
42+
libopus
43+
];
2444
nativeBuildInputs = with pkgs; [
25-
rustc
26-
cargo
27-
clippy
28-
rustfmt
29-
rust-analyzer
30-
3145
mold
3246
cmake
33-
libopus
3447
];
3548

3649
hardeningDisable = [ "fortify" ];
3750
};
51+
in
52+
tts-utils.mkTTSModule {
53+
inherit pkgs;
54+
package = botPkg;
55+
disableFortify = true;
56+
extraDevTools = with pkgs; [
57+
clippy
58+
rustfmt
59+
rust-analyzer
60+
];
3861
}
3962
);
4063
}

0 commit comments

Comments
 (0)