Skip to content

Commit

Permalink
Add formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
yousiki committed Mar 18, 2024
1 parent 67de7af commit b3132fa
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 16 deletions.
164 changes: 164 additions & 0 deletions flake.lock

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

26 changes: 10 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{
description = "nix configurations for daily life";

outputs = {self, ...} @ inputs:
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
outputs = {
self,
flake-parts,
haumea,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = import (inputs.default-systems);

imports = with inputs; [
treefmt-nix.flakeModule
imports = [
./parts/formatter.nix
];

perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}: {};
};

inputs = {
Expand All @@ -31,8 +27,6 @@
haumea.url = "github:nix-community/haumea";
haumea.inputs.nixpkgs.follows = "nixpkgs";

flake-utils.url = "github:numtide/flake-utils";

flake-parts.url = "github:hercules-ci/flake-parts";

default-systems.url = "github:nix-systems/default";
Expand All @@ -43,7 +37,7 @@

nixConfig = rec {
substituters = [
# "https://cache.garnix.io?priority=50"
# "https://cache.garnix.io?priority=50" # Disable in China
"https://cache.nixos.org?priority=45"
"https://hyprland.cachix.org?priority=40"
"https://mirror.sjtu.edu.cn/nix-channels/store?priority=25"
Expand Down
1 change: 1 addition & 0 deletions parts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# flake-parts modules
22 changes: 22 additions & 0 deletions parts/formatter.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{inputs, ...}: {
imports = [
inputs.treefmt-nix.flakeModule
];

perSystem = {...}: {
treefmt.config = {
projectRootFile = "flake.nix";
programs.alejandra.enable = true;
programs.prettier.enable = true;
programs.stylua.enable = true;
settings.formatter = {
alejandra.excludes = [
"nvfetcher/generated.nix"
];
prettier.excludes = [
"nvfetcher/generated.json"
];
};
};
};
}

0 comments on commit b3132fa

Please sign in to comment.