diff --git a/README.md b/README.md new file mode 100644 index 0000000..ce79f4d --- /dev/null +++ b/README.md @@ -0,0 +1,51 @@ +# Compiz 0.9 on Nix + +This is [Compiz 0.9.x](https://code.launchpad.net/compiz) packaged for NixOS. + +TODO: +- [x] Compiz (Full) +- [ ] Emerald (Full) + +Tragically, Nix decided to remove Compiz from nixpkgs like ages ago. This was the only thing stopping me from migrating to NixOS (since I use compiz at least until I can make my own wayland wm :3), so now compiz is back on the nix land! + +This is a fork of [Gabriel's repo](https://github.com/Misterio77/compiz-nix). He's like the proest of pros when it comes to nix, and he did most of the work packaging this! + + +## Installing + +Add this repo to your flake inputs on your `flake.nix`: +````nix + compiz.url = "github:LuNeder/compiz-reloaded-nix/compiz09"; + compiz.inputs.nixpkgs.follows = "nixpkgs"; +```` + +Then install Compiz from your `environment.systemPackages`: +````nix +inputs.compiz.packages.${pkgs.system}.default +```` + +## Using + +You now should be able to launch Compiz from a terminal with `compiz --replace`. + +If you use XFCE and want to use Compiz as your compositor/window manager, you can add the following to your Home-Manager config to autostart it: + +````nix + # Autostart Compiz + xfconf.settings = { + xfce4-session."sessions/Failsafe/Client1_Command" = [ "xfsettingsd" ]; + xfce4-session."sessions/Failsafe/Client0_Command" = [ "compiz" ]; + }; +```` + +## Configuring + +You can configure Compiz from CompizConfig (CCSM). Run `ccsm` from your terminal or find it in your menu or something. +For now there's no way to configure Compiz directly from Nix but ccsm is really cool (if you want to share your Compiz configuration you can export (and import) it from ccsm). + +#### Note + +Compiz will launch the `gtk-window-decorator` window decorator on startup by default. If you don't like it, you can change this for your favourite decorator on ccsm. I'll package Emerald someday which will probably be a better fit. + +## Compiz-Reloaded +I'm also trying to package compiz-reloaded since Compiz 0.9 has some weird bugs (unlike compiz 0.8 / [compiz-reloaded](https://gitlab.com/compiz/compiz-core)), but that's still a wip (see the [main](https://github.com/LuNeder/compiz-reloaded-nix/tree/main) branch of this repo). diff --git a/default.nix b/default.nix index 814c6dd..eaaddc0 100644 --- a/default.nix +++ b/default.nix @@ -1,25 +1,30 @@ { - stdenv, - fetchurl, lib, - cmake, - pkg-config, - makeWrapper, boost, cairo, + cmake, + fetchurl, fuse, glibmm, gnome, + metacity, + gobject-introspection, + gtk3, intltool, libnotify, libstartup_notification, libwnck3, libxml2, libxslt, + makeWrapper, mesa_glu, pcre2, + pkg-config, protobuf, + python3, python3Packages, + stdenv, + wrapGAppsHook, xorg, xorgserver, ... @@ -35,18 +40,26 @@ stdenv.mkDerivation (f: { nativeBuildInputs = [ cmake - pkg-config + libxml2 makeWrapper - xorg.libXdmcp.dev - pcre2.dev - libxml2.dev + pcre2 + pkg-config + (python3Packages.python.withPackages (p: [ p.setuptools ])) + python3Packages.distlib + python3Packages.distutils-extra + python3Packages.cython + python3Packages.setuptools + python3Packages.wrapPython + wrapGAppsHook ]; buildInputs = [ boost cairo fuse glibmm - gnome.metacity + metacity + gobject-introspection + gtk3 intltool libnotify libstartup_notification @@ -55,32 +68,52 @@ stdenv.mkDerivation (f: { libxslt mesa_glu pcre2 - pcre2.dev protobuf - python3Packages.cython - python3Packages.pycairo - python3Packages.pygobject3 - python3Packages.setuptools xorg.libXcursor xorg.libXdmcp - xorg.libXdmcp.dev xorgserver ]; postInstall = '' - sed -i "s|/usr/bin/metacity|${gnome.metacity}/bin/metacity|" $out/bin/compiz-decorator + sed -i "s|/usr/bin/metacity|metacity|" $out/bin/compiz-decorator sed -i "s|/usr/bin/compiz-decorator|$out/bin/compiz-decorator|" $out/share/compiz/decor.xml - wrapProgram $out/bin/compiz \ - --suffix LD_LIBRARY_PATH : "$out/lib" \ - --suffix COMPIZ_BIN_PATH : "$out/bin/" + ''; + + dontWrapGApps = true; + + pythonPath = with python3Packages; [ + pycairo + pygobject3 + ]; + + postFixup = '' + wrapProgram "$out/bin/compiz" \ + --prefix COMPIZ_BIN_PATH : "$out/bin/" \ + --prefix LD_LIBRARY_PATH : "$out/lib" + + wrapProgram "$out/bin/compiz-decorator" \ + --prefix COMPIZ_BIN_PATH : "$out/bin/" \ + --prefix PATH : "${metacity}/bin" + + # Wrap CCSM with GApps and Python path + makeWrapperArgs+=("''${gappsWrapperArgs[@]}") + wrapPythonPrograms + for i in $out/bin/* + do + wrapProgram $i \ + --prefix PATH : ${lib.makeBinPath [ + (python3.withPackages(pp: [pp.pygobject3 pp.distutils-extra pp.distlib])) + ]} + done ''; patches = [ - ./patches/reverse-unity-config.patch + # ./patches/reverse-unity-config.patch ./patches/focus-prevention-disable.patch ./patches/gtk-extents.patch ./patches/screenshot-launch-fix.patch ./patches/no-compile-gschemas.patch + ./patches/compiz-suse-defaults.patch ]; cmakeFlags = [ diff --git a/flake.nix b/flake.nix index 6d6a3b3..d1945f5 100644 --- a/flake.nix +++ b/flake.nix @@ -12,14 +12,14 @@ forEachSystem = nixpkgs.lib.genAttrs (import systems); in { overlays.default = final: prev: { - compiz = final.callPackage ./. {}; + compiz = final.callPackage ./. { python3 = final.python311; python3Packages = final.python311Packages; }; }; packages = forEachSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; in rec { default = compiz; - compiz = pkgs.callPackage ./. {}; + compiz = pkgs.callPackage ./. { python3 = pkgs.python311; python3Packages = pkgs.python311Packages; }; }); }; } diff --git a/patches/compiz-suse-defaults.patch b/patches/compiz-suse-defaults.patch new file mode 100644 index 0000000..18e27f7 --- /dev/null +++ b/patches/compiz-suse-defaults.patch @@ -0,0 +1,116 @@ +--- a/metadata/core.xml.in ++++ b/metadata/core.xml.in +@@ -13,7 +13,7 @@ + + +@@ -254,7 +254,7 @@ + +--- a/plugins/cube/cube.xml.in ++++ b/plugins/cube/cube.xml.in +@@ -123,18 +123,18 @@ + <_short>Skydome Gradient Start Color + <_long>Color and opacity to use for the top color-stop of the skydome-fallback gradient. + +- 0x0d0d +- 0xb1b1 +- 0xfdfd ++ 0xafaf ++ 0xafaf ++ 0xafaf + + + + +@@ -144,7 +144,7 @@ + + + +--- a/plugins/decor/decor.xml.in ++++ b/plugins/decor/decor.xml.in +@@ -23,7 +23,7 @@ + +