flake: use treefmt-nix

This commit is contained in:
Guanran Wang 2024-03-09 09:44:41 +08:00
parent 82c7210f57
commit 5c888edaf4
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
5 changed files with 50 additions and 4 deletions

View file

@ -442,7 +442,8 @@
"rust-overlay": "rust-overlay", "rust-overlay": "rust-overlay",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"spicetify-nix": "spicetify-nix", "spicetify-nix": "spicetify-nix",
"systems": "systems" "systems": "systems",
"treefmt-nix": "treefmt-nix"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -528,6 +529,26 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1709911575,
"narHash": "sha256-yC2iOKe0BSZAeXLNPXPrsGn5BwUTYYZESKb+OblLnXY=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "9c57261c71871d2208a6dd4394774cca226c6dbc",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -76,6 +76,10 @@
inputs.flake-utils.follows = "flake-utils"; inputs.flake-utils.follows = "flake-utils";
}; };
systems.url = "github:nix-systems/default"; systems.url = "github:nix-systems/default";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
### De-dupe flake dependencies ### De-dupe flake dependencies
crane = { crane = {
@ -128,8 +132,11 @@
inherit system modules; inherit system modules;
specialArgs = {inherit inputs;}; specialArgs = {inherit inputs;};
}; };
treefmtEval = eachDefaultSystemMap (system: inputs.treefmt-nix.lib.evalModule inputs.nixpkgs.legacyPackages.${system} ./treefmt.nix);
in { in {
formatter = eachDefaultSystemMap (system: inputs.nixpkgs.legacyPackages.${system}.alejandra); formatter = eachDefaultSystemMap (system: treefmtEval.${system}.config.build.wrapper);
checks = eachDefaultSystemMap (system: {formatting = treefmtEval.${system}.config.build.check inputs.self;});
packages = eachDefaultSystemMap (system: import ./pkgs inputs.nixpkgs.legacyPackages.${system}); packages = eachDefaultSystemMap (system: import ./pkgs inputs.nixpkgs.legacyPackages.${system});
overlays = import ./overlays; overlays = import ./overlays;
nixosModules.default = ./nixos/modules; nixosModules.default = ./nixos/modules;

View file

@ -31,5 +31,5 @@ user_pref("browser.urlbar.suggest.calculator", true);
user_pref("apz.overscroll.enabled", true); user_pref("apz.overscroll.enabled", true);
user_pref("general.smoothScroll", true); user_pref("general.smoothScroll", true);
user_pref("general.smoothScroll.msdPhysics.enabled", true); user_pref("general.smoothScroll.msdPhysics.enabled", true);
user_pref("general.smoothScroll.msdPhysics.motionBeginSpringConstant", 600) user_pref("general.smoothScroll.msdPhysics.motionBeginSpringConstant", 600);
user_pref("mousewheel.default.delta_multiplier_y", 75); user_pref("mousewheel.default.delta_multiplier_y", 75);

View file

@ -6,7 +6,6 @@ user_pref("browser.cache.memory.capacity", 1);
user_pref("privacy.clearOnShutdown.cache", false); user_pref("privacy.clearOnShutdown.cache", false);
user_pref("mail.imap.use_disk_cache2", true); user_pref("mail.imap.use_disk_cache2", true);
// View related. // View related.
// Makes messages prettier. // Makes messages prettier.
user_pref("permissions.default.image", 1); user_pref("permissions.default.image", 1);

19
treefmt.nix Normal file
View file

@ -0,0 +1,19 @@
{
projectRootFile = "flake.nix";
### nix
programs.deadnix.enable = true;
programs.statix.enable = true;
programs.alejandra.enable = true;
### shell
programs.shellcheck.enable = true;
programs.shfmt.enable = true;
### toml
programs.taplo.enable = true;
### misc
programs.prettier.enable = true;
settings.formatter.prettier.excludes = ["secrets.yaml"];
}