-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This unpacks the flake into a few different files. This more closely matches the way that I write my projects and separates some concerns out such as managing devShells alongside cargo builds. Many of the flake inputs have been updated to take advantage of newer features such as treefmt in pre-commit-hooks. Configuration for cocogitto and bomper are also included to handle releases.
- Loading branch information
1 parent
c7c9de5
commit 3359c62
Showing
11 changed files
with
984 additions
and
138 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,3 @@ | ||
( | ||
cargo: Some(Autodetect), | ||
) |
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,23 @@ | ||
ignore_merge_commits = false | ||
branch_whitelist = ["main"] | ||
pre_bump_hooks = [ | ||
"bomper {{latest}} {{version}}" | ||
] | ||
post_bump_hooks = [ | ||
"git push", | ||
"git push origin {{version}}" | ||
] | ||
|
||
[commit_types] | ||
|
||
[changelog] | ||
path = "CHANGELOG.md" | ||
template = "remote" | ||
remote = "github.com" | ||
repository = "thoenix" | ||
owner = "justinrubek" | ||
authors = [ | ||
{ signature = "Justin Rubek", username = "justinrubek" } | ||
] | ||
|
||
[bump_profiles] |
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
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,34 @@ | ||
{inputs, ...}: { | ||
perSystem = { | ||
config, | ||
pkgs, | ||
system, | ||
inputs', | ||
self', | ||
... | ||
}: let | ||
ciPackages = [ | ||
self'.packages.cocogitto | ||
self'.packages.bomper | ||
]; | ||
|
||
packages = { | ||
cocogitto = pkgs.cocogitto; | ||
bomper = inputs'.bomper.packages.cli; | ||
}; | ||
|
||
devShells = { | ||
ci = pkgs.mkShell rec { | ||
packages = ciPackages; | ||
|
||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages; | ||
}; | ||
}; | ||
in rec { | ||
inherit devShells packages; | ||
|
||
legacyPackages = { | ||
inherit ciPackages; | ||
}; | ||
}; | ||
} |
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,32 @@ | ||
{ | ||
inputs, | ||
self, | ||
... | ||
}: { | ||
perSystem = { | ||
pkgs, | ||
lib, | ||
... | ||
}: let | ||
formatters = [ | ||
pkgs.alejandra | ||
pkgs.rustfmt | ||
]; | ||
|
||
treefmt = pkgs.writeShellApplication { | ||
name = "treefmt"; | ||
runtimeInputs = [pkgs.treefmt] ++ formatters; | ||
text = '' | ||
exec treefmt "$@" | ||
''; | ||
}; | ||
in { | ||
packages = { | ||
inherit treefmt; | ||
}; | ||
|
||
legacyPackages = { | ||
inherit formatters; | ||
}; | ||
}; | ||
} |
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,21 @@ | ||
{ | ||
inputs, | ||
self, | ||
... | ||
}: { | ||
perSystem = {self', ...}: let | ||
in { | ||
pre-commit = { | ||
check.enable = true; | ||
|
||
settings = { | ||
src = ../.; | ||
hooks = { | ||
treefmt.enable = true; | ||
}; | ||
|
||
settings.treefmt.package = self'.packages.treefmt; | ||
}; | ||
}; | ||
}; | ||
} |
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,38 @@ | ||
{...}: { | ||
perSystem = { | ||
inputs', | ||
lib, | ||
pkgs, | ||
... | ||
}: let | ||
# "stable", "latest", "minimal", "complete" | ||
channel = "latest"; | ||
fenix-channel = inputs'.fenix.packages.${channel}; | ||
|
||
# rust targets | ||
fenix-targets = with inputs'.fenix.packages.targets; | ||
[ | ||
x86_64-unknown-linux-gnu.${channel}.rust-std | ||
aarch64-unknown-linux-gnu.${channel}.rust-std | ||
] | ||
++ lib.optionals pkgs.stdenv.isDarwin [ | ||
x86_64-apple-darwin.${channel}.rust-std | ||
aarch64-apple-darwin.${channel}.rust-std | ||
]; | ||
|
||
fenix-toolchain = inputs'.fenix.packages.combine ([ | ||
fenix-channel.rustc | ||
fenix-channel.cargo | ||
fenix-channel.clippy | ||
fenix-channel.rust-analysis | ||
fenix-channel.rust-src | ||
fenix-channel.rustfmt | ||
fenix-channel.llvm-tools-preview | ||
] | ||
++ fenix-targets); | ||
in { | ||
packages = { | ||
rust-toolchain = fenix-toolchain; | ||
}; | ||
}; | ||
} |
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,40 @@ | ||
{inputs, ...}: { | ||
perSystem = { | ||
config, | ||
pkgs, | ||
system, | ||
inputs', | ||
self', | ||
lib, | ||
... | ||
}: let | ||
inherit (self'.packages) rust-toolchain; | ||
inherit (self'.legacyPackages) cargoExtraPackages ciPackages; | ||
|
||
devTools = [ | ||
# rust tooling | ||
rust-toolchain | ||
pkgs.cargo-audit | ||
pkgs.cargo-udeps | ||
pkgs.cargo-nextest | ||
pkgs.bacon | ||
# formatting | ||
self'.packages.treefmt | ||
# misc | ||
pkgs.terraform | ||
]; | ||
in { | ||
devShells = { | ||
default = pkgs.mkShell rec { | ||
packages = devTools ++ cargoExtraPackages ++ ciPackages; | ||
|
||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages; | ||
RUST_SRC_PATH = "${self'.packages.rust-toolchain}/lib/rustlib/src/rust/src"; | ||
|
||
shellHook = '' | ||
${config.pre-commit.installationScript} | ||
''; | ||
}; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.