add niri mobile

This commit is contained in:
Henry Hiles 2026-11-16 16:24:31 -05:00
commit c5c04a8aac
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
4 changed files with 148 additions and 109 deletions

69
flake.lock generated
View file

@ -814,25 +814,6 @@
"type": "github"
}
},
"gnome-mobile": {
"inputs": {
"gnome-shell-mobile": "gnome-shell-mobile",
"mutter-mobile": "mutter-mobile",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 0,
"narHash": "sha256-nO7cqicSHCjn96qMIV1JKwDei3n56Ra4G6rtaePbu3k=",
"type": "git",
"url": "file:///home/quadradical/Documents/Code/nixos-gnome-mobile"
},
"original": {
"type": "git",
"url": "file:///home/quadradical/Documents/Code/nixos-gnome-mobile"
}
},
"gnome-shell": {
"flake": false,
"locked": {
@ -852,21 +833,6 @@
"type": "gitlab"
}
},
"gnome-shell-mobile": {
"flake": false,
"locked": {
"dirtyRev": "c602286053f9e06b3493decb4a9dabe8ba20ad9c-dirty",
"dirtyShortRev": "c60228605-dirty",
"lastModified": 1793323139,
"narHash": "sha256-DTqRtdXSwmb8ovlEmzVf7CcwtjRgpXinuWCb+1CgTc0=",
"type": "git",
"url": "file:///home/quadradical/Documents/Code/gnome-shell-mobile"
},
"original": {
"type": "git",
"url": "file:///home/quadradical/Documents/Code/gnome-shell-mobile"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -921,21 +887,6 @@
"url": "https://git.federated.nexus/Henry-Hiles/matrixoidc"
}
},
"mutter-mobile": {
"flake": false,
"locked": {
"dirtyRev": "7e7b25f68c7719ebf3b651808824e0c8bd33020d-dirty",
"dirtyShortRev": "7e7b25f68-dirty",
"lastModified": 1793323139,
"narHash": "sha256-mvdRwZfbnlzBrwr0bT4ZItYcM15smb7gkpppwIEp64k=",
"type": "git",
"url": "file:///home/quadradical/Documents/Code/mutter-mobile"
},
"original": {
"type": "git",
"url": "file:///home/quadradical/Documents/Code/mutter-mobile"
}
},
"nexus": {
"inputs": {
"continuwuity": "continuwuity_2",
@ -981,6 +932,24 @@
"url": "https://git.federated.nexus/federated-nexus/nexusbot"
}
},
"niri-mobile": {
"flake": false,
"locked": {
"lastModified": 1794856587,
"narHash": "sha256-3QcIjmE7szOtZKpWXg36lcPZ/v8vFW3SkYrg59M9GT4=",
"ref": "quad/mobile-testing",
"rev": "9256350fa5b80e7420661e369a2bca91522a1690",
"shallow": true,
"type": "git",
"url": "file:///home/quadradical/Documents/Code/niri"
},
"original": {
"ref": "quad/mobile-testing",
"shallow": true,
"type": "git",
"url": "file:///home/quadradical/Documents/Code/niri"
}
},
"nix-github-actions": {
"inputs": {
"nixpkgs": [
@ -1248,12 +1217,12 @@
"flake-parts": "flake-parts_5",
"gadgetfs": "gadgetfs",
"gaypanel": "gaypanel",
"gnome-mobile": "gnome-mobile",
"home-manager": "home-manager",
"lk-jwt-service-module": "lk-jwt-service-module",
"matrixoidc": "matrixoidc",
"nexus": "nexus",
"nexusbot": "nexusbot",
"niri-mobile": "niri-mobile",
"nix-maid": "nix-maid",
"nixphone": "nixphone",
"nixpkgs": "nixpkgs",

View file

@ -8,9 +8,9 @@
url = "github:sorki/nixos-gadgetfs-proto";
flake = false;
};
gnome-mobile = {
url = "git+file:///home/quadradical/Documents/Code/nixos-gnome-mobile";
inputs.nixpkgs.follows = "nixpkgs";
niri-mobile = {
url = "git+file:///home/quadradical/Documents/Code/niri?ref=quad/mobile-testing&shallow=1";
flake = false;
};
nixphone = {
url = "git+https://codeberg.org/nixphone/nixphone";

View file

@ -1,56 +0,0 @@
# GNOME Shell mobile. GDM and the GNOME services/apps are in modules/graphical/gnome.
{ inputs, pkgs, ... }:
{
nixpkgs.overlays = [ inputs.gnome-mobile.overlays.default ];
services = {
desktopManager.gnome = {
enable = true;
# One app per workspace
extraGSettingsOverrides = ''
[org.gnome.mutter]
dynamic-workspaces=true
'';
extraGSettingsOverridePackages = [ pkgs.mutter ];
};
logind.settings.Login = {
HandlePowerKey = "ignore";
HandlePowerKeyLongPress = "poweroff";
};
};
# GNOME talks to IBus over D-Bus, with these set the on-screen keyboard won't show up.
environment.extraInit = ''
unset GTK_IM_MODULE QT_IM_MODULE XMODIFIERS
'';
users.users.quadradical.maid.gsettings.settings.org.gnome = {
desktop = {
search-providers.sort-order = [
"org.gnome.Contacts.desktop"
"org.gnome.Documents.desktop"
"org.gnome.Nautilus.desktop"
];
background = rec {
picture-uri = "file://${../../background.jpg}";
picture-uri-dark = picture-uri;
};
lockdown.user-administration-disabled = true;
};
system.location.enabled = true;
shell = {
remember-mount-password = true;
favorite-apps = [
"librewolf.desktop"
"org.gnome.Geary.desktop"
"org.gnome.Nautilus.desktop"
];
};
};
}

126
modules/mobile/niri.nix Normal file
View file

@ -0,0 +1,126 @@
{
inputs,
lib,
pkgs,
...
}:
let
src = inputs.niri-mobile;
niri = pkgs.niri.overrideAttrs (old: {
inherit src;
cargoDeps = pkgs.rustPlatform.importCargoLock {
lockFile = "${src}/Cargo.lock";
allowBuiltinFetchGit = true;
};
env = old.env // {
NIRI_BUILD_COMMIT = "quad-mobile-${src.shortRev}";
};
});
# Placeholder app grid, from test-shell/ in the clone.
grid = pkgs.stdenvNoCC.mkDerivation {
name = "niri-test-grid";
src = "${src}/test-shell/grid.js";
dontUnpack = true;
nativeBuildInputs = with pkgs; [
gobject-introspection
makeWrapper
wrapGAppsHook4
];
buildInputs = with pkgs; [
gjs
gtk4
gtk4-layer-shell
];
installPhase = ''
install -Dm644 $src $out/share/niri-test-grid/grid.js
# gtk4-layer-shell has to be loaded before libwayland-client.
makeWrapper ${lib.getExe' pkgs.gjs "gjs"} $out/bin/niri-test-grid \
--add-flags "-m $out/share/niri-test-grid/grid.js" \
--set LD_PRELOAD ${pkgs.gtk4-layer-shell}/lib/libgtk4-layer-shell.so \
--set NIRI_BIN ${lib.getExe niri}
'';
};
swayosdStyle = pkgs.writeText "swayosd.css" ''
@import url("file://${pkgs.swayosd}/etc/xdg/swayosd/style.css");
window#osd {
background: shade(@theme_bg_color, 1.15);
}
'';
swayosd-client = lib.getExe' pkgs.swayosd "swayosd-client";
in
{
programs.niri = {
enable = true;
package = niri;
};
environment.etc."niri/config.kdl".text = ''
input {
touch { edge-swipe-size 24; }
}
layout {
gaps 16
struts {
left -16
right -16
top -16
bottom -16
}
center-focused-column "always"
default-column-width { proportion 1.0; }
}
// zoom and workspace-anchor have to match the constants in test-shell/grid.js.
overview {
zoom 0.25
workspace-anchor 0.15
hide-inactive-workspaces
swipe-to-close
swipe-down-to-focus
}
layer-rule {
match namespace="^niri-test-grid$"
follow-overview true
}
layer-rule {
match namespace="^wallpaper$"
place-within-backdrop true
}
prefer-no-csd
spawn-at-startup "${lib.getExe pkgs.swaybg}" "-i" "${../../background.jpg}" "-m" "fill"
spawn-at-startup "${lib.getExe grid}"
spawn-at-startup "${lib.getExe pkgs.stevia}"
spawn-at-startup "${lib.getExe' pkgs.swayosd "swayosd-server"}" "--style" "${swayosdStyle}"
binds {
XF86AudioRaiseVolume allow-when-locked=true { spawn "${swayosd-client}" "--output-volume" "raise"; }
XF86AudioLowerVolume allow-when-locked=true { spawn "${swayosd-client}" "--output-volume" "lower"; }
}
'';
services.logind.settings.Login = {
HandlePowerKey = "ignore";
HandlePowerKeyLongPress = "poweroff";
};
# Let GTK use text-input-v3, so the on-screen keyboard gets the text fields.
environment.extraInit = ''
unset GTK_IM_MODULE QT_IM_MODULE XMODIFIERS
'';
# The on-screen keyboard only shows itself with this on.
users.users.quadradical.maid.gsettings.settings.org.gnome.desktop.a11y.applications.screen-keyboard-enabled =
true;
}