initial, gets info from aur packages

This commit is contained in:
2026-03-29 20:25:00 +01:00
commit 238f3d00e5
6 changed files with 1909 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/target
.session

1756
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

8
Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "voidpack"
version = "0.1.0"
edition = "2024"
[dependencies]
reqwest = { version = "0.13.2", features = ["blocking", "json"] }
serde_json = "1.0.149"

61
flake.lock generated Normal file
View File

@@ -0,0 +1,61 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1774386573,
"narHash": "sha256-4hAV26quOxdC6iyG7kYaZcM3VOskcPUrdCQd/nx8obc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "46db2e09e1d3f113a13c0d7b81e2f221c63b8ce9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

48
flake.nix Normal file
View File

@@ -0,0 +1,48 @@
{
description = "A simple Rust development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
utils,
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Rust toolchain
rustc
cargo
rustfmt
clippy
rust-analyzer
# Common dependencies for Rust crates
pkg-config
openssl
];
# Environment variables
shellHook = ''
export RUST_BACKTRACE=1
echo "🦀 Rust Dev Environment Loaded"
# Trigger zsh if not already in it
if [[ -z "$ZSH_VERSION" ]]; then
exec zsh
fi
'';
};
}
);
}

34
src/main.rs Normal file
View File

@@ -0,0 +1,34 @@
use reqwest::Error;
use reqwest::blocking::get;
use std::env;
fn request_url(url: &str) -> Result<String, Error> {
dbg!(url);
let response = get(url)?;
let body = response.text()?;
Ok(body)
}
fn main() {
// Get arguments from commandline
let args: Vec<String> = env::args().collect();
// Check length of arguments
let args_length = args.len();
if &args[1] == "aur" {
if args_length < 3 {
println!("no package specified")
} else {
let package: &String = &args[2];
let url: String = format!("https://aur.archlinux.org/rpc/v5/info/{}", package);
let package_info = match request_url(&url) {
Ok(s) => s,
Err(e) => panic!("shit... {e:?}"),
};
println!("something {}", &package_info)
}
};
}