-
Notifications
You must be signed in to change notification settings - Fork 59
/
default.nix
51 lines (46 loc) · 1.51 KB
/
default.nix
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
{
pkgs ? import <nixpkgs> {
inherit system;
config = { };
overlays = [ ];
},
lib ? pkgs.lib,
system ? builtins.currentSystem,
}:
let
catppuccinPackages =
let
generated = lib.foldlAttrs (
acc: port:
{ rev, hash }:
lib.recursiveUpdate acc {
# Save our sources for each port
sources.${port} = catppuccinPackages.fetchCatppuccinPort { inherit port rev hash; };
# And create a default package for them
"${port}" = catppuccinPackages.buildCatppuccinPort { pname = port; };
}
) { } (lib.importJSON ./pkgs/sources.json);
collected = lib.packagesFromDirectoryRecursive {
callPackage = lib.callPackageWith (pkgs // catppuccinPackages);
directory = ./pkgs;
};
in
generated // collected;
in
{
# Filter out derivations not available on/meant for the current system
packages = lib.filterAttrs (lib.const (
deriv:
let
# Only export packages available on the current system, *unless* they are being cross compiled
availableOnHost = lib.meta.availableOn pkgs.stdenv.hostPlatform deriv;
# `nix flake check` doesn't like broken packages
broken = deriv.meta.broken or false;
isCross = deriv.stdenv.buildPlatform != deriv.stdenv.targetPlatform;
# Make sure we don't remove our functions
isFunction = lib.isFunction deriv;
in
isFunction || (!broken) && availableOnHost || isCross
)) catppuccinPackages;
shell = import ./shell.nix { inherit pkgs; };
}