diff options
| author | Chris Wells <chris@mathematicaster.org> | 2025-10-18 00:27:05 -0500 |
|---|---|---|
| committer | Chris Wells <chris@mathematicaster.org> | 2025-10-18 00:27:05 -0500 |
| commit | 22720e4a4ca088bb80dcded6667cec1f5becc0f4 (patch) | |
| tree | a454918dbd366ec97b74352d8596e4a1f6bb186d /modules/pinecil.nix | |
| parent | bf9ccc339a2da236afdbad0fe63eb0c9bcb74d7e (diff) | |
| download | fw-manager-22720e4a4ca088bb80dcded6667cec1f5becc0f4.tar fw-manager-22720e4a4ca088bb80dcded6667cec1f5becc0f4.tar.gz fw-manager-22720e4a4ca088bb80dcded6667cec1f5becc0f4.tar.bz2 fw-manager-22720e4a4ca088bb80dcded6667cec1f5becc0f4.tar.lz fw-manager-22720e4a4ca088bb80dcded6667cec1f5becc0f4.tar.xz fw-manager-22720e4a4ca088bb80dcded6667cec1f5becc0f4.tar.zst fw-manager-22720e4a4ca088bb80dcded6667cec1f5becc0f4.zip | |
qmk seems to be mostly working. Now working on pinecil
Diffstat (limited to 'modules/pinecil.nix')
| -rw-r--r-- | modules/pinecil.nix | 64 |
1 files changed, 64 insertions, 0 deletions
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}" + ''; + }; + }; +} |
