Skip to content

Commit a8aa4cf

Browse files
committed
chore(nix): add nix flake
1 parent f94651a commit a8aa4cf

File tree

5 files changed

+226
-1
lines changed

5 files changed

+226
-1
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@
22
*.zip
33

44
# Exclude exported Modrinth modpacks
5-
*.mrpack
5+
*.mrpack
6+
7+
# Exclude .direnv
8+
.direnv
9+
10+
# Eclude precommit hooks config
11+
.pre-commit-config.yaml

flake.lock

+159
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
description = "A template designed to streamline the release process of Minecraft modpacks.";
3+
inputs = {
4+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
flake-parts = {
6+
url = "github:hercules-ci/flake-parts";
7+
inputs.nixpkgs-lib.follows = "nixpkgs";
8+
};
9+
pre-commit-hooks = {
10+
url = "github:cachix/pre-commit-hooks.nix";
11+
inputs.nixpkgs.follows = "nixpkgs";
12+
};
13+
};
14+
outputs = inputs:
15+
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
16+
systems = ["x86_64-linux"];
17+
18+
imports = [
19+
./pre-commit-hooks.nix
20+
];
21+
22+
perSystem = {
23+
config,
24+
pkgs,
25+
...
26+
}: {
27+
devShells.default = pkgs.mkShell {
28+
packages = [
29+
pkgs.alejandra
30+
pkgs.git
31+
pkgs.packwiz
32+
pkgs.yamllint
33+
];
34+
name = "mc-modpack-kit";
35+
DIRENV_LOG_FORMAT = "";
36+
shellHook = ''
37+
${config.pre-commit.installationScript}
38+
'';
39+
};
40+
41+
formatter = pkgs.alejandra;
42+
};
43+
};
44+
}

pre-commit-hooks.nix

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{inputs, ...}: {
2+
imports = [inputs.pre-commit-hooks.flakeModule];
3+
4+
perSystem.pre-commit = {
5+
settings.excludes = ["flake.lock"];
6+
7+
settings = {
8+
hooks = {
9+
alejandra.enable = true;
10+
yamllint.relaxed = true;
11+
};
12+
settings.yamllint.relaxed = true;
13+
};
14+
};
15+
}

0 commit comments

Comments
 (0)