devShell for all system types

This commit is contained in:
Noah Masur 2022-05-15 20:46:17 -04:00
parent b9d28efa4b
commit 9099a9f63b

View File

@ -20,6 +20,7 @@
}; };
outputs = { self, nixpkgs, home-manager, nur }: outputs = { self, nixpkgs, home-manager, nur }:
let let
# Global configuration for my systems # Global configuration for my systems
@ -37,6 +38,13 @@
}; };
}; };
# System types to support.
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;
in { in {
# Define my systems # Define my systems
@ -49,13 +57,13 @@
}; };
# Used to run commands and editing in this repo # Used to run commands and editing in this repo
devShells.x86_64-linux = devShells = forAllSystems (system:
let pkgs = import nixpkgs { system = "x86_64-linux"; }; let pkgs = import nixpkgs { inherit system; };
in { in {
default = pkgs.mkShell { default = pkgs.mkShell {
buildInputs = with pkgs; [ git stylua nixfmt shfmt shellcheck ]; buildInputs = with pkgs; [ git stylua nixfmt shfmt shellcheck ];
}; };
}; });
}; };
} }