-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathflake.nix
More file actions
92 lines (83 loc) · 3.06 KB
/
Copy pathflake.nix
File metadata and controls
92 lines (83 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{
description = "Terminal-first calendar, todo, and journal manager";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
# Single source of truth for the released version; the release
# workflow refuses to run if VERSION does not match the tag.
version = pkgs.lib.trim (builtins.readFile ./VERSION);
# One source of truth for the Go toolchain. The package build and the
# devShell both use this value. go.mod asks for a 1.26 toolchain, so
# the flake selects go_1_26 from nixpkgs. The binary cache holds that
# package, so a build does not compile Go from the source.
go = pkgs.go_1_26;
chroncal = (pkgs.buildGoModule.override { inherit go; }) {
pname = "chroncal";
inherit version;
src = ./.;
subPackages = [ "cmd/chroncal" ];
vendorHash = "sha256-mNZMtpysKQUroyVCJ5z+D359AhrdkCJRvanUQ2hxjAw=";
env.CGO_ENABLED = "0";
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
"-X main.commit=${self.shortRev or "unknown"}"
"-X main.date=${self.lastModifiedDate or "unknown"}"
];
# Do not run the Go test suite in the Nix sandbox. The sandbox has
# no OS keyring, so the credential tests fail with exit status 195.
# The passwd home directory of the build user is /var/empty, so the
# account lock root is not writable. The lock root comes from the
# passwd entry on purpose, because every process of one OS user must
# resolve the same root. See issue #761.
# The CI workflow .github/workflows/ci.yml runs the full suite with
# the race detector on Linux and macOS for every push and every pull
# request.
doCheck = false;
meta = {
description = "Terminal-first calendar, todo, and journal manager";
homepage = "https://github.com/DouglasdeMoura/chroncal";
license = pkgs.lib.licenses.mit;
mainProgram = "chroncal";
};
};
in
{
packages = {
default = chroncal;
chroncal = chroncal;
};
apps.default = flake-utils.lib.mkApp {
drv = self.packages.${system}.default;
exePath = "/bin/chroncal";
};
devShells.default = pkgs.mkShell {
packages = [
go
pkgs.golangci-lint
pkgs.goreleaser
pkgs.govulncheck
pkgs.sqlc
];
};
}
)
// {
# The home-manager module is not per-system. It reads the pkgs of the
# host configuration, so it stays outside eachDefaultSystem.
homeModules.chroncal = import ./nix/hm-module.nix self;
homeModules.default = self.homeModules.chroncal;
};
}