From f57babf97c253c5aad57faa87ef0f989249a5ed2 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Thu, 14 Dec 2023 15:51:52 +0100 Subject: [PATCH] use new bacula fixes --- flake.nix | 2 ++ modules/bacula.nix | 40 +--------------------------------------- overlays/default.nix | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 39 deletions(-) create mode 100644 overlays/default.nix diff --git a/flake.nix b/flake.nix index d3c807e..4f04668 100755 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,7 @@ formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt; hydraJobs."x86-64-linux".quitte = self.packages."x86_64-linux".quitte; + overlays.default = import ./overlays; nixosConfigurations = { quitte = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -67,6 +68,7 @@ ./modules/sharepic.nix ./modules/zammad.nix { + nixpkgs.overlays = [ self.overlays.default ]; sops.defaultSopsFile = ./secrets/quitte.yaml; } ]; diff --git a/modules/bacula.nix b/modules/bacula.nix index fd03eb7..d28e3a8 100644 --- a/modules/bacula.nix +++ b/modules/bacula.nix @@ -1,41 +1,4 @@ { pkgs, config, lib, ... }: -with lib; - -let - # We write a custom config file because the upstream config has some flaws - fd_cfg = config.services.bacula-fd; - fd_conf = pkgs.writeText "bacula-fd.conf" '' - Client { - Name = ${fd_cfg.name} - FDPort = ${toString fd_cfg.port} - WorkingDirectory = /var/lib/bacula - Pid Directory = /run - ${fd_cfg.extraClientConfig} - } - - ${concatStringsSep "\n" (mapAttrsToList (name: value: '' - Director { - Name = ${name} - Password = ${value.password} - Monitor = ${value.monitor} - } - '') fd_cfg.director)} - - Messages { - Name = Standard; - syslog = all, !skipped, !restored - ${fd_cfg.extraMessagesConfig} - } - ''; - # AGDSN is running an outdated version that we have to comply to - bacula_package = (pkgs.bacula.overrideAttrs (old: rec { - version = "9.6.7"; - src = pkgs.fetchurl { - url = "mirror://sourceforge/bacula/${old.pname}-${version}.tar.gz"; - sha256 = "sha256-3w+FJezbo4DnS1N8pxrfO3WWWT8CGJtZqw6//IXMyN4="; - }; - })); -in { sops.secrets = { "bacula/password".owner = "bacula"; @@ -56,7 +19,7 @@ in ''; extraMessagesConfig = '' director = abel-dir = all, !skipped, !restored - mailcommand = "${bacula_package}/bin/bsmtp -f \"Bacula \" -s \"Bacula report" %r" + mailcommand = "${pkgs.bacula}/bin/bsmtp -f \"Bacula \" -s \"Bacula report" %r" mail = root+backup = all, !skipped ''; director."abel-dir".password = "@${config.sops.secrets."bacula/password".path}"; @@ -73,5 +36,4 @@ in Password = @${config.sops.secrets."bacula/password".path} } ''; - systemd.services.bacula-fd.serviceConfig.ExecStart = lib.mkForce "${bacula_package}/sbin/bacula-fd -f -u root -g bacula -c ${fd_conf}"; } diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..52de42e --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,15 @@ +_final: prev: +let + inherit (prev) fetchurl; +in +{ + # AGDSN is running an outdated version that we have to comply to + bacula = (prev.bacula.overrideAttrs (old: rec { + version = "9.6.7"; + src = fetchurl { + url = "mirror://sourceforge/bacula/${old.pname}-${version}.tar.gz"; + sha256 = "sha256-3w+FJezbo4DnS1N8pxrfO3WWWT8CGJtZqw6//IXMyN4="; + }; + })); + +}