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": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1712192574, "lastModified": 1713349283,
"narHash": "sha256-LbbVOliJKTF4Zl2b9salumvdMXuQBr2kuKP5+ZwbYq4=", "narHash": "sha256-2bjFu3+1zPWZPPGqF+7rumTvEwmdBHBhjPva/AMSruQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "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" "type": "github"
}, },
"original": { "original": {
@ -18,7 +34,26 @@
}, },
"root": { "root": {
"inputs": { "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"
} }
} }
}, },

View file

@ -1,66 +1,75 @@
{ {
description = "Swayfx development environment"; 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 = outputs =
{ self, nixpkgs, ... }: {
self,
nixpkgs,
scenefx,
...
}:
let 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 = [ targetSystems = [
"aarch64-linux" "aarch64-linux"
"x86_64-linux" "x86_64-linux"
]; ];
mkPackage = pkgs: { pkgsFor =
swayfx-unwrapped = system:
(pkgs.swayfx-unwrapped.override { import nixpkgs {
# When the sway 1.9 rebase is finished, this will need to be overridden. inherit system;
# wlroots_0_16 = pkgs.wlroots_0_16; overlays = [ scenefx.overlays.insert ];
}).overrideAttrs
(old: {
version = "0.3.2-git";
src = pkgs.lib.cleanSource ./.;
});
}; };
forEachSystem = f: nixpkgs.lib.genAttrs targetSystems (system: f (pkgsFor system));
in in
{ {
overlays = rec { overlays = rec {
default = insert; default = insert;
# Override onto the input nixpkgs # Insert using the locked nixpkgs. Can be used with any nixpkgs version.
override = _: prev: mkPackage prev;
# Insert using the locked nixpkgs
insert = _: prev: mkPackage (pkgsFor prev.system); 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 ( packages = forEachSystem (
system: (mkPackage (pkgsFor system) // { default = self.packages.${system}.swayfx-unwrapped; }) pkgs: (mkPackage pkgs // { default = self.packages.${pkgs.system}.swayfx-unwrapped; })
); );
devShells = nixpkgs.lib.genAttrs targetSystems ( devShells = forEachSystem (pkgs: {
system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.mkShell { default = pkgs.mkShell {
name = "swayfx-shell"; name = "swayfx-shell";
inputsFrom = [ inputsFrom = [
self.packages.${system}.swayfx-unwrapped self.packages.${pkgs.system}.swayfx-unwrapped
pkgs.wlroots_0_17 pkgs.wlroots_0_17
pkgs.scenefx
]; ];
nativeBuildInputs = with pkgs; [ packages = with pkgs; [
cmake gdb # for debugging
wayland-scanner
hwdata # for wlroots
]; ];
# Copy the nix version of wlroots into the project shellHook = ''
shellHook = with pkgs; ''
( (
# Copy the nix version of wlroots and scenefx into the project
mkdir -p "$PWD/subprojects" && cd "$PWD/subprojects" mkdir -p "$PWD/subprojects" && cd "$PWD/subprojects"
cp -R --no-preserve=mode,ownership ${wlroots_0_17.src} wlroots 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);
}; };
} }