|
1 | | -# Overlay for Nixpkgs which holds rust-jobs related packages. |
2 | | -# |
3 | | -# Serves as common overlay for this repository. |
4 | | -# |
5 | | -self: super: |
| 1 | +# Overlay for Nixpkgs which holds all opsqueue related packages. |
| 2 | +final: prev: |
6 | 3 | let |
7 | | - sources = import ./sources.nix; |
8 | | - lib = super.pkgs.lib; |
9 | | - pythonOverlay = import ./python-overlay.nix { inherit sources; }; |
| 4 | + pythonOverlay = import ./python-overlay.nix; |
10 | 5 | in |
11 | 6 | { |
12 | | - # A powerful way of filtering the right files for the src attribute of a derivation. |
13 | | - fileFilter = |
14 | | - { |
15 | | - name, |
16 | | - # Regex whitelist of files |
17 | | - srcWhitelist ? [ ".*" ], |
18 | | - # Blacklist of files and directories anywhere in the repository. Use only |
19 | | - # with files that can appear in multiple places in the repository. |
20 | | - srcGlobalBlacklist ? [ ], |
21 | | - # Global whitelist by suffix, only allow the following file extensions |
22 | | - srcGlobalWhitelist ? [ ], |
23 | | - # Global whitelist by regex, only allow the following file extensions |
24 | | - srcGlobalWhitelistRegex ? [ ], |
25 | | - src, |
26 | | - }: |
27 | | - lib.cleanSourceWith rec { |
28 | | - inherit name src; |
29 | | - filter = |
30 | | - path: type: |
31 | | - let |
32 | | - relativePath = lib.removePrefix (toString src + "/") path; |
33 | | - in |
34 | | - (builtins.any (r: builtins.match r relativePath != null) srcWhitelist) |
35 | | - && |
36 | | - # Whitelist these files |
37 | | - ( |
38 | | - (type == "directory") |
39 | | - || ( |
40 | | - (builtins.length srcGlobalWhitelist != 0) |
41 | | - && (builtins.any (suffix: lib.hasSuffix suffix relativePath) srcGlobalWhitelist) |
42 | | - || ( |
43 | | - (builtins.length srcGlobalWhitelistRegex != 0) |
44 | | - && (builtins.any (r: builtins.match r relativePath != null) srcGlobalWhitelistRegex) |
45 | | - ) |
46 | | - ) |
47 | | - ) |
48 | | - && |
49 | | - # Ignore the files from srcGlobalBlacklist anywhere |
50 | | - !(builtins.elem (baseNameOf path) srcGlobalBlacklist) |
51 | | - && |
52 | | - # Discard editor files, git repo stuff, and other cruft. This one is taken |
53 | | - # from Nixpkgs; we don't need to implement it ourselves. |
54 | | - lib.cleanSourceFilter path type; |
55 | | - }; |
56 | | - |
57 | | - # Placing the sources in the overlay gives all packages access to the sources, |
58 | | - # and it makes it possible to override them in new overlays. |
59 | | - sources = if super ? sources then super.sources // sources else sources; |
60 | | - |
61 | | - opsqueue = self.callPackage ../opsqueue/opsqueue.nix { }; |
| 7 | + opsqueue = final.callPackage ../opsqueue/opsqueue.nix { }; |
62 | 8 |
|
63 | 9 | # The explicit choice is made not to override `python312`, as this will cause a rebuild of many |
64 | 10 | # packages when nixpkgs uses python 3.12 as default python environment. |
65 | 11 | # These packages should not be affected, e.g. cachix. This is because of a transitive |
66 | 12 | # dependency on the Python packages that we override. |
67 | 13 | # In our case cachix > ghc > shpinx > Python libraries. |
68 | | - pythonChannable = super.python312.override { packageOverrides = pythonOverlay; }; |
69 | | - |
70 | | - # We choose a minimal Rust channel to keep the Nix closure size smaller |
71 | | - rust-with-lsp = self.rust-bin.stable.latest.minimal.override { |
72 | | - extensions = [ |
73 | | - "clippy" |
74 | | - "rustfmt" |
75 | | - ]; |
76 | | - }; |
| 14 | + pythonChannable = prev.python312.override { packageOverrides = pythonOverlay; }; |
77 | 15 |
|
78 | | - pre-commit-env = self.buildEnv { |
79 | | - name = "pre-commit-env"; |
80 | | - paths = [ |
81 | | - super.python3Packages.pre-commit-hooks |
82 | | - super.nixfmt-rfc-style |
83 | | - super.ruff |
84 | | - super.biome |
85 | | - self.rust-with-lsp |
86 | | - ]; |
87 | | - }; |
88 | 16 | } |
0 commit comments