keyboards/iris-ce/flake.nix

69 lines
2.1 KiB
Nix
Raw Normal View History

2024-06-26 10:33:54 -05:00
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
outputs = {
self,
nixpkgs,
pre-commit-hooks,
...
}: let
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
forSystems = nixpkgs.lib.genAttrs systems;
pkgsFor = system: (import nixpkgs {inherit system;});
genPkgs = func: (forSystems (system: func (pkgsFor system)));
pkg = callee: overrides: genPkgs (pkgs: pkgs.callPackage callee overrides);
in {
formatter = genPkgs (p: p.alejandra);
checks = pkg ({system}: {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
};
};
}) {};
devShells = pkg ({
system,
mkShell,
nil,
alejandra,
qmk,
}: {
qmk = mkShell {
buildInputs = [
nil
alejandra
qmk
];
# inherit (self.outputs.checks.${system}.pre-commit-check) shellHook;
shellHook = ''
# TODO: maybe check that qmk has been setup first?
mkdir ~/qmk_firmware/keyboards/keebio/iris_ce/keymaps/lytedev
cp ./rules.mk ~/qmk_firmware/keyboards/keebio/iris_ce/keymaps/lytedev
cp ./keymap.c ~/qmk_firmware/keyboards/keebio/iris_ce/keymaps/lytedev
echo "You can compile this firmware with"
echo " qmk compile --keyboard keebio/iris_ce/rev1 -km lytedev"
echo
echo "You can flash this firmware with"
echo " qmk flash --keyboard keebio/iris_ce/rev1 -km lytedev"
'';
};
default = self.outputs.devShells.${system}.qmk;
}) {};
# packages = forAllSystems (system: import ./pkgs {pkgs = nixpkgs.legacyPackages.${system};});
# overlays = import ./overlays self;
# nixosModules = import ./modules/nixos;
# homeManagerModules = import ./modules/home-manager;
# nixosConfigurations = import ./nixos;
# homeConfigurations = import ./home
# templates = import ./templates;
};
}