From 0855f8f133f8ae87e6ccbf547d6c7e78bdd82430 Mon Sep 17 00:00:00 2001 From: Joseph Hanson Date: Sat, 27 Jul 2024 14:18:12 -0500 Subject: [PATCH] new regex parser for managing container versions with renovate --- .../services/onepassword-connect/default.nix | 16 ++++++++-- renovate.json | 13 -------- renovate.json5 | 31 +++++++++++++++++++ 3 files changed, 44 insertions(+), 16 deletions(-) delete mode 100644 renovate.json create mode 100644 renovate.json5 diff --git a/nixos/modules/nixos/services/onepassword-connect/default.nix b/nixos/modules/nixos/services/onepassword-connect/default.nix index d35c984..6ef5bc7 100644 --- a/nixos/modules/nixos/services/onepassword-connect/default.nix +++ b/nixos/modules/nixos/services/onepassword-connect/default.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, ... }: +{ lib, config, ... }: with lib; let cfg = config.mySystem.services.onepassword-connect; @@ -6,6 +6,16 @@ in { options.mySystem.services.onepassword-connect = { enable = mkEnableOption "onepassword-connect"; + apiVersion = lib.mkOption { + type = lib.types.str; + # renovate: depName=docker.io/1password/connect-api datasource=docker + default = "1.7.2"; + }; + syncVersion = lib.mkOption { + type = lib.types.str; + # renovate: depName=docker.io/1password/connect-sync datasource=docker + default = "1.7.2"; + }; credentialsFile = lib.mkOption { type = lib.types.path; }; @@ -25,7 +35,7 @@ in # Enable onepassword-connect containers. virtualisation.oci-containers.containers = { onepassword-connect-api = { - image = "docker.io/1password/connect-api:1.7.2"; + image = "docker.io/1password/connect-api:${cfg.apiVersion}"; autoStart = true; ports = [ "8080:8080" ]; volumes = [ @@ -35,7 +45,7 @@ in }; onepassword-connect-sync = { - image = "docker.io/1password/connect-sync:1.7.2"; + image = "docker.io/1password/connect-sync:${cfg.syncVersion}"; autoStart = true; ports = [ "8081:8080" ]; volumes = [ diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 23f1358..0000000 --- a/renovate.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:base" - ], - "nix": { - "enabled": true - }, - "lockFileMaintenance": { - "enabled": true, - "extends": ["schedule:daily"] - } -} diff --git a/renovate.json5 b/renovate.json5 new file mode 100644 index 0000000..e6ffc25 --- /dev/null +++ b/renovate.json5 @@ -0,0 +1,31 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base" + ], + "nix": { + "enabled": true + }, + "lockFileMaintenance": { + "enabled": true, + "extends": [ + "schedule:daily" + ] + }, + "customManagers": [ + { + "customType": "regex", + "description": "Process various dependencies in nix files", + "fileMatch": [ + "\\.nix$" + ], + "matchStrings": [ + // Newline + "(?m:^[ \\t]*?# ?renovate: depName=(?\\S+)( datasource=(?\\S+))?( versioning=(?\\S+))?( extractVersion=(?\\S+))?\\n[ \\t ]*?\\S+ = \"?(?[^\" ]+?)\";?$)" + ], + "datasourceTemplate": "{{#if datasource}}{{{datasource}}}{{else}}github-releases{{/if}}", + "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}", + "extractVersionTemplate": "{{#if extractVersion}}{{{extractVersion}}}{{else}}^(?.*)${{/if}}", + }, + ], +} \ No newline at end of file