diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index 768e1878..38c0d0d1 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -50,7 +50,11 @@ jobs: - name: Update version and vendor hashes in Nix derivation id: nix-update-hashes run: | - nix develop .#ci --command nix-update --flake --version ${{ steps.tags.outputs.next || steps.tags.outputs.current }} default + alias nix-update="nix develop .#ci --command nix-update --flake --version ${{ steps.tags.outputs.next || steps.tags.outputs.current }}" + + nix-update gocov-merger + nix-update cunicu + git diff --quiet || echo "changed=true" >> "$GITHUB_OUTPUT" - name: Commit changes diff --git a/flake.lock b/flake.lock index 45c34f95..f1896f6e 100644 --- a/flake.lock +++ b/flake.lock @@ -18,13 +18,37 @@ "type": "github" } }, + "nix-update": { + "inputs": { + "flake-parts": [ + "flake-parts" + ], + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1734774211, + "narHash": "sha256-C3xQn5oG2HIFM3ITncfsfPMqnRhBIx1+At1GKDV9CxM=", + "owner": "Mic92", + "repo": "nix-update", + "rev": "33baee51bcf3bf20271d812c7b8922d776cc764f", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "nix-update", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1734435836, - "narHash": "sha256-kMBQ5PRiFLagltK0sH+08aiNt3zGERC2297iB6vrvlU=", + "lastModified": 1735821806, + "narHash": "sha256-cuNapx/uQeCgeuhUhdck3JKbgpsml259sjUQnWM7zW8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4989a246d7a390a859852baddb1013f825435cee", + "rev": "d6973081434f88088e5321f83ebafe9a1167c367", "type": "github" }, "original": { @@ -49,8 +73,30 @@ "root": { "inputs": { "flake-parts": "flake-parts", + "nix-update": "nix-update", "nixpkgs": "nixpkgs" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nix-update", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730321837, + "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index a6754cf9..6c430790 100644 --- a/flake.nix +++ b/flake.nix @@ -5,15 +5,18 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; + nix-update = { + url = "github:Mic92/nix-update"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-parts.follows = "flake-parts"; + }; + }; }; outputs = - inputs@{ - nixpkgs, - self, - flake-parts, - }: - flake-parts.lib.mkFlake { inherit inputs; } { + inputs@{ self, ... }: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { flake = { nixosModules = rec { default = cunicu; @@ -21,7 +24,10 @@ }; overlays = { - default = final: prev: { cunicu = final.callPackage ./nix/cunicu.nix { }; }; + default = final: prev: { + cunicu = final.callPackage ./nix/cunicu.nix { }; + gocov-merger = final.callPackage ./nix/gocov-merger.nix { }; + }; }; }; @@ -39,7 +45,7 @@ ... }: let - pkgs = import nixpkgs { + pkgs = import inputs.nixpkgs { inherit system; overlays = [ self.overlays.default ]; }; @@ -47,13 +53,17 @@ { formatter = pkgs.nixfmt-rfc-style; - devShells = { - default = import ./nix/shell.nix { inherit pkgs self'; }; - ci = import ./nix/shell-ci.nix { inherit pkgs; }; - }; + devShells = + let + inherit (inputs.nix-update.packages.${system}) nix-update; + in + { + default = pkgs.callPackage ./nix/shell.nix { inherit nix-update; }; + ci = pkgs.callPackage ./nix/shell-ci.nix { inherit nix-update; }; + }; packages = { - inherit (pkgs) cunicu; + inherit (pkgs) cunicu gocov-merger; default = pkgs.cunicu; }; diff --git a/nix/gocov-merger.nix b/nix/gocov-merger.nix new file mode 100644 index 00000000..5c74fe06 --- /dev/null +++ b/nix/gocov-merger.nix @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: 2025 Steffen Vogel +# SPDX-License-Identifier: Apache-2.0 +{ + lib, + buildGoModule, + fetchFromGitHub, +}: +buildGoModule { + pname = "gocov-merger"; + version = "0.10.0"; + + src = fetchFromGitHub { + owner = "amobe"; + repo = "gocov-merger"; + rev = "5494981677165bdf08c8c0595c3b6ed246cb77de"; + hash = "sha256-zec5gKWbZBAIqlxRS811AwSZxNjmbIsE5/zInp94kR8="; + }; + + vendorHash = "sha256-6DznXSmQkb91GJZ2WMAIg558y+8a46KjRKfWRHsvus0="; + + meta = { + description = "Merge coverprofile results from multiple go cover runs"; + homepage = "https://github.com/amobe/gocov-merger"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ stv0g ]; + }; +} diff --git a/nix/shell-ci.nix b/nix/shell-ci.nix index c984b7fc..882d1c1e 100644 --- a/nix/shell-ci.nix +++ b/nix/shell-ci.nix @@ -1,8 +1,14 @@ # SPDX-FileCopyrightText: 2023 Philipp Jungkamp # SPDX-License-Identifier: Apache-2.0 -{ pkgs, ... }: -pkgs.mkShell { - packages = with pkgs; [ +{ + mkShell, + + nix-update, + goreleaser, + svu, +}: +mkShell { + packages = [ nix-update goreleaser svu diff --git a/nix/shell.nix b/nix/shell.nix index b65f40d2..7106cd2b 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -1,42 +1,46 @@ # SPDX-FileCopyrightText: 2023 Philipp Jungkamp # SPDX-FileCopyrightText: 2025 Steffen Vogel # SPDX-License-Identifier: Apache-2.0 -{ self', pkgs, ... }: -pkgs.mkShell { - packages = with pkgs; [ - yarn-berry - protobuf - gnumake - libpcap - reuse - ginkgo - goreleaser - golangci-lint - protoc-gen-go - protoc-gen-go-grpc - evans +{ + mkShell, - nix-update - goreleaser - svu - - (buildGoModule { - name = "gocov-merger"; - - src = fetchFromGitHub { - owner = "amobe"; - repo = "gocov-merger"; - rev = "5494981677165bdf08c8c0595c3b6ed246cb77de"; - hash = "sha256-zec5gKWbZBAIqlxRS811AwSZxNjmbIsE5/zInp94kR8="; - }; - - vendorHash = "sha256-6DznXSmQkb91GJZ2WMAIg558y+8a46KjRKfWRHsvus0="; - }) + coturn, + cunicu, + cunicu-website, + evans, + ginkgo, + gnumake, + gocov-merger, + golangci-lint, + goreleaser, + inotify-tools, + libpcap, + nix-update, + reuse, + svu, + ... +}: +mkShell { + packages = [ coturn + evans + ginkgo + gnumake + gocov-merger + golangci-lint + goreleaser + inotify-tools + libpcap + nix-update + reuse + svu ]; - inputsFrom = [ self'.packages.cunicu ]; + inputsFrom = [ + cunicu + cunicu-website + ]; hardeningDisable = [ "fortify" ]; }