feat(flake): add treefmt for formatting all files

This commit is contained in:
Reed Krantz
2026-02-18 18:14:12 -06:00
parent 6be48da010
commit 35e34c27f7
8 changed files with 46 additions and 13 deletions

View File

@@ -2,7 +2,7 @@
name = "squad-quote-store" name = "squad-quote-store"
version = "0.1.0" version = "0.1.0"
authors = ["Reed Krantz <programming@krantz.one>"] authors = ["Reed Krantz <programming@krantz.one>"]
edition = "2021" edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

23
flake.lock generated
View File

@@ -69,7 +69,8 @@
"crane": "crane", "crane": "crane",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay",
"treefmt-nix": "treefmt-nix"
} }
}, },
"rust-overlay": { "rust-overlay": {
@@ -91,6 +92,26 @@
"repo": "rust-overlay", "repo": "rust-overlay",
"type": "github" "type": "github"
} }
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1770228511,
"narHash": "sha256-wQ6NJSuFqAEmIg2VMnLdCnUc0b7vslUohqqGGD+Fyxk=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "337a4fe074be1042a35086f15481d763b8ddc0e7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@@ -6,6 +6,11 @@
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane"; crane.url = "github:ipetkov/crane";
rust-overlay = { rust-overlay = {
@@ -17,11 +22,16 @@
outputs = { outputs = {
nixpkgs, nixpkgs,
flake-parts, flake-parts,
treefmt-nix,
crane, crane,
rust-overlay, rust-overlay,
... ...
} @ inputs: } @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} { flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
treefmt-nix.flakeModule
];
systems = ["aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin"]; systems = ["aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin"];
perSystem = {system, ...}: let perSystem = {system, ...}: let
@@ -71,7 +81,13 @@
}; };
# Formatter for nix files, available through 'nix fmt' # Formatter for nix files, available through 'nix fmt'
formatter = pkgs.alejandra; treefmt = {
programs.alejandra.enable = true;
programs.rustfmt = {
enable = true;
edition = (builtins.fromTOML (builtins.readFile "${src}/Cargo.toml")).package.edition;
};
};
# Your custom packages # Your custom packages
# Accessible through 'nix build', 'nix shell', 'nix run', etc # Accessible through 'nix build', 'nix shell', 'nix run', etc
@@ -86,10 +102,6 @@
inherit src buildInputs nativeBuildInputs cargoArtifacts; inherit src buildInputs nativeBuildInputs cargoArtifacts;
cargoClippyExtraArgs = "-- --deny warnings"; cargoClippyExtraArgs = "-- --deny warnings";
}; };
fmt = craneLib.cargoFmt {
inherit src buildInputs nativeBuildInputs;
};
}; };
}; };
}; };

View File

@@ -1,2 +1,2 @@
mod component; mod component;
pub use component::*; pub use component::*;

View File

@@ -1,9 +1,9 @@
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_primitives::{ use dioxus_primitives::{
ContentAlign,
date_picker::{self, DatePickerInputProps, DatePickerProps, DateRangePickerProps}, date_picker::{self, DatePickerInputProps, DatePickerProps, DateRangePickerProps},
popover::{PopoverContentProps, PopoverTriggerProps}, popover::{PopoverContentProps, PopoverTriggerProps},
ContentAlign,
}; };
use super::super::calendar::*; use super::super::calendar::*;

View File

@@ -1,2 +1,2 @@
mod component; mod component;
pub use component::*; pub use component::*;

View File

@@ -1,11 +1,11 @@
use crate::components::{ use crate::components::{
Input,
date_picker::{DatePicker, DatePickerInput}, date_picker::{DatePicker, DatePickerInput},
textarea::Textarea, textarea::Textarea,
Input,
}; };
use dioxus::prelude::*; use dioxus::prelude::*;
use time::{macros::offset, OffsetDateTime}; use time::{OffsetDateTime, macros::offset};
#[component] #[component]
pub fn EditQuote() -> Element { pub fn EditQuote() -> Element {

View File

@@ -1,2 +1,2 @@
mod component; mod component;
pub use component::*; pub use component::*;