flake: update for swayfx 0.4 (#284)

This commit is contained in:
ozwaldorf 2024-04-18 23:51:51 -04:00 committed by GitHub
parent 40a5ebf109
commit 4b954d5a05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 94 additions and 50 deletions

View file

@ -2,11 +2,27 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1712192574,
"narHash": "sha256-LbbVOliJKTF4Zl2b9salumvdMXuQBr2kuKP5+ZwbYq4=",
"lastModified": 1713349283,
"narHash": "sha256-2bjFu3+1zPWZPPGqF+7rumTvEwmdBHBhjPva/AMSruQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f480f9d09e4b4cf87ee6151eba068197125714de",
"rev": "2e359fb3162c85095409071d131e08252d91a14f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1713128889,
"narHash": "sha256-aB90ZqzosyRDpBh+rILIcyP5lao8SKz8Sr2PSWvZrzk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2748d22b45a99fb2deafa5f11c7531c212b2cefa",
"type": "github"
},
"original": {
@ -18,7 +34,26 @@
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"scenefx": "scenefx"
}
},
"scenefx": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1713495445,
"narHash": "sha256-dMvGkhjt72NznwI57HLR+Oc6QMctf16W4zI1XYuwnZI=",
"owner": "wlrfx",
"repo": "scenefx",
"rev": "5ada125a56012923c47fcf3d049fab32eb7104ff",
"type": "github"
},
"original": {
"owner": "wlrfx",
"repo": "scenefx",
"type": "github"
}
}
},

101
flake.nix
View file

@ -1,66 +1,75 @@
{
description = "Swayfx development environment";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
scenefx.url = "github:wlrfx/scenefx";
};
outputs =
{ self, nixpkgs, ... }:
{
self,
nixpkgs,
scenefx,
...
}:
let
pkgsFor = system: import nixpkgs { inherit system; };
mkPackage = pkgs: {
swayfx-unwrapped =
(pkgs.swayfx-unwrapped.override { wlroots_0_16 = pkgs.wlroots_0_17; }).overrideAttrs
(old: {
version = "0.4.0-git";
src = pkgs.lib.cleanSource ./.;
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.cmake ];
buildInputs = old.buildInputs ++ [ pkgs.scenefx ];
});
};
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 ./.;
});
};
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;
# Override onto the input nixpkgs
override = _: prev: mkPackage prev;
# Insert using the locked nixpkgs
# 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 = nixpkgs.lib.genAttrs targetSystems (
system: (mkPackage (pkgsFor system) // { default = self.packages.${system}.swayfx-unwrapped; })
packages = forEachSystem (
pkgs: (mkPackage pkgs // { default = self.packages.${pkgs.system}.swayfx-unwrapped; })
);
devShells = nixpkgs.lib.genAttrs targetSystems (
system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.mkShell {
name = "swayfx-shell";
inputsFrom = [
self.packages.${system}.swayfx-unwrapped
pkgs.wlroots_0_17
];
nativeBuildInputs = with pkgs; [
cmake
wayland-scanner
hwdata # for wlroots
];
# 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_17.src} wlroots
)'';
};
}
);
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 = nixpkgs.lib.genAttrs targetSystems (system: (pkgsFor system).nixfmt-rfc-style);
formatter = forEachSystem (pkgs: pkgs.nixfmt-rfc-style);
};
}