diff --git a/darwin-modules/borgmatic.nix b/darwin-modules/borgmatic.nix new file mode 100644 index 00000000..25644372 --- /dev/null +++ b/darwin-modules/borgmatic.nix @@ -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; + }; + }; + }; + + +} diff --git a/flake.nix b/flake.nix index 0d2b0d08..6b8b5be8 100644 --- a/flake.nix +++ b/flake.nix @@ -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 ]; diff --git a/hm-imports/vscode/default.nix b/hm-imports/vscode/default.nix index 3f817860..f96da576 100644 --- a/hm-imports/vscode/default.nix +++ b/hm-imports/vscode/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 = [ "" "r" "n" ]; + "commands" = [ "editor.action.rename" ]; + quiet = true; + } { before = [ "" "c" "f" ]; "commands" = [ "editor.action.quickFix" ]; @@ -108,6 +116,11 @@ in "commands" = [ "editor.action.marker.prev" ]; quiet = true; } + { + before = [ "" "g" "r" ]; + "commands" = [ "editor.action.goToReferences" ]; + quiet = true; + } { before = [ "" ]; "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"; + }; };