|
2 | 2 | description = "selfoss feed reader and aggregator"; |
3 | 3 |
|
4 | 4 | inputs = { |
| 5 | + # Tool for downloading Composer dependencies using Nix. |
| 6 | + c4.url = "github:fossar/composition-c4"; |
| 7 | + |
5 | 8 | # Shim to make flake.nix work with stable Nix. |
6 | 9 | flake-compat = { |
7 | 10 | url = "github:edolstra/flake-compat"; |
|
11 | 14 | # Repository with software packages. |
12 | 15 | nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; |
13 | 16 |
|
| 17 | + napalm = { |
| 18 | + url = "github:nmattia/napalm"; |
| 19 | + inputs.nixpkgs.follows = "nixpkgs"; |
| 20 | + }; |
| 21 | + |
14 | 22 | utils.url = "github:numtide/flake-utils"; |
15 | 23 |
|
16 | 24 | # Package expression for old PHP versions. |
17 | 25 | phps.url = "github:fossar/nix-phps"; |
18 | 26 | }; |
19 | 27 |
|
20 | | - outputs = { self, flake-compat, nixpkgs, phps, utils }: |
| 28 | + outputs = { self, c4, flake-compat, napalm, nixpkgs, phps, utils }: |
21 | 29 | let |
22 | 30 | # Configure the development shell here (e.g. for CI). |
23 | 31 |
|
|
28 | 36 | utils.lib.eachDefaultSystem (system: |
29 | 37 | let |
30 | 38 | # Get Nixpkgs packages for current platform. |
31 | | - pkgs = nixpkgs.legacyPackages.${system}; |
| 39 | + pkgs = import nixpkgs { |
| 40 | + inherit system; |
| 41 | + overlays = [ |
| 42 | + # Include c4 tool. |
| 43 | + c4.overlay |
| 44 | + |
| 45 | + # Include napalm tool. |
| 46 | + napalm.overlay |
| 47 | + ]; |
| 48 | + }; |
32 | 49 |
|
33 | 50 | # Create a PHP package from the selected PHP package, with some extra extensions enabled. |
34 | 51 | php = phps.packages.${system}.${matrix.phpPackage}.withExtensions ({ enabled, all }: with all; enabled ++ [ |
|
69 | 86 | # node-gyp wants some locales, let’s make them available through an environment variable. |
70 | 87 | LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; |
71 | 88 | }; |
| 89 | + |
| 90 | + packages = { |
| 91 | + selfoss = |
| 92 | + let |
| 93 | + filteredSrc = builtins.path { |
| 94 | + path = ./.; |
| 95 | + filter = |
| 96 | + path: |
| 97 | + type: |
| 98 | + !builtins.elem (builtins.baseNameOf path) [ |
| 99 | + # These should not be part of the source code for packages built by Nix. |
| 100 | + # Otherwise, iterating on Nix files will trigger a rebuild all the time since the source will have changed. |
| 101 | + "flake.nix" |
| 102 | + "flake.lock" |
| 103 | + "utils" |
| 104 | + # CI changes should not affect it either. |
| 105 | + ".github" |
| 106 | + ]; |
| 107 | + # Unfortunately, it still triggers a rebuild since any change will cause the flake to be re-cloned. |
| 108 | + # https://github.com/NixOS/nix/issues/3732 |
| 109 | + }; |
| 110 | + |
| 111 | + # Due to Nix bug, we cannot actually use the output directly and need to copy it to a new derivation. |
| 112 | + # https://github.com/NixOS/nix/issues/3234 |
| 113 | + src = pkgs.runCommand "selfoss-src" {} "cp -r '${filteredSrc}' $out"; |
| 114 | + in |
| 115 | + pkgs.callPackage ./utils/selfoss.nix rec { |
| 116 | + inherit src; |
| 117 | + }; |
| 118 | + }; |
72 | 119 | } |
73 | 120 | ); |
74 | 121 | } |
0 commit comments