diff --git a/hosts/lolcathost/default.nix b/hosts/lolcathost/default.nix index 17ed254..4726f05 100755 --- a/hosts/lolcathost/default.nix +++ b/hosts/lolcathost/default.nix @@ -17,6 +17,7 @@ in { ../modules/wm/hyprland.nix # ../modules/wm/river.nix + ../modules/wm/crywl.nix ../modules/steam.nix ../modules/obsidian.nix @@ -208,6 +209,7 @@ in { # ---- SYSTEM PACKAGES ----- environment.systemPackages = with pkgs; [ # User Environment + # crywl swww helvum easyeffects @@ -312,13 +314,13 @@ in { ]; programs = { - hyprland = { + crywl = { enable = true; - withUWSM = true; # Universal Wayland Session Manager - xwayland.enable = true; + xwayland.enable = false; + defaultSession = false; + useUnmodifiedDWL = false; }; - zsh.enable = true; fish.enable = true; nix-ld.enable = true; diff --git a/hosts/modules/wm/crywl.nix b/hosts/modules/wm/crywl.nix new file mode 100644 index 0000000..1454af2 --- /dev/null +++ b/hosts/modules/wm/crywl.nix @@ -0,0 +1,116 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.programs.crywl; +in { + options.programs.crywl = with lib; { + enable = mkEnableOption "CryWL"; + xwayland.enable = mkEnableOption "XWayland"; + defaultSession = mkEnableOption "CryWL as the default login session"; + + # currently DWL 0.7 (also beware I'll barely ever update the original DWL refs) + useUnmodifiedDWL = mkOption { + type = types.bool; + default = false; + description = "Whether to use unmodified DWL source code (latest stable release)"; + }; + }; + + config = lib.mkIf cfg.enable (let + xwaylandEnabled = cfg.xwayland.enable; + defaultSession = cfg.defaultSession; + useUnmodifiedDWL = cfg.useUnmodifiedDWL; + in { + services.displayManager = { + sessionPackages = [ + pkgs.crywl + ]; + + defaultSession = lib.mkIf defaultSession "crywl"; + }; + + environment.systemPackages = [ + pkgs.crywl + ]; + + nixpkgs.overlays = [ + (self: super: { + crywl = super.dwl.overrideAttrs (oldAttrs: rec { + pname = "crywl"; + version = "0.1-unstable"; + + src = let + dwl_0_70 = { + rev = "74e45c4014ae7048ecbb76eb6f54034b8b479480"; + hash = "sha256-7SoCITrbMrlfL4Z4hVyPpjB9RrrjLXHP9C5t1DVXBBA="; + }; + crywl_unstable = { + rev = "dc1260d3cfd14e8e5b243ec1d3d56e4b08c8c517"; + hash = "sha256-61R+xBYMzeEn93gLofcj8Y3VbJqW6g7GzCTujpAco90="; + }; + in + pkgs.fetchFromGitea ({ + domain = "forge.imbored.dev"; + owner = "emileclarkb"; + repo = pname; + } + // ( + if useUnmodifiedDWL + then dwl_0_70 + else crywl_unstable + )); + + buildInputs = with pkgs; + [ + libinput + xorg.libxcb + libxkbcommon + pixman + wayland + wayland-protocols + wlroots_0_19 + ] + ++ lib.optionals xwaylandEnabled [ + xorg.libX11 + xorg.xcbutilwm + xwayland + ]; + + makeFlags = + [ + "PKG_CONFIG=${pkgs.stdenv.cc.targetPrefix}pkg-config" + "WAYLAND_SCANNER=wayland-scanner" + "PREFIX=$(out)" + "MANDIR=$(man)/share/man" + ] + ++ lib.optionals xwaylandEnabled [ + ''XWAYLAND="-DXWAYLAND"'' + ''XLIBS="xcb xcb-icccm.pc"'' + ]; + + # Ensure `crywl.desktop` entry is registered + passthru = { + providedSessions = [pname]; + + tests.version = pkgs.testers.testVersion { + package = oldAttrs.finalPackage; + # `dwl -v` emits its version string to stderr and returns 1 + command = "crywl -v 2>&1; return 0"; + }; + }; + meta = { + homepage = "https://forge.imbored.dev/emileclarkb/crywl"; + description = "Personal fork of DWL"; + license = lib.licenses.gpl3Only; + maintainers = [lib.maintainers.emileclarkb]; + inherit (pkgs.wayland.meta) platforms; + mainProgram = "crywl"; + }; + }); + }) + ]; + }); +}