nix/templates/nix-flake/flake.nix

49 lines
1.3 KiB
Nix
Raw Permalink Normal View History

2024-02-28 09:31:58 -06:00
{
2024-07-09 11:12:55 -05:00
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
2024-03-19 10:25:29 -05:00
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
2024-02-28 09:31:58 -06:00
outputs = {
self,
nixpkgs,
pre-commit-hooks,
...
}: let
2024-06-25 09:38:00 -05:00
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
forSystems = nixpkgs.lib.genAttrs systems;
2024-07-09 11:12:55 -05:00
pkgsFor = system: (import nixpkgs {inherit system;});
genPkgs = func: (forSystems (system: func (pkgsFor system)));
2024-02-28 09:31:58 -06:00
in {
2024-06-25 09:38:00 -05:00
formatter = genPkgs (pkgs: pkgs.alejandra);
2024-02-28 09:31:58 -06:00
2024-06-25 09:38:00 -05:00
checks = genPkgs (pkgs: {
pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run {
2024-02-28 09:31:58 -06:00
src = ./.;
hooks = {
alejandra.enable = true;
};
};
});
2024-06-28 09:51:25 -05:00
devShells = genPkgs (pkgs: {
nix = pkgs.mkShell {
2024-07-09 11:12:55 -05:00
packages = with pkgs; [nil alejandra];
2024-06-25 09:38:00 -05:00
inherit (self.outputs.checks.${pkgs.system}.pre-commit-check) shellHook;
2024-06-28 09:51:25 -05:00
};
default = self.outputs.devShells.${pkgs.system}.nix;
});
2024-02-28 09:31:58 -06:00
2024-09-12 11:58:24 -05:00
/*
packages = genPkgs (pkgs: import ./pkgs {inherit pkgs;});
overlays = import ./overlays self;
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
nixosConfigurations = import ./nixos;
homeConfigurations = import ./home
templates = import ./templates;
*/
2024-02-28 09:31:58 -06:00
};
}