nixos/klipper: Remove automatic flashing option flashing.enable

This commit is contained in:
Van Tuan Vo 2022-03-22 11:23:40 +01:00
parent 2da038a900
commit b391d98a71
No known key found for this signature in database
GPG Key ID: 7C96B1B77958A566
2 changed files with 9 additions and 13 deletions

View File

@ -76,11 +76,9 @@ in
type = with types; attrsOf
(submodule {
options = {
flashing.enable = mkEnableOption ''
automatic flashing of firmware to microcontroller
WARNING: Be careful with this option. Enabling this will automatically flash your microcontroller on e.g. nixos-rebuild.
This can potentially brick your microcontroller. Alternatively, use `klipper-flash-$mcu` to flash manually.
enable = mkEnableOption ''
building of firmware and addition of klipper-flash tools for manual flashing.
This will add `klipper-flash-$mcu` scripts to your environment which can be called to flash the firmware.
'';
configFile = mkOption {
type = path;
@ -143,15 +141,14 @@ in
environment.systemPackages =
with pkgs;
let
firmwares = mapAttrs
(mcu: { flashing, configFile }: pkgs.klipper-firmware.override {
flashDevice = if flashing.enable then cfg.settings."${mcu}".serial else null;
firmwares = filterAttrs (n: v: v!= null) (mapAttrs
(mcu: { enable, configFile }: if enable then pkgs.klipper-firmware.override {
mcu = lib.strings.sanitizeDerivationName mcu;
firmwareConfig = configFile;
})
cfg.firmwares;
} else null)
cfg.firmwares);
firmwareFlasher = mapAttrsToList
(mcu: firmware: pkgs.callPackage pkgs.klipper-flash.override {
(mcu: firmware: pkgs.klipper-flash.override {
mcu = lib.strings.sanitizeDerivationName mcu;
klipper-firmware = firmware;
flashDevice = cfg.settings."${mcu}".serial;

View File

@ -14,7 +14,6 @@
, stm32flash
, mcu ? "mcu"
, firmwareConfig ? ./simulator.cfg
, flashDevice ? null
}: stdenv.mkDerivation rec {
name = "klipper-firmware-${mcu}-${version}";
version = klipper.version;
@ -49,7 +48,7 @@
mkdir -p $out
cp ./.config $out/config
cp -r out/* $out
'' + lib.optionalString (flashDevice != null) "make FLASH_DEVICE=${toString flashDevice} OUT=$out/ KCONFIG_CONFIG=$out/config flash";
'';
dontFixup = true;