diff --git a/config-processor-hardware.nix b/config-processor-hardware.nix index ffbbfe7..fbdb98c 100644 --- a/config-processor-hardware.nix +++ b/config-processor-hardware.nix @@ -38,7 +38,7 @@ let }; }; boot.kernelParams = [ - "intel_iommu=on,igx_off,sm_on" + "intel_iommu=on,igfx_off,sm_on" "iommu=pt" ]; } @@ -64,9 +64,7 @@ in { flake = { nixosConfigurations = builtins.listToAttrs (map (t: lib.nameValuePair t.name t.hostConfiguration) targets); - packages = { - x86_64-linux = - builtins.listToAttrs (map (t: lib.nameValuePair t.name t.package) targets); - }; + packages.${system} = + builtins.listToAttrs (map (t: lib.nameValuePair t.name t.package) targets); }; } diff --git a/hydrajobs/flake-module.nix b/hydrajobs/flake-module.nix index 96481f3..1c9bb43 100644 --- a/hydrajobs/flake-module.nix +++ b/hydrajobs/flake-module.nix @@ -1,11 +1,27 @@ # Copyright 2022-2024 TII (SSRC) and the Ghaf contributors # SPDX-License-Identifier: Apache-2.0 -{self, ...}: -{ - flake.hydraJobs = { - fmo-os-installer-public-debug.x86_64-linux = self.packages.x86_64-linux.fmo-os-installer-public-debug; - fmo-os-installer-public-release.x86_64-linux = self.packages.x86_64-linux.fmo-os-installer-public-release; - fmo-os-rugged-devices-public-debug.x86_64-linux = self.packages.x86_64-linux.fmo-os-rugged-devices-public-debug; - fmo-os-rugged-devices-public-release.x86_64-linux = self.packages.x86_64-linux.fmo-os-rugged-devices-public-release; - }; +# +# TODO: For more robust target collection, maybe add an attribute +# to the package config, or some similar trickery instead of +# just checking the package name. +# +# Reference: https://wiki.nixos.org/wiki/Flakes#Output_schema +# hydraJobs.""."" = derivation; +{ + self, + lib, + ... +}: let + packageFilter = name: value: ((lib.hasInfix "public" name) && !(lib.hasInfix "compressed" name)); +in { + flake.hydraJobs = + lib.foldlAttrs + ( + acc: system: packages: let + publicPackages = lib.filterAttrs packageFilter packages; + in + acc // (lib.mapAttrs' (name: package: lib.nameValuePair name {${system} = package;}) publicPackages) + ) + {} + self.packages; } diff --git a/modules/desktop/launchers/default.nix b/modules/desktop/launchers/default.nix index d6c17be..b6eb1b5 100644 --- a/modules/desktop/launchers/default.nix +++ b/modules/desktop/launchers/default.nix @@ -7,38 +7,39 @@ ... }: let cfg = config.ghaf.graphics.app-launchers; - get_launcer = descr: ( let - extraArgs = if lib.hasAttr "extraArgs" descr then descr.extraArgs else ""; - launcers_description = { - google-chrome = { - name = "Chrome"; - path = "${pkgs.google-chrome}/bin/google-chrome-stable --enable-features=UseOzonePlatform --ozone-platform=wayland ${extraArgs}"; - icon = "${pkgs.google-chrome}/share/icons/hicolor/48x48/apps/google-chrome.png"; - package = [pkgs.google-chrome]; - }; - chromium = { - name = "Chromium"; - path = "${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform --ozone-platform=wayland ${extraArgs}"; - icon = "${pkgs.chromium}/share/icons/hicolor/48x48/apps/chromium.png"; - package = [pkgs.chromium]; - }; - terminal = { - name = "Terminal"; - path = "${pkgs.terminator}/bin/terminator ${extraArgs}"; - icon = "${pkgs.terminator}/share/icons/hicolor/48x48/apps/terminator.png"; - package = [pkgs.terminator]; - }; - nmLauncher = { - name = "nmLauncher"; - path = "${pkgs.nmLauncher}/bin/nmLauncher ${extraArgs}"; - icon = "${pkgs.networkmanagerapplet}/share/icons/hicolor/22x22/apps/nm-device-wwan.png"; - package = [pkgs.nmLauncher pkgs.networkmanagerapplet]; - }; + getLauncers = descr: (let + extraArgs = + if lib.hasAttr "extraArgs" descr + then descr.extraArgs + else ""; + launchers = { + google-chrome = { + name = "Chrome"; + path = "${pkgs.google-chrome}/bin/google-chrome-stable --enable-features=UseOzonePlatform --ozone-platform=wayland ${extraArgs}"; + icon = "${pkgs.google-chrome}/share/icons/hicolor/48x48/apps/google-chrome.png"; + package = [pkgs.google-chrome]; + }; + chromium = { + name = "Chromium"; + path = "${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform --ozone-platform=wayland ${extraArgs}"; + icon = "${pkgs.chromium}/share/icons/hicolor/48x48/apps/chromium.png"; + package = [pkgs.chromium]; + }; + terminal = { + name = "Terminal"; + path = "${pkgs.terminator}/bin/terminator ${extraArgs}"; + icon = "${pkgs.terminator}/share/icons/hicolor/48x48/apps/terminator.png"; + package = [pkgs.terminator]; + }; + nmLauncher = { + name = "nmLauncher"; + path = "${pkgs.nmLauncher}/bin/nmLauncher ${extraArgs}"; + icon = "${pkgs.networkmanagerapplet}/share/icons/hicolor/22x22/apps/nm-device-wwan.png"; + package = [pkgs.nmLauncher pkgs.networkmanagerapplet]; + }; }; in - launcers_description."${descr.app}"); - - + launchers."${descr.app}"); in { options.ghaf.graphics.app-launchers = with lib; { enabled-launchers = mkOption { @@ -88,14 +89,15 @@ in { }; config = lib.mkIf cfg.enableAppLaunchers { - ghaf.graphics.app-launchers.launchers = (map get_launcer cfg.enabled-launchers); + ghaf.graphics.app-launchers.launchers = map getLauncers cfg.enabled-launchers; environment.systemPackages = lib.lists.flatten ( - builtins.map (launcher: launcher.package) config.ghaf.graphics.app-launchers.launchers); + builtins.map (launcher: launcher.package) config.ghaf.graphics.app-launchers.launchers + ); # Needed for nm-applet as defined in # https://github.com/NixOS/nixpkgs/blob/4cdde2bb35340a5b33e4a04e3e5b28d219985b7e/nixos/modules/programs/nm-applet.nix#L22 # Requires further testing - services.dbus.packages = [ pkgs.gcr ]; + services.dbus.packages = [pkgs.gcr]; }; } diff --git a/modules/packages/squeekboard/squeekboard.nix b/modules/packages/squeekboard/squeekboard.nix index cdddeff..1e594f3 100644 --- a/modules/packages/squeekboard/squeekboard.nix +++ b/modules/packages/squeekboard/squeekboard.nix @@ -1,18 +1,25 @@ # Copyright 2022-2024 TII (SSRC) and the Ghaf contributors # SPDX-License-Identifier: Apache-2.0 +{pkgs}: +pkgs.writeShellApplication { + name = "squeekboard-control"; + runtimeInputs = [ + pkgs.systemd + ]; + text = '' + function isVisible { + case "$(busctl --user get-property sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible)" in + *true*) return 0;; + *) return 1;; + esac + } -{ - pkgs, -}: -pkgs.writeScriptBin "squeekboard-control" '' - #${pkgs.bash}/bin/bash - i=$(busctl --user get-property sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) - echo $i - if [ "$i" == "b true" ] - then - pkill squeekboard - else - busctl --user call sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true - fi - echo "Toggling on-screen keyboard..." - '' + echo "Toggling on-screen keyboard..." + + if isVisible; then + busctl --user call sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false + else + busctl --user call sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true + fi + ''; +} diff --git a/utils/launchers.nix b/utils/launchers.nix index 0cc63ab..a83b184 100644 --- a/utils/launchers.nix +++ b/utils/launchers.nix @@ -1,31 +1,32 @@ # Copyright 2022-2024 TII (SSRC) and the Ghaf contributors # SPDX-License-Identifier: Apache-2.0 -{ - sysconf, -}: { +{sysconf}: { lib, pkgs, ... -}: with lib; -let - get_launcer = descr: ( - let - extraArgs = if lib.hasAttr "extraArgs" descr then descr.extraArgs else ""; - launcers_description = { - weston-terminal = { - path = "${pkgs.weston}/bin/weston-terminal ${extraArgs}"; - icon = "${pkgs.weston}/share/weston/icon_terminal.png"; - }; +}: +with lib; let + getLauncher = descr: ( + let + extraArgs = + if lib.hasAttr "extraArgs" descr + then descr.extraArgs + else ""; + launchers = { + weston-terminal = { + path = "${pkgs.weston}/bin/weston-terminal ${extraArgs}"; + icon = "${pkgs.weston}/share/weston/icon_terminal.png"; + }; - chromium = { - path = "${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform --ozone-platform=wayland ${extraArgs}"; - icon = "${pkgs.chromium}/share/icons/hicolor/24x24/apps/chromium.png"; + chromium = { + path = "${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform --ozone-platform=wayland ${extraArgs}"; + icon = "${pkgs.chromium}/share/icons/hicolor/24x24/apps/chromium.png"; + }; }; - }; - in - launcers_description."${descr.app}" + in + launchers."${descr.app}" ); in { ghaf.graphics.weston.enableDemoApplications = lib.mkIf (lib.hasAttr "launchers" sysconf) (lib.mkForce false); - ghaf.graphics.weston.launchers = lib.mkIf (lib.hasAttr "launchers" sysconf) (map get_launcer sysconf.launchers); + ghaf.graphics.weston.launchers = lib.mkIf (lib.hasAttr "launchers" sysconf) (map getLauncher sysconf.launchers); }