From f8d91b6a7b35f2ffa8fc6b7dcaa94e20ef1bd8f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 24 May 2024 02:21:41 +0200 Subject: [PATCH 1/3] Replace ensurePermissions with ensureDBOwnership which is required in NixOS 24.05 This also requires changing the user/group to match the database name --- flake.lock | 6 +++--- flake.nix | 1 - nixos-module.nix | 8 +++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 56f57a3..5ae5b2a 100644 --- a/flake.lock +++ b/flake.lock @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1713805509, - "narHash": "sha256-YgSEan4CcrjivCNO5ZNzhg7/8ViLkZ4CB/GrGBVSudo=", + "lastModified": 1716358718, + "narHash": "sha256-NQbegJb2ZZnAqp2EJhWwTf6DrZXSpA6xZCEq+RGV1r0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1e1dc66fe68972a76679644a5577828b6a7e8be4", + "rev": "3f316d2a50699a78afe5e77ca486ad553169061e", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7ae63f0..5f086e7 100644 --- a/flake.nix +++ b/flake.nix @@ -10,7 +10,6 @@ outputs = { self, nixpkgs, utils, naersk }: let - inherit (nixpkgs) lib; makeBuzzrelay = pkgs: let naersk-lib = pkgs.callPackage naersk { }; diff --git a/nixos-module.nix b/nixos-module.nix index 0089e19..16024ad 100644 --- a/nixos-module.nix +++ b/nixos-module.nix @@ -27,11 +27,11 @@ }; user = mkOption { type = types.str; - default = "relay"; + default = "buzzrelay"; }; group = mkOption { type = types.str; - default = "relay"; + default = "buzzrelay"; }; logLevel = mkOption { type = types.enum [ "ERROR" "WARN" "INFO" "DEBUG" "TRACE" ]; @@ -87,9 +87,7 @@ ensureDatabases = [ cfg.database ]; ensureUsers = [ { name = cfg.user; - ensurePermissions = { - "DATABASE ${cfg.database}" = "ALL PRIVILEGES"; - }; + ensureDBOwnership = true; } ]; }; From 997471d094cb6c01efc43ff4a311722200ffc6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 24 May 2024 02:36:05 +0200 Subject: [PATCH 2/3] Fix clippy --- src/actor.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index 505caa4..7e5e532 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -46,17 +46,17 @@ impl Actor { let host; if uri.starts_with("acct:tag-") { let off = "acct:tag-".len(); - let Some(at) = uri.find('@') else { return None; }; + let at = uri.find('@')?; kind = ActorKind::from_tag(&uri[off..at]); host = Arc::new(uri[at + 1..].to_string()); } else if uri.starts_with("acct:instance-") { let off = "acct:instance-".len(); - let Some(at) = uri.find('@') else { return None; }; + let at = uri.find('@')?; kind = ActorKind::InstanceRelay(uri[off..at].to_lowercase()); host = Arc::new(uri[at + 1..].to_string()); } else if uri.starts_with("acct:language-") { let off = "acct:language-".len(); - let Some(at) = uri.find('@') else { return None; }; + let at = uri.find('@')?; kind = ActorKind::from_language(&uri[off..at])?; host = Arc::new(uri[at + 1..].to_string()); } else if uri.starts_with("https://") { From 30cdfc28ad2a717bf4f3cb4e7adb0ffa8bc12ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 24 May 2024 02:38:25 +0200 Subject: [PATCH 3/3] Fix network-online.target warning --- nixos-module.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos-module.nix b/nixos-module.nix index 16024ad..f4f35d9 100644 --- a/nixos-module.nix +++ b/nixos-module.nix @@ -94,6 +94,7 @@ systemd.services.buzzrelay = { wantedBy = [ "multi-user.target" ]; after = [ "postgresql.service" "network-online.target" ]; + wants = [ "network-online.target" ]; environment.RUST_LOG = "buzzrelay=${cfg.logLevel}"; serviceConfig = { Type = "notify";