Skip to content

Commit dc4275a

Browse files
Add a nix flake, mainly for the devShell (#41)
1 parent e3249cf commit dc4275a

6 files changed

Lines changed: 203 additions & 31 deletions

File tree

.github/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
ignore:
2-
- examples # Demo programs to showcase the library, coverage tracking not needed
2+
- examples # Demo programs to showcase the library, coverage tracking not needed

.github/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ categories:
3939
- dependencies
4040
- build
4141

42-
template: |
42+
template: |-
4343
## Changes
4444
$CHANGES

.github/workflows/CI.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ concurrency:
1313
permissions: {}
1414

1515
jobs:
16-
ci:
17-
name: CI
16+
go:
17+
name: Go
1818
permissions:
1919
contents: read
2020
uses: FollowTheProcess/ci/.github/workflows/Go.yml@v4
21+
22+
nix:
23+
name: Nix
24+
permissions:
25+
contents: read
26+
uses: FollowTheProcess/ci/.github/workflows/Nix.yml@v4

.gitignore

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,66 @@
11
# Allowlisting gitignore template for GO projects prevents us
22
# from adding various unwanted local files, such as generated
33
# files, developer configurations or IDE-specific files etc.
4+
#
5+
# Recommended: Go.AllowList.gitignore
46

57
# Ignore everything
68
*
79

8-
# Except these...
9-
10-
# Git/GitHub
10+
# But not these files...
1111
!/.gitignore
12-
!/.gitattributes
13-
!/.github/**/*
14-
!.mailmap
15-
16-
# Tangled workflows
17-
!/.tangled/**/*.yml
1812

1913
# Go
2014
!*.go
21-
!go.sum
22-
!go.mod
23-
!.goreleaser.yaml
24-
!.golangci.yml
25-
!staticcheck.conf
26-
!**/testdata/**
15+
!/go.sum
16+
!/go.mod
17+
!/.golangci.yml
18+
!/.goreleaser.yaml
19+
!*.tmpl
2720

28-
# CodeCov
29-
!codecov.yml
21+
# Test fixtures
22+
!**/testdata/**/*.txt
23+
!**/testdata/**/*.txtar
24+
!**/testdata/**/*.http
25+
!**/testdata/**/*.snap
3026

31-
# General
32-
!README.md
33-
!LICENSE
34-
!docs/**/*
35-
!examples/**/*
36-
37-
# Typos
38-
!.typos.toml
27+
# Go fuzz corpus entries are hashes with no extension
28+
!**/testdata/fuzz/**
3929

4030
# mise
4131
!mise.toml
4232

43-
# Copier
44-
!.copier-answers.yml
33+
# Git
34+
!/.gitattributes
35+
!.gitignore
36+
!/.mailmap
37+
38+
# GitHub Actions
39+
!.github/**/*.yml
40+
!.github/**/*.yaml
41+
!.github/renovate.json
42+
43+
# Tangled
44+
!.tangled/**/*.yml
45+
!.tangled/**/*.yaml
46+
47+
# Docs
48+
!*.tape
49+
!*.md
50+
!/README.md
51+
!/LICENSE
52+
53+
# Docker
54+
!/Dockerfile
55+
56+
# Nix
57+
!*.nix
58+
!/flake.lock
59+
!/.envrc
60+
61+
# Other
62+
!/.typos.toml
63+
!/.copier-answers.yml
4564

4665
# ...even if they are in subdirectories
4766
!*/

flake.lock

Lines changed: 79 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
description = "Simple, fast, opinionated logging for command line applications";
3+
4+
inputs = {
5+
nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
6+
flake-parts.url = "github:hercules-ci/flake-parts";
7+
treefmt-nix = {
8+
url = "github:numtide/treefmt-nix";
9+
inputs.nixpkgs.follows = "nixpkgs";
10+
};
11+
};
12+
13+
outputs =
14+
inputs@{ flake-parts, ... }:
15+
flake-parts.lib.mkFlake { inherit inputs; } {
16+
imports = [
17+
inputs.treefmt-nix.flakeModule
18+
];
19+
20+
systems = [
21+
"aarch64-linux"
22+
"x86_64-linux"
23+
"aarch64-darwin"
24+
"x86_64-darwin"
25+
];
26+
27+
perSystem = { pkgs, ... }: {
28+
treefmt.programs = {
29+
deadnix.enable = true;
30+
gofmt.enable = true;
31+
nixfmt.enable = true;
32+
shellcheck.enable = true;
33+
shfmt.enable = true;
34+
statix.enable = true;
35+
yamlfmt = {
36+
enable = true;
37+
settings.formatter = {
38+
type = "basic";
39+
eof_newline = true;
40+
indent = 2;
41+
pad_line_comments = 2;
42+
retain_line_breaks_single = true;
43+
scan_folded_as_literal = true;
44+
trim_trailing_whitespace = true;
45+
};
46+
};
47+
};
48+
49+
devShells.default = pkgs.mkShell {
50+
packages = with pkgs; [
51+
go
52+
golangci-lint
53+
golangci-lint-langserver
54+
goperf
55+
gopls
56+
gotools
57+
mise
58+
pkgsite
59+
typos
60+
];
61+
62+
shellHook = ''
63+
echo "👋🏻 Welcome to the log devShell!"
64+
'';
65+
};
66+
};
67+
};
68+
}

0 commit comments

Comments
 (0)