flake: nix packaged!

This commit is contained in:
Zynh Ludwig 2024-12-26 23:33:24 -08:00
parent ee8aa55849
commit ea833b39ec
4 changed files with 41 additions and 6 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
.DS_Store
/.cache
/node_modules
result
testing.db
testing.db-shm
testing.db-wal

View file

@ -1,6 +1,6 @@
{
"db_name": "SQLite",
"query": "UPDATE records\nSET downloads = downloads + 1\nWHERE\n cache_name = ?\n AND downloads < max_downloads\n AND julianday('now') - julianday(uploaded) > 5;\n",
"query": "UPDATE records\nSET downloads = downloads + 1\nWHERE\n cache_name = ?\n AND downloads < max_downloads\n AND julianday('now') - julianday(uploaded) < 5;\n",
"describe": {
"columns": [],
"parameters": {
@ -8,5 +8,5 @@
},
"nullable": []
},
"hash": "a2f3905f8f8e14c95404f88f2e60dcf13e7b7caf5307bd19240655621251f7c9"
"hash": "09bffef8e28906ad1827486e236aa53d5a9096c06677c3f6089fbab52461781c"
}

View file

@ -3,10 +3,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
@ -33,6 +30,12 @@
}))
];
};
packages.default =
let rust-bin = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal);
in pkgs.callPackage ./package.nix {
cargo = rust-bin;
rustc = rust-bin;
};
};
};
}

31
package.nix Normal file
View file

@ -0,0 +1,31 @@
{ makeRustPlatform
, cargo
, rustc
# Runtime Deps
, sqlite
# Build Deps
, openssl
, pkg-config
}:
let rustPlatform = makeRustPlatform { inherit cargo rustc; };
in rustPlatform.buildRustPackage {
pname = "nyazoom";
version = "0.1.0";
src = ./.;
cargoHash = "sha256-lBMe1TvkTJgN+q/9o7KId6w3CSxGl94Zcz7nxDqu9N0=";
nativeBuildInputs = [
openssl
pkg-config
];
buildInputs = [
openssl
sqlite
];
}