-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
112 lines (96 loc) · 2.7 KB
/
flake.nix
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
109
110
111
112
{
description = "OpenAI API compatible GTK4 chat client";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
systems,
treefmt-nix,
...
}:
let
forAllSystems = nixpkgs.lib.genAttrs (import systems);
treefmtEval = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
treefmt-nix.lib.evalModule pkgs ./treefmt.nix
);
in
{
formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper);
checks = forAllSystems (system: {
formatting = treefmtEval.${system}.config.build.check self;
});
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nim
nimble
pkg-config
(writeShellScriptBin "lock" ''
nimble lock
${nim_lk}/bin/nim_lk nimble-to-nix > lock.json
'')
(writeShellScriptBin "update" ''
nimble upgrade
${nim_lk}/bin/nim_lk nimble-to-nix > lock.json
'')
];
buildInputs = with pkgs; [
openssl
gtk4
libadwaita
];
shellHook = ''
echo -e "\033[0;32;4mHeper commands:\033[0m"
echo "'lock' instead of 'nimble lock'"
echo "'update' instead of 'nimble upgrade'"
'';
};
}
);
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.buildNimPackage {
pname = "chatgptclient";
version = "0.2.0";
src = self;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [
openssl
gtk4
libadwaita
];
lockFile = ./lock.json;
meta = with pkgs.lib; {
description = "OpenAI API compatible GTK4 chat client";
homepage = "https://github.com/jaredmontoya/chatgptclient";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ jaredmontoya ];
platforms = platforms.linux;
mainProgram = "chatgptclient";
};
};
}
);
};
}