diff --git a/clients/quadphone/cross-fixes.nix b/clients/quadphone/cross-fixes.nix index 761215a..b321114 100644 --- a/clients/quadphone/cross-fixes.nix +++ b/clients/quadphone/cross-fixes.nix @@ -1,56 +1,8 @@ { - inputs, lib, ... }: { - nixpkgs.overlays = [ - (final: prev: { - gnome = prev.gnome // { - nixos-gsettings-overrides = prev.gnome.nixos-gsettings-overrides.override { - glib = final.buildPackages.glib; - }; - }; - - # Meson looks for gio and gdbus-codegen for the build machine - gnome-session = prev.gnome-session.overrideAttrs (old: { - depsBuildBuild = (old.depsBuildBuild or [ ]) ++ [ - final.pkgsBuildBuild.pkg-config - final.pkgsBuildBuild.glib - ]; - }); - }) - ]; - # TODO: flutter apps don't cross compile, and the flake's package isn't cached programs.nexus.enable = lib.mkForce false; - - # The cache builder doesn't find gtk-query-immodules-3.0 when cross compiling, - # and GNOME Shell connects apps to IBus itself, so the GTK module isn't used anyway. - i18n.inputMethod.enableGtk3 = false; - - # Needs python gi on the build machine, and only connects desktop browsers to - # extensions.gnome.org anyway. - services.gnome.gnome-browser-connector.enable = false; - - # nix-maid runs the host mustache-go at build time, swap in a copy of its core - # module that uses the build platform's one for that step. - # TODO: upstream (use pkgs.buildPackages.mustache-go in core.nix) - maid.sharedModules = - let - core = "${inputs.nix-maid}/src/maid/modules/core.nix"; - in - [ - { - disabledModules = [ core ]; - imports = [ - (builtins.toFile "nix-maid-core.nix" ( - builtins.replaceStrings - [ "import ../vars.nix" "lib.getExe pkgs.mustache-go" ] - [ "import ${inputs.nix-maid}/src/maid/vars.nix" "lib.getExe pkgs.buildPackages.mustache-go" ] - (builtins.readFile core) - )) - ]; - } - ]; } diff --git a/clients/quadphone/cross.nix b/clients/quadphone/cross.nix index 2a5f46e..063011d 100644 --- a/clients/quadphone/cross.nix +++ b/clients/quadphone/cross.nix @@ -5,7 +5,6 @@ ... }: let - cfg = config.quadphone; host = config.nixpkgs.hostPlatform; otherOverlays = lib.init config.nixpkgs.overlays; @@ -41,8 +40,7 @@ let let name = lib.concatStringsSep "." path; in - !(builtins.elem name cfg.crossPackages) - && builtins.match toolchainRegex name == null + builtins.match toolchainRegex name == null && lib.isDerivation native && lib.meta.availableOn host native && (native.meta.license.free or true) @@ -96,15 +94,6 @@ let v; in { - options.quadphone.crossPackages = lib.mkOption { - type = with lib.types; listOf str; - default = [ ]; - description = '' - Top-level attribute names that should always be cross-compiled instead of - substituted from the binary cache (i.e. ones that turn out not to be cached). - ''; - }; - config = { nixpkgs.buildPlatform = "x86_64-linux"; diff --git a/clients/quadphone/fde.nix b/clients/quadphone/fde.nix new file mode 100644 index 0000000..5244025 --- /dev/null +++ b/clients/quadphone/fde.nix @@ -0,0 +1,23 @@ +{ + # The image is built with an empty LUKS passphrase (systemd-repart can't take a + # key file through the NixOS image builder). After flashing, set a real passphrase + # and rotate the volume key, since the image's key is sitting in the nix store: + # run0 systemd-cryptenroll --password --wipe-slot=empty /dev/disk/by-partlabel/nixos + # run0 cryptsetup reencrypt /dev/disk/by-partlabel/nixos + image.repart.partitions."30-root".repartConfig.Encrypt = "key-file"; + + boot.initrd = { + luks.forceLuksSupportInInitrd = true; + unl0kr = { + enable = true; + settings = { + general.backend = "drm"; + theme = { + default = "nord-dark"; + alternate = "nord-light"; + }; + }; + }; + systemd.settings.Manager.DefaultDeviceTimeoutSec = "infinity"; + }; +} diff --git a/clients/quadraticpc/monitor-power.nix b/clients/quadraticpc/monitor-power.nix new file mode 100644 index 0000000..9346807 --- /dev/null +++ b/clients/quadraticpc/monitor-power.nix @@ -0,0 +1,58 @@ +{ pkgs, ... }: +let + # Sets VCP 0xD6 (power mode) on every display: 01 = on, 05 = off (even monitors that say they don't support it are usually lying) + monitor-power = pkgs.writeShellApplication { + name = "monitor-power"; + runtimeInputs = with pkgs; [ + ddcutil + gnugrep + coreutils + ]; + text = '' + for bus in $(ddcutil detect --terse | grep -oP '/dev/i2c-\K\d+'); do + (for _ in 1 2 3 4 5; do ddcutil --bus "$bus" setvcp D6 "$1" && break; sleep 1; done) & + done + wait + ''; + }; +in +{ + hardware.i2c.enable = true; + environment.systemPackages = [ + pkgs.ddcutil + monitor-power + ]; + + systemd.services = + let + # ddcutil refuses to start without a cache dir, and services have no HOME + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + CacheDirectory = "ddcutil"; + Environment = "XDG_CACHE_HOME=/var/cache"; + }; + in + { + monitor-power = { + wantedBy = [ "multi-user.target" ]; + after = [ "systemd-modules-load.service" ]; + # Otherwise every rebuild that touches this unit blinks the monitors + restartIfChanged = false; + serviceConfig = serviceConfig // { + ExecStart = "${monitor-power}/bin/monitor-power 01"; + ExecStop = "${monitor-power}/bin/monitor-power 05"; + }; + }; + + monitor-power-sleep = { + wantedBy = [ "sleep.target" ]; + before = [ "sleep.target" ]; + unitConfig.StopWhenUnneeded = true; + serviceConfig = serviceConfig // { + ExecStart = "${monitor-power}/bin/monitor-power 05"; + ExecStop = "${monitor-power}/bin/monitor-power 01"; + }; + }; + }; +} diff --git a/clients/quadraticserver/degoog.nix b/clients/quadraticserver/degoog.nix index b7b9726..8223998 100644 --- a/clients/quadraticserver/degoog.nix +++ b/clients/quadraticserver/degoog.nix @@ -20,7 +20,7 @@ displayName = "Search"; originUrl = "https://${domain}/oauth2/callback"; originLanding = "https://${domain}"; - imageFile = "${config.services.degoog.package}/share/degoog/src/public/images/degoog-logo.svg"; + imageFile = "${config.services.degoog.package}/share/degoog/src/public/images/degoog-logo.svg"; basicSecretFile = "/var/lib/kanidm-oauth2-secrets/${client}"; preferShortUsername = true; scopeMaps.idm_all_persons = [ @@ -74,10 +74,14 @@ }; systemd.services = { - caddy.serviceConfig.SupplementaryGroups = [ - "degoog" - "oauth2-proxy" - ]; + caddy = { + wants = [ "degoog.service" ]; + after = [ "degoog.service" ]; + serviceConfig.SupplementaryGroups = [ + "degoog" + "oauth2-proxy" + ]; + }; oauth2-proxy = { requires = [ "kanidm.service" ]; diff --git a/clients/quadraticserver/kanidm/default.nix b/clients/quadraticserver/kanidm/default.nix index 18fb817..2418dbf 100644 --- a/clients/quadraticserver/kanidm/default.nix +++ b/clients/quadraticserver/kanidm/default.nix @@ -339,6 +339,8 @@ in serviceConfig = hardening // { Type = "oneshot"; RemainAfterExit = true; + Restart = "on-failure"; + RestartSec = 5; User = "kanidm"; Group = "kanidm"; StateDirectory = "kanidm-bootstrap"; @@ -397,8 +399,10 @@ in kanidm-mail-sender = { description = "Kanidm mail sender"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; - requires = [ "kanidm-bootstrap.service" ]; + wants = [ + "network-online.target" + "kanidm-bootstrap.service" + ]; after = [ "network-online.target" "kanidm-bootstrap.service" diff --git a/clients/quadtop/disko.nix b/clients/quadtop/disko.nix new file mode 100644 index 0000000..22fd73e --- /dev/null +++ b/clients/quadtop/disko.nix @@ -0,0 +1,36 @@ +{ inputs, ... }: +{ + imports = [ inputs.disko.nixosModules.disko ]; + disko.devices.disk.main = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "cryptroot"; + settings.allowDiscards = true; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; +} diff --git a/clients/quadtop/fingerprint.nix b/clients/quadtop/fingerprint.nix new file mode 100644 index 0000000..2c6c121 --- /dev/null +++ b/clients/quadtop/fingerprint.nix @@ -0,0 +1,4 @@ +{ + # Enroll after install with `fprintd-enroll`. + services.fprintd.enable = true; +} diff --git a/clients/quadtop/gamescope.nix b/clients/quadtop/gamescope.nix index 08e4c12..1ffb883 100644 --- a/clients/quadtop/gamescope.nix +++ b/clients/quadtop/gamescope.nix @@ -3,6 +3,6 @@ "--force-grab-cursor" "-W 1920" "-H 1080" - "-r 120" + "-r 60" ]; } diff --git a/clients/quadtop/hardware-configuration.nix b/clients/quadtop/hardware-configuration.nix index 1e051cc..c944e9b 100755 --- a/clients/quadtop/hardware-configuration.nix +++ b/clients/quadtop/hardware-configuration.nix @@ -1,30 +1,14 @@ { boot = { - initrd = { - availableKernelModules = [ - "xhci_pci" - "ahci" - "nvme" - "usb_storage" - "sd_mod" - ]; - kernelModules = [ ]; - }; - kernelModules = [ "kvm-intel" ]; - extraModulePackages = [ ]; + initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + ]; + kernelModules = [ "kvm-amd" ]; }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/15598217-e3e1-4922-b336-8e9f62fad939"; - fsType = "ext4"; - }; - "/boot" = { - device = "/dev/disk/by-uuid/C6EC-B430"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; + hardware = { + amdgpu.initrd.enable = true; + cpu.amd.updateMicrocode = true; }; - - hardware.cpu.intel.updateMicrocode = true; } diff --git a/clients/quadtop/nvidia.nix b/clients/quadtop/nvidia.nix deleted file mode 100644 index f308113..0000000 --- a/clients/quadtop/nvidia.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - services.xserver.videoDrivers = [ "nvidia" ]; - hardware.nvidia = { - prime = { - offload = { - enable = true; - enableOffloadCmd = true; - }; - - intelBusId = "PCI:00:02:0"; - nvidiaBusId = "PCI:01:00:0"; - }; - open = true; - nvidiaSettings = false; - nvidiaPersistenced = false; - dynamicBoost.enable = true; - powerManagement.finegrained = true; - }; -} diff --git a/flake.lock b/flake.lock index 4686ce0..0d86dbc 100644 --- a/flake.lock +++ b/flake.lock @@ -74,6 +74,26 @@ "type": "github" } }, + "app-grid": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1794892850, + "narHash": "sha256-7kOT7EWzzNnKvuuPkTx9HciJ7Kd1ZrUbZJcwKgqq+w0=", + "ref": "refs/heads/main", + "rev": "ab0704e682c8b394edbec55c2b7b83d1601f7da8", + "revCount": 4, + "type": "git", + "url": "https://git.federated.nexus/Henry-Hiles/app-grid" + }, + "original": { + "type": "git", + "url": "https://git.federated.nexus/Henry-Hiles/app-grid" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -281,11 +301,11 @@ ] }, "locked": { - "lastModified": 1793997955, - "narHash": "sha256-Smi0gGdpBHiowEIU1oNBkeUx+27VcYJpz2Z7X7hFC1I=", + "lastModified": 1795004531, + "narHash": "sha256-3fvQO3U9rhUkBNxe56X6Ta5huTShZ2mtavi49o7tMvY=", "owner": "degoog-org", "repo": "degoog", - "rev": "cf012d9b639b9d5d874560ab69b31e02d29a6bb4", + "rev": "5490ca46096167cbf9b6f9480e7ac83726c0ce7e", "type": "github" }, "original": { @@ -779,11 +799,11 @@ ] }, "locked": { - "lastModified": 1794806514, - "narHash": "sha256-hRJv/aBOgTE5HnUFWi7yD1vTckeZ+WNIrrJ/hLhLQiM=", + "lastModified": 1794948232, + "narHash": "sha256-ngHNaADvk405ZLGgGK4j1AqbXTEVSQFN94Dw0KqSJI8=", "ref": "refs/heads/main", - "rev": "c3d58126ff1351d85bc03a1139139324898559cb", - "revCount": 383, + "rev": "51021d3af207c519ab5d9824af940d48ca9eabc1", + "revCount": 393, "type": "git", "url": "https://codeberg.org/pastthepixels/gaypanel" }, @@ -814,25 +834,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 +853,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": [ @@ -874,11 +860,11 @@ ] }, "locked": { - "lastModified": 1794715309, - "narHash": "sha256-awkBBs5ctFKgEYjpNGpi3t/VqF589n5EWfdinRb2gNI=", + "lastModified": 1794963576, + "narHash": "sha256-+CPrP74GDJ63f7bgEFC9Av4hbxc7K9WUNv1ZVRifRe8=", "owner": "nix-community", "repo": "home-manager", - "rev": "a1293da7dd8e497e08d26173f97e2976b36a31ea", + "rev": "2b13c9cb3aa20653e6f8ee0b7f8331a53ea9b0a9", "type": "github" }, "original": { @@ -921,21 +907,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", @@ -946,11 +917,11 @@ ] }, "locked": { - "lastModified": 1794839305, - "narHash": "sha256-LoJibO1DD1is9P2DtjjqHKBFxmupVlbFb3QavT2wnR0=", + "lastModified": 1795013460, + "narHash": "sha256-GSeulyglamkjHjdD2fCIddwZ2Phy6CZ4GyauzHPi6iE=", "ref": "refs/heads/main", - "rev": "3112871ceb0f1e94513ebb70c01e84c7f3443100", - "revCount": 1255, + "rev": "01938119931f92be47ca0c5b44ece2989b0d482e", + "revCount": 1267, "submodules": true, "type": "git", "url": "https://git.federated.nexus/Nexus/nexus" @@ -981,6 +952,27 @@ "url": "https://git.federated.nexus/federated-nexus/nexusbot" } }, + "niri-mobile": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1795016524, + "narHash": "sha256-gpq5p9sIORvbvR5S095ixBprS2/oXIrdXyg+Y8EQtDs=", + "owner": "Henry-Hiles", + "repo": "niri", + "rev": "cd9fabb98e9c3f5048d6f8fd2de5f9460a3efeb8", + "type": "github" + }, + "original": { + "owner": "Henry-Hiles", + "ref": "quad/mobile", + "repo": "niri", + "type": "github" + } + }, "nix-github-actions": { "inputs": { "nixpkgs": [ @@ -1004,17 +996,18 @@ }, "nix-maid": { "locked": { - "lastModified": 1794213517, - "narHash": "sha256-bryY6i495uT5OEz0eSeTPeJ35E6JLpI0PjPGNa5EdRk=", - "ref": "refs/heads/master", - "rev": "d4f00026e380858e683a022abe313a0ae52ad2c0", - "revCount": 136, + "lastModified": 1795021775, + "narHash": "sha256-KwipEAmXRwCpFccoUXkE7bw4Rg3Fqlm0GpSVNLlvCTU=", + "ref": "quad/fix/cross-mustache", + "rev": "f1fc27b1a9f4c2707a229683843edd97738b248b", + "revCount": 138, "type": "git", - "url": "https://codeberg.org/viperML/nix-maid" + "url": "https://codeberg.org/Henry-Hiles/nix-maid" }, "original": { + "ref": "quad/fix/cross-mustache", "type": "git", - "url": "https://codeberg.org/viperML/nix-maid" + "url": "https://codeberg.org/Henry-Hiles/nix-maid" } }, "nix2flatpak": { @@ -1046,26 +1039,27 @@ ] }, "locked": { - "lastModified": 1794327622, - "narHash": "sha256-mJlrDqLL7Xqz1avdukOJyaA52EauQMoJ6/DBO7rptQg=", - "ref": "refs/heads/master", - "rev": "5dc82c9de380dba9df746ad516363d08b1fe4c93", - "revCount": 53, + "lastModified": 1795105247, + "narHash": "sha256-S0pWLHzB0u7y/t9OUk+xhxWNqIFY8DuJA2S2ONNQmww=", + "ref": "quad/fix/sdm845-initrd", + "rev": "fbcf8cf2e49c21af5cb1bdcf9f661af74d2dc8b3", + "revCount": 54, "type": "git", "url": "https://codeberg.org/nixphone/nixphone" }, "original": { + "ref": "quad/fix/sdm845-initrd", "type": "git", "url": "https://codeberg.org/nixphone/nixphone" } }, "nixpkgs": { "locked": { - "lastModified": 1794537146, - "narHash": "sha256-Wpz/7x/YWnDIBu7yj6ixe8j6fIMsidd9Y+o1PqPF3iM=", + "lastModified": 1794890597, + "narHash": "sha256-lME2lHoDHAaSHP3/okgiVoJ0icVEvsQH8LeU3We7tcc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d5cc6833999746cffdfe0598f7bc801a57b887a9", + "rev": "04906337b6d53e8bb0eaf0470ae9f070a4d4eb55", "type": "github" }, "original": { @@ -1235,10 +1229,31 @@ "type": "github" } }, + "quadshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1795014593, + "narHash": "sha256-BPxE0o1cicSrKejw1Zy0yNV2c6eEFpYxQLxaJnDwA+A=", + "ref": "refs/heads/main", + "rev": "66bdba9a05985399d99a8d34278dd59fdf0669e5", + "revCount": 10, + "type": "git", + "url": "https://git.federated.nexus/Henry-Hiles/quadshell" + }, + "original": { + "type": "git", + "url": "https://git.federated.nexus/Henry-Hiles/quadshell" + } + }, "root": { "inputs": { "agenix": "agenix", "agenix-cli": "agenix-cli", + "app-grid": "app-grid", "continuwuity": "continuwuity", "cozybot": "cozybot", "degoog": "degoog", @@ -1248,18 +1263,20 @@ "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", + "quadshell": "quadshell", "run0-sudo-shim": "run0-sudo-shim", "sable": "sable", "sable-next": "sable-next", + "stevia-mobile": "stevia-mobile", "stylix": "stylix", "wrapper-manager": "wrapper-manager" } @@ -1368,11 +1385,11 @@ ] }, "locked": { - "lastModified": 1794833435, - "narHash": "sha256-KrUwt40VEm7MaUULGXRRflSlmyRQEam+0CED+ewOLHE=", + "lastModified": 1795015701, + "narHash": "sha256-S6oHH5S2sziGcqTUBiyzmkABUtsY/JT9eHtozN/N2fg=", "ref": "refs/heads/main", - "rev": "ba9340cee718a8aae962a2171f44d3a25c793589", - "revCount": 8292, + "rev": "4c8b5133de1804a6a759169bcb9fe93124d0ee3e", + "revCount": 8426, "type": "git", "url": "https://git.sable.moe/SableClient/sable-next" }, @@ -1381,6 +1398,23 @@ "url": "https://git.sable.moe/SableClient/sable-next" } }, + "stevia-mobile": { + "flake": false, + "locked": { + "lastModified": 1794931711, + "narHash": "sha256-o77hyGwV3ipquHABWk0zAP3QniiORpi3WmdQ26Dp1pg=", + "ref": "quad/mobile", + "rev": "40ed1ab05b5b81cdabb76a959c4fc681fd216d3b", + "revCount": 1348, + "type": "git", + "url": "https://gitlab.gnome.org/Henry-Hiles/stevia" + }, + "original": { + "ref": "quad/mobile", + "type": "git", + "url": "https://gitlab.gnome.org/Henry-Hiles/stevia" + } + }, "stylix": { "inputs": { "base16": "base16", diff --git a/flake.nix b/flake.nix index 3618f6d..6e10c45 100755 --- a/flake.nix +++ b/flake.nix @@ -3,17 +3,29 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; wrapper-manager.url = "git+https://codeberg.org/viperML/wrapper-manager"; flake-parts.url = "github:hercules-ci/flake-parts"; - nix-maid.url = "git+https://codeberg.org/viperML/nix-maid"; + nix-maid.url = "git+https://codeberg.org/Henry-Hiles/nix-maid?ref=quad/fix/cross-mustache"; gadgetfs = { url = "github:sorki/nixos-gadgetfs-proto"; flake = false; }; - gnome-mobile = { - url = "git+file:///home/quadradical/Documents/Code/nixos-gnome-mobile"; + app-grid = { + url = "git+https://git.federated.nexus/Henry-Hiles/app-grid"; inputs.nixpkgs.follows = "nixpkgs"; }; + quadshell = { + url = "git+https://git.federated.nexus/Henry-Hiles/quadshell"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + niri-mobile = { + url = "github:Henry-Hiles/niri/quad/mobile"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + stevia-mobile = { + url = "git+https://gitlab.gnome.org/Henry-Hiles/stevia?ref=quad/mobile"; + flake = false; + }; nixphone = { - url = "git+https://codeberg.org/nixphone/nixphone"; + url = "git+https://codeberg.org/nixphone/nixphone?ref=quad/fix/sdm845-initrd"; inputs.nixpkgs.follows = "nixpkgs"; }; continuwuity = { diff --git a/modules/common/nh.nix b/modules/common/nh.nix index b161d99..fe5ce74 100644 --- a/modules/common/nh.nix +++ b/modules/common/nh.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let aliases = { upgrade = "nh os switch --update"; @@ -23,8 +28,15 @@ in ( command: host: pkgs.writeShellScriptBin command '' + # Stop other systems from getting GC'd + keep() { + path=$(nix build --no-link --print-out-paths \ + "${config.programs.nh.flake}#nixosConfigurations.${host}.config.system.build.toplevel") + sudo nix-env --profile /nix/var/nix/profiles/${host} --set "$path" + } + ${lib.concatMapAttrsStringSep "\n" ( - name: cmd: ''${name}() { ${cmd} -H ${host} --target-host ${command} --diff never "$@"; }'' + name: cmd: ''${name}() { ${cmd} -H ${host} --target-host ${command} --diff never "$@" && keep; }'' ) aliases} "$@" diff --git a/modules/common/users.nix b/modules/common/users.nix index 3a3cc79..037ae28 100644 --- a/modules/common/users.nix +++ b/modules/common/users.nix @@ -2,17 +2,21 @@ { users = { mutableUsers = false; - users = { - root.hashedPasswordFile = config.age.secrets."password.age".path; - quadradical = { - isNormalUser = true; - hashedPasswordFile = config.age.secrets."password.age".path; - description = "QuadRadical"; - extraGroups = [ - "wheel" - "networkmanager" - ]; + users = + let + password = config.age.secrets."password-${config.networking.hostName}.age".path; + in + { + root.hashedPasswordFile = password; + quadradical = { + isNormalUser = true; + hashedPasswordFile = password; + description = "QuadRadical"; + extraGroups = [ + "wheel" + "networkmanager" + ]; + }; }; - }; }; } diff --git a/modules/desktop/packages.nix b/modules/desktop/packages.nix index 6cfa860..1390716 100644 --- a/modules/desktop/packages.nix +++ b/modules/desktop/packages.nix @@ -1,10 +1,11 @@ { pkgs, ... }: { + services.adw-bluetooth.enable = true; environment.systemPackages = with pkgs; [ + nmgui heroic inkscape libreoffice - authenticator prismlauncher ]; } diff --git a/modules/desktop/vscodium.nix b/modules/desktop/vscodium.nix index b219d71..e089c56 100644 --- a/modules/desktop/vscodium.nix +++ b/modules/desktop/vscodium.nix @@ -37,6 +37,18 @@ version = "0.2.1"; sha256 = "sha256-uHdQeW9ZXYg6+VnD6cb5CU10/xV5hCtxt5K+j0qb7as="; } + { + publisher = "theqtcompany"; + name = "qt-core"; + version = "1.16.0"; + hash = "sha256-6NBWsK7ljx7Ie3xvOrjBClyvwQP1UltCna1jQHJST5U="; + } + { + publisher = "theqtcompany"; + name = "qt-qml"; + version = "1.16.0"; + hash = "sha256-QWjUSbBtHIdxYZyRBDn64HXhvSwhgzm7DjDaed6lNds="; + } ]; }) ]; @@ -104,9 +116,11 @@ "indentRainbow.ignoreErrorLanguages" = [ "*" ]; "dart.runPubGetOnPubspecChanges" = "never"; "workbench.colorTheme" = "Nord"; + "qt-qml.qmlls.customExePath" = "${pkgs.qt6.qtdeclarative}/bin/qmlls"; + "qt-qml.doNotAskForQmllsDownload" = true; }; - "/home/quadradical/.config/VSCodium/User/keybindings.json".source = builtins.toJSON [ + "VSCodium/User/keybindings.json".text = builtins.toJSON [ { key = "ctrl+s"; command = "workbench.action.files.saveAll"; diff --git a/modules/desktop/wm/clipboard.nix b/modules/desktop/wm/clipboard.nix deleted file mode 100644 index 5c60a70..0000000 --- a/modules/desktop/wm/clipboard.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, lib, ... }: -{ - # Keeps clipboard contents available after the app they were copied from exits - programs.fht-compositor.sessionPrograms.wl-clip-persist = - "${lib.getExe pkgs.wl-clip-persist} --clipboard regular"; -} diff --git a/modules/desktop/wm/fht-compositor/default.nix b/modules/desktop/wm/fht-compositor/default.nix index 8a87cad..b68ee5d 100644 --- a/modules/desktop/wm/fht-compositor/default.nix +++ b/modules/desktop/wm/fht-compositor/default.nix @@ -63,6 +63,8 @@ in "org.freedesktop.impl.portal.ScreenCast" = [ "fht-compositor" ]; }; + quad.session = lib.getExe' cfg.package "fht-compositor-session"; + environment = { # Called by name (rather than by store path), so Super+Ctrl+R after a rebuild runs the new version systemPackages = [ session-programs ]; @@ -77,6 +79,7 @@ in patches = (old.patches or [ ]) ++ [ ./resize-tiled-windows.patch ./lone-modifier.patch + ./session-lock-fail-closed.patch ]; nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.makeWrapper ]; @@ -110,6 +113,10 @@ in Super-q = "close-focused-window"; Super-f = "fullscreen-focused-window"; Super-Ctrl-q = "quit"; + Super-l = { + action = "run-command"; + arg = "${config.quad.lock}"; + }; Super-Ctrl-r = { action = "run-command"; arg = "fht-compositor ipc action reload-config; session-programs"; diff --git a/modules/desktop/wm/fht-compositor/session-lock-fail-closed.patch b/modules/desktop/wm/fht-compositor/session-lock-fail-closed.patch new file mode 100644 index 0000000..c04e75f --- /dev/null +++ b/modules/desktop/wm/fht-compositor/session-lock-fail-closed.patch @@ -0,0 +1,128 @@ +--- a/src/handlers/session_lock.rs ++++ b/src/handlers/session_lock.rs +@@ -117,9 +117,11 @@ + + impl Fht { + pub fn is_locked(&self) -> bool { ++ // Fail closed: as soon as a lock is requested, session contents and input must be hidden, ++ // even if the lock client is slow (or never) providing surfaces. + matches!( + &self.lock_state, +- LockState::Locked(_) | LockState::Locking(_) ++ LockState::Locked(_) | LockState::Locking(_) | LockState::WaitingForSurfaces(_) + ) + } + +@@ -130,8 +132,11 @@ + + let has_surfaces = self + .output_state +- .values() +- .all(|state| state.lock_surface.is_some()); ++ .iter() ++ // State of disconnected outputs is never removed, and they will never get a lock ++ // surface, so only wait for outputs that still exist. ++ .filter(|(output, _)| self.space.outputs().any(|o| o == *output)) ++ .all(|(_, state)| state.lock_surface.is_some()); + if !has_surfaces { + trace!("not locking session, waiting for other lock surfaces"); + // still didn't map everything. +@@ -161,6 +166,14 @@ + return; + } + ++ // Black while the lock client is still mapping its surfaces, red once locked, where it ++ // can only be seen if a lock surface is missing (the lock client died, new output, etc). ++ let backdrop_color = if matches!(self.lock_state, LockState::Locked(_)) { ++ [1., 0., 0., 1.] ++ } else { ++ [0., 0., 0., 1.] ++ }; ++ + let output_state = self.output_state.get_mut(output).unwrap(); + // Inform that we finally rendered this output with its designated lock surface. + output_state.rendered_with_lock = true; +@@ -176,6 +189,21 @@ + &mut |e| push(e.into()), + ); + } ++ ++ // Always cover the output, so nothing leaks when there's no lock surface (yet), for ++ // example on a newly connected output or if the lock client died. ++ output_state ++ .lock_backdrop ++ .update(output.geometry().size, backdrop_color); ++ push(SessionLockRenderElement::ClearBackdrop( ++ SolidColorRenderElement::from_buffer( ++ &output_state.lock_backdrop, ++ Point::default(), ++ scale, ++ 1.0, ++ Kind::Unspecified, ++ ), ++ )); + } + } + +--- a/src/output.rs ++++ b/src/output.rs +@@ -1,4 +1,5 @@ + use smithay::backend::renderer::damage::OutputDamageTracker; ++use smithay::backend::renderer::element::solid::SolidColorBuffer; + use smithay::output::Output; + use smithay::reexports::calloop::RegistrationToken; + use smithay::wayland::session_lock::LockSurface; +@@ -57,6 +58,8 @@ + pub lock_surface: Option, + /// Whether the output rendered a frame with the [`lock_surface`] yet. + pub rendered_with_lock: bool, ++ /// Backdrop drawn below the [`lock_surface`], covering the output while locked. ++ pub lock_backdrop: SolidColorBuffer, + } + + /// A state machine to describe where an [`Output`](smithay::output::Output) in the redraw loop. +--- a/src/renderer/mod.rs ++++ b/src/renderer/mod.rs +@@ -205,6 +205,8 @@ + self.render_session_lock(renderer, output, &mut |e| { + push(FhtRenderElement::SessionLock(e)) + }); ++ // The lock covers everything, don't even render session contents below it. ++ return rv; + } + + let layer_map = layer_map_for_output(output); +--- a/src/state.rs ++++ b/src/state.rs +@@ -268,8 +268,10 @@ + let all_locked = self + .fht + .output_state +- .values() +- .all(|state| state.rendered_with_lock); ++ .iter() ++ // Disconnected outputs will never render again, ignore them. ++ .filter(|(output, _)| self.fht.space.outputs().any(|o| o == *output)) ++ .all(|(_, state)| state.rendered_with_lock); + + if all_locked { + // All outputs are locked, report success. +@@ -1072,6 +1074,7 @@ + lock_surface: None, + // If we are already locked, the first frame should have the lock surface. + rendered_with_lock: self.is_locked(), ++ lock_backdrop: smithay::backend::renderer::element::solid::SolidColorBuffer::new(output.geometry().size, [0., 0., 0., 1.]), + }; + self.output_state.insert(output.clone(), state); + +@@ -1107,6 +1110,10 @@ + for layer in layer_map_for_output(output).layers() { + layer.layer_surface().send_close() + } ++ ++ // A pending session lock might have only been waiting on this output. ++ self.try_continue_locking(); ++ self.queue_redraw_all(); + } + + pub fn focus_output(&mut self, output: &Output) { diff --git a/modules/desktop/wm/hyprlock.nix b/modules/desktop/wm/hyprlock.nix new file mode 100644 index 0000000..a5980b7 --- /dev/null +++ b/modules/desktop/wm/hyprlock.nix @@ -0,0 +1,60 @@ +{ + config, + lib, + pkgs, + ... +}: +let + inherit (config.lib.stylix) colors; + + hyprlockConfig = pkgs.writeText "hyprlock.conf" '' + auth { + fingerprint { + enabled = ${lib.boolToString config.services.fprintd.enable} + ready_message = Scan fingerprint to unlock + present_message = Scanning... + } + } + + background { + path = ${../../../background.jpg} + blur_passes = 3 + } + + label { + text = $TIME + font_size = 96 + position = 0, 200 + } + + label { + text = cmd[update:60000] date +"%A, %B %-d" + font_size = 20 + position = 0, 110 + } + + input-field { + size = 300, 50 + outline_thickness = 0 + inner_color = rgb(${colors.base01}) + font_color = rgb(${colors.base05}) + check_color = rgb(${colors.base0D}) + fade_on_empty = false + ${lib.optionalString config.services.fprintd.enable "placeholder_text = $FPRINTPROMPT"} + } + ''; +in +{ + options.quad.lock = lib.mkOption { + type = lib.types.package; + readOnly = true; + description = "Locks the session with hyprlock, unless it's already running."; + default = pkgs.writeShellScript "lock" '' + exec ${lib.getExe' pkgs.util-linux "flock"} --nonblock "$XDG_RUNTIME_DIR/hyprlock.lock" \ + ${lib.getExe' config.systemd.package "systemd-cat"} --identifier=hyprlock \ + ${lib.getExe pkgs.hyprlock} --config ${hyprlockConfig} + ''; + }; + + config.security.pam.services.hyprlock.fprintAuth = false; +} diff --git a/modules/desktop/wm/lockscreen.nix b/modules/desktop/wm/lockscreen.nix index 6afec7a..9b7895e 100644 --- a/modules/desktop/wm/lockscreen.nix +++ b/modules/desktop/wm/lockscreen.nix @@ -7,46 +7,15 @@ { services.logind.settings.Login.HandlePowerKey = "suspend"; - programs = { - hyprlock.enable = true; + programs.fht-compositor = { + # We log in automatically, so lock straight away. + settings.autostart = [ "${config.quad.lock}" ]; - fht-compositor.sessionPrograms.hypridle = - "${lib.getExe pkgs.hypridle} --config ${pkgs.writeText "hypridle.conf" '' - general { - lock_cmd = pidof hyprlock || ${lib.getExe pkgs.hyprlock} --config ${ - let - inherit (config.lib.stylix) colors; - in - pkgs.writeText "hyprlock.conf" '' - background { - path = screenshot - blur_passes = 3 - } - - label { - text = $TIME - font_size = 96 - position = 0, 200 - } - - label { - text = cmd[update:60000] date +"%A, %B %-d" - font_size = 20 - position = 0, 110 - } - - input-field { - size = 300, 50 - outline_thickness = 0 - inner_color = rgb(${colors.base01}) - font_color = rgb(${colors.base05}) - check_color = rgb(${colors.base0D}) - fade_on_empty = false - } - '' - } - before_sleep_cmd = loginctl lock-session - } - ''}"; + sessionPrograms.hypridle = "${lib.getExe pkgs.hypridle} --config ${pkgs.writeText "hypridle.conf" '' + general { + lock_cmd = ${config.quad.lock} + before_sleep_cmd = loginctl lock-session + } + ''}"; }; } diff --git a/modules/graphical/clipboard.nix b/modules/graphical/clipboard.nix new file mode 100644 index 0000000..b3d1ace --- /dev/null +++ b/modules/graphical/clipboard.nix @@ -0,0 +1,12 @@ +{ pkgs, lib, ... }: +{ + systemd.user.services.wl-clip-persist = { + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + ExecStart = "${lib.getExe pkgs.wl-clip-persist} --clipboard regular"; + Restart = "on-failure"; + }; + }; +} diff --git a/modules/graphical/gnome/default.nix b/modules/graphical/gnome.nix similarity index 72% rename from modules/graphical/gnome/default.nix rename to modules/graphical/gnome.nix index 1448271..f0334ac 100644 --- a/modules/graphical/gnome/default.nix +++ b/modules/graphical/gnome.nix @@ -6,8 +6,6 @@ }: { services = { - displayManager.gdm.enable = true; - gnome = { core-os-services.enable = true; core-apps.enable = true; @@ -16,6 +14,23 @@ gvfs.enable = true; }; + systemd.user.tmpfiles.users.quadradical.rules = + let + keyring = pkgs.writeText "login.keyring" '' + [keyring] + display-name=Login + ctime=0 + mtime=0 + lock-on-idle=false + lock-after=false + ''; + in + [ + "d %h/.local/share/keyrings 0700 - - -" + "C %h/.local/share/keyrings/login.keyring 0600 - - - ${keyring}" + "f %h/.local/share/keyrings/default 0600 - - - login" + ]; + environment.sessionVariables.NAUTILUS_4_EXTENSION_DIR = lib.mkForce "${config.system.path}/lib/nautilus/extensions-4"; environment.gnome.excludePackages = with pkgs; [ diff --git a/modules/graphical/librewolf/customChrome.css b/modules/graphical/librewolf/customChrome.css index 0760c97..4083f51 100644 --- a/modules/graphical/librewolf/customChrome.css +++ b/modules/graphical/librewolf/customChrome.css @@ -30,7 +30,8 @@ /* Menus */ --gnome-menu-background: #3b4252; --gnome-menu-border-color: rgba(0, 0, 0, 0.14); - --gnome-menu-shadow: 0 1px 5px 1px rgba(0, 0, 0, 0.09), + --gnome-menu-shadow: + 0 1px 5px 1px rgba(0, 0, 0, 0.09), 0 2px 14px 3px rgba(0, 0, 0, 0.05); --gnome-menu-button-hover-background: var(--gnome-button-background); --gnome-menu-separator-color: rgba(255, 255, 255, 0.1); @@ -134,3 +135,15 @@ --gnome-private-text-primary-color: #fbfbfe; } } + +/* Phone only: quad.mobile is set in modules/mobile/librewolf.nix. The mobile layout turns the URL + * bar results into a sheet over the page, but the theme makes its background transparent. */ +@media -moz-pref("quad.mobile") { + .urlbarView { + background: var(--gnome-menu-background) !important; + } + + :root[customtitlebar] #nav-bar > .titlebar-buttonbox-container { + display: none !important; + } +} diff --git a/modules/graphical/librewolf/default.nix b/modules/graphical/librewolf/default.nix index 94784ba..b52fce1 100644 --- a/modules/graphical/librewolf/default.nix +++ b/modules/graphical/librewolf/default.nix @@ -9,8 +9,8 @@ environment.etc."librewolf/policies/policies.json".source = config.environment.etc."firefox/policies/policies.json".source; - users.users.quadradical.maid.file.home = { - ".librewolf/profiles.ini".source = (pkgs.formats.ini { }).generate "profiles.ini" { + users.users.quadradical.maid.file.xdg_config = { + "librewolf/librewolf/profiles.ini".source = (pkgs.formats.ini { }).generate "profiles.ini" { General = { StartWithLastProfile = 1; }; @@ -22,7 +22,7 @@ }; }; - ".librewolf/quadradical/chrome".source = toString ( + "librewolf/librewolf/quadradical/chrome".source = toString ( pkgs.symlinkJoin { name = "firefox-gnome-theme"; paths = [ @@ -42,6 +42,7 @@ "webgl.disabled" = false; "font.name-list.emoji" = ""; "browser.tabs.groups.enabled" = false; + "browser.fireButton.enabled" = false; "media.peerconnection.enabled" = true; "privacy.resistFingerprinting" = false; "browser.ml.linkPreview.enabled" = false; @@ -51,8 +52,25 @@ "widget.use-xdg-desktop-portal.file-picker" = 1; "toolkit.legacyUserProfileCustomizations.stylesheets" = true; "privacy.fingerprintingProtection.overrides" = "+AllTargets,-CSSPrefersColorScheme,-JSDateTimeUTC"; - "browser.uiCustomization.state" = - "{\"placements\":{\"widget-overflow-fixed-list\":[],\"unified-extensions-area\":[],\"nav-bar\":[\"back-button\",\"forward-button\",\"stop-reload-button\",\"urlbar-container\",\"downloads-button\"],\"toolbar-menubar\":[\"menubar-items\"],\"TabsToolbar\":[\"tabbrowser-tabs\",\"new-tab-button\",\"alltabs-button\"],\"PersonalToolbar\":[\"personal-bookmarks\"]},\"seen\":[\"save-to-pocket-button\",\"developer-button\"],\"dirtyAreaCache\":[\"nav-bar\",\"PersonalToolbar\",\"toolbar-menubar\",\"TabsToolbar\"],\"currentVersion\":19}"; + "browser.download.autohideButton" = true; + "browser.uiCustomization.state" = builtins.toJSON { + currentVersion = 28; + placements = { + nav-bar = [ + "back-button" + "forward-button" + "stop-reload-button" + "urlbar-container" + "downloads-button" + "unified-extensions-button" + ]; + TabsToolbar = [ + "tabbrowser-tabs" + "new-tab-button" + "alltabs-button" + ]; + }; + }; } ); @@ -133,6 +151,8 @@ value = { install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${id}/latest.xpi"; installation_mode = "force_installed"; + # In the extensions menu, not as separate toolbar buttons + default_area = "menupanel"; }; }) [ @@ -141,15 +161,9 @@ "sponsorBlocker@ajay.app" "firefox@tampermonkey.net" "firefox-addon@pronoundb.org" - "jid1-MnnxcxisBPnSXQ@jetpack" # Privacy Badger "frankerfacez@frankerfacez.com" - "7esoorv3@alefvanoon.anonaddy.me" # LibRedirect "{de621c74-2aa6-4c91-a2da-28d445b66bab}" # YouTube Livestreams Theater Mode - "{cf3dba12-a848-4f68-8e2d-f9fadc0721de}" # Google Lighthouse "{446900e4-71c2-419f-a6a7-df9c091e268b}" # Bitwarden - "{4ce83447-8255-43c2-b8f7-e02eb8c2cc39}" # Draw on Page - "{ac34afe8-3a2e-4201-b745-346c0cf6ec7d}" # Better Youtube Shorts - "{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" # User-Agent Switcher and Manager "enhancerforyoutube@maximerf.addons.mozilla.org" ] ) diff --git a/modules/graphical/login.nix b/modules/graphical/login.nix new file mode 100644 index 0000000..135004b --- /dev/null +++ b/modules/graphical/login.nix @@ -0,0 +1,23 @@ +{ config, lib, ... }: +{ + options.quad.session = lib.mkOption { + type = lib.types.str; + description = "Command for the graphical session. greetd logs straight into it, and the session is expected to lock itself."; + }; + + config.services.greetd = { + enable = true; + settings = + let + initial_session = { + command = config.quad.session; + user = "quadradical"; + }; + in + { + inherit initial_session; + + default_session = initial_session; + }; + }; +} diff --git a/modules/mobile/allow-broken.nix b/modules/mobile/allow-broken.nix deleted file mode 100644 index 0745649..0000000 --- a/modules/mobile/allow-broken.nix +++ /dev/null @@ -1 +0,0 @@ -{ nixpkgs.config.allowBroken = true; } diff --git a/modules/mobile/gnome-mobile.nix b/modules/mobile/gnome-mobile.nix deleted file mode 100644 index 72b12d9..0000000 --- a/modules/mobile/gnome-mobile.nix +++ /dev/null @@ -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" - ]; - }; - }; -} diff --git a/modules/mobile/librewolf.nix b/modules/mobile/librewolf.nix new file mode 100644 index 0000000..743c6a6 --- /dev/null +++ b/modules/mobile/librewolf.nix @@ -0,0 +1,39 @@ +{ pkgs, ... }: +# The mobile layout from postmarketOS's mobile-config-firefox, the same way nixpkgs' firefox-mobile +# adds it, but on top of the LibreWolf set up in graphical/librewolf. +let + src = pkgs.fetchFromGitLab { + domain = "gitlab.nura.eco"; + owner = "nura"; + repo = "mobile-config-firefox"; + rev = "5.5.1"; + hash = "sha256-kIMeVKUI8/MdCJIkBlcYYEUnN7+ciDpKuReAeKkn8VY="; + }; + + configDir = pkgs.runCommand "mobile-config-firefox" { } '' + mkdir -p $out + cp -r ${src}/src/modules/. $out/ + cp -r ${src}/src/themes $out/ + ''; + + autoconfig = pkgs.runCommand "mobile-config-autoconfig.js" { } '' + substitute ${src}/src/mobile-config-autoconfig.js autoconfig.js \ + --replace-fail "/usr/lib/mobile-config-firefox" "${configDir}" \ + --replace-fail 'var logFile = g_chromeDir.clone();' 'var logFile = Services.dirsvc.get("ProfD", Ci.nsIFile);' + { echo '(function () {'; cat autoconfig.js; echo '})();'; } > $out + ''; + + # The wrapper sets up autoconfig itself + prefs = pkgs.runCommand "mobile-config-prefs.js" { } '' + grep -v -e general.config.filename -e general.config.obscure_value \ + -e general.config.sandbox_enabled ${src}/src/mobile-config-prefs.js > $out + ''; +in +{ + programs.firefox.autoConfigFiles = [ + autoconfig + prefs + # Lets graphical/librewolf/customChrome.css fix things up for the mobile layout only + (pkgs.writeText "quad-mobile-prefs.js" ''defaultPref("quad.mobile", true);'') + ]; +} diff --git a/modules/mobile/niri.nix b/modules/mobile/niri.nix new file mode 100644 index 0000000..451b330 --- /dev/null +++ b/modules/mobile/niri.nix @@ -0,0 +1,144 @@ +{ + config, + inputs, + lib, + pkgs, + ... +}: +let + 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"; + + stevia = pkgs.stevia.overrideAttrs (old: { + version = "quad-mobile-${inputs.stevia-mobile.shortRev}"; + src = inputs.stevia-mobile; + # Needed by newer Stevia than nixpkgs has + buildInputs = old.buildInputs ++ [ + pkgs.gsettings-desktop-schemas + pkgs.gst_all_1.gstreamer + pkgs.gst_all_1.gst-plugins-base + pkgs.libsoup_3 + ]; + mesonFlags = old.mesonFlags ++ [ + "-Duim=disabled" + "-Dgovarnam=disabled" + ]; + }); + + hypridleConfig = pkgs.writeText "hypridle.conf" '' + general { + before_sleep_cmd = loginctl lock-session + } + ''; + + suspend = pkgs.writeShellScript "suspend" '' + ${lib.getExe pkgs.niri} msg action power-off-monitors + exec ${config.systemd.package}/bin/systemctl suspend + ''; + +in +{ + nixpkgs.overlays = [ + inputs.niri-mobile.overlays.default + inputs.app-grid.overlays.default + ]; + + programs.niri.enable = true; + + environment.etc."niri/config.kdl".text = '' + output "DSI-1" { + scale 3 + } + + input { + touch { edge-swipe-size 24; } + // The power key is bound below instead. + disable-power-key-handling + } + + layout { + gaps 16 + struts { + left -16 + right -16 + top -16 + bottom -16 + } + center-focused-column "always" + default-column-width { proportion 1.0; } + background-color "transparent" + focus-ring { off; } + } + + // zoom and workspace-anchor have to match the constants in the app grid. + overview { + zoom 0.25 + workspace-anchor 0.15 + hide-inactive-workspaces + swipe-to-close + swipe-down-to-exit + open-when-empty + workspace-shadow { off; } + } + + gestures { + workspace-switch { off; } + } + + window-rule { + open-floating false + } + + layer-rule { + match namespace="^app-grid$" + place-within-backdrop true + backdrop-input true + } + + layer-rule { + match namespace="^wallpaper$" + place-within-backdrop true + } + + prefer-no-csd + + hotkey-overlay { + skip-at-startup + } + + spawn-at-startup "${lib.getExe pkgs.swaybg}" "-i" "${../../background.jpg}" "-m" "fill" + spawn-at-startup "${lib.getExe pkgs.app-grid}" + spawn-at-startup "${lib.getExe stevia}" + spawn-at-startup "${lib.getExe' pkgs.swayosd "swayosd-server"}" "--style" "${swayosdStyle}" + spawn-at-startup "${lib.getExe pkgs.hypridle}" "--config" "${hypridleConfig}" + + binds { + XF86PowerOff allow-when-locked=true { spawn "${suspend}"; } + XF86AudioRaiseVolume allow-when-locked=true { spawn "${swayosd-client}" "--output-volume" "raise"; } + XF86AudioLowerVolume allow-when-locked=true { spawn "${swayosd-client}" "--output-volume" "lower"; } + } + ''; + + quad.session = lib.getExe' pkgs.niri "niri-session"; + + services.logind.settings.Login = { + HandlePowerKey = "ignore"; + HandlePowerKeyLongPress = "poweroff"; + }; + + # GNOME's core-os-services turns on IBus, but GTK has to use text-input-v3 + # so the on-screen keyboard gets the text fields. + i18n.inputMethod.enable = false; + + users.users.quadradical.maid.gsettings.settings.org.gnome.desktop = { + a11y.applications.screen-keyboard-enabled = true; + wm.preferences.button-layout = "appmenu:"; + }; +} diff --git a/modules/mobile/phone.nix b/modules/mobile/phone.nix index 139727f..5fcb798 100644 --- a/modules/mobile/phone.nix +++ b/modules/mobile/phone.nix @@ -9,13 +9,13 @@ chatty ]; + # chatty always links libcmatrix, which needs olm, even if Matrix isn't used nixpkgs.config.permittedInsecurePackages = [ "olm-3.2.16" ]; networking.modemmanager.enable = true; - services.geoclue2.enable = true; users.users.geoclue.extraGroups = [ "networkmanager" ]; location.provider = "geoclue2"; } diff --git a/modules/mobile/quadshell.nix b/modules/mobile/quadshell.nix new file mode 100644 index 0000000..fcfc431 --- /dev/null +++ b/modules/mobile/quadshell.nix @@ -0,0 +1,22 @@ +{ + lib, + pkgs, + inputs, + ... +}: +{ + nixpkgs.overlays = [ inputs.quadshell.overlays.default ]; + + # quadshell's Bluetooth arrow opens it, and it needs its daemon + services.adw-bluetooth.enable = true; + + # quadshell is GeoClue's agent, for its location toggle + services.geoclue2 = { + enableDemoAgent = false; + whitelistedAgents = [ "quadshell" ]; + }; + + environment.etc."niri/config.kdl".text = '' + spawn-at-startup "${lib.getExe pkgs.quadshell}" + ''; +} diff --git a/secrets/password-quadphone.age b/secrets/password-quadphone.age new file mode 100644 index 0000000..9f3e686 --- /dev/null +++ b/secrets/password-quadphone.age @@ -0,0 +1,10 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZLUVVkUSBGNVFs +REE0cndoQ002TDdrQzFtMmw1RERaY0xnajVuYjgvNkw0aWlhVndzCkxUVzlHZ0tm +MlFZUytHUlhvZmI1TE5aN3pXcmhwZ3ViUnVkQ1BUNHNac1EKLT4gJy1ncmVhc2Ug +TlxePzd7flEgeVsgOXU7IDxhdmZaCitkUlRCVWU2cnBiVTh2YXc3aktlaTBGajkw +VUl2RTQKLS0tIEwrdkFNUTd4ZzFpV1N3ZDBpQnREQTFMaTdNSVRGMkIwZUNRV1lR +NElVTlEKD3nduDFOvdiQj3fnDP8nXTk29Wv6rEzwPo+9QGztxgFxZETvO7LgFF46 +boM+33qpaW/x34nAgzUlhsIZoN7Js4slFTHlibxn6g3hJceNeTW5DhngO/teoFX3 +W1UP9oFcTwt3wOP09203LA== +-----END AGE ENCRYPTED FILE----- diff --git a/secrets/password.age b/secrets/password-quadraticpc.age similarity index 100% rename from secrets/password.age rename to secrets/password-quadraticpc.age diff --git a/secrets/password-quadraticserver.age b/secrets/password-quadraticserver.age new file mode 100644 index 0000000..f2e3879 --- /dev/null +++ b/secrets/password-quadraticserver.age @@ -0,0 +1,11 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZLUVVkUSBKQ29L +VTVOL1FyeXBKUWpHRkVodmRnTXdMenppUHJrOHl1WmhTdkFnTTBzCkY3T0dlN1d1 +OExlRnQzZ2FrbU5nd1pLQzUxSlVubHhaS0x4Wm4zRzVnNEUKLT4gW1twcC1ncmVh +c2UgRUlhTmJxIHA0CjBmU3U3dEZ0OFpXUDZockwwcmQwQUd6Tjg4TXQyWVcwOXZO +ZG9YYnBGckd4RWpxNEorVnlCb0lMa205TXJVWDgKSGpmalV1WWp2cXlyRFFFaWNy +VjIrSzZJCi0tLSBiVC8rTjU0aTNRdEd5SG1talBHa1lMdGJURTNkb1VSd0VML3dq +N3hFb09zCg82/CrPNT58LNfrZRKvK31rmnTySJW8bImJIdmsneAhthoTCRjcvLXV +7WUfnbeUsDMEqUB2soABF0EwdezUnbAlt+Pu/4cPLDWPKCCvEZL7T8vAwXtUc7YO +fIZmFPL0G8upe/Gk/Nbz7Is= +-----END AGE ENCRYPTED FILE----- diff --git a/secrets/password-quadtop.age b/secrets/password-quadtop.age new file mode 100644 index 0000000..6dff80b --- /dev/null +++ b/secrets/password-quadtop.age @@ -0,0 +1,11 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZLUVVkUSBEV0RT +bkNvWUlDS2xDVVBHS0F2MkV1dHViTUE1OFc1YnVhcjIyOHVWeUJFClFPZlFnZGxn +eitkMkRvN0doUlpRbkhVVXhoRlFXL1VZRWQvbDZWQXVKUEEKLT4gXT5rTUZ6I34t +Z3JlYXNlIGJqPGVyUG4gYCB3RwpjZW9PSkE0ZlFCU1BtM3JPeWN6dmlYNzQwUG84 +alpNNVdKV0xDbHFSWUVRNndGcFBGdXlUQ1B4MFZ4cVN5bi9vCmhSMmFtQQotLS0g +OUlNVUdqOHFma2hrMmhlRkxyWHg1ZUtjeks1d0Nzc1BWWjhIR0E1K2lpUQru2QnH +9wvPXC5qDcMxrOTDgwPFWI/4SCS7Jj2b89hwQDQmpBTg1KJ09X2u3JEUe4aijxcZ +YqPqWs9cS8NZhg09xuTBGpTmp6+yJf1CmgWx3TYL+6TkgiRF1abKJYJgW9qADgeq +ZWEaLU73 +-----END AGE ENCRYPTED FILE----- diff --git a/wrappers/desktop/gaypanel/default.nix b/wrappers/desktop/gaypanel/default.nix index b333632..923d118 100644 --- a/wrappers/desktop/gaypanel/default.nix +++ b/wrappers/desktop/gaypanel/default.nix @@ -8,7 +8,7 @@ let bar = pkgs.writeText "top.blp" '' using Gtk 4.0; - $GayPanel panel { + $ShellPanel panel { anchor-direction: top; monitor: "all"; @@ -72,7 +72,7 @@ let padding: 2px 12px; } - window.panel { + panel { background: alpha(var(--window-bg-color), 0.5); } diff --git a/wrappers/desktop/gaypanel/no-sound-panic.patch b/wrappers/desktop/gaypanel/no-sound-panic.patch index 5cc4018..67b4d9a 100644 --- a/wrappers/desktop/gaypanel/no-sound-panic.patch +++ b/wrappers/desktop/gaypanel/no-sound-panic.patch @@ -1,6 +1,6 @@ -diff -ru a/src/system/sound.rs b/src/system/sound.rs ---- a/src/system/sound.rs -+++ b/src/system/sound.rs +diff -ru a/src/core/system/sound.rs b/src/core/system/sound.rs +--- a/src/core/system/sound.rs ++++ b/src/core/system/sound.rs @@ -158,7 +158,16 @@ fn init() {