-
Notifications
You must be signed in to change notification settings - Fork 55
/
flake.nix
76 lines (72 loc) · 2.3 KB
/
flake.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
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
{
description = "Swayfx development environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
scenefx.url = "github:wlrfx/scenefx";
};
outputs =
{
self,
nixpkgs,
scenefx,
...
}:
let
mkPackage = pkgs: {
swayfx-unwrapped =
pkgs.swayfx-unwrapped.overrideAttrs
(old: {
version = "0.4.0-git";
src = pkgs.lib.cleanSource ./.;
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.cmake ];
buildInputs = old.buildInputs ++ [ pkgs.scenefx ];
providedSessions = [ pkgs.swayfx-unwrapped.meta.mainProgram ];
});
};
targetSystems = [
"aarch64-linux"
"x86_64-linux"
];
pkgsFor =
system:
import nixpkgs {
inherit system;
overlays = [ scenefx.overlays.insert ];
};
forEachSystem = f: nixpkgs.lib.genAttrs targetSystems (system: f (pkgsFor system));
in
{
overlays = rec {
default = insert;
# Insert using the locked nixpkgs. Can be used with any nixpkgs version.
insert = _: prev: mkPackage (pkgsFor prev.system);
# Override onto the input nixpkgs. Users *MUST* have a scenefx overlay
# used before this overlay, otherwise pkgs.scenefx will be unavailable
override = _: prev: mkPackage prev;
};
packages = forEachSystem (
pkgs: (mkPackage pkgs // { default = self.packages.${pkgs.system}.swayfx-unwrapped; })
);
devShells = forEachSystem (pkgs: {
default = pkgs.mkShell {
name = "swayfx-shell";
inputsFrom = [
self.packages.${pkgs.system}.swayfx-unwrapped
pkgs.wlroots_0_17
pkgs.scenefx
];
packages = with pkgs; [
gdb # for debugging
];
shellHook = ''
(
# Copy the nix version of wlroots and scenefx into the project
mkdir -p "$PWD/subprojects" && cd "$PWD/subprojects"
cp -R --no-preserve=mode,ownership ${pkgs.wlroots_0_17.src} wlroots
cp -R --no-preserve=mode,ownership ${pkgs.scenefx.src} scenefx
)'';
};
});
formatter = forEachSystem (pkgs: pkgs.nixfmt-rfc-style);
};
}