Move Nix files back to the root of the project

This commit is contained in:
Oliver Davies 2025-03-29 23:19:06 +00:00
parent 52044d9995
commit 087153a16d
223 changed files with 12 additions and 12 deletions

43
pkgs/build-glove80.nix Normal file
View file

@ -0,0 +1,43 @@
{ pkgs, ... }:
with pkgs;
writeShellApplication {
name = "build-glove80";
runtimeInputs = [
cachix
git
nix
];
text = ''
BRANCH="''${1:-main}"
SRC_DIR="''${PWD}/src"
CONFIG_DIR="''${PWD}/config"
NIX_FILE="''${CONFIG_DIR}/default.nix"
# Ensure cachix is configured
echo "Using moergo-glove80-zmk-dev cache"
cachix use moergo-glove80-zmk-dev
# Clone or update the ZMK repository
if [ ! -d "$SRC_DIR" ]; then
echo "Cloning ZMK repository into ./src..."
git clone https://github.com/moergo-sc/zmk "$SRC_DIR"
else
echo "Updating ZMK repository in ./src..."
git -C "$SRC_DIR" fetch --all
fi
# Checkout the specified branch or tag
echo "Checking out branch/tag: $BRANCH in ./src"
git -C "$SRC_DIR" checkout -q --detach "$BRANCH"
# Build firmware using Nix
echo "Building firmware from: $NIX_FILE"
nix-build "$NIX_FILE" --arg firmware "import ''${SRC_DIR}/default.nix {}" -j2 -o ./glove80.uf2 --show-trace
echo "Firmware built successfully: $(realpath ./glove80.uf2)"
'';
}