-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathflake.nix
More file actions
108 lines (96 loc) · 2.62 KB
/
Copy pathflake.nix
File metadata and controls
108 lines (96 loc) · 2.62 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
gomod2nix = {
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
gotk4-nix = {
url = "github:diamondburned/gotk4-nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.gomod2nix.follows = "gomod2nix";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
gotk4-nix,
gomod2nix,
...
}:
with builtins;
with nixpkgs.lib;
let
baseFunc =
pkgs:
import ./nix/base.nix {
inherit pkgs;
src = self;
};
goPackage = "go_1_27";
in
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system}.appendOverlays [
gomod2nix.overlays.default
gotk4-nix.overlays.patchelf
];
go = pkgs.${goPackage};
in
{
devShells.default = gotk4-nix.lib.mkShell {
pkgs = pkgs;
base = baseFunc pkgs;
buildInputs = with pkgs; [
jq
niv
libxml2 # for xmllint
python3
imagemagick
pkgs.gomod2nix
(callPackage ./.github/tools { })
];
inherit go;
# Disable Gstreamer registry caching.
#
# I ran into issues with Dissent crashing with an error: `GstPlay:
# 'playbin3' element not found, please check your setup`.
# `gst-inspect-1.0 playbin3` yielded "blacklisted".
# This was only fixed after running `rm -r ~/.cache/gstreamer-1.0` and
# re-running this command.
GST_REGISTRY = "/dev/null";
};
packages.default = gotk4-nix.lib.mkPackage {
pkgs = pkgs;
base = baseFunc pkgs;
version = self.rev or "unknown";
inherit go;
};
apps = rec {
default = dissent;
dissent = {
type = "app";
program = "${self.packages.${system}.default}/bin/dissent";
};
staticcheck = {
type = "app";
program = "${pkgs.go-tools}/bin/staticcheck";
};
};
}
))
// {
lib = gotk4-nix.lib.mkLib rec {
pkgs = nixpkgs.legacyPackages.${builtins.currentSystem};
base = baseFunc pkgs;
go = pkgs.${goPackage};
};
};
}