Skip to content

Commit

Permalink
nixos/klipper: build genconf, firmware & flasher using package opt
Browse files Browse the repository at this point in the history
  • Loading branch information
kira-bruneau authored and cab404 committed Jan 5, 2025
1 parent 1e90553 commit 8bc4f19
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nixos/modules/services/misc/klipper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,11 @@ in
};

environment.systemPackages =
with pkgs;
let
default = a: b: if a != null then a else b;
genconf = pkgs.klipper-genconf.override {
klipper = cfg.package;
};
firmwares = lib.filterAttrs (n: v: v != null) (
lib.mapAttrs (
mcu:
Expand All @@ -241,6 +243,7 @@ in
}:
if enable then
pkgs.klipper-firmware.override {
klipper = cfg.package;
mcu = lib.strings.sanitizeDerivationName mcu;
firmwareConfig = configFile;
}
Expand All @@ -251,14 +254,15 @@ in
firmwareFlasher = lib.mapAttrsToList (
mcu: firmware:
pkgs.klipper-flash.override {
mcu = lib.strings.sanitizeDerivationName mcu;
klipper = cfg.package;
klipper-firmware = firmware;
mcu = lib.strings.sanitizeDerivationName mcu;
flashDevice = default cfg.firmwares."${mcu}".serial cfg.settings."${mcu}".serial;
firmwareConfig = cfg.firmwares."${mcu}".configFile;
}
) (lib.filterAttrs (mcu: firmware: cfg.firmwares."${mcu}".enableKlipperFlash) firmwares);
in
[ klipper-genconf ] ++ firmwareFlasher ++ lib.attrValues firmwares;
[ genconf ] ++ firmwareFlasher ++ lib.attrValues firmwares;
};
meta.maintainers = [
lib.maintainers.cab404
Expand Down

0 comments on commit 8bc4f19

Please sign in to comment.