Skip to content

Commit b1c89f1

Browse files
committed
Update flakes, add support for other architectures
1 parent d1eba5f commit b1c89f1

File tree

2 files changed

+58
-49
lines changed

2 files changed

+58
-49
lines changed

flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 54 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,69 @@
22
description = "Development environment and build process for a Hugo app with Python requirements";
33

44
inputs = {
5-
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
66
};
77

88
outputs = { self, nixpkgs }:
99
let
10-
system = "x86_64-linux";
10+
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
11+
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
1112

12-
# Importing packages from nixpkgs
13-
pkgs = import nixpkgs {
14-
inherit system;
15-
config.allowUnfree = true; # Allow unfree packages like VSCode if needed
16-
};
17-
18-
19-
mkDevShell = pkgs.mkShell {
20-
packages = with pkgs; [
21-
hugo # Hugo for building the website
22-
vscode # VSCode for development
23-
python312Packages.feedparser # Python package: feedparser
24-
python312Packages.requests # Python package: requests
25-
python312Packages.pillow # Python package: Pillow
26-
python312Packages.python-dateutil # Python package: dateutil
27-
gnumake # GNU Make for build automation
28-
];
13+
nixpkgsFor = forAllSystems (system: import nixpkgs {
14+
inherit system;
15+
config.allowUnfree = true;
16+
});
17+
18+
mkDevShell = system:
19+
let
20+
pkgs = nixpkgsFor.${system};
21+
in
22+
{
23+
default = pkgs.mkShell {
24+
packages = with pkgs; [
25+
hugo # Hugo for building the website
26+
vscode # VSCode for development
27+
python312Packages.feedparser # Python package: feedparser
28+
python312Packages.requests # Python package: requests
29+
python312Packages.pillow # Python package: Pillow
30+
python312Packages.python-dateutil # Python package: dateutil
31+
gnumake # GNU Make for build automation
32+
];
33+
34+
shellHook = ''
35+
export DIRENV_LOG_FORMAT=
36+
echo "-----------------------"
37+
echo "🌈 Your Hugo Dev Environment is ready."
38+
echo "It provides hugo and vscode for use with the QGIS Planet Website Project"
39+
echo ""
40+
echo "🪛 VSCode:"
41+
echo "--------------------------------"
42+
echo "Start vscode like this:"
43+
echo ""
44+
echo "./vscode.sh"
45+
echo ""
46+
echo "🪛 Hugo:"
47+
echo "--------------------------------"
48+
echo "Start Hugo like this:"
49+
echo ""
50+
echo "hugo server"
51+
echo "-----------------------"
52+
'';
53+
};
54+
};
2955

30-
shellHook = ''
31-
export DIRENV_LOG_FORMAT=
32-
echo "-----------------------"
33-
echo "🌈 Your Hugo Dev Environment is ready."
34-
echo "It provides hugo and vscode for use with the QGIS Planet Website Project"
35-
echo ""
36-
echo "🪛 VSCode:"
37-
echo "--------------------------------"
38-
echo "Start vscode like this:"
39-
echo ""
40-
echo "./vscode.sh"
41-
echo ""
42-
echo "🪛 Hugo:"
43-
echo "--------------------------------"
44-
echo "Start Hugo like this:"
45-
echo ""
46-
echo "hugo server"
47-
echo "-----------------------"
48-
'';
49-
};
50-
5156
in
5257
{
53-
devShells.x86_64-linux.default = mkDevShell;
58+
devShells = builtins.listToAttrs (map (system: {
59+
name = system;
60+
value = mkDevShell system;
61+
}) supportedSystems);
5462

55-
packages = {
56-
x86_64-linux = {
57-
qgis-planet-website = pkgs.callPackage ./package.nix {};
63+
packages = builtins.listToAttrs (map (system: {
64+
name = system;
65+
value = {
66+
qgis-planet-website = nixpkgsFor.${system}.callPackage ./package.nix {};
5867
};
59-
};
68+
}) supportedSystems);
6069
};
6170
}

0 commit comments

Comments
 (0)