|
1 | 1 | {
|
2 |
| - description = "Development environment and build process for a Hugo app with Python requirements"; |
| 2 | + description = "QGIS Planet Website"; |
| 3 | + |
| 4 | + # nixConfig = { |
| 5 | + # extra-substituters = [ "https://example.cachix.org" ]; |
| 6 | + # extra-trusted-public-keys = [ "example.cachix.org-1:xxxx=" ]; |
| 7 | + # }; |
3 | 8 |
|
4 | 9 | inputs = {
|
5 | 10 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
6 | 11 | };
|
7 | 12 |
|
8 |
| - outputs = { self, nixpkgs }: |
| 13 | + outputs = { self, nixpkgs }: |
9 | 14 | let
|
| 15 | + # Flake system |
10 | 16 | supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
11 | 17 | forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
12 |
| - |
13 |
| - nixpkgsFor = forAllSystems (system: import nixpkgs { |
14 |
| - inherit system; |
| 18 | + nixpkgsFor = forAllSystems (system: import nixpkgs { |
| 19 | + inherit system; |
15 | 20 | config.allowUnfree = true;
|
16 | 21 | });
|
17 | 22 |
|
18 |
| - mkDevShell = system: |
| 23 | + in |
| 24 | + { |
| 25 | + # |
| 26 | + ### PACKAGES |
| 27 | + # |
| 28 | + |
| 29 | + packages = forAllSystems (system: |
| 30 | + let |
| 31 | + pkgs = nixpkgsFor.${system}; |
| 32 | + |
| 33 | + in |
| 34 | + { |
| 35 | + website = pkgs.callPackage ./package.nix { }; |
| 36 | + }); |
| 37 | + |
| 38 | + |
| 39 | + # |
| 40 | + ### APPS |
| 41 | + # |
| 42 | + |
| 43 | + apps = forAllSystems (system: |
| 44 | + let |
| 45 | + pkgs = nixpkgsFor.${system}; |
| 46 | + inherit (nixpkgs) lib; |
| 47 | + |
| 48 | + wwwLauncher = pkgs.writeShellApplication { |
| 49 | + name = "website"; |
| 50 | + runtimeInputs = [ pkgs.python3 ]; |
| 51 | + text = '' |
| 52 | + exec ${lib.getExe pkgs.python3} \ |
| 53 | + -m http.server 8000 \ |
| 54 | + -d ${self.packages.${system}.website}/ |
| 55 | + ''; |
| 56 | + }; |
| 57 | + |
| 58 | + in |
| 59 | + { |
| 60 | + default = { |
| 61 | + type = "app"; |
| 62 | + program = "${wwwLauncher}/bin/website"; |
| 63 | + }; |
| 64 | + }); |
| 65 | + |
| 66 | + |
| 67 | + # |
| 68 | + ### SHELLS |
| 69 | + # |
| 70 | + |
| 71 | + devShells = forAllSystems (system: |
19 | 72 | let
|
20 | 73 | pkgs = nixpkgsFor.${system};
|
| 74 | + |
21 | 75 | in
|
22 | 76 | {
|
| 77 | + # Development environment |
23 | 78 | default = pkgs.mkShell {
|
| 79 | + |
24 | 80 | 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 |
| 81 | + hugo # Hugo for building the website |
| 82 | + vscode # VSCode for development |
| 83 | + python312Packages.feedparser # Python package: feedparser |
| 84 | + python312Packages.requests # Python package: requests |
| 85 | + python312Packages.pillow # Python package: Pillow |
30 | 86 | python312Packages.python-dateutil # Python package: dateutil
|
31 |
| - gnumake # GNU Make for build automation |
| 87 | + gnumake # GNU Make for build automation |
32 | 88 | ];
|
33 | 89 |
|
34 | 90 | shellHook = ''
|
|
51 | 107 | echo "-----------------------"
|
52 | 108 | '';
|
53 | 109 | };
|
54 |
| - }; |
55 |
| - |
56 |
| - in |
57 |
| - { |
58 |
| - devShells = builtins.listToAttrs (map (system: { |
59 |
| - name = system; |
60 |
| - value = mkDevShell system; |
61 |
| - }) supportedSystems); |
62 |
| - |
63 |
| - packages = builtins.listToAttrs (map (system: { |
64 |
| - name = system; |
65 |
| - value = { |
66 |
| - qgis-planet-website = nixpkgsFor.${system}.callPackage ./package.nix {}; |
67 |
| - }; |
68 |
| - }) supportedSystems); |
| 110 | + }); |
69 | 111 | };
|
70 | 112 | }
|
0 commit comments