From 8c0728f23bee482576cf4a701687a0175744d6a9 Mon Sep 17 00:00:00 2001 From: Redyf Date: Mon, 8 Jan 2024 22:36:40 -0300 Subject: [PATCH] feat: Add devshell + formatter for CI/CD --- flake.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 7dffbd11..2f23c8c4 100644 --- a/flake.nix +++ b/flake.nix @@ -38,7 +38,15 @@ NixOS-WSL, spicetify-nix, ... - } @ inputs: { + } @ inputs: let + supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; + + # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + + # Nixpkgs instantiated for supported system types. + nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); + in { nixosConfigurations = { redyf = nixpkgs.lib.nixosSystem @@ -103,5 +111,18 @@ ]; }; }; + devShells = forAllSystems (system: let + pkgs = nixpkgsFor.${system}; + in { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + git + nixpkgs-fmt + statix + ]; + }; + }); + + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt; }; }