[deploy]: Nix build works now
Some checks failed
/ clippy (push) Failing after 5m4s
/ test (push) Failing after 5m51s

This will be my first step to having a build that folks can use
This commit is contained in:
Chris Cochrun 2026-04-10 14:41:28 -05:00
parent 22c9b02fbc
commit ce2e021b4c
6 changed files with 81 additions and 24 deletions

3
.gitignore vendored
View file

@ -13,4 +13,5 @@ test.db-shm
test.db-wal
test.lum
test.pres
profile.json.gz
profile.json.gz
result

View file

@ -3,6 +3,8 @@
#+CATEGORY: dev
* TODO [#A] Deployment pipeline and get a MVP going
* TODO [#A] Add Action system
This will be based on each slide having the ability to activate an action (i.e. OBS scene switch, OBS start or stop) when it is active.

16
flake.lock generated
View file

@ -1,5 +1,20 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1775839657,
"narHash": "sha256-SPm9ck7jh3Un9nwPuMGbRU04UroFmOHjLP56T10MOeM=",
"owner": "ipetkov",
"repo": "crane",
"rev": "7cf72d978629469c4bd4206b95c402514c1f6000",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": "nixpkgs",
@ -144,6 +159,7 @@
},
"root": {
"inputs": {
"crane": "crane",
"fenix": "fenix",
"flake-utils": "flake-utils",
"naersk": "naersk",

View file

@ -7,6 +7,7 @@
flake-utils.url = "github:numtide/flake-utils";
fenix.url = "github:nix-community/fenix";
rust-overlay.url = "github:oxalica/rust-overlay";
crane.url = "github:ipetkov/crane";
};
outputs =
@ -21,10 +22,21 @@
# overlays = [ rust-overlay.overlays.default ];
# overlays = [cargo2nix.overlays.default];
};
inherit (pkgs) lib;
craneLib = crane.mkLib pkgs;
naersk' = pkgs.callPackage naersk { };
# toolchain = (with pkgs.fenix.default; [cargo clippy rust-std rust-src rustc rustfmt rust-analyzer-nightly]);
unfilteredRoot = ./.; # The original, unfiltered source
src = lib.fileset.toSource {
root = unfilteredRoot;
fileset = lib.fileset.unions [
# Default files from crane (Rust and cargo files)
(craneLib.fileset.commonCargoSources unfilteredRoot)
# Include all the .sql migrations as well
./migrations
];
};
nativeBuildInputs = with pkgs; [
# Rust tools
@ -49,6 +61,10 @@
libxkbcommon
pkg-config
sccache
just
sqlx-cli
cargo-watch
samply
];
buildInputs = with pkgs; [
@ -83,11 +99,6 @@
ffmpeg-full
mupdf
# yt-dlp
just
sqlx-cli
cargo-watch
samply
];
LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${
@ -112,6 +123,28 @@
pkgs.libclang
]
}";
commonArgs = {
strictDeps = false;
inherit src buildInputs nativeBuildInputs LD_LIBRARY_PATH;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
lumina = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts buildInputs nativeBuildInputs LD_LIBRARY_PATH;
preBuild = ''
export DATABASE_URL=sqlite:./db.sqlite3
sqlx database create
sqlx migrate run
'';
cargoTestCommand = "";
cargoExtraArgs = "";
}
);
in
rec {
devShell =
@ -125,15 +158,9 @@
DATABASE_URL = "sqlite://./test.db";
# RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
};
defaultPackage = naersk'.buildPackage {
inherit nativeBuildInputs buildInputs LD_LIBRARY_PATH;
src = ./.;
};
defaultPackage = lumina;
packages = {
default = naersk'.buildPackage {
inherit nativeBuildInputs buildInputs LD_LIBRARY_PATH;
src = ./.;
};
default = lumina;
};
}
);

View file

@ -44,6 +44,7 @@ impl AppTheme {
pub struct Settings {
pub app_theme: AppTheme,
pub obs_url: Option<url::Url>,
pub genius_token: Option<String>,
}
impl Default for Settings {
@ -51,6 +52,7 @@ impl Default for Settings {
Self {
app_theme: AppTheme::System,
obs_url: None,
genius_token: None,
}
}
}

View file

@ -1,6 +1,9 @@
use std::collections::HashMap;
use crate::core::songs::{Song, VerseName};
use crate::core::{
settings,
songs::{Song, VerseName},
};
use itertools::Itertools;
use miette::{IntoDiagnostic, Result, miette};
use nom::{
@ -147,13 +150,16 @@ fn parse_verse_lyrics(lyrics: &str) -> IResult<&str, String> {
pub async fn search_genius_links(
query: impl AsRef<str> + std::fmt::Display,
auth_token: String,
) -> Result<Vec<OnlineSong>> {
let auth_token = env!("GENIUS_TOKEN");
// let Some(auth_token) = option_env!("GENIUS_TOKEN") else {
// return Err(miette!("No Genius Token"));
// };
let head_value = header::HeaderValue::from_str(&auth_token)
.into_diagnostic()?;
let mut headers = header::HeaderMap::new();
headers.insert(
header::AUTHORIZATION,
header::HeaderValue::from_static(auth_token),
);
headers.insert(header::AUTHORIZATION, head_value);
let client = reqwest::Client::builder()
.default_headers(headers)
.build()
@ -365,9 +371,12 @@ mod test {
site: "https://genius.com".to_string(),
link: "https://genius.com/North-point-worship-death-was-arrested-lyrics".to_string(),
};
let hits = search_genius_links("Death was arrested")
.await
.map_err(|e| e.to_string())?;
let hits = search_genius_links(
"Death was arrested",
"test".to_string(),
)
.await
.map_err(|e| e.to_string())?;
assert!(
hits.iter().find(|hit| **hit == song).is_some(),