Merge pull request #18 from astro/nixos-23.05

Replace ensurePermissions with ensureDBOwnership which is required in…
This commit is contained in:
Astro 2024-05-24 02:45:05 +02:00 committed by GitHub
commit dd1d644481
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 12 deletions

View file

@ -23,11 +23,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1713805509, "lastModified": 1716358718,
"narHash": "sha256-YgSEan4CcrjivCNO5ZNzhg7/8ViLkZ4CB/GrGBVSudo=", "narHash": "sha256-NQbegJb2ZZnAqp2EJhWwTf6DrZXSpA6xZCEq+RGV1r0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1e1dc66fe68972a76679644a5577828b6a7e8be4", "rev": "3f316d2a50699a78afe5e77ca486ad553169061e",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -10,7 +10,6 @@
outputs = { self, nixpkgs, utils, naersk }: outputs = { self, nixpkgs, utils, naersk }:
let let
inherit (nixpkgs) lib;
makeBuzzrelay = pkgs: makeBuzzrelay = pkgs:
let let
naersk-lib = pkgs.callPackage naersk { }; naersk-lib = pkgs.callPackage naersk { };

View file

@ -27,11 +27,11 @@
}; };
user = mkOption { user = mkOption {
type = types.str; type = types.str;
default = "relay"; default = "buzzrelay";
}; };
group = mkOption { group = mkOption {
type = types.str; type = types.str;
default = "relay"; default = "buzzrelay";
}; };
logLevel = mkOption { logLevel = mkOption {
type = types.enum [ "ERROR" "WARN" "INFO" "DEBUG" "TRACE" ]; type = types.enum [ "ERROR" "WARN" "INFO" "DEBUG" "TRACE" ];
@ -87,15 +87,14 @@
ensureDatabases = [ cfg.database ]; ensureDatabases = [ cfg.database ];
ensureUsers = [ { ensureUsers = [ {
name = cfg.user; name = cfg.user;
ensurePermissions = { ensureDBOwnership = true;
"DATABASE ${cfg.database}" = "ALL PRIVILEGES";
};
} ]; } ];
}; };
systemd.services.buzzrelay = { systemd.services.buzzrelay = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "postgresql.service" "network-online.target" ]; after = [ "postgresql.service" "network-online.target" ];
wants = [ "network-online.target" ];
environment.RUST_LOG = "buzzrelay=${cfg.logLevel}"; environment.RUST_LOG = "buzzrelay=${cfg.logLevel}";
serviceConfig = { serviceConfig = {
Type = "notify"; Type = "notify";

View file

@ -46,17 +46,17 @@ impl Actor {
let host; let host;
if uri.starts_with("acct:tag-") { if uri.starts_with("acct:tag-") {
let off = "acct:tag-".len(); let off = "acct:tag-".len();
let Some(at) = uri.find('@') else { return None; }; let at = uri.find('@')?;
kind = ActorKind::from_tag(&uri[off..at]); kind = ActorKind::from_tag(&uri[off..at]);
host = Arc::new(uri[at + 1..].to_string()); host = Arc::new(uri[at + 1..].to_string());
} else if uri.starts_with("acct:instance-") { } else if uri.starts_with("acct:instance-") {
let off = "acct:instance-".len(); 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()); kind = ActorKind::InstanceRelay(uri[off..at].to_lowercase());
host = Arc::new(uri[at + 1..].to_string()); host = Arc::new(uri[at + 1..].to_string());
} else if uri.starts_with("acct:language-") { } else if uri.starts_with("acct:language-") {
let off = "acct:language-".len(); let off = "acct:language-".len();
let Some(at) = uri.find('@') else { return None; }; let at = uri.find('@')?;
kind = ActorKind::from_language(&uri[off..at])?; kind = ActorKind::from_language(&uri[off..at])?;
host = Arc::new(uri[at + 1..].to_string()); host = Arc::new(uri[at + 1..].to_string());
} else if uri.starts_with("https://") { } else if uri.starts_with("https://") {