add borgmatic darwin module
This commit is contained in:
parent
323d7fc16b
commit
b0871baea6
3 changed files with 102 additions and 2 deletions
83
darwin-modules/borgmatic.nix
Normal file
83
darwin-modules/borgmatic.nix
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.ragon.services.borgmatic;
|
||||
settingsFormat = pkgs.formats.yaml { };
|
||||
cfgType = with types; submodule {
|
||||
freeformType = settingsFormat.type;
|
||||
options.location = {
|
||||
source_directories = mkOption {
|
||||
type = listOf str;
|
||||
description = mdDoc ''
|
||||
List of source directories to backup (required). Globs and
|
||||
tildes are expanded.
|
||||
'';
|
||||
example = [ "/home" "/etc" "/var/log/syslog*" ];
|
||||
};
|
||||
repositories = mkOption {
|
||||
type = listOf str;
|
||||
description = mdDoc ''
|
||||
Paths to local or remote repositories (required). Tildes are
|
||||
expanded. Multiple repositories are backed up to in
|
||||
sequence. Borg placeholders can be used. See the output of
|
||||
"borg help placeholders" for details. See ssh_command for
|
||||
SSH options like identity file or port. If systemd service
|
||||
is used, then add local repository paths in the systemd
|
||||
service file to the ReadWritePaths list.
|
||||
'';
|
||||
example = [
|
||||
"ssh://user@backupserver/./sourcehostname.borg"
|
||||
"ssh://user@backupserver/./{fqdn}"
|
||||
"/var/local/backups/local.borg"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
cfgfile = settingsFormat.generate "config.yaml" cfg.settings;
|
||||
in
|
||||
{
|
||||
options.ragon.services.borgmatic = {
|
||||
enable = mkEnableOption (mdDoc "borgmatic");
|
||||
|
||||
settings = mkOption {
|
||||
description = mdDoc ''
|
||||
See https://torsion.org/borgmatic/docs/reference/configuration/
|
||||
'';
|
||||
default = null;
|
||||
type = types.nullOr cfgType;
|
||||
};
|
||||
|
||||
configurations = mkOption {
|
||||
description = mdDoc ''
|
||||
Set of borgmatic configurations, see https://torsion.org/borgmatic/docs/reference/configuration/
|
||||
'';
|
||||
default = { };
|
||||
type = types.attrsOf cfgType;
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = [ pkgs.borgmatic ];
|
||||
|
||||
environment.etc = (optionalAttrs (cfg.settings != null) { "borgmatic/config.yaml".source = cfgfile; }) //
|
||||
mapAttrs'
|
||||
(name: value: nameValuePair
|
||||
"borgmatic.d/${name}.yaml"
|
||||
{ source = settingsFormat.generate "${name}.yaml" value; })
|
||||
cfg.configurations;
|
||||
|
||||
launchd.agents.borgmatic = {
|
||||
script = "borgmatic";
|
||||
serviceConfig = {
|
||||
StartInterval = 60 * 60; # run every hour
|
||||
label = "xyz.ragon.borgmatic";
|
||||
StandardOutPath = "/var/log/borgmatic.log";
|
||||
StandardErrorPath = "/var/log/borgmatic.log.error";
|
||||
NetworkState = true;
|
||||
Nice = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -197,8 +197,8 @@
|
|||
my = self.packages."${prev.system}";
|
||||
};
|
||||
nixosModules = lib.my.mapModulesRec ./nixos-modules import;
|
||||
darwinModules = [ ];
|
||||
#darwinModules = lib.my.mapModulesRec ./darwin-modules import;
|
||||
#darwinModules = [ ];
|
||||
darwinModules = lib.my.mapModulesRec ./darwin-modules import;
|
||||
nixosConfigurations = processConfigurations {
|
||||
picard = nixosSystem "x86_64-linux" [ ./hosts/picard/default.nix ];
|
||||
ds9 = nixosSystem "x86_64-linux" [ ./hosts/ds9/default.nix ];
|
||||
|
|
|
|||
|
|
@ -37,11 +37,14 @@ in
|
|||
ms-dotnettools.csharp # c# und so
|
||||
rust-lang.rust-analyzer # rust
|
||||
marketplace.sswg.swift-lang # swift
|
||||
marketplace.vadimcn.vscode-lldb # swift
|
||||
marketplace.ms-toolsai.jupyter # jupiter notebooks
|
||||
marketplace.jakebecker.elixir-ls # elixir
|
||||
marketplace.dart-code.flutter # dart/flutter
|
||||
marketplace.dart-code.dart-code # dart/flutter
|
||||
marketplace.alexisvt.flutter-snippets # flutter snippets
|
||||
marketplace.tauri-apps.tauri-vscode # tauri
|
||||
marketplace.dbaeumer.vscode-eslint # js
|
||||
|
||||
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
||||
];
|
||||
|
|
@ -88,6 +91,11 @@ in
|
|||
"commands" = [ "editor.action.sourceAction" ];
|
||||
quiet = true;
|
||||
}
|
||||
{
|
||||
before = [ "<leader>" "r" "n" ];
|
||||
"commands" = [ "editor.action.rename" ];
|
||||
quiet = true;
|
||||
}
|
||||
{
|
||||
before = [ "<leader>" "c" "f" ];
|
||||
"commands" = [ "editor.action.quickFix" ];
|
||||
|
|
@ -108,6 +116,11 @@ in
|
|||
"commands" = [ "editor.action.marker.prev" ];
|
||||
quiet = true;
|
||||
}
|
||||
{
|
||||
before = [ "<leader>" "g" "r" ];
|
||||
"commands" = [ "editor.action.goToReferences" ];
|
||||
quiet = true;
|
||||
}
|
||||
{
|
||||
before = [ "<Tab>" ];
|
||||
"commands" = [ "workbench.view.explorer" ];
|
||||
|
|
@ -157,6 +170,10 @@ in
|
|||
# "preview" = { "html" = { defaults = {}; options = []; }; };
|
||||
# };
|
||||
#};
|
||||
# swift
|
||||
"lldb.library" = "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB";
|
||||
"lldb.launch.expressions" = "native";
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue