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 - name: Update version and vendor hashes in Nix derivation
id: nix-update-hashes id: nix-update-hashes
run: | 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" git diff --quiet || echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Commit changes - name: Commit changes

52
flake.lock generated
View File

@@ -18,13 +18,37 @@
"type": "github" "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1734435836, "lastModified": 1735821806,
"narHash": "sha256-kMBQ5PRiFLagltK0sH+08aiNt3zGERC2297iB6vrvlU=", "narHash": "sha256-cuNapx/uQeCgeuhUhdck3JKbgpsml259sjUQnWM7zW8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4989a246d7a390a859852baddb1013f825435cee", "rev": "d6973081434f88088e5321f83ebafe9a1167c367",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -49,8 +73,30 @@
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nix-update": "nix-update",
"nixpkgs": "nixpkgs" "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", "root": "root",

View File

@@ -5,15 +5,18 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts"; 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 = outputs =
inputs@{ inputs@{ self, ... }:
nixpkgs, inputs.flake-parts.lib.mkFlake { inherit inputs; } {
self,
flake-parts,
}:
flake-parts.lib.mkFlake { inherit inputs; } {
flake = { flake = {
nixosModules = rec { nixosModules = rec {
default = cunicu; default = cunicu;
@@ -21,7 +24,10 @@
}; };
overlays = { 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 let
pkgs = import nixpkgs { pkgs = import inputs.nixpkgs {
inherit system; inherit system;
overlays = [ self.overlays.default ]; overlays = [ self.overlays.default ];
}; };
@@ -47,13 +53,17 @@
{ {
formatter = pkgs.nixfmt-rfc-style; formatter = pkgs.nixfmt-rfc-style;
devShells = { devShells =
default = import ./nix/shell.nix { inherit pkgs self'; }; let
ci = import ./nix/shell-ci.nix { inherit pkgs; }; 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 = { packages = {
inherit (pkgs) cunicu; inherit (pkgs) cunicu gocov-merger;
default = pkgs.cunicu; 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-FileCopyrightText: 2023 Philipp Jungkamp <p.jungkamp@gmx.net>
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
{ pkgs, ... }: {
pkgs.mkShell { mkShell,
packages = with pkgs; [
nix-update,
goreleaser,
svu,
}:
mkShell {
packages = [
nix-update nix-update
goreleaser goreleaser
svu svu

View File

@@ -1,42 +1,46 @@
# SPDX-FileCopyrightText: 2023 Philipp Jungkamp <p.jungkamp@gmx.net> # SPDX-FileCopyrightText: 2023 Philipp Jungkamp <p.jungkamp@gmx.net>
# SPDX-FileCopyrightText: 2025 Steffen Vogel <post@steffenvogel.de> # SPDX-FileCopyrightText: 2025 Steffen Vogel <post@steffenvogel.de>
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
{ self', pkgs, ... }: {
pkgs.mkShell { mkShell,
packages = with pkgs; [
yarn-berry
protobuf
gnumake
libpcap
reuse
ginkgo
goreleaser
golangci-lint
protoc-gen-go
protoc-gen-go-grpc
evans
nix-update coturn,
goreleaser cunicu,
svu cunicu-website,
evans,
(buildGoModule { ginkgo,
name = "gocov-merger"; gnumake,
gocov-merger,
src = fetchFromGitHub { golangci-lint,
owner = "amobe"; goreleaser,
repo = "gocov-merger"; inotify-tools,
rev = "5494981677165bdf08c8c0595c3b6ed246cb77de"; libpcap,
hash = "sha256-zec5gKWbZBAIqlxRS811AwSZxNjmbIsE5/zInp94kR8="; nix-update,
}; reuse,
svu,
vendorHash = "sha256-6DznXSmQkb91GJZ2WMAIg558y+8a46KjRKfWRHsvus0=";
})
...
}:
mkShell {
packages = [
coturn 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" ]; hardeningDisable = [ "fortify" ];
} }