diff --git a/flake.lock b/flake.lock index f5e559cd..6ea780ee 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,79 @@ { "nodes": { + "flake-compat": { + "locked": { + "lastModified": 1688025799, + "narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=", + "owner": "nix-community", + "repo": "flake-compat", + "rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs-wayland", + "nix-eval-jobs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "lib-aggregate": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1710072502, + "narHash": "sha256-+T3YAtF/KUzhkf6vgujy0t12B/KL92hxU3mRSUi0nQw=", + "owner": "nix-community", + "repo": "lib-aggregate", + "rev": "b8a148b163687c9be602b63c6b0b7bc81eecb015", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "lib-aggregate", + "type": "github" + } + }, "mobile-nixos": { "flake": false, "locked": { @@ -17,6 +91,80 @@ "type": "github" } }, + "nix-eval-jobs": { + "inputs": { + "flake-parts": "flake-parts", + "nix-github-actions": "nix-github-actions", + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1705242886, + "narHash": "sha256-TLj334vRwFtSym3m+NnKcNCnKKPNoTC/TDZL40vmOso=", + "owner": "nix-community", + "repo": "nix-eval-jobs", + "rev": "6b03a93296faf174b97546fd573c8b379f523a8d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-eval-jobs", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "nixpkgs-wayland", + "nix-eval-jobs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701208414, + "narHash": "sha256-xrQ0FyhwTZK6BwKhahIkUVZhMNk21IEI1nUcWSONtpo=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "93e39cc1a087d65bcf7a132e75a650c44dd2b734", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1703134684, + "narHash": "sha256-SQmng1EnBFLzS7WSRyPM9HgmZP2kLJcPAz+Ug/nug6o=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d6863cbcbbb80e71cecfc03356db1cda38919523", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1710031547, + "narHash": "sha256-pkUg3hOKuGWMGF9WEMPPN/G4pqqdbNGJQ54yhyQYDVY=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "630ebdc047ca96d8126e16bb664c7730dc52f6e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-next-unpatched": { "locked": { "lastModified": 1710093662, @@ -65,11 +213,35 @@ "type": "github" } }, + "nixpkgs-wayland": { + "inputs": { + "flake-compat": "flake-compat", + "lib-aggregate": "lib-aggregate", + "nix-eval-jobs": "nix-eval-jobs", + "nixpkgs": [ + "nixpkgs-unpatched" + ] + }, + "locked": { + "lastModified": 1710123752, + "narHash": "sha256-BnZ94vHYj/i9SiQNOgDcZdK2bGf2nRHJAtrrEW5ZHPU=", + "owner": "nix-community", + "repo": "nixpkgs-wayland", + "rev": "8af78a7dfb3a2041235c116cc9cc92f5a6d3a20c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs-wayland", + "type": "github" + } + }, "root": { "inputs": { "mobile-nixos": "mobile-nixos", "nixpkgs-next-unpatched": "nixpkgs-next-unpatched", "nixpkgs-unpatched": "nixpkgs-unpatched", + "nixpkgs-wayland": "nixpkgs-wayland", "sops-nix": "sops-nix", "uninsane-dot-org": "uninsane-dot-org" } @@ -95,6 +267,43 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs-wayland", + "nix-eval-jobs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1702979157, + "narHash": "sha256-RnFBbLbpqtn4AoJGXKevQMCGhra4h6G2MPcuTSZZQ+g=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "2961375283668d867e64129c22af532de8e77734", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "uninsane-dot-org": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 222a2b8d..c404de43 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,11 @@ # nixpkgs-unpatched.url = "github:nixos/nixpkgs?ref=nixos-staging-next"; nixpkgs-next-unpatched.url = "github:nixos/nixpkgs?ref=staging-next"; + nixpkgs-wayland = { + url = "github:nix-community/nixpkgs-wayland"; + inputs.nixpkgs.follows = "nixpkgs-unpatched"; + }; + mobile-nixos = { # # only used for building disk images, not relevant after deployment @@ -76,6 +81,7 @@ self, nixpkgs-unpatched, nixpkgs-next-unpatched ? nixpkgs-unpatched, + nixpkgs-wayland, mobile-nixos, sops-nix, uninsane-dot-org, @@ -184,9 +190,18 @@ let mobile = (import "${mobile-nixos}/overlay/overlay.nix"); uninsane = uninsane-dot-org.overlays.default; + wayland = final: prev: { + # default is to dump the packages into `waylandPkgs` *and* the toplevel. + # but i just want the `waylandPkgs` set + inherit (nixpkgs-wayland.overlays.default final prev) + waylandPkgs + new-wayland-protocols #< 2024/03/10: nixpkgs-wayland assumes this will be in the toplevel + ; + }; in (mobile final prev) // (uninsane final prev) + // (wayland final prev) ; }; diff --git a/hosts/common/programs/sway/default.nix b/hosts/common/programs/sway/default.nix index db44e6b0..a3d7cc41 100644 --- a/hosts/common/programs/sway/default.nix +++ b/hosts/common/programs/sway/default.nix @@ -29,12 +29,38 @@ let passthru.sway-unwrapped = configuredSway; }; swayPackage = wrapSway ( - pkgs.sway-unwrapped.override { - # wlroots seems to launch Xwayland itself, and i can't easily just do that myself externally. - # so in order for the Xwayland it launches to be sandboxed, i need to patch the sandboxed version in here. - wlroots = pkgs.wlroots.override { + pkgs.waylandPkgs.sway-unwrapped.override { + wlroots = (pkgs.waylandPkgs.wlroots.override { + # wlroots seems to launch Xwayland itself, and i can't easily just do that myself externally. + # so in order for the Xwayland it launches to be sandboxed, i need to patch the sandboxed version in here. xwayland = config.sane.programs.xwayland.package; - }; + }).overrideAttrs (upstream: { + # 2023/09/08: fix so clicking a notification can activate the corresponding window. + # - test: run dino, receive a message while tabbed away, click the desktop notification. + # - if sway activates the dino window (i.e. colors the workspace and tab), then all good + # - do all of this with only a touchscreen (e.g. on mobile phone) -- NOT a mouse/pointer + # 2023/12/17: this patch is still necessary + ## what this patch does: + # - allows any wayland window to request activation, at any time. + # - traditionally, wayland only allows windows to request activation if + # the client requesting to transfer control has some connection to a recent user interaction. + # - e.g. the active window may transfer control to any window + # - a window which was very recently active may transfer control to itself + ## alternative (longer-term) solutions: + # - fix this class of bug in gtk: + # - + # - N.B.: this linked PR doesn't actually fix it + # - add xdg_activation_v1 support to SwayNC (my notification daemon): + # - + # - mako notification daemon supports activation, can use as a reference + # - all of ~30 LoC, looks straight-forward + # - however, it's not clear that gtk4 (or dino) actually support this mode of activation. + # - i.e. my experience with dino is the same using mako as with SwayNC + postPatch = (upstream.postPatch or "") + '' + substituteInPlace types/wlr_xdg_activation_v1.c \ + --replace-fail 'if (token->seat != NULL)' 'if (false && token->seat != NULL)' + ''; + }); # about xwayland: # - required by many electron apps, though some electron apps support NIXOS_OZONE_WL=1 for native wayland. diff --git a/overlays/preferences.nix b/overlays/preferences.nix index 9082e30d..32a123c9 100644 --- a/overlays/preferences.nix +++ b/overlays/preferences.nix @@ -68,36 +68,6 @@ # }) # ]; - sway-unwrapped = super.sway-unwrapped.override { - wlroots = wlroots.overrideAttrs (upstream: { - # 2023/09/08: fix so clicking a notification can activate the corresponding window. - # - test: run dino, receive a message while tabbed away, click the desktop notification. - # - if sway activates the dino window (i.e. colors the workspace and tab), then all good - # - do all of this with only a touchscreen (e.g. on mobile phone) -- NOT a mouse/pointer - # 2023/12/17: this patch is still necessary - ## what this patch does: - # - allows any wayland window to request activation, at any time. - # - traditionally, wayland only allows windows to request activation if - # the client requesting to transfer control has some connection to a recent user interaction. - # - e.g. the active window may transfer control to any window - # - a window which was very recently active may transfer control to itself - ## alternative (longer-term) solutions: - # - fix this class of bug in gtk: - # - - # - N.B.: this linked PR doesn't actually fix it - # - add xdg_activation_v1 support to SwayNC (my notification daemon): - # - - # - mako notification daemon supports activation, can use as a reference - # - all of ~30 LoC, looks straight-forward - # - however, it's not clear that gtk4 (or dino) actually support this mode of activation. - # - i.e. my experience with dino is the same using mako as with SwayNC - postPatch = (upstream.postPatch or "") + '' - substituteInPlace types/wlr_xdg_activation_v1.c \ - --replace-fail 'if (token->seat != NULL)' 'if (false && token->seat != NULL)' - ''; - }); - }; - # 2023/12/10: zbar barcode scanner: used by megapixels, frog. # the video component does not cross compile (qt deps), but i don't need that. zbar = super.zbar.override { enableVideo = false; };