swayfx/flake.nix

68 lines
2 KiB
Nix
Raw Normal View History

2022-04-28 04:31:46 +10:00
{
2024-04-10 14:58:34 +10:00
description = "Swayfx development environment";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
outputs =
{ self, nixpkgs, ... }:
let
2024-04-10 14:58:34 +10:00
pkgsFor = system: import nixpkgs { inherit system; };
targetSystems = [
"aarch64-linux"
"x86_64-linux"
];
mkPackage = pkgs: {
swayfx-unwrapped =
(pkgs.swayfx-unwrapped.override {
# When the sway 1.9 rebase is finished, this will need to be overridden.
# wlroots_0_16 = pkgs.wlroots_0_16;
}).overrideAttrs
(old: {
version = "0.3.2-git";
src = pkgs.lib.cleanSource ./.;
});
};
in
{
2024-04-10 14:58:34 +10:00
overlays = rec {
default = override;
# Override onto the input nixpkgs
override = _: prev: mkPackage prev;
# Insert using the locked nixpkgs
insert = _: prev: mkPackage (pkgsFor prev.system);
};
2024-04-10 14:58:34 +10:00
packages = nixpkgs.lib.genAttrs targetSystems (
system: (mkPackage (pkgsFor system) // { default = self.packages.${system}.swayfx-unwrapped; })
);
2024-04-10 14:58:34 +10:00
devShells = nixpkgs.lib.genAttrs targetSystems (
system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.mkShell {
name = "swayfx-shell";
2024-04-10 14:58:34 +10:00
inputsFrom = [
self.packages.${system}.swayfx-unwrapped
pkgs.wlroots_0_16
];
nativeBuildInputs = with pkgs; [
cmake
wayland-scanner
];
2024-04-10 14:58:34 +10:00
# Copy the nix version of wlroots into the project
shellHook = with pkgs; ''
(
mkdir -p "$PWD/subprojects" && cd "$PWD/subprojects"
cp -R --no-preserve=mode,ownership ${wlroots_0_16.src} wlroots
)'';
};
2024-04-10 14:58:34 +10:00
}
);
formatter = nixpkgs.lib.genAttrs targetSystems (system: {
default = (pkgsFor system).nixfmt-rfc-style;
});
};
2022-04-28 04:31:46 +10:00
}