mirror of
https://codeberg.org/icewind/tasmota-backup.git
synced 2026-06-03 14:24:08 +02:00
fmt
This commit is contained in:
parent
191e3868f6
commit
22e415ba6a
5 changed files with 46 additions and 44 deletions
|
|
@ -28,6 +28,8 @@ password = "device-password" # the device password is the MQTT password used by
|
|||
# password-file = "/path/to/device-password"
|
||||
```
|
||||
|
||||
A `.dmp` for every discovered device file will be written to the configured output directory.
|
||||
A `.dmp` for every discovered device file will be written to the configured
|
||||
output directory.
|
||||
|
||||
The output files should be stable as long as the device configuration isn't changed and the backup program will not overwrite existing unchanged files.
|
||||
The output files should be stable as long as the device configuration isn't
|
||||
changed and the backup program will not overwrite existing unchanged files.
|
||||
|
|
|
|||
23
flake.nix
23
flake.nix
|
|
@ -10,22 +10,23 @@
|
|||
inputs.flakelight.follows = "flakelight";
|
||||
};
|
||||
};
|
||||
outputs = { mill-scale, ... }: mill-scale ./. {
|
||||
withOverlays = import ./overlay.nix;
|
||||
outputs = {mill-scale, ...}:
|
||||
mill-scale ./. {
|
||||
withOverlays = import ./overlay.nix;
|
||||
|
||||
nixosModules = { outputs, ... }: {
|
||||
default =
|
||||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
nixosModules = {outputs, ...}: {
|
||||
default = {
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [ ./module.nix ];
|
||||
imports = [./module.nix];
|
||||
config = lib.mkIf config.services.tasmota-backup.enable {
|
||||
nixpkgs.overlays = [ (import ./overlay.nix) ];
|
||||
nixpkgs.overlays = [(import ./overlay.nix)];
|
||||
services.tasmota-backup.package = lib.mkDefault pkgs.tasmota-backup;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
24
module.nix
24
module.nix
|
|
@ -1,10 +1,11 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
format = pkgs.formats.toml { };
|
||||
format = pkgs.formats.toml {};
|
||||
configFile = format.generate "tasmota-backup.toml" {
|
||||
output.target = cfg.outputPath;
|
||||
mqtt = {
|
||||
|
|
@ -14,8 +15,7 @@ with lib; let
|
|||
device."password-file" = "$CREDENTIALS_DIRECTORY/device_password";
|
||||
};
|
||||
cfg = config.services.tasmota-backup;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.services.tasmota-backup = {
|
||||
enable = mkEnableOption "Log archiver";
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.groups.tasmota-backup = { };
|
||||
users.groups.tasmota-backup = {};
|
||||
users.users.tasmota-backup = {
|
||||
group = config.users.groups.tasmota-backup.name;
|
||||
isSystemUser = true;
|
||||
|
|
@ -83,7 +83,7 @@ in
|
|||
"mqtt_password:${cfg.mqtt.passwordFile}"
|
||||
"device_password:${cfg.devicePasswordFile}"
|
||||
];
|
||||
BindPaths = [ cfg.outputPath ];
|
||||
BindPaths = [cfg.outputPath];
|
||||
User = "tasmota-backup";
|
||||
Restart = "on-failure";
|
||||
PrivateTmp = true;
|
||||
|
|
@ -102,10 +102,10 @@ in
|
|||
ProtectHostname = true;
|
||||
LockPersonality = true;
|
||||
ProtectKernelTunables = true;
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
|
||||
RestrictAddressFamilies = ["AF_INET" "AF_INET6"];
|
||||
RestrictRealtime = true;
|
||||
ProtectProc = "noaccess";
|
||||
SystemCallFilter = [ "@system-service" "~@resources" "~@privileged" ];
|
||||
SystemCallFilter = ["@system-service" "~@resources" "~@privileged"];
|
||||
IPAddressDeny = mkDefault "multicast";
|
||||
PrivateUsers = true;
|
||||
ProcSubset = "pid";
|
||||
|
|
@ -130,7 +130,7 @@ in
|
|||
inherit (config.systemd.services."tasmota-backup") description;
|
||||
|
||||
enable = true;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wantedBy = ["multi-user.target"];
|
||||
timerConfig = {
|
||||
OnCalendar = cfg.interval;
|
||||
RandomizedDelaySec = "15m";
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
final: prev: {
|
||||
tasmota-backup = final.callPackage ./package.nix { };
|
||||
tasmota-backup = final.callPackage ./package.nix {};
|
||||
}
|
||||
|
|
|
|||
35
package.nix
35
package.nix
|
|
@ -1,23 +1,22 @@
|
|||
{ stdenv
|
||||
, rustPlatform
|
||||
, libsodium
|
||||
, pkg-config
|
||||
, lib
|
||||
,
|
||||
}:
|
||||
let
|
||||
{
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
libsodium,
|
||||
pkg-config,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.sources) sourceByRegex;
|
||||
src = sourceByRegex ./. [ "Cargo.*" "(src)(/.*)?" ];
|
||||
src = sourceByRegex ./. ["Cargo.*" "(src)(/.*)?"];
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "tasmota-backup";
|
||||
version = "0.1.0";
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "tasmota-backup";
|
||||
version = "0.1.0";
|
||||
|
||||
inherit src;
|
||||
inherit src;
|
||||
|
||||
doCheck = false;
|
||||
doCheck = false;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
}
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue