Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/flakebox/id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
73cf0906ef0f6cf3d29caed7d58a7f826172d3ee593ad3510289eee2937ecd4d71074d62b0c327a7e026fd61d96d09c0b43fc40d7934b2a61fc85dbee554c210
2fefc36adbe89c5c8953715f73d8c3d75062ecf9937b22e9b88afaa9cb261fc5bea72e092566df9803b7948b186f39abf7458504c35de64f5dec352a4e14d80d
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ group_imports = "StdExternalCrate"
wrap_comments = true
format_code_in_doc_comments = true
imports_granularity = "Module"
edition = "2021"
edition = "2024"
8 changes: 8 additions & 0 deletions .treefmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[formatter.nix]
command = "nixfmt"
includes = ["*.nix"]

[formatter.rust]
command = "rustfmt"
options = ["--edition", "2024", "--config", "skip_children=true"]
includes = ["*.rs"]
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resolver = "2"
[workspace.package]
version = "0.1.0"
authors = ["Dawid Ciężarkiewicz <dpc@dpc.pw>"]
edition = "2021"
edition = "2024"
description = "Rust dev experience (DX) we can share and love."
documentation = "https://github.com/rustshop/flakebox"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion flakebox-bin/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod opts;

use std::fs::{set_permissions, Permissions};
use std::fs::{Permissions, set_permissions};
use std::io;
use std::os::unix::fs::PermissionsExt;
use std::path::{Path, PathBuf};
Expand Down
1 change: 1 addition & 0 deletions lib/mkDevShell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ let
coreutils
parallel
shellcheck
treefmt
;
# Nix
inherit (pkgs) nixfmt-rfc-style nil;
Expand Down
1 change: 1 addition & 0 deletions lib/mkLintShell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ let
coreutils
parallel
shellcheck
treefmt
;
# Nix
inherit (pkgs) nixfmt-rfc-style;
Expand Down
32 changes: 0 additions & 32 deletions lib/modules/nix.nix

This file was deleted.

2 changes: 1 addition & 1 deletion lib/modules/rust.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ in
wrap_comments = true
format_code_in_doc_comments = true
imports_granularity = "Module"
edition = "2021"
edition = "2024"
'';
})

Expand Down
21 changes: 21 additions & 0 deletions lib/modules/treefmt.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{ lib, config, ... }:
let
inherit (lib) types;
in
{
options.treefmt = {
enable = lib.mkEnableOption "clippy check in pre-commit hook" // {
default = true;
};
};

config = lib.mkMerge [
(lib.mkIf config.treefmt.enable {
git.pre-commit.hooks = {
treefmt = ''
treefmt -q --fail-on-change
'';
};
})
];
}
20 changes: 9 additions & 11 deletions misc/git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,6 @@ function check_cargo_lock() {
}
export -f check_cargo_lock

# NOTE: THIS FILE IS AUTO-GENERATED BY FLAKEBOX
function check_nixfmt() {
set -euo pipefail

# we actually rely on word splitting here
# shellcheck disable=SC2046
nixfmt -c $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep "\.nix$")
}
export -f check_nixfmt

# NOTE: THIS FILE IS AUTO-GENERATED BY FLAKEBOX
function check_semgrep() {
set -euo pipefail
Expand Down Expand Up @@ -148,6 +138,14 @@ function check_trailing_whitespace() {
}
export -f check_trailing_whitespace

# NOTE: THIS FILE IS AUTO-GENERATED BY FLAKEBOX
function check_treefmt() {
set -euo pipefail

treefmt -q --fail-on-change
}
export -f check_treefmt

# NOTE: THIS FILE IS AUTO-GENERATED BY FLAKEBOX
function check_typos() {
set -euo pipefail
Expand All @@ -164,11 +162,11 @@ parallel \
::: \
check_cargo_fmt \
check_cargo_lock \
check_nixfmt \
check_semgrep \
check_shellcheck \
check_trailing_newline \
check_trailing_whitespace \
check_treefmt \
check_typos \
check_nothing
#
Expand Down