From 9171d226a281b1a4acb37861f40fba0e72d44b48 Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 16 Jul 2023 10:19:52 -0500 Subject: [PATCH] Initial commit --- .gitignore | 3 +++ Cargo.lock | 7 +++++ Cargo.toml | 8 ++++++ flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 34 ++++++++++++++++++++++++ pict-rs-uploader.nix | 21 +++++++++++++++ src/main.rs | 3 +++ 7 files changed, 137 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 pict-rs-uploader.nix create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cbd80d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/target +/.direnv +/.envrc diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..bd18df6 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "pict-rs-uploader" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..397a8cf --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "pict-rs-uploader" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b941d30 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1689444953, + "narHash": "sha256-0o56bfb2LC38wrinPdCGLDScd77LVcr7CrH1zK7qvDg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8acef304efe70152463a6399f73e636bcc363813", + "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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9c5e57b --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "pict-rs-uploader"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + }; + in + { + packages = rec { + pict-rs-uploader = pkgs.callPackage ./pict-rs-uploader.nix { }; + + default = pict-rs-uploader; + }; + + apps = rec { + dev = flake-utils.lib.mkApp { drv = self.packages.${system}.pict-rs-uploader; }; + default = dev; + }; + + devShell = with pkgs; mkShell { + nativeBuildInputs = [ cargo cargo-outdated clippy gcc rust-analyzer rustc rustfmt ]; + + RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; + }; + }); +} diff --git a/pict-rs-uploader.nix b/pict-rs-uploader.nix new file mode 100644 index 0000000..e79ed67 --- /dev/null +++ b/pict-rs-uploader.nix @@ -0,0 +1,21 @@ +{ lib +, nixosTests +, rustPlatform +}: + +rustPlatform.buildRustPackage { + pname = "pict-rs-uploader"; + version = "0.1.0"; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + + nativeBuildInputs = [ ]; + + passthru.tests = { inherit (nixosTests) pict-rs-uploader; }; + + meta = with lib; { + description = "A simple image hosting service"; + homepage = "https://git.asonix.dog/asonix/pict-rs-uploader"; + license = with licenses; [ agpl3Plus ]; + }; +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}