From c95485589a9e277114285aa588031a60eeaf739f Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 24 May 2022 20:57:43 -0700 Subject: [PATCH] moby: upgrade pkgs from 2022/03/30 -> 2022/05/20 this upstreams the manual phosh tweaks i had previously applied. --- flake.lock | 24 ++++- flake.nix | 16 ++- machines/moby/default.nix | 5 - machines/moby/phosh.nix | 218 -------------------------------------- 4 files changed, 31 insertions(+), 232 deletions(-) delete mode 100644 machines/moby/phosh.nix diff --git a/flake.lock b/flake.lock index d991a6ac..9f2ae77d 100644 --- a/flake.lock +++ b/flake.lock @@ -84,16 +84,31 @@ }, "pkgs-mobile": { "locked": { - "lastModified": 1648632716, - "narHash": "sha256-kCmnDeiaMsdhfnNKjxdOzwRh2H6eQb8yWAL+nNabC/Y=", + "lastModified": 1653060744, + "narHash": "sha256-kfRusllRumpt33J1hPV+CeCCylCXEU7e0gn2/cIM7cY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "710fed5a2483f945b14f4a58af2cd3676b42d8c8", + "rev": "dfd82985c273aac6eced03625f454b334daae2e8", "type": "github" }, "original": { "id": "nixpkgs", - "rev": "710fed5a2483f945b14f4a58af2cd3676b42d8c8", + "rev": "dfd82985c273aac6eced03625f454b334daae2e8", + "type": "indirect" + } + }, + "pkgs-telegram": { + "locked": { + "lastModified": 1653269863, + "narHash": "sha256-B0Zhu/a8Qnh1V7bu51tMvl3Q3UQRYe9WlzrPVH4/zvo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "33775ec9a2173a08e46edf9f46c9febadbf743e8", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "rev": "33775ec9a2173a08e46edf9f46c9febadbf743e8", "type": "indirect" } }, @@ -120,6 +135,7 @@ "nurpkgs": "nurpkgs", "pkgs-gitea": "pkgs-gitea", "pkgs-mobile": "pkgs-mobile", + "pkgs-telegram": "pkgs-telegram", "pkgs-unstable": "pkgs-unstable" } } diff --git a/flake.nix b/flake.nix index 02e9d6c9..547105cd 100644 --- a/flake.nix +++ b/flake.nix @@ -15,11 +15,12 @@ nixpkgs.url = "nixpkgs/nixos-21.11"; pkgs-unstable.url = "nixpkgs/nixos-unstable"; pkgs-gitea.url = "nixpkgs/c777cdf5c564015d5f63b09cc93bef4178b19b01"; + # pkgs-telegram.url = "nixpkgs/33775ec9a2173a08e46edf9f46c9febadbf743e8";# 2022/04/18; telegram 3.7.3. fails: nix log /nix/store/y5kv47hnv55qknb6cnmpcyraicay79fx-telegram-desktop-3.7.3.drv: g++: fatal error: cannot execute '/nix/store/njk5sbd21305bhr7gwibxbbvgbx5lxvn-gcc-9.3.0/libexec/gcc/aarch64-unknown-linux-gnu/9.3.0/cc1plus': execv: No such file or directory # pkgs-mobile.url = "nixpkgs/6daa4a5c045d40e6eae60a3b6e427e8700f1c07f"; # FAILS: currently pinned to mobile-nixos tip -> fails building lvgui # pkgs-mobile.url = "nixpkgs/7e567a3d092b7de69cdf5deaeb8d9526de230916"; # WORKS (NO PHOSH): 2021/06/21, coordinated with mobile-nixos 85557dca93ae574eaa7dc7b1877edf681a280d35 - # pkgs-mobile.url = "nixpkgs/dfd82985c273aac6eced03625f454b334daae2e8"; # FAILS (kernelAtLeast... originates in mobile-nixos): 2022/05/20 + pkgs-mobile.url = "nixpkgs/dfd82985c273aac6eced03625f454b334daae2e8"; # WORKS: 2022/05/20; mobile-nixos follows this same commit. # pkgs-mobile.url = "nixpkgs/ff691ed9ba21528c1b4e034f36a04027e4522c58"; # FAILS (kernelAtLeast) 2022/05/17 https://hydra.nixos.org/eval/1762140 - pkgs-mobile.url = "nixpkgs/710fed5a2483f945b14f4a58af2cd3676b42d8c8"; # BUILDS (NO PHOSH) 2022/03/30 https://hydra.nixos.org/eval/1752121 + # pkgs-mobile.url = "nixpkgs/710fed5a2483f945b14f4a58af2cd3676b42d8c8"; # BUILDS (NO PHOSH) 2022/03/30 https://hydra.nixos.org/eval/1752121 # pkgs-mobile.url = "nixpkgs/cbe587c735b734405f56803e267820ee1559e6c1"; # UNTESTED: successful mobile-nixos build https://hydra.nixos.org/eval/1759474#tabs-inputs # pkgs-mobile.url = "nixpkgs/48037fd90426e44e4bf03e6479e88a11453b9b66"; # UNTESTED: successful mobile-nixos build 2022/05/19 https://hydra.nixos.org/eval/1762659#tabs-inputs # pkgs-mobile.url = "nixpkgs/1d7db1b9e4cf1ee075a9f52e5c36f7b9f4207502"; @@ -112,7 +113,10 @@ # patch rpi uboot with something that fixes USB HDD boot ubootRaspberryPi4_64bit = next.callPackage ./pkgs/ubootRaspberryPi4_64bit { pkgs = prev; }; - #### nixos-unstable packages + # we care about keeping these packages up-to-date + electrum = pkgs-unstable.legacyPackages.${system}.electrum; + + #### TEMPORARY NIXOS-UNSTABLE PACKAGES # gitea: 1.16.5 contains a fix which makes manual user approval *actually* work. # https://github.com/go-gitea/gitea/pull/19119 # safe to remove after 1.16.5 (or 1.16.7 if we need db compat?) @@ -122,8 +126,10 @@ # TODO: remove this on next nixos release. whalebird = pkgs-unstable.legacyPackages.${system}.whalebird; - # we care about keeping these packages up-to-date - electrum = pkgs-unstable.legacyPackages.${system}.electrum; + # pkgs-mobile' telegram doesn't build, so explicitly use the stable one. + # TODO: apply this specifically to the moby build? + # tdesktop = pkgs-telegram.legacyPackages.${system}.tdesktop; + tdesktop = nixpkgs.legacyPackages.${system}.tdesktop; }) ]; }; diff --git a/machines/moby/default.nix b/machines/moby/default.nix index b67d6305..a5e8cf56 100644 --- a/machines/moby/default.nix +++ b/machines/moby/default.nix @@ -2,11 +2,6 @@ { imports = [ ./../common/all - # TODO: remove this phosh.nix file. - # phosh service support was added to nixpkgs on 2022/05/07: https://github.com/NixOS/nixpkgs/pull/153940 - # it may be possible to import this via /... path ? - # or find a more recent nixpkgs which builds with mobile-nixos. that PR indicates people have done so. - ./phosh.nix ./gui-phosh.nix ]; diff --git a/machines/moby/phosh.nix b/machines/moby/phosh.nix deleted file mode 100644 index c0b55679..00000000 --- a/machines/moby/phosh.nix +++ /dev/null @@ -1,218 +0,0 @@ -# inline of this: https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/nixos/modules/services/x11/desktop-managers/phosh.nix -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.services.xserver.desktopManager.phosh; - - # Based on https://source.puri.sm/Librem5/librem5-base/-/blob/4596c1056dd75ac7f043aede07887990fd46f572/default/sm.puri.OSK0.desktop - oskItem = pkgs.makeDesktopItem { - name = "sm.puri.OSK0"; - desktopName = "On-screen keyboard"; - exec = "${pkgs.squeekboard}/bin/squeekboard"; - categories = [ "GNOME" "Core" ]; - onlyShowIn = [ "GNOME" ]; - noDisplay = true; - extraConfig = { - X-GNOME-Autostart-Phase = "Panel"; - X-GNOME-Provides = "inputmethod"; - X-GNOME-Autostart-Notify = "true"; - X-GNOME-AutoRestart = "true"; - }; - }; - - phocConfigType = types.submodule { - options = { - xwayland = mkOption { - description = '' - Whether to enable XWayland support. - - To start XWayland immediately, use `immediate`. - ''; - type = types.enum [ "true" "false" "immediate" ]; - default = "false"; - }; - cursorTheme = mkOption { - description = '' - Cursor theme to use in Phosh. - ''; - type = types.str; - default = "default"; - }; - outputs = mkOption { - description = '' - Output configurations. - ''; - type = types.attrsOf phocOutputType; - default = { - DSI-1 = { - scale = 2; - }; - }; - }; - }; - }; - - phocOutputType = types.submodule { - options = { - modeline = mkOption { - description = '' - One or more modelines. - ''; - type = types.either types.str (types.listOf types.str); - default = []; - example = [ - "87.25 720 776 848 976 1440 1443 1453 1493 -hsync +vsync" - "65.13 768 816 896 1024 1024 1025 1028 1060 -HSync +VSync" - ]; - }; - mode = mkOption { - description = '' - Default video mode. - ''; - type = types.nullOr types.str; - default = null; - example = "768x1024"; - }; - scale = mkOption { - description = '' - Display scaling factor. - ''; - type = types.nullOr types.ints.unsigned; - default = null; - example = 2; - }; - rotate = mkOption { - description = '' - Screen transformation. - ''; - type = types.enum [ - "90" "180" "270" "flipped" "flipped-90" "flipped-180" "flipped-270" null - ]; - default = null; - }; - }; - }; - - optionalKV = k: v: if v == null then "" else "${k} = ${builtins.toString v}"; - - renderPhocOutput = name: output: let - modelines = if builtins.isList output.modeline - then output.modeline - else [ output.modeline ]; - renderModeline = l: "modeline = ${l}"; - in '' - [output:${name}] - ${concatStringsSep "\n" (map renderModeline modelines)} - ${optionalKV "mode" output.mode} - ${optionalKV "scale" output.scale} - ${optionalKV "rotate" output.rotate} - ''; - - renderPhocConfig = phoc: let - outputs = mapAttrsToList renderPhocOutput phoc.outputs; - in '' - [core] - xwayland = ${phoc.xwayland} - ${concatStringsSep "\n" outputs} - [cursor] - theme = ${phoc.cursorTheme} - ''; -in - -{ - options = { - services.xserver.desktopManager.phosh = { - enable = mkOption { - type = types.bool; - default = false; - description = "Enable the Phone Shell."; - }; - - package = mkOption { - type = types.package; - default = pkgs.phosh; - defaultText = literalExpression "pkgs.phosh"; - example = literalExpression "pkgs.phosh"; - description = '' - Package that should be used for Phosh. - ''; - }; - - user = mkOption { - description = "The user to run the Phosh service."; - type = types.str; - example = "alice"; - }; - - group = mkOption { - description = "The group to run the Phosh service."; - type = types.str; - example = "users"; - }; - - phocConfig = mkOption { - description = '' - Configurations for the Phoc compositor. - ''; - type = types.oneOf [ types.lines types.path phocConfigType ]; - default = {}; - }; - }; - }; - - config = mkIf cfg.enable { - systemd.defaultUnit = "graphical.target"; - # Inspired by https://gitlab.gnome.org/World/Phosh/phosh/-/blob/main/data/phosh.service - systemd.services.phosh = { - wantedBy = [ "graphical.target" ]; - serviceConfig = { - ExecStart = "${cfg.package}/bin/phosh"; - User = cfg.user; - Group = cfg.group; - PAMName = "login"; - WorkingDirectory = "~"; - Restart = "always"; - - TTYPath = "/dev/tty7"; - TTYReset = "yes"; - TTYVHangup = "yes"; - TTYVTDisallocate = "yes"; - - # Fail to start if not controlling the tty. - StandardInput = "tty-fail"; - StandardOutput = "journal"; - StandardError = "journal"; - - # Log this user with utmp, letting it show up with commands 'w' and 'who'. - UtmpIdentifier = "tty7"; - UtmpMode = "user"; - }; - }; - - environment.systemPackages = [ - pkgs.phoc - cfg.package - pkgs.squeekboard - oskItem - ]; - - systemd.packages = [ cfg.package ]; - - programs.feedbackd.enable = true; - - security.pam.services.phosh = {}; - - hardware.opengl.enable = mkDefault true; - - services.gnome.core-shell.enable = true; - services.gnome.core-os-services.enable = true; - services.xserver.displayManager.sessionPackages = [ cfg.package ]; - - environment.etc."phosh/phoc.ini".source = - if builtins.isPath cfg.phocConfig then cfg.phocConfig - else if builtins.isString cfg.phocConfig then pkgs.writeText "phoc.ini" cfg.phocConfig - else pkgs.writeText "phoc.ini" (renderPhocConfig cfg.phocConfig); - }; -}