fixed + simplified flake

This commit is contained in:
William McKinnon 2025-06-26 23:37:09 -04:00
parent 8125e08b12
commit 04da086f5f
2 changed files with 124 additions and 92 deletions

72
flake.lock generated
View file

@ -1,12 +1,32 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1750605355, "lastModified": 1750865895,
"narHash": "sha256-xT8cPLTxlktxI9vSdoBlAVK7dXgd8IK59j7ZwzkkhnI=", "narHash": "sha256-p2dWAQcLVzquy9LxYCZPwyUdugw78Qv3ChvnX755qHA=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3078b9a9e75f1790e6d6ef9955fdc6a2d1740cc6", "rev": "61c0f513911459945e2cb8bf333dc849f1b976ff",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -18,22 +38,28 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"scenefx": "scenefx" "scenefx": "scenefx",
"systems": "systems_2"
} }
}, },
"scenefx": { "scenefx": {
"inputs": { "inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ],
"systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1749449355, "lastModified": 1750992888,
"narHash": "sha256-GMMmxM/z7KKEs5PXB0TJFMg7qcwqbQ3/nI2906sZbxM=", "narHash": "sha256-P1MSTJrLBBaBVfZ0mD6wOIxNueW31ImXtECQTEX/YD0=",
"owner": "wlrfx", "owner": "wlrfx",
"repo": "scenefx", "repo": "scenefx",
"rev": "b92dcb43bcf0da17ba8bfbdd7385dce75383628c", "rev": "5a8d954abae9eeac3e46e1d9ac3c1443188b9c8a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -41,6 +67,36 @@
"repo": "scenefx", "repo": "scenefx",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

144
flake.nix
View file

@ -1,110 +1,86 @@
{ {
description = "Swayfx development environment"; description = "Swayfx development environment";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default-linux";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
scenefx = { scenefx = {
url = "github:wlrfx/scenefx"; url = "github:wlrfx/scenefx";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
}; };
}; };
outputs =
{
self,
nixpkgs,
scenefx,
...
}:
let
mkPackage = pkgs: {
swayfx-unwrapped =
(pkgs.swayfx-unwrapped.override {
# This override block is currently empty, you might remove it
# unless you intend to override function arguments later.
}).overrideAttrs
(old: {
version = "0.5.2-git";
src = pkgs.lib.cleanSource ./.;
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.cmake ];
# Add wlroots_0_19 here
buildInputs = old.buildInputs ++ [
pkgs.scenefx
pkgs.wlroots_0_19 # <-- Added this line
];
providedSessions = [ pkgs.swayfx-unwrapped.meta.mainProgram ];
patches = []; ## Consider if you need patches from the original derivation
mesonFlags = let
inherit (pkgs.lib.strings) mesonEnable mesonOption;
in
[
(mesonOption "sd-bus-provider" "libsystemd")
(mesonEnable "tray" true)
# You might need to explicitly enable fx if the default changed
# (mesonEnable "fx" true) # <-- Potentially add this if needed
];
});
};
targetSystems = [ outputs = { self, nixpkgs, flake-utils, scenefx, ... }:
"aarch64-linux" flake-utils.lib.eachDefaultSystem (system:
"x86_64-linux" let
]; pkgs = import nixpkgs { inherit system; };
pkgsFor = scenefx-git = scenefx.packages.${system}.scenefx-git;
system:
import nixpkgs { in {
inherit system; packages = rec {
overlays = [ scenefx.overlays.insert ]; swayfx-unwrapped-git = pkgs.swayfx-unwrapped.overrideAttrs(old: {
version = "git";
src = pkgs.lib.cleanSource ./.;
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
wayland-scanner
scdoc
];
buildInputs = with pkgs; [
libGL
wayland
libxkbcommon
pcre2
json_c
libevdev
pango
cairo
libinput
gdk-pixbuf
librsvg
wayland-protocols
libdrm
xorg.xcbutilwm
wlroots_0_19
] ++ [ scenefx-git ];
});
default = swayfx-unwrapped-git;
}; };
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 ( devShells.default = pkgs.mkShell {
pkgs: (mkPackage pkgs // { default = self.packages.${pkgs.system}.swayfx-unwrapped; })
);
devShells = forEachSystem (pkgs: {
default = pkgs.mkShell {
name = "swayfx-shell"; name = "swayfx-shell";
# inputsFrom propagates buildInputs, nativeBuildInputs etc. from the listed derivations
# Adding wlroots and scenefx explicitly here is fine, but they are also included via inputsFrom
inputsFrom = [ inputsFrom = [
self.packages.${pkgs.system}.swayfx-unwrapped self.packages.${system}.swayfx-unwrapped-git
# pkgs.wlroots_0_19 # Included via swayfx-unwrapped buildInputs now scenefx-git
# pkgs.scenefx # Included via swayfx-unwrapped buildInputs now
];
# You still might want wlroots/scenefx here if you need tools/headers directly in the shell
# outside of what swayfx uses.
buildInputs = [
pkgs.wlroots_0_19
pkgs.scenefx
];
packages = with pkgs; [
gdb # for debugging
]; ];
packages = [ pkgs.gdb ]; # add debugging packages
shellHook = '' shellHook = ''
( (
# Copy the nix version of wlroots and scenefx into the project # Copy the nix version of wlroots and scenefx into the project
# This is useful if you want meson to use them as subprojects during manual dev/testing # This is useful if you want meson to use them as subprojects during manual dev/testing
echo "Copying wlroots and scenefx sources to ./subprojects for dev environment..."
mkdir -p "$PWD/subprojects" && cd "$PWD/subprojects" mkdir -p "$PWD/subprojects" && cd "$PWD/subprojects"
rm -rf wlroots scenefx # Clean previous copies if they exist if [ ! -d scenefx ]; then
cp -R --no-preserve=mode,ownership ${pkgs.wlroots_0_19.src} wlroots echo "Copying scenefx to ./subprojects..."
cp -R --no-preserve=mode,ownership ${pkgs.scenefx.src} scenefx cp -R --no-preserve=mode,ownership ${scenefx-git.src} scenefx
echo "Done copying sources." fi
cd "$OLDPWD" cd "$OLDPWD"
) || echo "Failed to copy subproject sources." ) || echo "Failed to copy subproject sources."
''; '';
}; };
});
formatter = forEachSystem (pkgs: pkgs.nixfmt-rfc-style); formatter = pkgs.nixfmt-rfc-style;
}; }
);
} }