diff options
| author | seth <[email protected]> | 2023-03-09 19:39:23 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-03-09 19:39:38 -0500 |
| commit | 721a349afd94a6f58d29d07185024d174a782201 (patch) | |
| tree | 8ae2d14d8458e8598a80fe35d2fe1b90ce811f88 /flake.nix | |
| parent | bc6276ede166783c5ba2aa1be504e3bbb546343e (diff) | |
add checks and dev shell
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 35 |
1 files changed, 33 insertions, 2 deletions
@@ -19,11 +19,17 @@ }; nixos-hardware.url = "github:NixOS/nixos-hardware"; nur.url = "github:nix-community/NUR"; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs @ { + self, nixpkgs, nixpkgsUnstable, + pre-commit-hooks, ... }: let supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; @@ -45,10 +51,35 @@ users = import ./users {inherit inputs;}; hosts = import ./hosts {inherit inputs;}; in { - homeConfigurations = forAllSystems (system: mapHMUsers (users.users {inherit system;})); + checks = forAllSystems (system: { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + alejandra.enable = true; + deadnix.enable = true; + statix.enable = true; + }; + }; + }); - nixosConfigurations = mapHosts hosts; + devShells = forAllSystems (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in + with pkgs; { + default = mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; + packages = [ + alejandra + deadnix + statix + ]; + }; + }); formatter = forAllSystems (system: channels.nixpkgs.${system}.alejandra); + + homeConfigurations = forAllSystems (system: mapHMUsers (users.users {inherit system;})); + + nixosConfigurations = mapHosts hosts; }; } |
