Compare commits
No commits in common. "e215f7aa1d5b8ebc79a2bdcbafe5b55b33aa00d1" and "820b52314f5ae01b700cca1ce3305fc089d76903" have entirely different histories.
e215f7aa1d
...
820b52314f
18
flake.lock
18
flake.lock
|
@ -23,11 +23,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1627501942,
|
||||
"narHash": "sha256-rG2PUTgzmXvf/fSDCWKhlRwZjZs1/0TySC5eYHVJrmg=",
|
||||
"lastModified": 1626073055,
|
||||
"narHash": "sha256-vocByfpVu6m9zvtJugDvmd6/9iT2HJuG4tmDICKd0lI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "2272fc312d5dc477e70816d94e550d08729b307b",
|
||||
"rev": "775cb20bd4af7781fbf336fb201df02ee3d544bb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -39,11 +39,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1627391865,
|
||||
"narHash": "sha256-tPoWBO9Nzu3wuX37WcnctzL6LoDCErJLnfLGqqmXCm4=",
|
||||
"lastModified": 1626046891,
|
||||
"narHash": "sha256-Zt8saH+hAehXskW0iFAzk+iMillYoFBxvLReYNqGT9E=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "8ecc61c91a596df7d3293603a9c2384190c1b89a",
|
||||
"rev": "d8f8f31af9d77a48220e4e8a301d1e79774cb7d2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -55,11 +55,11 @@
|
|||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1627534577,
|
||||
"narHash": "sha256-cGVIlBkZZA9VvhXRRrWsTpkesJ/bSlGSPYPxafQVjSU=",
|
||||
"lastModified": 1626192709,
|
||||
"narHash": "sha256-REQ9ByMk4crAX37e8YDZOBl9Kxn+nTfnnLwwxczcoP0=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "0e1a91ef1d0460adfb5c669a9c0114f46e67956c",
|
||||
"rev": "564ec91b61dab796f1af44502ff3a9c124f4d6da",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
./pirate.nix
|
||||
./podgrab.nix
|
||||
./postgresql-backup.nix
|
||||
./postgresql.nix
|
||||
./quassel.nix
|
||||
./rss-bridge.nix
|
||||
./sabnzbd.nix
|
||||
|
|
|
@ -81,7 +81,6 @@ in
|
|||
users.groups.drone = { };
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ "drone" ];
|
||||
ensureUsers = [{
|
||||
name = "drone";
|
||||
|
|
|
@ -63,6 +63,7 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_12;
|
||||
initialScript = pkgs.writeText "synapse-init.sql" ''
|
||||
CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'synapse';
|
||||
CREATE DATABASE "matrix-synapse" WITH OWNER "matrix-synapse"
|
||||
|
|
|
@ -78,7 +78,7 @@ in
|
|||
dashboards = [
|
||||
{
|
||||
name = "Node Exporter";
|
||||
options.path = pkgs.nur.repos.alarsyo.grafanaDashboards.node-exporter;
|
||||
options.path = pkgs.nur.repos.alarsyo.grafana-dashboards.node-exporter;
|
||||
disableDeletion = true;
|
||||
}
|
||||
];
|
||||
|
|
|
@ -30,7 +30,7 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
package = pkgs.nextcloud22;
|
||||
package = pkgs.nextcloud21;
|
||||
hostName = nextcloudDomain;
|
||||
home = "/var/lib/nextcloud";
|
||||
maxUploadSize = cfg.maxSize;
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
services.grafana.provision.dashboards = [
|
||||
{
|
||||
name = "NGINX";
|
||||
options.path = pkgs.nur.repos.alarsyo.grafanaDashboards.nginx;
|
||||
options.path = pkgs.nur.repos.alarsyo.grafana-dashboards.nginx;
|
||||
disableDeletion = true;
|
||||
}
|
||||
];
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.services.postgresql;
|
||||
in
|
||||
{
|
||||
options.my.services.postgresql = with lib; {
|
||||
enable = my.mkDisableOption "postgres configuration";
|
||||
|
||||
# Transient option to be enabled for migrations
|
||||
upgradeScript = mkEnableOption "postgres upgrade script";
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
# Let other services enable postgres when they need it
|
||||
(lib.mkIf cfg.enable {
|
||||
services.postgresql = {
|
||||
package = pkgs.postgresql_13;
|
||||
};
|
||||
})
|
||||
|
||||
# Taken from the manual
|
||||
(lib.mkIf cfg.upgradeScript {
|
||||
containers.temp-pg.config.services.postgresql = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_13;
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
let
|
||||
newpg = config.containers.temp-pg.config.services.postgresql;
|
||||
in
|
||||
[
|
||||
(pkgs.writeScriptBin "upgrade-pg-cluster" ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
export OLDDATA="${config.services.postgresql.dataDir}"
|
||||
export NEWDATA="${newpg.dataDir}"
|
||||
export OLDBIN="${config.services.postgresql.package}/bin"
|
||||
export NEWBIN="${newpg.package}/bin"
|
||||
|
||||
if [ "$OLDDATA" -ef "$NEWDATA" ]; then
|
||||
echo "Cannot migrate to same data directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install -d -m 0700 -o postgres -g postgres "$NEWDATA"
|
||||
cd "$NEWDATA"
|
||||
sudo -u postgres $NEWBIN/initdb -D "$NEWDATA"
|
||||
|
||||
systemctl stop postgresql # old one
|
||||
|
||||
sudo -u postgres $NEWBIN/pg_upgrade \
|
||||
--old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \
|
||||
--old-bindir $OLDBIN --new-bindir $NEWBIN \
|
||||
"$@"
|
||||
'')
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue