fix(nix): Rework devShells

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel
2025-01-04 11:06:00 +01:00
parent eab4fedda3
commit 996b1b8a7f
6 changed files with 148 additions and 51 deletions

View File

@@ -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

52
flake.lock generated
View File

@@ -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",

View File

@@ -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;
};

27
nix/gocov-merger.nix Normal file
View File

@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: 2025 Steffen Vogel <post@steffenvogel.de>
# 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 ];
};
}

View File

@@ -1,8 +1,14 @@
# SPDX-FileCopyrightText: 2023 Philipp Jungkamp <p.jungkamp@gmx.net>
# SPDX-License-Identifier: Apache-2.0
{ pkgs, ... }:
pkgs.mkShell {
packages = with pkgs; [
{
mkShell,
nix-update,
goreleaser,
svu,
}:
mkShell {
packages = [
nix-update
goreleaser
svu

View File

@@ -1,42 +1,46 @@
# SPDX-FileCopyrightText: 2023 Philipp Jungkamp <p.jungkamp@gmx.net>
# SPDX-FileCopyrightText: 2025 Steffen Vogel <post@steffenvogel.de>
# 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" ];
}