From 22720e4a4ca088bb80dcded6667cec1f5becc0f4 Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Sat, 18 Oct 2025 00:27:05 -0500 Subject: qmk seems to be mostly working. Now working on pinecil --- modules/pinecil.nix | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 modules/pinecil.nix (limited to 'modules/pinecil.nix') diff --git a/modules/pinecil.nix b/modules/pinecil.nix new file mode 100644 index 0000000..d59c37d --- /dev/null +++ b/modules/pinecil.nix @@ -0,0 +1,64 @@ +{ lib, pkgs, config, ... }: let + inherit (lib) mkOption mkPackageOption mkIf types; +in { + options = { + type = types.enum [ "pinecil" ]; + + pinecil = { + version = mkOption { + type = types.enum [ "v1" "v2" ]; + description = "v1 or v2?"; + }; + + iron-os = mkOption { + type = types.path; + default = let + v = "2.23"; + in if config.pinecil.version == "v1" + then pkgs.fetchzip { + url = "https://github.com/Ralim/IronOS/releases/download/v${v}/Pinecil.zip"; + } else pkgs.fetchzip { + url = "https://github.com/Ralim/IronOS/releases/download/v${v}/PinecilV2.zip"; + }; + }; + + blisp = mkPackageOption pkgs "blisp" {}; + dfu = mkPackageOption pkgs "dfu-util" {}; + + build = { + bin = mkOption { + type = types.path; + default = pkgs.runCommandLocal "getbin" {} (let + iron = config.pinecil.iron-os; + in if config.pinecil.version == "v1" + then '' + cp ${iron}/Pinecil_EN.dfu $out + '' + else '' + cp ${iron}/Pinecilv2_EN.bin $out + ''; + ); + + }; + }; + }; + }; + + config = mkIf (config.type == "pinecil") { + build.flash = let + flasher = if config.pinecil.version == "v1" then { + pkg = config.pinecil.dfu-util; + tool = "dfu-util"; + } else { + pkg = config.pinecil.blisp; + tool = "blisp" + }; + in pkgs.writeShellApplication { + name = "flash"; + runtimeInputs = [ flasher.pkg ]; + text = '' + ${flasher.tool} "${config.pinecil.build.bin}" + ''; + }; + }; +} -- cgit v1.2.3