diff --git a/SwarselSystems.org b/SwarselSystems.org index a858775..d514b3f 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -297,7 +297,10 @@ When setting this option normally, the password would normally be written world- inputs = { }; }; nix-topology.url = "github:oddlama/nix-topology"; - + scenefx = { + url = "github:wlrfx/scenefx"; + inputs.nixpkgs.follows = "nixpkgs"; + }; #+end_src ** let :PROPERTIES: @@ -3521,6 +3524,157 @@ This script allows for quick git branch switching. #+end_src +**** swayfxoki + + +#+begin_src nix :tangle pkgs/swayfxoki/default.nix + { + lib, + fetchFromGitHub, + stdenv, + systemd, + meson, + replaceVars, + swaybg, + ninja, + pkg-config, + gdk-pixbuf, + librsvg, + wayland-protocols, + libdrm, + libinput, + cairo, + pango, + wayland, + libGL, + libxkbcommon, + pcre2, + cmake, + json_c, + libevdev, + scdoc, + scenefx, + wayland-scanner, + xcbutilwm, + wlroots_0_18, + testers, + nixosTests, + # Used by the NixOS module: + isNixOS ? false, + enableXWayland ? true, + systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, + trayEnabled ? systemdSupport, + ... + }: + + stdenv.mkDerivation (finalAttrs: { + inherit + enableXWayland + isNixOS + systemdSupport + trayEnabled + ; + + pname = "swayfx-unwrapped"; + version = "0.5"; + + src = fetchFromGitHub { + owner = "WillPower3309"; + repo = "swayfx"; + tag = "0.5"; + hash = "sha256-gdab7zkjp/S7YVCP1t/OfOdUXZRwNvNSuRFGWEJScF8="; + }; + + patches = + [ + ./load-configuration-from-etc.patch + + (replaceVars ./fix-paths.patch { + inherit swaybg; + }) + ]; + + strictDeps = true; + depsBuildBuild = [ pkg-config ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + scdoc + wayland-scanner + cmake + ]; + + buildInputs = [ + cairo + gdk-pixbuf + json_c + libdrm + libevdev + libGL + libinput + librsvg + libxkbcommon + pango + pcre2 + scenefx + wayland + wayland-protocols + (wlroots_0_18.override { inherit (finalAttrs) enableXWayland; }) + ] ++ lib.optionals finalAttrs.enableXWayland [ xcbutilwm ]; + + mesonFlags = + let + inherit (lib.strings) mesonEnable mesonOption; + + # The "sd-bus-provider" meson option does not include a "none" option, + # but it is silently ignored iff "-Dtray=disabled". We use "basu" + # (which is not in nixpkgs) instead of "none" to alert us if this + # changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761 + # assert trayEnabled -> systemdSupport && dbusSupport; + + sd-bus-provider = if systemdSupport then "libsystemd" else "basu"; + in + [ + (mesonOption "sd-bus-provider" sd-bus-provider) + (mesonEnable "tray" finalAttrs.trayEnabled) + ]; + + passthru = { + tests = { + basic = nixosTests.swayfx; + version = testers.testVersion { + package = finalAttrs.finalPackage; + command = "sway --version"; + version = "swayfx version ${finalAttrs.version}"; + }; + }; + }; + + meta = { + description = "Sway, but with eye candy!"; + homepage = "https://github.com/WillPower3309/swayfx"; + changelog = "https://github.com/WillPower3309/swayfx/releases/tag/${finalAttrs.version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + ricarch97 + ]; + platforms = lib.platforms.linux; + mainProgram = "sway"; + + longDescription = '' + Fork of Sway, an incredible and one of the most well established Wayland + compositors, and a drop-in replacement for the i3 window manager for X11. + SwayFX adds extra options and effects to the original Sway, such as rounded corners, + shadows and inactive window dimming to bring back some of the Picom X11 + compositor functionality, which was commonly used with the i3 window manager. + ''; + }; + }) + +#+end_src + **** project #+begin_src shell :tangle scripts/project.sh @@ -3637,7 +3791,8 @@ When adding a new entry here, do not forget to add it in the default output of t ]; }; - mgba = final.swarsel-mgba; + # mgba = final.swarsel-mgba; + swayfx-unwrapped = final.swayfxoki; retroarch = prev.retroarch.withCores (cores: with cores; [ snes9x # snes @@ -3650,17 +3805,8 @@ When adding a new entry here, do not forget to add it in the default output of t dolphin # gc/wii ]); - # luakit = prev.river.overrideAttrs (oldAttrs: rec { - # pname = "river"; - # version = "git"; - # src = prev.fetchFromGitHub { - # owner = "luakit"; - # repo = pname; - # rev = "c16628c7f57c51d50f2d10a96c265fb0afaddb02"; - # hash = "sha256-E3Xtv7JeCmafiNmpuS5VuLgh1TDAbibPtMo6A9Pz6EQ="; - # fetchSubmodules = true; - # }; - # }); + + }; nixpkgs-stable = final: _: { @@ -3686,6 +3832,7 @@ When adding a new entry here, do not forget to add it in the default output of t // (inputs.nur.overlays.default final prev) // (inputs.emacs-overlay.overlay final prev) // (inputs.nix-topology.overlays.default final prev) + // (inputs.scenefx.overlays.insert final prev) // (inputs.nixgl.overlay final prev); } diff --git a/flake.nix b/flake.nix index 04108b3..384b1cc 100644 --- a/flake.nix +++ b/flake.nix @@ -76,7 +76,10 @@ inputs = { }; }; nix-topology.url = "github:oddlama/nix-topology"; - + scenefx = { + url = "github:wlrfx/scenefx"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs@{ self diff --git a/overlays/default.nix b/overlays/default.nix index 32a0395..45dba8a 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -16,7 +16,8 @@ let ]; }; - mgba = final.swarsel-mgba; + # mgba = final.swarsel-mgba; + swayfx-unwrapped = final.swayfxoki; retroarch = prev.retroarch.withCores (cores: with cores; [ snes9x # snes @@ -29,17 +30,8 @@ let dolphin # gc/wii ]); - # luakit = prev.river.overrideAttrs (oldAttrs: rec { - # pname = "river"; - # version = "git"; - # src = prev.fetchFromGitHub { - # owner = "luakit"; - # repo = pname; - # rev = "c16628c7f57c51d50f2d10a96c265fb0afaddb02"; - # hash = "sha256-E3Xtv7JeCmafiNmpuS5VuLgh1TDAbibPtMo6A9Pz6EQ="; - # fetchSubmodules = true; - # }; - # }); + + }; nixpkgs-stable = final: _: { @@ -65,6 +57,7 @@ in // (inputs.nur.overlays.default final prev) // (inputs.emacs-overlay.overlay final prev) // (inputs.nix-topology.overlays.default final prev) + // (inputs.scenefx.overlays.insert final prev) // (inputs.nixgl.overlay final prev); } diff --git a/pkgs/swayfxoki/default.nix b/pkgs/swayfxoki/default.nix new file mode 100644 index 0000000..5d14a9e --- /dev/null +++ b/pkgs/swayfxoki/default.nix @@ -0,0 +1,143 @@ +{ lib +, fetchFromGitHub +, stdenv +, systemd +, meson +, replaceVars +, swaybg +, ninja +, pkg-config +, gdk-pixbuf +, librsvg +, wayland-protocols +, libdrm +, libinput +, cairo +, pango +, wayland +, libGL +, libxkbcommon +, pcre2 +, cmake +, json_c +, libevdev +, scdoc +, scenefx +, wayland-scanner +, xcbutilwm +, wlroots_0_18 +, testers +, nixosTests +, # Used by the NixOS module: + isNixOS ? false +, enableXWayland ? true +, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd +, trayEnabled ? systemdSupport +, ... +}: + +stdenv.mkDerivation (finalAttrs: { + inherit + enableXWayland + isNixOS + systemdSupport + trayEnabled + ; + + pname = "swayfx-unwrapped"; + version = "0.5"; + + src = fetchFromGitHub { + owner = "WillPower3309"; + repo = "swayfx"; + tag = "0.5"; + hash = "sha256-gdab7zkjp/S7YVCP1t/OfOdUXZRwNvNSuRFGWEJScF8="; + }; + + patches = + [ + ./load-configuration-from-etc.patch + + (replaceVars ./fix-paths.patch { + inherit swaybg; + }) + ]; + + strictDeps = true; + depsBuildBuild = [ pkg-config ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + scdoc + wayland-scanner + cmake + ]; + + buildInputs = [ + cairo + gdk-pixbuf + json_c + libdrm + libevdev + libGL + libinput + librsvg + libxkbcommon + pango + pcre2 + scenefx + wayland + wayland-protocols + (wlroots_0_18.override { inherit (finalAttrs) enableXWayland; }) + ] ++ lib.optionals finalAttrs.enableXWayland [ xcbutilwm ]; + + mesonFlags = + let + inherit (lib.strings) mesonEnable mesonOption; + + # The "sd-bus-provider" meson option does not include a "none" option, + # but it is silently ignored iff "-Dtray=disabled". We use "basu" + # (which is not in nixpkgs) instead of "none" to alert us if this + # changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761 + # assert trayEnabled -> systemdSupport && dbusSupport; + + sd-bus-provider = if systemdSupport then "libsystemd" else "basu"; + in + [ + (mesonOption "sd-bus-provider" sd-bus-provider) + (mesonEnable "tray" finalAttrs.trayEnabled) + ]; + + passthru = { + tests = { + basic = nixosTests.swayfx; + version = testers.testVersion { + package = finalAttrs.finalPackage; + command = "sway --version"; + version = "swayfx version ${finalAttrs.version}"; + }; + }; + }; + + meta = { + description = "Sway, but with eye candy!"; + homepage = "https://github.com/WillPower3309/swayfx"; + changelog = "https://github.com/WillPower3309/swayfx/releases/tag/${finalAttrs.version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + ricarch97 + ]; + platforms = lib.platforms.linux; + mainProgram = "sway"; + + longDescription = '' + Fork of Sway, an incredible and one of the most well established Wayland + compositors, and a drop-in replacement for the i3 window manager for X11. + SwayFX adds extra options and effects to the original Sway, such as rounded corners, + shadows and inactive window dimming to bring back some of the Picom X11 + compositor functionality, which was commonly used with the i3 window manager. + ''; + }; +}) diff --git a/pkgs/swayfxoki/fix-paths.patch b/pkgs/swayfxoki/fix-paths.patch new file mode 100644 index 0000000..a937cc4 --- /dev/null +++ b/pkgs/swayfxoki/fix-paths.patch @@ -0,0 +1,11 @@ +--- a/sway/config.c ++++ b/sway/config.c +@@ -276,7 +276,7 @@ + + if (!(config->active_bar_modifiers = create_list())) goto cleanup; + +- if (!(config->swaybg_command = strdup("swaybg"))) goto cleanup; ++ if (!(config->swaybg_command = strdup("@swaybg@/bin/swaybg"))) goto cleanup; + + if (!(config->config_chain = create_list())) goto cleanup; + config->current_config_path = NULL; diff --git a/pkgs/swayfxoki/load-configuration-from-etc.patch b/pkgs/swayfxoki/load-configuration-from-etc.patch new file mode 100644 index 0000000..f98826d --- /dev/null +++ b/pkgs/swayfxoki/load-configuration-from-etc.patch @@ -0,0 +1,48 @@ +From 92283df3acbffa5c1bb21f23cdd686113d905114 Mon Sep 17 00:00:00 2001 +From: Patrick Hilhorst +Date: Wed, 31 Mar 2021 21:14:13 +0200 +Subject: [PATCH] Load configs from /etc but fallback to /nix/store + +This change will load all configuration files from /etc, to make it easy +to override them, but fallback to /nix/store/.../etc/sway/config to make +Sway work out-of-the-box with the default configuration on non NixOS +systems. + +Original patch by Michael Weiss, updated for Sway 1.6 by Patrick Hilhorst + +Co-authored-by: Michael Weiss +--- + meson.build | 3 ++- + sway/config.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index b7a29660..8ae8ceb3 100644 +--- a/meson.build ++++ b/meson.build +@@ -164,7 +164,8 @@ if scdoc.found() + endforeach + endif + +-add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') ++add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c') ++add_project_arguments('-DNIX_SYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') + + version = '"@0@"'.format(meson.project_version()) + git = find_program('git', native: true, required: false) +diff --git a/sway/config.c b/sway/config.c +index 76b9ec08..fb5b51aa 100644 +--- a/sway/config.c ++++ b/sway/config.c +@@ -374,7 +374,8 @@ static char *get_config_path(void) { + { .prefix = home, .config_folder = ".i3"}, + { .prefix = config_home, .config_folder = "i3"}, + { .prefix = SYSCONFDIR, .config_folder = "sway"}, +- { .prefix = SYSCONFDIR, .config_folder = "i3"} ++ { .prefix = SYSCONFDIR, .config_folder = "i3"}, ++ { .prefix = NIX_SYSCONFDIR, .config_folder = "sway"}, + }; + + size_t num_config_paths = sizeof(config_paths)/sizeof(config_paths[0]); +-- +2.30.1