generated from qgis/QGIS-User-Group-Website
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathflake.nix
More file actions
130 lines (120 loc) · 3.41 KB
/
flake.nix
File metadata and controls
130 lines (120 loc) · 3.41 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
{
description = "QGIS UC 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-11";
# Fetch the Hugo theme submodule directly as a flake input
qgis-website-theme = {
url = "github:qgis/QGIS-Hugo-Website-Theme";
flake = false; # it's not a flake, just a source tree
};
};
outputs =
{ self, nixpkgs, qgis-website-theme,... }:
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;
}
);
in
{
#
### PACKAGES
#
packages = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
rec {
website = pkgs.callPackage ./nix/package.nix {
theme = qgis-website-theme; # <-- pass the theme source in
};
default = website;
}
);
#
### APPS
#
apps = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
inherit (nixpkgs) lib;
wwwLauncher = pkgs.writeShellApplication {
name = "website";
runtimeInputs = [ pkgs.python3 ];
text = ''
exec ${lib.getExe pkgs.python3} \
-m http.server 8000 \
-d ${self.packages.${system}.website}/
'';
};
in
rec {
website = {
type = "app";
program = "${wwwLauncher}/bin/website";
};
default = website;
}
);
#
### SHELLS
#
devShells = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
{
# Development environment
default = pkgs.mkShell {
packages = with pkgs; [
hugo # Hugo for building the website
vscode # VSCode for development
python3Packages.feedparser # Python package: feedparser
python3Packages.requests # Python package: requests
python3Packages.pillow # Python package: Pillow
python3Packages.python-dateutil # Python package: dateutil
gnumake # GNU Make for build automation
];
shellHook = ''
export DIRENV_LOG_FORMAT=
echo "-----------------------"
echo "🌈 Your Hugo Dev Environment is ready."
echo "It provides hugo and vscode for use with the QGIS UC Website Project"
echo ""
echo "🪛 VSCode:"
echo "--------------------------------"
echo "Start vscode like this:"
echo ""
echo "./vscode.sh"
echo ""
echo "🪛 Hugo:"
echo "--------------------------------"
echo "Start Hugo like this:"
echo ""
echo "hugo server"
echo "-----------------------"
'';
};
}
);
};
}