Update cargo dependencies and add flake.nix
This commit is contained in:
952
Cargo.lock
generated
952
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -7,9 +7,9 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.81"
|
anyhow = "1.0.81"
|
||||||
crossterm = "0.28.1"
|
crossterm = "0.29.0"
|
||||||
mpris = "2.0.1"
|
mpris = "2.0.1"
|
||||||
ratatui = "0.29"
|
ratatui = "0.30"
|
||||||
sqlx = { version = "0.8.3", features = ["sqlite", "runtime-tokio"] }
|
sqlx = { version = "0.8.3", features = ["sqlite", "runtime-tokio"] }
|
||||||
tokio = { version = "1.36.0", features = ["rt", "macros", "rt-multi-thread"] }
|
tokio = { version = "1.36.0", features = ["rt", "macros", "rt-multi-thread"] }
|
||||||
tui-textarea = "0.7.0"
|
tui-textarea = "0.7.0"
|
||||||
|
|||||||
86
flake.nix
Normal file
86
flake.nix
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
description = "A Nix flake for the rate_music Rust project";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
|
crane.url = "github:ipetkov/crane";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
rust-overlay,
|
||||||
|
crane,
|
||||||
|
flake-utils,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
overlays = [ (import rust-overlay) ];
|
||||||
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
|
||||||
|
# 1. Define the Rust toolchain
|
||||||
|
rustToolchain = pkgs.rust-bin.stable.latest.default;
|
||||||
|
|
||||||
|
# 2. Configure crane to use our specific toolchain
|
||||||
|
craneLib = (crane.legal.lib.${system}).overrideToolchain rustToolchain;
|
||||||
|
|
||||||
|
# 3. Define common build inputs (system libraries)
|
||||||
|
# mpris and sqlx often need pkg-config and specific C libraries
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
pkg-config
|
||||||
|
rustToolchain
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs =
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
sqlite
|
||||||
|
openssl
|
||||||
|
dbus # Required by many mpris implementations
|
||||||
|
]
|
||||||
|
++ lib.optionals stdenv.isDarwin [
|
||||||
|
darwin.apple_sdk.frameworks.Security
|
||||||
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
||||||
|
];
|
||||||
|
|
||||||
|
# 4. Build the project
|
||||||
|
# This splits the build into "deps" and "project" for better caching
|
||||||
|
commonArgs = {
|
||||||
|
src = craneLib.cleanCargoSource (craneLib.path ./.);
|
||||||
|
strictDeps = true;
|
||||||
|
inherit buildInputs nativeBuildInputs;
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||||
|
rate_music = craneLib.buildPackage (
|
||||||
|
commonArgs
|
||||||
|
// {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages.default = rate_music;
|
||||||
|
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
inputsFrom = [ rate_music ];
|
||||||
|
# Extra tools for development
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
rust-analyzer
|
||||||
|
sqlx-cli
|
||||||
|
];
|
||||||
|
|
||||||
|
# SQLX environment variable if you're using offline mode or a specific DB path
|
||||||
|
shellHook = ''
|
||||||
|
export DATABASE_URL="sqlite:./rate_music.db"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user