-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflake.nix
More file actions
192 lines (174 loc) · 5.66 KB
/
Copy pathflake.nix
File metadata and controls
192 lines (174 loc) · 5.66 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
{
description = "Kartoza Website";
# nixConfig = {
# extra-substituters = [ "https://example.cachix.org" ];
# extra-trusted-public-keys = [ "example.cachix.org-1:xxxx=" ];
# };
inputs = {
nixpkgs-version.url = "github:QGIS/qgis-nixpkgs-version";
nixpkgs.follows = "nixpkgs-version/nixpkgs-25-05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs =
{ self, nixpkgs, nixpkgs-unstable, ... }:
let
# Flake system
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (
system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
}
);
# nixpkgs-unstable for packages with security fixes
nixpkgsUnstableFor = forAllSystems (
system:
import nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
}
);
in
{
#
### PACKAGES
#
packages = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
rec {
website = pkgs.callPackage ./nix/package.nix { };
default = website;
}
);
#
### APPS
#
apps = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
pkgsUnstable = nixpkgsUnstableFor.${system};
inherit (nixpkgs) lib;
# Python environment for scripts
pythonEnv = pkgsUnstable.python3.withPackages (ps: with ps; [
requests pyyaml beautifulsoup4 python-dateutil tabulate
]);
wwwLauncher = pkgs.writeShellApplication {
name = "website";
runtimeInputs = [ pkgs.python3 ];
text = ''
exec ${lib.getExe pkgs.python3} \
-m http.server 8000 \
-d ${self.packages.${system}.website}/public/
'';
};
syncBlogs = pkgs.writeShellApplication {
name = "sync-blogs";
runtimeInputs = [ pythonEnv ];
text = ''
exec ${pythonEnv}/bin/python3 \
${self}/scripts/fetch-erpnext-blogs.py "$@"
'';
};
syncBlogsDryRun = pkgs.writeShellApplication {
name = "sync-blogs-dry-run";
runtimeInputs = [ pythonEnv ];
text = ''
exec ${pythonEnv}/bin/python3 \
${self}/scripts/fetch-erpnext-blogs.py --dry-run "$@"
'';
};
listBlogs = pkgs.writeShellApplication {
name = "list-blogs";
runtimeInputs = [ pythonEnv ];
text = ''
exec ${pythonEnv}/bin/python3 \
${self}/scripts/fetch-erpnext-blogs.py --list "$@"
'';
};
in
rec {
website = {
type = "app";
program = "${wwwLauncher}/bin/website";
};
sync-blogs = {
type = "app";
program = "${syncBlogs}/bin/sync-blogs";
};
sync-blogs-dry-run = {
type = "app";
program = "${syncBlogsDryRun}/bin/sync-blogs-dry-run";
};
list-blogs = {
type = "app";
program = "${listBlogs}/bin/list-blogs";
};
default = website;
}
);
#
### SHELLS
#
devShells = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
pkgsUnstable = nixpkgsUnstableFor.${system};
# Use unstable Python packages for security fixes (Pillow CVE-2026-25990)
pythonEnv = pkgsUnstable.python3.withPackages (ps: with ps; [
icalendar # Calendar handling
requests # HTTP requests - for ERPNext API
pyyaml # YAML generation
pillow # Image processing (12.1.0 - patched for CVE-2026-25990)
stripe # Donor management
beautifulsoup4 # HTML parsing - for content comparison
html2text # HTML to markdown conversion
python-dateutil # Date parsing
tabulate # Nice table output
pytest # Testing framework
]);
in
{
# Development environment
default = pkgs.mkShell {
packages = [
pkgs.hugo # Hugo for building the website
pkgs.vscode # VSCode for development
pythonEnv # Python with all packages from unstable
pkgs.gnumake # GNU Make for build automation
# Linting and formatting tools
pkgs.nodePackages.markdownlint-cli # Markdown linting
pkgs.nodePackages.prettier # Code formatting
pkgs.nodePackages.cspell # Spell checking
# Testing tools
pkgs.nodejs_22 # Node.js for Playwright
pkgs.playwright-driver.browsers # Playwright browsers
pkgs.chafa # Terminal image rendering (kitty/sixel/ASCII)
];
shellHook = ''
export DIRENV_LOG_FORMAT=
export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers}
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
# Render the project welcome screen. The script lives in the
# repo (not the Nix store) so contributors can tweak it without
# rebuilding the flake.
if [ -x scripts/dev-shell-welcome.sh ]; then
scripts/dev-shell-welcome.sh
fi
'';
};
}
);
};
}