mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-16 17:14:00 +00:00
Merge pull request #231881 from lovesegfault/klipper-log
This commit is contained in:
commit
d8b94f5b2c
@ -23,6 +23,16 @@ in
|
||||
description = lib.mdDoc "The Klipper package.";
|
||||
};
|
||||
|
||||
logFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
example = "/var/lib/klipper/klipper.log";
|
||||
description = lib.mdDoc ''
|
||||
Path of the file Klipper should log to.
|
||||
If `null`, it logs to stdout, which is not recommended by upstream.
|
||||
'';
|
||||
};
|
||||
|
||||
inputTTY = mkOption {
|
||||
type = types.path;
|
||||
default = "/run/klipper/tty";
|
||||
@ -151,7 +161,9 @@ in
|
||||
systemd.services.klipper =
|
||||
let
|
||||
klippyArgs = "--input-tty=${cfg.inputTTY}"
|
||||
+ optionalString (cfg.apiSocket != null) " --api-server=${cfg.apiSocket}";
|
||||
+ optionalString (cfg.apiSocket != null) " --api-server=${cfg.apiSocket}"
|
||||
+ optionalString (cfg.logFile != null) " --logfile=${cfg.logFile}"
|
||||
;
|
||||
printerConfigPath =
|
||||
if cfg.mutableConfig
|
||||
then cfg.mutableConfigFolder + "/printer.cfg"
|
||||
@ -177,7 +189,7 @@ in
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${cfg.package}/lib/klipper/klippy.py ${klippyArgs} ${printerConfigPath}";
|
||||
ExecStart = "${cfg.package}/bin/klippy ${klippyArgs} ${printerConfigPath}";
|
||||
RuntimeDirectory = "klipper";
|
||||
StateDirectory = "klipper";
|
||||
SupplementaryGroups = [ "dialout" ];
|
||||
|
@ -3,6 +3,7 @@
|
||||
, fetchFromGitHub
|
||||
, python3
|
||||
, unstableGitUpdater
|
||||
, makeWrapper
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@ -19,7 +20,10 @@ stdenv.mkDerivation rec {
|
||||
sourceRoot = "source/klippy";
|
||||
|
||||
# NB: This is needed for the postBuild step
|
||||
nativeBuildInputs = [ (python3.withPackages ( p: with p; [ cffi ] )) ];
|
||||
nativeBuildInputs = [
|
||||
(python3.withPackages ( p: with p; [ cffi ] ))
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [ (python3.withPackages (p: with p; [ cffi pyserial greenlet jinja2 markupsafe numpy ])) ];
|
||||
|
||||
@ -49,7 +53,9 @@ stdenv.mkDerivation rec {
|
||||
cp -r $src/docs $out/lib/docs
|
||||
cp -r $src/config $out/lib/config
|
||||
|
||||
mkdir -p $out/bin
|
||||
chmod 755 $out/lib/klipper/klippy.py
|
||||
makeWrapper $out/lib/klipper/klippy.py $out/bin/klippy --chdir $out/lib/klipper
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user