lol

Merge pull request #243373 from adisbladis/pict-rs_0_4

pict-rs: 0.3.3 -> 0.4.0

authored by

adisbladis and committed by
GitHub
110489e1 dee09dee

+128 -15
+2
nixos/doc/manual/release-notes/rl-2311.section.md
··· 72 72 73 73 - `services.lemmy.settings.federation` was removed in 0.17.0 and no longer has any effect. To enable federation, the hostname must be set in the configuration file and then federation must be enabled in the admin web UI. See the [release notes](https://github.com/LemmyNet/lemmy/blob/c32585b03429f0f76d1e4ff738786321a0a9df98/RELEASES.md#upgrade-instructions) for more details. 74 74 75 + - `pict-rs` was upgraded from 0.3 to 0.4 and contains an incompatible database & configuration change. To upgrade on systems with `stateVersion = "23.05";` or older follow the migration steps from https://git.asonix.dog/asonix/pict-rs#user-content-0-3-to-0-4-migration-guide and set `services.pict-rs.package = pkgs.pict-rs;`. 76 + 75 77 - The following packages in `haskellPackages` have now a separate bin output: `cabal-fmt`, `calligraphy`, `eventlog2html`, `ghc-debug-brick`, `hindent`, `nixfmt`, `releaser`. This means you need to replace e.g. `"${pkgs.haskellPackages.nixfmt}/bin/nixfmt"` with `"${lib.getBin pkgs.haskellPackages.nixfmt}/bin/nixfmt"` or `"${lib.getExe pkgs.haskellPackages.nixfmt}"`. The binaries also won’t be in scope if you rely on them being installed e.g. via `ghcWithPackages`. `environment.packages` picks the `bin` output automatically, so for normal installation no intervention is required. Also, toplevel attributes like `pkgs.nixfmt` are not impacted negatively by this change. 76 78 77 79 - `spamassassin` no longer supports the `Hashcash` module. The module needs to be removed from the `loadplugin` list if it was copied over from the default `initPreConf` option.
+65 -7
nixos/modules/services/web-apps/pict-rs.nix
··· 1 1 { lib, pkgs, config, ... }: 2 - with lib; 2 + 3 3 let 4 4 cfg = config.services.pict-rs; 5 + inherit (lib) maintainers mkOption types; 6 + 7 + is03 = lib.versionOlder cfg.package.version "0.4.0"; 8 + 5 9 in 6 10 { 7 11 meta.maintainers = with maintainers; [ happysalada ]; 8 12 meta.doc = ./pict-rs.md; 9 13 10 14 options.services.pict-rs = { 11 - enable = mkEnableOption (lib.mdDoc "pict-rs server"); 15 + enable = lib.mkEnableOption (lib.mdDoc "pict-rs server"); 16 + 17 + package = mkOption { 18 + type = types.package; 19 + example = lib.literalExpression "pkgs.pict-rs"; 20 + description = lib.mdDoc '' 21 + pict-rs package to use. 22 + ''; 23 + }; 24 + 12 25 dataDir = mkOption { 13 26 type = types.path; 14 27 default = "/var/lib/pict-rs"; 15 28 description = lib.mdDoc '' 29 + The directory where to store the uploaded images & database. 30 + ''; 31 + }; 32 + 33 + repoPath = mkOption { 34 + type = types.nullOr (types.path); 35 + default = null; 36 + description = lib.mdDoc '' 37 + The directory where to store the database. 38 + This option takes precedence over dataDir. 39 + ''; 40 + }; 41 + 42 + storePath = mkOption { 43 + type = types.nullOr (types.path); 44 + default = null; 45 + description = lib.mdDoc '' 16 46 The directory where to store the uploaded images. 47 + This option takes precedence over dataDir. 17 48 ''; 18 49 }; 50 + 19 51 address = mkOption { 20 52 type = types.str; 21 53 default = "127.0.0.1"; ··· 23 55 The IPv4 address to deploy the service to. 24 56 ''; 25 57 }; 58 + 26 59 port = mkOption { 27 60 type = types.port; 28 61 default = 8080; ··· 31 64 ''; 32 65 }; 33 66 }; 67 + 34 68 config = lib.mkIf cfg.enable { 69 + services.pict-rs.package = lib.mkDefault ( 70 + # An incompatible db change happened in the transition from 0.3 to 0.4. 71 + if lib.versionAtLeast config.system.stateVersion "23.11" 72 + then pkgs.pict-rs 73 + else pkgs.pict-rs_0_3 74 + ); 75 + 76 + # Account for config differences between 0.3 and 0.4 77 + assertions = [ 78 + { 79 + assertion = !is03 || (cfg.repoPath == null && cfg.storePath == null); 80 + message = '' 81 + Using `services.pict-rs.repoPath` or `services.pict-rs.storePath` with pict-rs 0.3 or older has no effect. 82 + ''; 83 + } 84 + ]; 85 + 35 86 systemd.services.pict-rs = { 36 - environment = { 37 - PICTRS__PATH = cfg.dataDir; 38 - PICTRS__ADDR = "${cfg.address}:${toString cfg.port}"; 39 - }; 87 + # Pict-rs split it's database and image storage paths in 0.4.0. 88 + environment = 89 + if is03 then { 90 + PICTRS__PATH = cfg.dataDir; 91 + PICTRS__ADDR = "${cfg.address}:${toString cfg.port}"; 92 + } else { 93 + PICTRS__REPO__PATH = if cfg.repoPath != null then cfg.repoPath else "${cfg.dataDir}/sled-repo"; 94 + PICTRS__STORE__PATH = if cfg.storePath != null then cfg.storePath else "${cfg.dataDir}/files"; 95 + PICTRS__SERVER__ADDR = "${cfg.address}:${toString cfg.port}"; 96 + }; 40 97 wantedBy = [ "multi-user.target" ]; 41 98 serviceConfig = { 42 99 DynamicUser = true; 43 100 StateDirectory = "pict-rs"; 44 - ExecStart = "${pkgs.pict-rs}/bin/pict-rs"; 101 + ExecStart = if is03 then "${lib.getBin cfg.package}/bin/pict-rs" else "${lib.getBin cfg.package}/bin/pict-rs run"; 45 102 }; 46 103 }; 47 104 }; 105 + 48 106 }
+53
pkgs/servers/web-apps/pict-rs/0.3.nix
··· 1 + { stdenv 2 + , lib 3 + , fetchFromGitea 4 + , rustPlatform 5 + , makeWrapper 6 + , protobuf 7 + , Security 8 + , imagemagick 9 + , ffmpeg 10 + , exiftool 11 + , nixosTests 12 + }: 13 + 14 + rustPlatform.buildRustPackage rec { 15 + pname = "pict-rs"; 16 + version = "0.3.3"; 17 + 18 + src = fetchFromGitea { 19 + domain = "git.asonix.dog"; 20 + owner = "asonix"; 21 + repo = pname; 22 + rev = "v${version}"; 23 + sha256 = "mEZBFDR+/aMRFw54Yq+f1gyEz8H+5IggNCpzv3UdDFg="; 24 + }; 25 + 26 + cargoLock = { 27 + lockFile = ./Cargo-0.3.lock; 28 + outputHashes = { 29 + "aws-creds-0.29.1" = "bwDFmDPThMLrpaB7cAj/2/vJKhbX6/DqgcIRBVKSZhg="; 30 + }; 31 + }; 32 + 33 + # needed for internal protobuf c wrapper library 34 + PROTOC = "${protobuf}/bin/protoc"; 35 + PROTOC_INCLUDE = "${protobuf}/include"; 36 + 37 + nativeBuildInputs = [ makeWrapper ]; 38 + buildInputs = lib.optionals stdenv.isDarwin [ Security ]; 39 + 40 + postInstall = '' 41 + wrapProgram "$out/bin/pict-rs" \ 42 + --prefix PATH : "${lib.makeBinPath [ imagemagick ffmpeg exiftool ]}" 43 + ''; 44 + 45 + passthru.tests = { inherit (nixosTests) pict-rs; }; 46 + 47 + meta = with lib; { 48 + description = "A simple image hosting service"; 49 + homepage = "https://git.asonix.dog/asonix/pict-rs"; 50 + license = with licenses; [ agpl3Plus ]; 51 + maintainers = with maintainers; [ happysalada ]; 52 + }; 53 + }
pkgs/servers/web-apps/pict-rs/Cargo.lock pkgs/servers/web-apps/pict-rs/Cargo-0.3.lock
+3 -8
pkgs/servers/web-apps/pict-rs/default.nix
··· 13 13 14 14 rustPlatform.buildRustPackage rec { 15 15 pname = "pict-rs"; 16 - version = "0.3.3"; 16 + version = "0.4.0"; 17 17 18 18 src = fetchFromGitea { 19 19 domain = "git.asonix.dog"; 20 20 owner = "asonix"; 21 21 repo = pname; 22 22 rev = "v${version}"; 23 - sha256 = "mEZBFDR+/aMRFw54Yq+f1gyEz8H+5IggNCpzv3UdDFg="; 23 + sha256 = "sha256-1WNd7Ei21g01S5ko6y+uyhHP+xlGtnrwU8MLMxnW3P8="; 24 24 }; 25 25 26 - cargoLock = { 27 - lockFile = ./Cargo.lock; 28 - outputHashes = { 29 - "aws-creds-0.29.1" = "bwDFmDPThMLrpaB7cAj/2/vJKhbX6/DqgcIRBVKSZhg="; 30 - }; 31 - }; 26 + cargoHash = "sha256-xD2LvB0xBDAShp4k4VnnhnOWowhU/0OKvkEzI6RzuJY="; 32 27 33 28 # needed for internal protobuf c wrapper library 34 29 PROTOC = "${protobuf}/bin/protoc";
+5
pkgs/top-level/all-packages.nix
··· 26335 26335 ffmpeg = ffmpeg_4; 26336 26336 }; 26337 26337 26338 + pict-rs_0_3 = callPackage ../servers/web-apps/pict-rs/0.3.nix { 26339 + inherit (darwin.apple_sdk.frameworks) Security; 26340 + ffmpeg = ffmpeg_4; 26341 + }; 26342 + 26338 26343 popa3d = callPackage ../servers/mail/popa3d { }; 26339 26344 26340 26345 postfix = callPackage ../servers/mail/postfix { };