Skip to content

Commit

Permalink
refactor: add nix and linters
Browse files Browse the repository at this point in the history
  • Loading branch information
sofiedotcafe committed Feb 5, 2024
1 parent f94651a commit f7794a0
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 1 deletion.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
*.zip

# Exclude exported Modrinth modpacks
*.mrpack
*.mrpack

# Exclude .direnv
.direnv

# Eclude precommit hooks config
.pre-commit-config.yaml
159 changes: 159 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
description = "A template designed to streamline the release process of Minecraft modpacks.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs:
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux"];

imports = [
./pre-commit-hooks.nix
];

perSystem = {
config,
pkgs,
...
}: {
devShells.default = pkgs.mkShell {
packages = [
pkgs.alejandra
pkgs.git
pkgs.packwiz
pkgs.yamllint
];
name = "mc-modpack-kit";
DIRENV_LOG_FORMAT = "";
shellHook = ''
${config.pre-commit.installationScript}
'';
};

formatter = pkgs.alejandra;
};
};
}
15 changes: 15 additions & 0 deletions pre-commit-hooks.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{inputs, ...}: {
imports = [inputs.pre-commit-hooks.flakeModule];

perSystem.pre-commit = {
settings.excludes = ["flake.lock"];

settings = {
hooks = {
alejandra.enable = true;
yamllint.enable = true;
};
settings.yamllint.relaxed = true;
};
};
}

0 comments on commit f7794a0

Please sign in to comment.