web01: Use pict-rs 0.4 from nixpkgs

This commit is contained in:
adisbladis 2023-07-15 17:32:56 +12:00
parent ff8125cf9f
commit 850821fb2d
3 changed files with 5 additions and 83 deletions

56
flake.lock generated
View file

@ -40,24 +40,6 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1687171271,
"narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"hercules-ci-effects": {
"inputs": {
"flake-parts": [
@ -187,28 +169,6 @@
"type": "github"
}
},
"pict-rs": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1688870061,
"narHash": "sha256-1WNd7Ei21g01S5ko6y+uyhHP+xlGtnrwU8MLMxnW3P8=",
"ref": "refs/tags/v0.4.0",
"rev": "fa74e3c82d942f7732087c86bc509aeb9216f487",
"revCount": 705,
"type": "git",
"url": "https://git.asonix.dog/asonix/pict-rs.git"
},
"original": {
"ref": "refs/tags/v0.4.0",
"type": "git",
"url": "https://git.asonix.dog/asonix/pict-rs.git"
}
},
"root": {
"inputs": {
"disko": "disko",
@ -219,7 +179,6 @@
"nixpkgs-update": "nixpkgs-update",
"nixpkgs-update-github-releases": "nixpkgs-update-github-releases",
"nur-update": "nur-update",
"pict-rs": "pict-rs",
"sops-nix": "sops-nix",
"srvos": "srvos",
"tf-pkgs": "tf-pkgs",
@ -267,21 +226,6 @@
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"tf-pkgs": {
"locked": {
"lastModified": 1685899275,

View file

@ -42,13 +42,6 @@
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
# Pict-rs is the image hosting server for Lemmy.
# 0.4 comes with a separation of database and file storage which we require but isn't
# in a stable release yet.
# After pict-rs 0.4 is in nixpkgs we can remove this input.
pict-rs.url = "git+https://git.asonix.dog/asonix/pict-rs.git?ref=refs/tags/v0.4.0";
pict-rs.inputs.nixpkgs.follows = "nixpkgs";
tf-pkgs.url = "github:NixOS/nixpkgs/3f697e808b31a955462bc0b20b229d4072c99aa7";
};

View file

@ -1,4 +1,4 @@
{ inputs, pkgs, lib, config, ... }:
{ pkgs, config, ... }:
let
domain = "lemmy.nix-community.org";
@ -29,29 +29,14 @@ in
# Lemmy image storage
services.pict-rs = {
enable = true;
dataDir = "/mnt/lemmy-pict-rs";
package = pkgs.pict-rs; # Use 0.4.0+ despite stateVersion
storePath = "/mnt/lemmy-pict-rs";
repoPath = "/var/lib/pict-rs/sled";
};
# In the transition from 0.3.3 to 0.4 pict-rs breaks it's previous
# conflation of data storage and statate storage.
# 0.4 is still not released but we need this separation already.
# This renames the env vars set by the NixOS module.
#
# Migrate to using upstream NixOS definitions when 0.4 is in nixpkgs.
systemd.services.pict-rs.unitConfig.RequiresMountsFor = [ "/mnt/lemmy-pict-rs" ];
systemd.services.pict-rs.serviceConfig.EnvironmentFile = [
config.sops.secrets.pictrs-env.path
];
systemd.services.pict-rs.unitConfig.RequiresMountsFor = [ "/mnt/lemmy-pict-rs" ];
systemd.services.pict-rs.environment = {
PICTRS__REPO__PATH = "/var/lib/pict-rs/sled";
PICTRS__STORE__PATH = "/mnt/lemmy-pict-rs";
};
systemd.services.pict-rs.serviceConfig.ExecStart = lib.mkForce "${lib.getExe pkgs.pict-rs} run";
nixpkgs.overlays = [
(_final: _prev: {
inherit (inputs.pict-rs.packages.x86_64-linux) pict-rs;
})
];
# Pict-rs uses DynamicUser
systemd.services.pict-rs.serviceConfig.ReadWritePaths = "/mnt/lemmy-pict-rs";