Initial commit

This commit is contained in:
Marc Plano-Lesay 2024-10-23 20:36:36 +11:00
commit 56a22203ef
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
9 changed files with 14675 additions and 0 deletions

4
.envrc Normal file
View file

@ -0,0 +1,4 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
use flake .

2
.gitignore vendored Normal file
View file

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

1730
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

19
Cargo.toml Normal file
View file

@ -0,0 +1,19 @@
[package]
name = "immich-tools"
version = "0.1.0"
edition = "2021"
[dependencies]
chrono = { version = "0.4.38", features = ["serde"] }
futures = "0.3.31"
progenitor-client = "0.8.0"
regress = "0.10.1"
reqwest = { version = "0.12.8", features = ["json", "stream"] }
serde = { version = "1.0.213", features = ["derive"] }
uuid = { version = "1.11.0", features = ["serde", "v4"] }
[build-dependencies]
prettyplease = "0.2.24"
progenitor = "0.8.0"
serde_json = "1.0"
syn = "2.0"

22
build.rs Normal file
View file

@ -0,0 +1,22 @@
use std::{
env,
fs::{self, File},
path::Path,
};
fn main() {
let src = "./src/immich-openapi-specs.json";
println!("cargo:rerun-if-changed={}", src);
let file = File::open(src).unwrap();
let spec = serde_json::from_reader(file).unwrap();
let mut generator = progenitor::Generator::default();
let tokens = generator.generate_tokens(&spec).unwrap();
let ast = syn::parse2(tokens).unwrap();
let content = prettyplease::unparse(&ast);
let mut out_file = Path::new(&env::var("OUT_DIR").unwrap()).to_path_buf();
out_file.push("codegen.rs");
fs::write(out_file, content).unwrap();
}

61
flake.lock generated Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1729413321,
"narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

31
flake.nix Normal file
View file

@ -0,0 +1,31 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ nixpkgs
, flake-utils
, ...
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
in
{
devShells.default = pkgs.mkShell {
name = "immich-tools";
buildInputs = with pkgs; [
cargo
openssl
pkg-config
] ++ lib.optionals stdenv.isDarwin [
libiconv
darwin.apple_sdk.frameworks.SystemConfiguration
];
};
});
}

12803
src/immich-openapi-specs.json Normal file

File diff suppressed because it is too large Load diff

3
src/main.rs Normal file
View file

@ -0,0 +1,3 @@
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
fn main() {}