Commit graph

39 commits

Author SHA1 Message Date
Zhaofeng Li f72f1eb0bc nixos/klipper: Expose firmware and flasher packages in config
This makes it easy to refer to the firmware and flasher packages from other
parts of the config. Currently, if `enableKlipperFlash` is false, simply adding
the firmware package to `systemPackages` isn't very useful.

Also makes the assertion message more helpful.
2025-09-22 08:18:38 -04:00
Wolfgang Walther 5a0711127c
treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Jack Wilsdon 3bdd0c1181
nixos/klipper: support extra settings (#378998)
Co-authored-by: Cabia Rangris <me+gh@cab.moe>
2025-07-13 20:04:00 +04:00
Kira Bruneau d5493eb701 nixos/klipper: restart when config changes 2025-01-12 13:58:51 +04:00
Kira Bruneau 809f97881d nixos/klipper: preserve SAVE_CONFIG for nixos-managed config
Klipper macros that use `SAVE_CONFIG` (eg. bed mesh calibration, PID
tuning, ...) don't currently work with a nixos-managed config.

This can be worked around by using `services.klipper.mutableConfig =
true`, but then you lose out on being able to configure klipper from
NixOS.

This changes the default behaviour so that:

1. The config is stored in `services.klipper.configDir` instead of `/etc`
2. The config is copied instead of symlinked (keeping a timestamped backup of the existing config)
3. The `SAVE_CONFIG` section from the backup is copied over into the new config
4. The backup is deleted if the final config is identical
2025-01-12 13:58:51 +04:00
Kira Bruneau 8bc4f19b89 nixos/klipper: build genconf, firmware & flasher using package opt 2025-01-05 11:34:31 +04:00
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Jack Wilsdon 464e353fcc nixos/klipper: fix serial value inheritance 2024-10-23 22:32:26 +01:00
Felix Buehler 14f18ffb06 nixos/services.klipper: remove with lib; 2024-08-30 23:00:52 +02:00
stuebinm 6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00
h7x4 0a37316d6c
treewide: use mkPackageOption
This commit replaces a lot of usages of `mkOption` with the package
type, to be `mkPackageOption`, in order to reduce the amount of code.
2023-11-27 01:28:36 +01:00
Bjørn Forsman 142074c2a8 nixos: fix bad mkEnableOption descriptions
Fix descriptions that don't account for (1) the "Whether to enable"
prefix or (2) the automatically added trailing dot.
2023-10-20 16:22:40 +01:00
Van Tuan Vo 917bb93078
nixos/klipper: add enableKlipperFlash option 2023-07-14 15:19:36 +02:00
Bernardo Meurer 570fff5e92
nixos/klipper: add logFile option 2023-05-14 13:02:08 -04:00
Bernardo Meurer 7a5f684ffd
nixos/klipper: use klippy from $out/bin 2023-05-14 13:02:06 -04:00
Luflosi 2378d1a214
nixos/klipper: fix assert message to match actual assertion
This error was introduced in 849c40b5f5.
2023-02-27 17:04:48 +01:00
cab 849c40b5f5
klipper: additional options
This allows for easier interop with Moonraker, as well as giving an
ability to store klipper configuration files in /var/lib/klipper, thus not
littering /etc with all the backups SAVE_CONFIG does.

- Added `configFile` as an alternative way to specify configuration
- Added `isMutableConfig` and `mutableConfigPath`

Co-authored-by: @lovesegfault <bernardo@meurer.org>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Bernardo Meurer <bernardo@meurer.org>
2022-09-23 03:10:28 +04:00
pennae ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02:00
pennae 1013069f52 nixos/*: convert more partially-md option descriptions
this mostly means marking options that use markdown already
appropriately and making a few adjustments so they still render
correctly. notable for nftables we have to transform the md links
because the manpage would not render them correctly otherwise.
2022-08-31 16:32:14 +02:00
pennae 7e7d68a250 nixos/*: mark pre-existing markdown descriptions as mdDoc 2022-08-19 22:40:58 +02:00
Richard Marko 9ba8f7d8b3 services/klipper: add CPUScheduling and IOScheduling tuning 2022-08-12 17:31:02 +08:00
Richard Marko 1410d89398 nixos/klipper: add OOMScoreAdjust -999
to make it unlikely that klipper gets killed by OOM killer.
2022-08-12 17:31:02 +08:00
pennae 61e93df189 nixos/*: automatically convert option docs to MD
once again using nix-doc-munge (69d080323a)
2022-08-03 22:46:41 +02:00
pennae 6b13dd0e9e
Merge pull request #183491 from pennae/automatic-md-conversions
treewide: automatically md-convert option descriptions
2022-08-02 02:15:30 +02:00
pennae 2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
Van Tuan Vo b391d98a71
nixos/klipper: Remove automatic flashing option flashing.enable 2022-03-25 00:20:53 +01:00
Van Tuan Vo 9271773a7b nixos/klipper: Rename firmwareConfig to configFile 2022-03-22 09:21:33 +01:00
Van Tuan Vo 7200dc6651 nixos/klipper: Rename flashingEnable to flashing.enable 2022-03-22 09:20:53 +01:00
Van Tuan Vo bc96bf2e06 nixos/klipper: Rename firmware option to firmwares 2022-03-22 09:20:45 +01:00
Van Tuan Vo c8b873fcd8
nixos/klipper: Fix working of assertion
Co-authored-by: Bernardo Meurer <bernardo@meurer.org>
2022-03-21 23:47:20 +01:00
Van Tuan Vo c49f15e87b
klipper-firmware: Fix IFD error and minor refactoring 2022-03-21 21:51:10 +01:00
Van Tuan Vo 72871a3596
nixos/klipper: Add klipper-firmware options 2022-03-21 20:23:45 +01:00
Naïm Favier 2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Zhaofeng Li fd435bdab7 nixos/klipper: Add default value for apiSocket 2021-08-04 12:09:15 -07:00
Zhaofeng Li 34d2b83291 nixos/klipper: Allow lists as values for gcode_macro 2021-07-22 22:01:44 -07:00
Zhaofeng Li 0c83078825 nixos/klipper: Allow configuring --input-tty and --api-server
This also makes it easy for other modules to get the correct
path to the virtual printer.
2021-07-19 02:30:25 -07:00
Zhaofeng Li 11313bc65d nixos/klipper: Allow overriding the Klipper package 2021-07-19 02:30:25 -07:00
Zhaofeng Li 94536fd6e3 nixos/klipper: Allow specifying arbitrary user/group
This paves the way for alternative integrations such as
Moonraker.
2021-07-19 02:30:25 -07:00
Bernardo Meurer 97eadef0c3
nixos/klipper: init 2020-10-11 15:55:50 -07:00