From ab6134c75fa2594c630075141e259af535f16396 Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 28 Aug 2023 16:06:29 -0500 Subject: [PATCH] Initial commit --- .gitignore | 4 ++++ Cargo.lock | 7 ++++++ Cargo.toml | 8 +++++++ flake.lock | 61 +++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 34 ++++++++++++++++++++++++++ pict-rs-admin.nix | 25 +++++++++++++++++++ src/main.rs | 3 +++ 7 files changed, 142 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-admin.nix create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9170f72 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/target +/.direnv +/.envrc +/result diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..fe63e0a --- /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-admin" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..5195472 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "pict-rs-admin" +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..adbe0cd --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1692799911, + "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1693158576, + "narHash": "sha256-aRTTXkYvhXosGx535iAFUaoFboUrZSYb1Ooih/auGp0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a999c1cc0c9eb2095729d5aa03e0d8f7ed256780", + "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..3c40a71 --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "pict-rs-admin"; + + 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-admin = pkgs.callPackage ./pict-rs-admin.nix { }; + + default = pict-rs-admin; + }; + + apps = rec { + dev = flake-utils.lib.mkApp { drv = self.packages.${system}.pict-rs-admin; }; + default = dev; + }; + + devShell = with pkgs; mkShell { + nativeBuildInputs = [ cargo cargo-outdated cargo-zigbuild clippy gcc protobuf rust-analyzer rustc rustfmt ]; + + RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; + }; + }); +} diff --git a/pict-rs-admin.nix b/pict-rs-admin.nix new file mode 100644 index 0000000..04f4b52 --- /dev/null +++ b/pict-rs-admin.nix @@ -0,0 +1,25 @@ +{ lib +, nixosTests +, protobuf +, rustPlatform +}: + +rustPlatform.buildRustPackage { + pname = "pict-rs-admin"; + version = "0.5.0-alpha.1"; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + + PROTOC = "${protobuf}/bin/protoc"; + PROTOC_INCLUDE = "${protobuf}/include"; + + nativeBuildInputs = [ ]; + + passthru.tests = { inherit (nixosTests) pict-rs-admin; }; + + meta = with lib; { + description = "A simple image hosting service"; + homepage = "https://git.asonix.dog/asonix/pict-rs-admin"; + 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!"); +}