-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add rust tooling config * feat: add generic tooling * feat: add nix tooling * feat: justfile setup
- Loading branch information
Showing
7 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{json,yaml,yml}] | ||
indent_size = 2 | ||
|
||
[*.nix] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake ./nix#default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"semi": false, | ||
"singleQuote": false, | ||
"overrides": [ | ||
{ "files": "*.md", "options": { "proseWrap": "always", "tabWidth": 2 } } | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
set positional-arguments | ||
set shell := ["bash", "-cue"] | ||
comp_dir := justfile_directory() | ||
root_dir := `git rev-parse --show-toplevel` | ||
|
||
# General Variables: | ||
# You can chose either "podman" or "docker" | ||
container_mgr := "podman" | ||
|
||
# Build the executable. | ||
build *args: | ||
cd "{{root_dir}}" && cargo build "${@:1}" | ||
|
||
# Watch source and continuously build the executable. | ||
watch: | ||
cd "{{root_dir}}" && cargo watch -x 'build' | ||
|
||
# Run the executable. | ||
run: | ||
cd "{{root_dir}}" && cargo run "${@:1}" | ||
|
||
format: | ||
cd "{{root_dir}}" && \ | ||
{{container_mgr}} run -v "{{root_dir}}:/repo" -v "$(pwd):/workspace" -w "/workspace" \ | ||
instrumentisto/rust:nightly-alpine cargo fmt -- --config-path /repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
description = "rdfpipe-rs"; | ||
|
||
nixConfig = { | ||
substituters = [ | ||
# Add here some other mirror if needed. | ||
"https://cache.nixos.org/" | ||
]; | ||
extra-substituters = [ | ||
# Nix community's cache server | ||
"https://nix-community.cachix.org" | ||
]; | ||
extra-trusted-public-keys = [ | ||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" | ||
]; | ||
}; | ||
|
||
inputs = { | ||
# Nixpkgs | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
|
||
# You can access packages and modules from different nixpkgs revs | ||
# at the same time. Here's an working example: | ||
nixpkgsStable.url = "github:nixos/nixpkgs/nixos-23.11"; | ||
# Also see the 'stable-packages' overlay at 'overlays/default.nix'. | ||
|
||
flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
# The Rust overlay to include the latest toolchain. | ||
rust-overlay = { | ||
url = "github:oxalica/rust-overlay"; | ||
inputs = { | ||
nixpkgs.follows = "nixpkgs"; | ||
flake-utils.follows = "flake-utils"; | ||
}; | ||
}; | ||
}; | ||
|
||
outputs = { | ||
self, | ||
nixpkgs, | ||
nixpkgsStable, | ||
flake-utils, | ||
rust-overlay, | ||
... | ||
} @ inputs: | ||
flake-utils.lib.eachDefaultSystem | ||
# Creates an attribute map `{ devShells.<system>.default = ...}` | ||
# by calling this function: | ||
( | ||
system: let | ||
overlays = [(import rust-overlay)]; | ||
|
||
# Import nixpkgs and load it into pkgs. | ||
pkgs = import nixpkgs { | ||
inherit system overlays; | ||
}; | ||
|
||
# Set the rust toolchain from the `rust-toolchain.toml`. | ||
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ../rust-toolchain.toml; | ||
|
||
# Things needed only at compile-time. | ||
nativeBuildInputsBasic = with pkgs; [ | ||
rustToolchain | ||
cargo-watch | ||
|
||
just | ||
parallel | ||
podman | ||
]; | ||
|
||
# Things needed only at compile-time. | ||
nativeBuildInputsDev = []; | ||
|
||
# Things needed at runtime. | ||
buildInputs = []; | ||
in | ||
with pkgs; { | ||
devShells = { | ||
default = mkShell { | ||
inherit buildInputs; | ||
nativeBuildInputs = nativeBuildInputsBasic ++ nativeBuildInputsDev; | ||
}; | ||
|
||
ci = mkShell { | ||
inherit buildInputs; | ||
nativeBuildInputs = nativeBuildInputsBasic; | ||
}; | ||
}; | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[toolchain] | ||
channel = "nightly-2024-06-17" | ||
components = [ "rustfmt", "rust-analyzer", "miri", "rust-docs", "clippy", "rust-src"] | ||
profile = "default" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
edition = "2021" | ||
reorder_imports = true | ||
imports_granularity = "Crate" |