Skip to content

Commit

Permalink
chore(nix): Add commit check + changelog generator
Browse files Browse the repository at this point in the history
Via pre-commit-hooks-nix and just-flake
  • Loading branch information
srid committed May 5, 2024
1 parent db9262f commit 04402e2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
/result
/result-lib
.direnv
.direnv
/just-flake.just
28 changes: 26 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
rust-flake.inputs.nixpkgs.follows = "nixpkgs";
cargo-doc-live.url = "github:srid/cargo-doc-live";
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
just-flake.url = "github:juspay/just-flake";
pre-commit-hooks-nix = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs";
};

# Dev tools
treefmt-nix.url = "github:numtide/treefmt-nix";
Expand All @@ -27,7 +33,9 @@
inputs.rust-flake.flakeModules.nixpkgs
inputs.cargo-doc-live.flakeModule
inputs.process-compose-flake.flakeModule
inputs.pre-commit-hooks-nix.flakeModule
inputs.treefmt-nix.flakeModule
inputs.just-flake.flakeModule
];

perSystem = { config, self', pkgs, lib, system, ... }: {
Expand All @@ -37,14 +45,29 @@
SystemConfiguration
] ++ [
libiconv
pkgconfig
pkg-config
];
buildInputs = lib.optionals pkgs.stdenv.isLinux [
pkgs.openssl
];
DEVOUR_FLAKE = inputs.devour-flake;
};

pre-commit = {
check.enable = true;
settings = {
hooks = {
treefmt.enable = true;
convco.enable = true;
};
};
};

just-flake.features = {
treefmt.enable = true;
convco.enable = true;
};

# Flake outputs
packages.default = self'.packages.nixci;
overlayAttrs.nixci = self'.packages.default;
Expand All @@ -54,14 +77,15 @@
inputsFrom = [
self'.devShells.nixci
config.treefmt.build.devShell
config.just-flake.outputs.devShell
];
shellHook = ''
export DEVOUR_FLAKE=${inputs.devour-flake}
'';
packages = [
pkgs.just
pkgs.cargo-watch
config.process-compose.cargo-doc-live.outputs.package
config.pre-commit.settings.tools.convco
];
};

Expand Down
12 changes: 5 additions & 7 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# See flake.nix (just-flake)
import 'just-flake.just'

# Display the list of recipes
default:
@just --list

# Auto-format the source tree
fmt:
treefmt

alias f := fmt


# Run the project locally (eg: `j w build ~/code/yourproject`)
w *ARGS:
cargo watch -s "cargo run -- {{ARGS}}"
Expand Down

0 comments on commit 04402e2

Please sign in to comment.