commit 88e67828062077647d7ab9fad8f61b3cf0772b4e Author: Chuang Zhu Date: Wed Apr 26 06:11:34 2023 +0800 split diff --git a/README.md b/README.md new file mode 100644 index 0000000..225fd96 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# nixpkgs-gnome-mobile + + + +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 +``` diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..21c180c --- /dev/null +++ b/flake.nix @@ -0,0 +1,6 @@ +{ + outputs = { self, ... }: { + overlays.default = import ./overlay.nix; + nixosModules.gnome-mobile = import ./module.nix; + }; +} diff --git a/module.nix b/module.nix new file mode 100644 index 0000000..47ba05b --- /dev/null +++ b/module.nix @@ -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 ""; + }; +} diff --git a/overlay.nix b/overlay.nix new file mode 100644 index 0000000..767883b --- /dev/null +++ b/overlay.nix @@ -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 '' ' ' \ + --replace '' ' ' + ''; + }); + + 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="; + }; + }); + }); +}