Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update flake.nix #281

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jobs:
with:
cond: ${{ inputs.release }}
if_true: goreleaser release
if_false: goreleaser release --skip-publish --snapshot
if_false: goreleaser release --skip=publish --snapshot

- name: Build
run: nix develop --impure .#ci -c ${{ steps.build-command.outputs.value }}
Expand Down
29 changes: 19 additions & 10 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
version: 2

project_name: vault-env

dist: build/dist

before:
hooks:
- go mod tidy
builds:
- main: .
env:
- env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags: "-s -w -X main.version={{ .Version }}"
main: .
goos:
- linux
- darwin
Expand All @@ -15,13 +19,18 @@ builds:
- arm64

archives:
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
format_overrides:
- goos: windows
format: zip
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}

checksum:
name_template: "checksums.txt"

changelog:
skip: false
disable: true
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ deps: ## Install dependencies
GOLANGCI_VERSION = 1.53.3
COSIGN_VERSION = 2.2.2
LICENSEI_VERSION = 0.8.0
GORELEASER_VERSION = 1.18.2
GORELEASER_VERSION = 2.0.0

# Dependency binaries
GOLANGCI_LINT_BIN := golangci-lint
Expand Down
14 changes: 7 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 7 additions & 45 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
description = "Go libraries for interacting with Hashicorp Vault";

inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
devenv.url = "github:cachix/devenv";
};
Expand Down Expand Up @@ -40,16 +39,20 @@
packages = with pkgs; [
gnumake

# golangci-lint
goreleaser

# golangci-lint
# TODO: remove once https://github.com/NixOS/nixpkgs/pull/254878 hits unstable
(golangci-lint.override (prev: {
buildGoModule = pkgs.buildGo121Module;
}))

kubectl

yamllint
hadolint
] ++ [
self'.packages.licensei
self'.packages.golangci-lint
];

env = {
Expand Down Expand Up @@ -116,47 +119,6 @@
"-X github.com/hashicorp/vault/sdk/version.VersionPrerelease="
];
};

golangci-lint = pkgs.buildGo121Module rec {
pname = "golangci-lint";
version = "1.54.2";

src = pkgs.fetchFromGitHub {
owner = "golangci";
repo = "golangci-lint";
rev = "v${version}";
hash = "sha256-7nbgiUrp7S7sXt7uFXX8NHYbIRLZZQcg+18IdwAZBfE=";
};

vendorHash = "sha256-IyH5lG2a4zjsg/MUonCUiAgMl4xx8zSflRyzNgk8MR0=";

subPackages = [ "cmd/golangci-lint" ];

nativeBuildInputs = [ pkgs.installShellFiles ];

ldflags = [
"-s"
"-w"
"-X main.version=${version}"
"-X main.commit=v${version}"
"-X main.date=19700101-00:00:00"
];

postInstall = ''
for shell in bash zsh fish; do
HOME=$TMPDIR $out/bin/golangci-lint completion $shell > golangci-lint.$shell
installShellCompletion golangci-lint.$shell
done
'';

meta = with pkgs.lib; {
description = "Fast linters Runner for Go";
homepage = "https://golangci-lint.run/";
changelog = "https://github.com/golangci/golangci-lint/blob/v${version}/CHANGELOG.md";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ anpryl manveru mic92 ];
};
};
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func main() {
}

levelFilter := func(levels ...slog.Level) func(ctx context.Context, r slog.Record) bool {
return func(ctx context.Context, r slog.Record) bool {
return func(_ context.Context, r slog.Record) bool {
return slices.Contains(levels, r.Level)
}
}
Expand Down
Loading