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

View file

@ -1,5 +1,4 @@
{ {
rustPlatform,
lib, lib,
pkg-config, pkg-config,
@ -12,44 +11,57 @@
openssl, openssl,
sqlite, sqlite,
shimmering-fonts, shimmering-fonts,
makeRustPlatform,
rust-toolchain,
}: }:
rustPlatform.buildRustPackage { (makeRustPlatform {
pname = "shimmeringmoon"; cargo = rust-toolchain;
version = "unstable-2024-09-06"; rustc = rust-toolchain;
}).buildRustPackage
rec {
pname = "shimmeringmoon";
version = "unstable-2024-09-06";
src = lib.cleanSource ../.;
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config pkg-config
makeWrapper makeWrapper
]; ];
buildInputs = [ # TODO: is this supposed to be here???
freetype # LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
fontconfig buildInputs = [
leptonica freetype
tesseract fontconfig
openssl leptonica
sqlite tesseract
shimmering-fonts openssl
]; sqlite
];
# Tell the binary where to find the fonts cargoLock = {
# postBuild = '' lockFile = ../Cargo.lock;
# wrapProgram $out/bin/shimmering-discord-bot \ outputHashes = {
# --set SHIMMERING_FONTS_DIR ${shimmering-fonts} "hypertesseract-0.1.0" = "sha256-G0dos5yvvcfBKznAo1IIzLgXqRDxmyZwB93QQ6hVZSo=";
# ''; "plotters-0.4.0" = "sha256-9wtd7lig1vQ2RJVaEHdicfPZy2AyuoNav8shPMZ1EuE=";
"faer-0.19.4" = "sha256-VXMk2S3caMMs0N0PJa/m/7aPykYgeXVVn7GWPnG63nQ=";
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=";
}; };
};
} # 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"