From 5c8712f48c5bcb6b79d3da1afd1268f84f5e35e3 Mon Sep 17 00:00:00 2001 From: technofab Date: Sat, 20 Dec 2025 14:37:26 +0100 Subject: [PATCH] chore: update cocogitto module to use nixpkgs package, assert version update flakes --- flake.lock | 12 ++++++------ lib/modules/cocogitto.nix | 36 +++++++++++++----------------------- nix/repo/devShells.nix | 3 +-- 3 files changed, 20 insertions(+), 31 deletions(-) diff --git a/flake.lock b/flake.lock index 7dd88b1..5aff439 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1757487488, - "narHash": "sha256-zwE/e7CuPJUWKdvvTCB7iunV4E/+G0lKfv4kk/5Izdg=", + "lastModified": 1766070988, + "narHash": "sha256-G/WVghka6c4bAzMhTwT2vjLccg/awmHkdKSd2JrycLc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ab0f3607a6c7486ea22229b92ed2d355f1482ee0", + "rev": "c6245e83d836d0433170a16eb185cefe0572f8b8", "type": "github" }, "original": { @@ -37,11 +37,11 @@ }, "locked": { "dir": "lib", - "lastModified": 1756370106, - "narHash": "sha256-l84ojcHuQWBwn4BRxQsMMfQpcq/Az/sHh/hSqFgVtyg=", + "lastModified": 1758738378, + "narHash": "sha256-NjzqdvQCDDdObEBH8x/vdhbdhrIB+N9E570uCdksGHY=", "owner": "rensa-nix", "repo": "core", - "rev": "9c1a29fa9ba7cbbb78b9e47eb8afbcd29303a3b4", + "rev": "abe19f9f13aff41de2b63304545c87d193d19ef4", "type": "gitlab" }, "original": { diff --git a/lib/modules/cocogitto.nix b/lib/modules/cocogitto.nix index 4198a9b..8622745 100644 --- a/lib/modules/cocogitto.nix +++ b/lib/modules/cocogitto.nix @@ -4,32 +4,22 @@ config, ... }: let - inherit (lib) mkEnableOption mkOption mkIf types; + inherit (lib) mkEnableOption mkOption mkIf types assertMsg versionAtLeast; cfg = config.cocogitto; - # we need a newer version than in nixpkgs, since the PR which adds `--config` - # didn't land in a release yet - cocogitto = pkgs.cocogitto.overrideAttrs (_prev: { - version = "2025-09-11"; - src = pkgs.fetchFromGitHub { - owner = "oknozor"; - repo = "cocogitto"; - rev = "031cc238cb3e3e8aa3a525c1df089c3e70020efc"; - hash = "sha256-fyhugacBLJPMqHWxoxBTFhIE3wHDB9xdrqJYzJc36I0="; - }; - }); - configFile = (pkgs.formats.toml {}).generate "cog.toml" cfg.config; - cogAlias = pkgs.writeTextFile { - name = "cog-alias"; - destination = "/bin/${cfg.alias}"; - executable = true; - text = - # sh - '' - ${cocogitto}/bin/cog --config "${configFile}" ''${@:1} - ''; - }; + cogAlias = assert assertMsg (versionAtLeast pkgs.cocogitto.version "6.4") + "cocogitto needs to be version 6.4 or higher to support the --config param"; + pkgs.writeTextFile { + name = "cog-alias"; + destination = "/bin/${cfg.alias}"; + executable = true; + text = + # sh + '' + ${pkgs.cocogitto}/bin/cog --config "${configFile}" ''${@:1} + ''; + }; in { options.cocogitto = { enable = diff --git a/nix/repo/devShells.nix b/nix/repo/devShells.nix index aca5e73..d26cba1 100644 --- a/nix/repo/devShells.nix +++ b/nix/repo/devShells.nix @@ -32,7 +32,6 @@ in { }; lefthook.config = { - skip_output = ["meta" "execution_out"]; "pre-commit" = { parallel = true; jobs = [ @@ -45,7 +44,7 @@ in { { name = "soonix"; stage_fixed = true; - run = "${soonix.shellHookFile}"; + run = "${soonix.packages."soonix:update"}/bin/soonix:update"; } ]; };