Unverified Commit 6fb6b4bd authored by K900's avatar K900 Committed by GitHub
Browse files

moonraker (and friends): update, wire up klipper-estimator analysis support (#382068)

parents 16d1bfa8 55069662
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -110,6 +110,8 @@ in
          for details on what clients are able to do.
        '';
      };

      analysis.enable = lib.mkEnableOption "Runtime analysis with klipper-estimator";
    };
  };

@@ -170,9 +172,15 @@ in
      in
      format.generate "moonraker.cfg" fullConfig;

    systemd.tmpfiles.rules = [
    systemd.tmpfiles.rules =
      [
        "d '${cfg.stateDir}' - ${cfg.user} ${cfg.group} - -"
    ] ++ lib.optional (cfg.configDir != null) "d '${cfg.configDir}' - ${cfg.user} ${cfg.group} - -";
      ]
      ++ lib.optional (cfg.configDir != null) "d '${cfg.configDir}' - ${cfg.user} ${cfg.group} - -"
      ++ lib.optionals cfg.analysis.enable [
        "d '${cfg.stateDir}/tools/klipper_estimator' - ${cfg.user} ${cfg.group} - -"
        "L+ '${cfg.stateDir}/tools/klipper_estimator/klipper_estimator_linux' - - - - ${lib.getExe pkgs.klipper-estimator}"
      ];

    systemd.services.moonraker = {
      description = "Moonraker, an API web server for Klipper";
@@ -206,10 +214,16 @@ in
      };
    };

    services.moonraker.settings = {
      # set this to false, otherwise we'll get a warning indicating that `/etc/klipper.cfg`
      # is not located in the moonraker config directory.
    services.moonraker.settings = lib.mkIf (!config.services.klipper.mutableConfig) {
      file_manager.check_klipper_config_path = false;
      file_manager.check_klipper_config_path = lib.mkIf (!config.services.klipper.mutableConfig) false;

      # enable analysis with our own klipper-estimator, disable updating it
      analysis = lib.mkIf (cfg.analysis.enable) {
        platform = "linux";
        enable_estimator_updates = false;
      };
    };

    security.polkit.extraConfig = lib.optionalString cfg.allowSystemControl ''
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ rustPlatform.buildRustPackage rec {
  useFetchCargoVendor = true;
  cargoHash = "sha256-wMgFkzgoHjvE+5t+cA5OW2COXbUj/5tWXz0Zp9cd5lw=";

  env.TOOL_VERSION = "v${version}";

  buildInputs =
    [ openssl ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
+15 −0
Original line number Diff line number Diff line
diff --git a/vite.config.inject-version.ts b/vite.config.inject-version.ts
index d1321fcf..fb3e4c6d 100644
--- a/vite.config.inject-version.ts
+++ b/vite.config.inject-version.ts
@@ -29,9 +29,7 @@ const vitePluginInjectVersion = (): Plugin => {
   return {
     name: 'version',
     config: () => {
-      const git_hash = child_process
-        .execSync('git rev-parse --short HEAD')
-        .toString()
+      const git_hash = '@version@'

       return {
         define: {
+22 −17
Original line number Diff line number Diff line
{ lib, stdenvNoCC, fetchurl, unzip, nixosTests }:

stdenvNoCC.mkDerivation rec {
{
  lib,
  buildNpmPackage,
  fetchFromGitHub,
  replaceVars,
  nixosTests,
}:

buildNpmPackage rec {
  pname = "fluidd";
  version = "1.31.4";
  version = "1.32.3";

  src = fetchurl {
    name = "fluidd-v${version}.zip";
    url = "https://github.com/fluidd-core/fluidd/releases/download/v${version}/fluidd.zip";
    sha256 = "sha256-gqwVZg37pZA+XjT3FpTMYkrOIT1KKUN6upg7e1vh1t0=";
  src = fetchFromGitHub {
    owner = "fluidd-core";
    repo = "fluidd";
    tag = "v${version}";
    hash = "sha256-3sfjwwfanmRy45hrjG9X0lYVPsC41S2oZkbISz6YzYo=";
  };

  nativeBuildInputs = [ unzip ];

  dontConfigure = true;
  dontBuild = true;
  patches = [
    (replaceVars ./hardcode-version.patch {
      inherit version;
    })
  ];

  unpackPhase = ''
    mkdir fluidd
    unzip $src -d fluidd
  '';
  npmDepsHash = "sha256-bwdlBXq1Z6ZoxwGhfMtPQy74/oxRt2aGxh+HXjREWMQ=";

  installPhase = ''
    mkdir -p $out/share/fluidd
    cp -r fluidd $out/share/fluidd/htdocs
    cp -r dist $out/share/fluidd/htdocs
  '';

  passthru.tests = { inherit (nixosTests) fluidd; };
+4 −4
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ let
      zeroconf
      preprocess-cancellation
      jinja2
      dbus-next
      dbus-fast
      apprise
      python-periphery
      ldap3
@@ -35,13 +35,13 @@ let
in
stdenvNoCC.mkDerivation rec {
  pname = "moonraker";
  version = "0.9.3-unstable-2024-11-17";
  version = "0.9.3-unstable-2025-02-18";

  src = fetchFromGitHub {
    owner = "Arksine";
    repo = "moonraker";
    rev = "ccfe32f2368a5ff6c2497478319909daeeeb8edf";
    sha256 = "sha256-aCYE3EmflMRIHnGnkZ/0+zScVA5liHSbavScQ7XRf/4=";
    rev = "62051108ea16d5db5fa382651e01a51d89c041c9";
    sha256 = "sha256-mKbWnEnpCWhoiYY9T5HrNI0vVGM4LwrJqAzhJa+Rj4Y=";
  };

  nativeBuildInputs = [ makeWrapper ];