2022-04-28 04:31:46 +10:00
|
|
|
{
|
2024-04-10 14:58:34 +10:00
|
|
|
description = "Swayfx development environment";
|
2024-04-19 13:51:51 +10:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
|
|
scenefx.url = "github:wlrfx/scenefx";
|
|
|
|
};
|
2024-04-10 14:58:34 +10:00
|
|
|
outputs =
|
2024-04-19 13:51:51 +10:00
|
|
|
{
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
scenefx,
|
|
|
|
...
|
|
|
|
}:
|
2022-11-16 14:47:04 +11:00
|
|
|
let
|
2024-04-10 14:58:34 +10:00
|
|
|
mkPackage = pkgs: {
|
|
|
|
swayfx-unwrapped =
|
2024-05-08 13:50:33 +10:00
|
|
|
(pkgs.swayfx-unwrapped.override { wlroots = pkgs.wlroots_0_17; }).overrideAttrs
|
2024-04-10 14:58:34 +10:00
|
|
|
(old: {
|
2024-04-19 13:51:51 +10:00
|
|
|
version = "0.4.0-git";
|
2024-04-10 14:58:34 +10:00
|
|
|
src = pkgs.lib.cleanSource ./.;
|
2024-04-19 13:51:51 +10:00
|
|
|
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.cmake ];
|
|
|
|
buildInputs = old.buildInputs ++ [ pkgs.scenefx ];
|
2024-04-10 14:58:34 +10:00
|
|
|
});
|
|
|
|
};
|
2024-04-19 13:51:51 +10:00
|
|
|
|
|
|
|
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));
|
2022-11-23 06:24:38 +11:00
|
|
|
in
|
|
|
|
{
|
2024-04-10 14:58:34 +10:00
|
|
|
overlays = rec {
|
2024-04-15 15:32:43 +10:00
|
|
|
default = insert;
|
2024-04-19 13:51:51 +10:00
|
|
|
# Insert using the locked nixpkgs. Can be used with any nixpkgs version.
|
2024-04-10 14:58:34 +10:00
|
|
|
insert = _: prev: mkPackage (pkgsFor prev.system);
|
2024-04-19 13:51:51 +10:00
|
|
|
# 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;
|
2022-11-16 14:47:04 +11:00
|
|
|
};
|
|
|
|
|
2024-04-19 13:51:51 +10:00
|
|
|
packages = forEachSystem (
|
|
|
|
pkgs: (mkPackage pkgs // { default = self.packages.${pkgs.system}.swayfx-unwrapped; })
|
2024-04-10 14:58:34 +10:00
|
|
|
);
|
2022-11-16 14:47:04 +11:00
|
|
|
|
2024-04-19 13:51:51 +10:00
|
|
|
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
|
|
|
|
)'';
|
|
|
|
};
|
|
|
|
});
|
2024-04-10 14:58:34 +10:00
|
|
|
|
2024-04-19 13:51:51 +10:00
|
|
|
formatter = forEachSystem (pkgs: pkgs.nixfmt-rfc-style);
|
2022-11-16 14:47:04 +11:00
|
|
|
};
|
2022-04-28 04:31:46 +10:00
|
|
|
}
|