scaffolding

This commit is contained in:
Asger Juul Brunshøj 2023-06-10 16:43:20 +02:00
commit 5501b63379
14 changed files with 246 additions and 0 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

2
.gitignore vendored Normal file
View File

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

15
Cargo.lock generated Normal file
View File

@ -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"

8
Cargo.toml Normal file
View File

@ -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 <asgerbrunshoj@gmail.com>"]
edition = "2021"

1
README.md Normal file
View File

@ -0,0 +1 @@
# Achievements

View File

@ -0,0 +1,7 @@
[package]
name = "backend"
version.workspace = true
authors.workspace = true
edition.workspace = true
[dependencies]

View File

@ -0,0 +1 @@
fn main() {}

7
crates/common/Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[package]
name = "common"
version.workspace = true
authors.workspace = true
edition.workspace = true
[dependencies]

1
crates/common/src/lib.rs Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1,7 @@
[package]
name = "frontend"
version.workspace = true
authors.workspace = true
edition.workspace = true
[dependencies]

View File

@ -0,0 +1 @@
fn main() {}

118
flake.lock generated Normal file
View File

@ -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
}

59
flake.nix Normal file
View File

@ -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
];
};
};
};
}

18
justfile Normal file
View File

@ -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`