This commit is contained in:
Chuang Zhu 2023-04-26 06:11:34 +08:00
commit 88e6782806
4 changed files with 118 additions and 0 deletions

21
README.md Normal file
View file

@ -0,0 +1,21 @@
# nixpkgs-gnome-mobile
<img align="right" width="270" src="https://user-images.githubusercontent.com/31200881/234408804-bb1c50f8-2bb9-4f84-84e4-38e503c79f6e.png">
A Nixpkgs overlay providing patches, and a NixOS module providing useful configurations, for running GNOME Shell on mobile.
* Official blog post about GNOME Shell on mobile: https://blogs.gnome.org/shell-dev/2022/09/09/gnome-shell-on-mobile-an-update/
* Packaging request in Nixpkgs: https://github.com/NixOS/nixpkgs/issues/191711
* A similar work: https://github.com/NixOS/mobile-nixos/pull/576
## Usage
For using with Nixpkgs, add `./overlay.nix` or `nixpkgs-gnome-mobile.overlays.default` to your Nixpkgs overlays. For using with NixOS, add `./module.nix` to your `imports` in `configuration.nix`, or `nixpkgs-gnome-mobile.nixosModules.gnome-mobile` to your `modules` in `nixpkgs.lib.nixosSystem`.
## Debugging gnome-shell
The Wayland compositor can be started directly from the Linux console. The log is actually verbose enough to identify problems, but for unknown reasons you may have to redirect the stderr to see it:
```shellsession
$ gnome-shell --wayland 2> gnome-shell.log
```

6
flake.nix Normal file
View file

@ -0,0 +1,6 @@
{
outputs = { self, ... }: {
overlays.default = import ./overlay.nix;
nixosModules.gnome-mobile = import ./module.nix;
};
}

47
module.nix Normal file
View file

@ -0,0 +1,47 @@
{ config, lib, pkgs, ... }:
{
nixpkgs.overlays = [ (import ./overlay.nix) ];
services.xserver.enable = true;
services.xserver.videoDrivers = [ "modesetting" ];
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome = {
enable = true;
# One app per workspace
extraGSettingsOverrides = ''
[org.gnome.mutter]
dynamic-workspaces=true
'';
extraGSettingsOverridePackages = [ pkgs.gnome.mutter ];
};
services.logind.extraConfig = ''
HandlePowerKey=ignore
HandlePowerKeyLongPress=poweroff
'';
# Installed by default but not mobile friendly yet
environment.gnome.excludePackages = with pkgs.gnome; [
pkgs.gnome-photos
totem # Videos
simple-scan # Document Scanner
gnome-system-monitor
yelp # Help
cheese
nautilus # Files
gnome-music
baobab # Disk Usage Analyser
evince # Document Viewer
pkgs.gnome-connections
pkgs.gnome-tour
];
# Input method works, but these envvars must not be set, or the on-screen keyboard won't pop up.
# GNOME got a builtin IBus support through IBus' D-Bus API, so these variables are not neccessary.
environment.variables = {
GTK_IM_MODULE = lib.mkForce "";
QT_IM_MODULE = lib.mkForce "";
XMODIFIERS = lib.mkForce "";
};
}

44
overlay.nix Normal file
View file

@ -0,0 +1,44 @@
self: super:
{
gnome = super.gnome.overrideScope' (gself: gsuper: {
gnome-shell = gsuper.gnome-shell.overrideAttrs (old: {
version = "unstable-2023-04-03";
src = super.fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "verdre";
repo = "gnome-shell";
rev = "7244a2d0ba30ff4927da14f2611db0dc777c668b";
hash = "sha256-4N2L/YsmjsgTGS990HnuFRKxiJKkF0duikT0nbN1w7E=";
fetchSubmodules = true;
};
patches = super.lib.take (builtins.length old.patches - 1) old.patches;
# JS ERROR: Error: Requiring ModemManager, version none: Typelib file for namespace 'ModemManager' (any version) not found
# @resource:///org/gnome/shell/misc/modemManager.js:4:49
buildInputs = old.buildInputs ++ [ super.modemmanager ];
postPatch = ''
patchShebangs src/data-to-c.pl
# We can generate it ourselves.
rm -f man/gnome-shell.1
# Build fails with -Dgtk_doc=true
# https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6486
# element include: XInclude error : could not load xxx, and no fallback was found
substituteInPlace docs/reference/shell/shell-docs.sgml \
--replace '<xi:include href="xml/shell-embedded-window.xml"/>' ' ' \
--replace '<xi:include href="xml/shell-gtk-embed.xml"/>' ' '
'';
});
mutter = gsuper.mutter.overrideAttrs (old: {
version = "unstable-2022-12-12";
src = super.fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "verdre";
repo = "mutter";
rev = "780aadd4ed77ca6a8312acb3ab13decdb5b6d569";
hash = "sha256-0B1HSwnjJHurOYg4iquXZKjbfyGM5xDIDh6FedlBuJI=";
};
});
});
}