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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
| | # SPDX-FileCopyrightText: 2023-2024 Alyssa Ross <hi@alyssa.is>
# SPDX-License-Identifier: MIT
{ ... } @ args:
let
config = import ../lib/config.nix args;
pkgs = import ./overlaid.nix ({ elaboratedConfig = config; } // args);
inherit (pkgs.lib) cleanSource fileset makeScope optionalAttrs sourceByRegex;
subprojects =
project:
let dir = project + "/subprojects"; in
fileset.difference dir (fileset.fromSource (sourceByRegex dir [
".*\\.wrap"
"packagefiles(/.*)?"
]));
makeScopeWithSplicing = pkgs: pkgs.makeScopeWithSplicing' {
otherSplices = {
selfBuildBuild = makeScope pkgs.pkgsBuildBuild.newScope scope;
selfBuildHost = makeScope pkgs.pkgsBuildHost.newScope scope;
selfBuildTarget = makeScope pkgs.pkgsBuildTarget.newScope scope;
selfHostHost = makeScope pkgs.pkgsHostHost.newScope scope;
selfTargetTarget = optionalAttrs (pkgs.pkgsTargetTarget ? newScope)
(makeScope pkgs.pkgsTargetTarget.newScope scope);
};
f = scope;
};
scope = self: let pkgs = self.callPackage ({ pkgs }: pkgs) {}; in {
inherit config;
callSpectrumPackage =
path: (import path { inherit (self) callPackage; }).override;
rootfs = self.callSpectrumPackage ../host/rootfs {};
mount-flatpak = self.callSpectrumPackage ../tools/mount-flatpak {};
spectrum-build-tools = self.callSpectrumPackage ../tools {
appSupport = false;
buildSupport = true;
};
spectrum-app-tools = self.callSpectrumPackage ../tools {};
spectrum-host-tools = self.callSpectrumPackage ../tools {
appSupport = false;
hostSupport = true;
};
spectrum-driver-tools = self.callSpectrumPackage ../tools {
appSupport = false;
driverSupport = true;
};
spectrum-router = self.callSpectrumPackage ../tools/router {};
xdg-desktop-portal-spectrum-host =
self.callSpectrumPackage ../tools/xdg-desktop-portal-spectrum-host {};
# Packages from the overlay, so it's possible to build them from
# the CLI easily.
inherit (pkgs) cloud-hypervisor dbus;
pkgsMusl = makeScopeWithSplicing pkgs.pkgsMusl;
pkgsStatic = makeScopeWithSplicing pkgs.pkgsStatic;
srcWithNix = fileset.difference
(fileset.fromSource (cleanSource ../.))
(fileset.unions ([
(subprojects ../tools)
] ++ map fileset.maybeMissing [
../Documentation/.jekyll-cache
../Documentation/_site
../host/initramfs/build
../host/rootfs/build
../img/app/build
../release/live/build
../tools/mount-flatpak/target
../tools/router/target
../tools/xdg-desktop-portal-spectrum-host/target
../vm/sys/net/build
]));
src = fileset.difference
self.srcWithNix
(fileset.fileFilter ({ hasExt, ... }: hasExt "nix") ../.);
};
in
makeScopeWithSplicing pkgs
|