commit 5501b63379ca41bd635e79916e7e6e74a3e9262c Author: Asger Juul Brunshøj Date: Sat Jun 10 16:43:20 2023 +0200 scaffolding diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..331202a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target/ +/.direnv/ \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..6613cd0 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,15 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "backend" +version = "0.1.0" + +[[package]] +name = "common" +version = "0.1.0" + +[[package]] +name = "frontend" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..1b89f76 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[workspace] +members = ["crates/backend", "crates/frontend", "crates/common"] + +[workspace.package] +name = "achievements" +version = "0.1.0" +authors = ["Asger Juul Brunshøj "] +edition = "2021" diff --git a/README.md b/README.md new file mode 100644 index 0000000..154cc96 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Achievements diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml new file mode 100644 index 0000000..236f41b --- /dev/null +++ b/crates/backend/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "backend" +version.workspace = true +authors.workspace = true +edition.workspace = true + +[dependencies] diff --git a/crates/backend/src/main.rs b/crates/backend/src/main.rs new file mode 100644 index 0000000..f328e4d --- /dev/null +++ b/crates/backend/src/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml new file mode 100644 index 0000000..d184f24 --- /dev/null +++ b/crates/common/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "common" +version.workspace = true +authors.workspace = true +edition.workspace = true + +[dependencies] diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/crates/common/src/lib.rs @@ -0,0 +1 @@ + diff --git a/crates/frontend/Cargo.toml b/crates/frontend/Cargo.toml new file mode 100644 index 0000000..dfe5c3e --- /dev/null +++ b/crates/frontend/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "frontend" +version.workspace = true +authors.workspace = true +edition.workspace = true + +[dependencies] diff --git a/crates/frontend/src/main.rs b/crates/frontend/src/main.rs new file mode 100644 index 0000000..f328e4d --- /dev/null +++ b/crates/frontend/src/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5c9f5ec --- /dev/null +++ b/flake.lock @@ -0,0 +1,118 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1685662779, + "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1686398752, + "narHash": "sha256-nGWNQVhSw4VSL+S0D0cbrNR9vs9Bq7rlYR+1K5f5j6w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a30520bf8eabf8a5c37889d661e67a2dbcaa59e6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1685564631, + "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1686364106, + "narHash": "sha256-h4gCQg+jizmAbdg6UPlhxQVk4A7Ar/zoLa0wx3wBya0=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "ba011dd1c5028dbb880bc3b0f427e0ff689e6203", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "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..00d2ea4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,59 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + rust-overlay.url = "github:oxalica/rust-overlay"; + rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs @ {flake-parts, ...}: let + cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); + in + flake-parts.lib.mkFlake {inherit inputs;} { + systems = ["x86_64-linux"]; + perSystem = { + pkgs, + system, + self', + ... + }: let + rust-toolchain = pkgs.rust-bin.stable.latest.minimal; + rust-toolchain-nightly = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal); + rustPlatform = pkgs.makeRustPlatform { + cargo = rust-toolchain; + rustc = rust-toolchain; + }; + in { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + overlays = [ + (import inputs.rust-overlay) + ]; + }; + + # packages.default = rustPlatform.buildRustPackage { + # pname = cargoToml.package.name; + # version = cargoToml.package.version; + # src = ./.; + # cargoLock.lockFile = ./Cargo.lock; + # nativeBuildInputs = [ + # pkgs.pkg-config + # ]; + # }; + + devShells.default = pkgs.mkShell { + packages = [ + (rust-toolchain.override { + extensions = ["rust-std" "rust-src" "clippy" "rust-analyzer"]; + }) + (rust-toolchain-nightly.override { + extensions = ["rustfmt"]; + }) + pkgs.taplo + pkgs.fd + pkgs.cargo-nextest + ]; + }; + }; + }; +} diff --git a/justfile b/justfile new file mode 100644 index 0000000..d8dcae1 --- /dev/null +++ b/justfile @@ -0,0 +1,18 @@ +_list: + @just --list + +# Check project +check: + just --unstable --fmt --check + cargo fmt --check + taplo fmt --check `fd --extension=toml` + taplo lint `fd --extension=toml` + cargo check + cargo nextest run + nix flake show + +# Format project +fmt: + just --unstable --fmt + cargo fmt + taplo fmt `fd --extension=toml`