1
Fork 0

Fix nix build

Also implement an "export chart info to csv" feature
This commit is contained in:
prescientmoon 2024-10-05 03:22:19 +02:00
parent 880a9ffa80
commit 548c105fae
Signed by: prescientmoon
SSH key fingerprint: SHA256:WFp/cO76nbarETAoQcQXuV+0h7XJsEsOCI0UsyPIy6U
3 changed files with 85 additions and 50 deletions

View file

@ -13,7 +13,8 @@
inputs.flake-utils.lib.eachSystem (with inputs.flake-utils.lib.system; [ x86_64-linux ]) (
system:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
# pkgs = inputs.nixpkgs.legacyPackages.${system};
pkgs = inputs.nixpkgs.legacyPackages.${system}.extend inputs.fenix.overlays.default;
# pkgs = inputs.nixpkgs.legacyPackages.${system}.extend (import inputs.rust-overlay);
# pkgs = import inputs.nixpkgs {
# inherit system;
@ -21,12 +22,14 @@
# };
# toolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default);
# toolchain = pkgs.rust-bin.stable.latest.default;
toolchain = inputs.fenix.packages.${system}.complete.toolchain;
rust-toolchain = pkgs.fenix.complete.toolchain;
spkgs = inputs.self.packages.${system};
inherit (pkgs) lib;
in
{
packages = {
inherit rust-toolchain;
kazesawa = pkgs.callPackage ./nix/kazesawa.nix { };
exo = pkgs.callPackage ./nix/exo.nix { };
geosans-light = pkgs.callPackage ./nix/geosans-light.nix { };
@ -38,24 +41,23 @@
default = spkgs.shimmeringmoon;
shimmeringmoon = pkgs.callPackage ./nix/shimmeringmoon.nix {
# Pass the directory of fonts
inherit (spkgs) shimmering-fonts;
inherit (spkgs) shimmering-fonts rust-toolchain;
};
};
# {{{ Devshell
devShell = pkgs.mkShell rec {
nativeBuildInputs = with pkgs; [
# cargo
# rustc
# clippy
# rust-analyzer
# rustfmt
toolchain
# pkgs.cargo
# pkgs.rustc
# pkgs.clippy
# pkgs.rust-analyzer
# pkgs.rustfmt
spkgs.rust-toolchain
ruff
imagemagick
pkg-config
pkgs.ruff
pkgs.imagemagick
pkgs.pkg-config
];
buildInputs = with pkgs; [

View file

@ -1,5 +1,4 @@
{
rustPlatform,
lib,
pkg-config,
@ -12,16 +11,26 @@
openssl,
sqlite,
shimmering-fonts,
makeRustPlatform,
rust-toolchain,
}:
rustPlatform.buildRustPackage {
(makeRustPlatform {
cargo = rust-toolchain;
rustc = rust-toolchain;
}).buildRustPackage
rec {
pname = "shimmeringmoon";
version = "unstable-2024-09-06";
src = lib.cleanSource ../.;
nativeBuildInputs = [
pkg-config
makeWrapper
];
# TODO: is this supposed to be here???
# LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
buildInputs = [
freetype
fontconfig
@ -29,27 +38,30 @@ rustPlatform.buildRustPackage {
tesseract
openssl
sqlite
shimmering-fonts
];
# Tell the binary where to find the fonts
# postBuild = ''
# wrapProgram $out/bin/shimmering-discord-bot \
# --set SHIMMERING_FONTS_DIR ${shimmering-fonts}
# '';
checkFlags = [
# disable all tests
"--skip"
];
src = lib.cleanSource ../.;
cargoLock = {
lockFile = ../Cargo.lock;
outputHashes = {
"hypertesseract-0.1.0" = "sha256-G0dos5yvvcfBKznAo1IIzLgXqRDxmyZwB93QQ6hVZSo=";
"plotters-0.4.0" = "sha256-9wtd7lig1vQ2RJVaEHdicfPZy2AyuoNav8shPMZ1EuE=";
"faer-0.19.4" = "sha256-VXMk2S3caMMs0N0PJa/m/7aPykYgeXVVn7GWPnG63nQ=";
};
};
}
# Disable all tests
doCheck = false;
# Tell the binary where to find the fonts
postInstall = ''
wrapProgram $out/bin/shimmering-discord-bot \
--set SHIMMERING_FONTS_DIR ${shimmering-fonts}
'';
meta = {
description = "Arcaea score management toolchain";
homepage = "https://github.com/prescientmoon/shimmeringmoon";
mainProgram = "shimmering-cli";
platforms = [ "x86_64-linux" ];
};
}

21
scripts/export-chart-info.sh Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
if [ "$#" != 2 ]; then
echo "Usage: $0 <from> <to>"
exit 1
fi
from=$1
to=$2
echo "Creating destination..."
rm -rf "$to"
mkdir -p "$to"
echo "Exporting info..."
sqlite3 "$from" ".header on" ".mode csv" "select * from songs" \
> $to/songs.csv
sqlite3 "$from" ".header on" ".mode csv" "select * from charts" \
> $to/charts.csv
echo "All done :3"