sxmo-utils: factor out commons and create a package for sxmo-utils-latest
This commit is contained in:
parent
02f409451d
commit
e4e5df80f1
|
@ -1,58 +0,0 @@
|
|||
commit bf0057011777b91ef5af005fb4e984b4b9b71c7b
|
||||
Author: Colin <colin@uninsane.org>
|
||||
Date: 2023-07-15 21:35:45 +0000
|
||||
|
||||
sxmo_wmmenu: respect SXMO_WORKSPACE_WRAPPING
|
||||
|
||||
sxmo_wm.sh uses the `SXMO_WORKSPACE_WRAPPING` variable to control
|
||||
relative movements. for example, set this to "5" and then the "Next
|
||||
Workspace" option in the switch menu will cycle WS 1 -> 2 ... -> 5 -> 1.
|
||||
same for one- and two-finger left/right swipe to switch/move workspaces.
|
||||
|
||||
however, absolute movements (via the move menu) only allowed moving to
|
||||
WS 1-4. a user with non-default `SXMO_WORKSPACE_WRAPPING` could move a
|
||||
window from WS 5 to WS 4 with this menu, but not from WS 4 back to WS 5.
|
||||
this patch brings consistency by using `SXMO_WORKSPACE_WRAPPING`
|
||||
anywhere we would otherwise assume the number of possible workspaces.
|
||||
|
||||
diff --git a/scripts/core/sxmo_wmmenu.sh b/scripts/core/sxmo_wmmenu.sh
|
||||
index 3d40b31..d3c1db6 100755
|
||||
--- a/scripts/core/sxmo_wmmenu.sh
|
||||
+++ b/scripts/core/sxmo_wmmenu.sh
|
||||
@@ -12,6 +12,12 @@
|
||||
|
||||
set -e
|
||||
|
||||
+_movetowssubmenu() {
|
||||
+ for ws in $(seq "${SXMO_WORKSPACE_WRAPPING:-4}"); do
|
||||
+ printf "%s Move to WS %s\n" "$ws" "$ws"
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
# A menu which allows to move windows or toggle floating.
|
||||
swaymovemenu() {
|
||||
CHOICES="$(cat <<EOF
|
||||
@@ -22,10 +28,7 @@ $icon_arl Move Left
|
||||
$icon_arr Move Right
|
||||
$icon_wn2 Toggle Floating
|
||||
$icon_ac1 Move Scratchpad
|
||||
-1 Move to WS 1
|
||||
-2 Move to WS 2
|
||||
-3 Move to WS 3
|
||||
-4 Move to WS 4
|
||||
+$(_movetowssubmenu)
|
||||
EOF
|
||||
)"
|
||||
|
||||
@@ -125,10 +128,7 @@ dwmwmmenu() {
|
||||
CHOICES="$(
|
||||
cat <<EOF
|
||||
$icon_cls Close Menu
|
||||
-1 Move to WS 1
|
||||
-2 Move to WS 2
|
||||
-3 Move to WS 3
|
||||
-4 Move to WS 4
|
||||
+$(_movetowssubmenu)
|
||||
$icon_rld Shift stack
|
||||
$icon_grd Toggle Layout
|
||||
EOF
|
174
pkgs/additional/sxmo-utils/common.nix
Normal file
174
pkgs/additional/sxmo-utils/common.nix
Normal file
|
@ -0,0 +1,174 @@
|
|||
{ stdenv
|
||||
, bash
|
||||
, bc
|
||||
, bemenu
|
||||
, bonsai
|
||||
, brightnessctl
|
||||
, buildPackages
|
||||
, busybox
|
||||
, conky
|
||||
, coreutils
|
||||
, curl
|
||||
, dbus
|
||||
, fetchgit
|
||||
, fetchpatch
|
||||
, gitUpdater
|
||||
, gnugrep
|
||||
, gojq
|
||||
, grim
|
||||
, inotify-tools
|
||||
, j4-dmenu-desktop
|
||||
, jq
|
||||
, lib
|
||||
, libnotify
|
||||
, libxml2
|
||||
, lisgd
|
||||
, makeBinaryWrapper
|
||||
, mako
|
||||
, mepo
|
||||
, modemmanager
|
||||
, nettools
|
||||
, playerctl
|
||||
, procps
|
||||
, pulseaudio
|
||||
, rsync
|
||||
, scdoc
|
||||
, sfeed
|
||||
, superd
|
||||
, sway
|
||||
, swayidle
|
||||
, wob
|
||||
, wvkbd
|
||||
, xdg-user-dirs
|
||||
, xdotool
|
||||
, xrdb
|
||||
|
||||
, version
|
||||
, rev ? version
|
||||
, hash ? ""
|
||||
, patches ? []
|
||||
}:
|
||||
|
||||
let
|
||||
# anything which any sxmo script or default hook in this package might invoke
|
||||
runtimeDeps = [
|
||||
bc # also in busybox
|
||||
bemenu
|
||||
bonsai
|
||||
brightnessctl
|
||||
conky
|
||||
curl
|
||||
dbus
|
||||
# dmenu # or dmenu-wayland? only used on x11?
|
||||
gnugrep # also in busybox
|
||||
gojq
|
||||
grim
|
||||
inotify-tools
|
||||
j4-dmenu-desktop
|
||||
jq
|
||||
libnotify
|
||||
libxml2.bin # for xmllint; sxmo_weather.sh, sxmo_surf_linkset.sh
|
||||
lisgd
|
||||
mako
|
||||
mepo # mepo_ui_central_menu.sh
|
||||
modemmanager # mmcli
|
||||
nettools # netstat
|
||||
playerctl
|
||||
procps # pgrep
|
||||
pulseaudio # pactl
|
||||
sfeed
|
||||
superd
|
||||
sway
|
||||
swayidle
|
||||
wob
|
||||
wvkbd
|
||||
xdg-user-dirs
|
||||
xrdb # for sxmo_xinit AND sxmo_winit
|
||||
|
||||
# X11 only?
|
||||
xdotool
|
||||
];
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "sxmo-utils";
|
||||
inherit version;
|
||||
|
||||
src = fetchgit {
|
||||
url = "https://git.sr.ht/~mil/sxmo-utils";
|
||||
inherit rev hash;
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
postPatch = ''
|
||||
# allow sxmo to source its init file
|
||||
sed -i "s@/etc/profile\.d/sxmo_init.sh@$out/etc/profile.d/sxmo_init.sh@" scripts/core/*.sh
|
||||
# remove absolute paths
|
||||
substituteInPlace scripts/core/sxmo_version.sh \
|
||||
--replace "/usr/bin/" ""
|
||||
|
||||
# let superd find sxmo service binaries at runtime via PATH
|
||||
# TODO: replace with fully-qualified paths
|
||||
sed -i 's:ExecStart=/usr/bin/:ExecStart=/usr/bin/env :' configs/superd/services/*.service
|
||||
|
||||
# install udev rules to where nix expects
|
||||
substituteInPlace Makefile \
|
||||
--replace "/usr/lib/udev/rules.d" "/etc/udev/rules.d"
|
||||
# avoid relative paths in udev rules
|
||||
substituteInPlace configs/udev/90-sxmo.rules \
|
||||
--replace "/bin/chgrp" "${coreutils}/bin/chgrp" \
|
||||
--replace "/bin/chmod" "${coreutils}/bin/chmod"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeBinaryWrapper
|
||||
scdoc
|
||||
];
|
||||
|
||||
buildInputs = [ bash ]; # needed here so stdenv's `patchShebangsAuto` hook sets the right interpreter
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
# busybox is used by setup_config_version.sh, but placing it in nativeBuildInputs breaks the nix builder
|
||||
PATH="$PATH:${buildPackages.busybox}/bin" make OPENRC=0 DESTDIR=$out PREFIX= install
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# we don't wrap sxmo_common.sh or sxmo_init.sh
|
||||
# which is unfortunate, for non-sxmo-utils files that might source though.
|
||||
# if that's a problem, could inject a PATH=... line into them with sed.
|
||||
postInstall = ''
|
||||
for f in \
|
||||
$out/bin/*.sh \
|
||||
$out/share/sxmo/default_hooks/desktop/sxmo_hook_*.sh \
|
||||
$out/share/sxmo/default_hooks/one_button_e_reader/sxmo_hook_*.sh \
|
||||
$out/share/sxmo/default_hooks/three_button_touchscreen/sxmo_hook_*.sh \
|
||||
$out/share/sxmo/default_hooks/sxmo_hook_*.sh \
|
||||
; do
|
||||
case $(basename $f) in
|
||||
(sxmo_common.sh|sxmo_deviceprofile_*.sh|sxmo_hook_icons.sh|sxmo_init.sh)
|
||||
# these are sourced by other scripts: don't wrap them else the `exec` in the wrapper breaks the outer script
|
||||
;;
|
||||
(*)
|
||||
wrapProgram "$f" \
|
||||
--prefix PATH : "${lib.makeBinPath runtimeDeps}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
providedSessions = [ "sxmo" "swmo" ];
|
||||
updateScript = gitUpdater { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://git.sr.ht/~mil/sxmo-utils";
|
||||
description = "Contains the scripts and small C programs that glues the sxmo enviroment together";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ colinsane ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
|
@ -1,101 +1,9 @@
|
|||
{ stdenv
|
||||
, bash
|
||||
, bc
|
||||
, bemenu
|
||||
, bonsai
|
||||
, brightnessctl
|
||||
, buildPackages
|
||||
, busybox
|
||||
, conky
|
||||
, coreutils
|
||||
, curl
|
||||
, dbus
|
||||
, fetchgit
|
||||
{ callPackage
|
||||
, fetchpatch
|
||||
, gitUpdater
|
||||
, gnugrep
|
||||
, gojq
|
||||
, grim
|
||||
, inotify-tools
|
||||
, j4-dmenu-desktop
|
||||
, jq
|
||||
, lib
|
||||
, libnotify
|
||||
, libxml2
|
||||
, lisgd
|
||||
, makeBinaryWrapper
|
||||
, mako
|
||||
, mepo
|
||||
, modemmanager
|
||||
, nettools
|
||||
, playerctl
|
||||
, procps
|
||||
, pulseaudio
|
||||
, rsync
|
||||
, scdoc
|
||||
, sfeed
|
||||
, superd
|
||||
, sway
|
||||
, swayidle
|
||||
, wob
|
||||
, wvkbd
|
||||
, xdg-user-dirs
|
||||
, xdotool
|
||||
, xrdb
|
||||
}:
|
||||
|
||||
let
|
||||
# anything which any sxmo script or default hook in this package might invoke
|
||||
runtimeDeps = [
|
||||
bc # also in busybox
|
||||
bemenu
|
||||
bonsai
|
||||
brightnessctl
|
||||
conky
|
||||
curl
|
||||
dbus
|
||||
# dmenu # or dmenu-wayland? only used on x11?
|
||||
gnugrep # also in busybox
|
||||
gojq
|
||||
grim
|
||||
inotify-tools
|
||||
j4-dmenu-desktop
|
||||
jq
|
||||
libnotify
|
||||
libxml2.bin # for xmllint; sxmo_weather.sh, sxmo_surf_linkset.sh
|
||||
lisgd
|
||||
mako
|
||||
mepo # mepo_ui_central_menu.sh
|
||||
modemmanager # mmcli
|
||||
nettools # netstat
|
||||
playerctl
|
||||
procps # pgrep
|
||||
pulseaudio # pactl
|
||||
sfeed
|
||||
superd
|
||||
sway
|
||||
swayidle
|
||||
wob
|
||||
wvkbd
|
||||
xdg-user-dirs
|
||||
xrdb # for sxmo_xinit AND sxmo_winit
|
||||
|
||||
# X11 only?
|
||||
xdotool
|
||||
];
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "sxmo-utils";
|
||||
version = "1.14.2";
|
||||
|
||||
src = fetchgit {
|
||||
url = "https://git.sr.ht/~mil/sxmo-utils";
|
||||
rev = version;
|
||||
hash = "sha256-1bGCUhf/bt9I8BjG/G7sjYBzLh28iZSC20ml647a3J4=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# needed for basic use:
|
||||
patches = {
|
||||
merged = [
|
||||
(fetchpatch {
|
||||
# merged post 1.14.2
|
||||
# [1/2] sxmo_init: behave well when user's primary group differs from their name
|
||||
|
@ -124,17 +32,22 @@ stdenv.mkDerivation rec {
|
|||
url = "https://git.sr.ht/~mil/sxmo-utils/commit/d0384a7caed036d25228fa3279c36c0230795e4a.patch";
|
||||
hash = "sha256-/UlcuEI5cJnsqRuZ1zWWzR4dyJw/zYeB1rtJWFeSGEE=";
|
||||
})
|
||||
# wanted to fix/silence some non-fatal errors
|
||||
./0005-system-audio.patch
|
||||
./0007-workspace-wrapping.patch
|
||||
|
||||
# personal (but upstreamable) preferences:
|
||||
(fetchpatch {
|
||||
# merged post 1.14.2
|
||||
name = "sxmo_hook_lock: allow configuration of auto-screenoff timeout v1";
|
||||
url = "https://lists.sr.ht/~mil/sxmo-devel/patches/42443/mbox";
|
||||
hash = "sha256-c4VySbVJgsbh2h+CnCgwWWe5WkAregpYFqL8n3WRXwY=";
|
||||
})
|
||||
(fetchpatch {
|
||||
# merged post 1.14.2
|
||||
name = "sxmo_wmmenu: respect SXMO_WORKSPACE_WRAPPING";
|
||||
url = "https://lists.sr.ht/~mil/sxmo-devel/patches/42698/mbox";
|
||||
hash = "sha256-TrTlrthrpYdIMC8/RCMNaB8PcGQgtya/h2/uLNQDeWs=";
|
||||
})
|
||||
];
|
||||
unmerged = [
|
||||
# let NixOS manage the audio daemons (pulseaudio/pipewire)
|
||||
./0005-system-audio.patch
|
||||
# (fetchpatch {
|
||||
# XXX: doesn't apply cleanly to 1.14.2 release
|
||||
# # Don't wait for led or status bar in state change hooks
|
||||
|
@ -151,76 +64,17 @@ stdenv.mkDerivation rec {
|
|||
./0105-more-apps.patch
|
||||
# ./0106-no-restart-lisgd.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# allow sxmo to source its init file
|
||||
sed -i "s@/etc/profile\.d/sxmo_init.sh@$out/etc/profile.d/sxmo_init.sh@" scripts/core/*.sh
|
||||
# remove absolute paths
|
||||
substituteInPlace scripts/core/sxmo_version.sh \
|
||||
--replace "/usr/bin/" ""
|
||||
|
||||
# let superd find sxmo service binaries at runtime via PATH
|
||||
# TODO: replace with fully-qualified paths
|
||||
sed -i 's:ExecStart=/usr/bin/:ExecStart=/usr/bin/env :' configs/superd/services/*.service
|
||||
|
||||
# install udev rules to where nix expects
|
||||
substituteInPlace Makefile \
|
||||
--replace "/usr/lib/udev/rules.d" "/etc/udev/rules.d"
|
||||
# avoid relative paths in udev rules
|
||||
substituteInPlace configs/udev/90-sxmo.rules \
|
||||
--replace "/bin/chgrp" "${coreutils}/bin/chgrp" \
|
||||
--replace "/bin/chmod" "${coreutils}/bin/chmod"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeBinaryWrapper
|
||||
scdoc
|
||||
];
|
||||
|
||||
buildInputs = [ bash ]; # needed here so stdenv's `patchShebangsAuto` hook sets the right interpreter
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
# busybox is used by setup_config_version.sh, but placing it in nativeBuildInputs breaks the nix builder
|
||||
PATH="$PATH:${buildPackages.busybox}/bin" make OPENRC=0 DESTDIR=$out PREFIX= install
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# we don't wrap sxmo_common.sh or sxmo_init.sh
|
||||
# which is unfortunate, for non-sxmo-utils files that might source though.
|
||||
# if that's a problem, could inject a PATH=... line into them with sed.
|
||||
postInstall = ''
|
||||
for f in \
|
||||
$out/bin/*.sh \
|
||||
$out/share/sxmo/default_hooks/desktop/sxmo_hook_*.sh \
|
||||
$out/share/sxmo/default_hooks/one_button_e_reader/sxmo_hook_*.sh \
|
||||
$out/share/sxmo/default_hooks/three_button_touchscreen/sxmo_hook_*.sh \
|
||||
$out/share/sxmo/default_hooks/sxmo_hook_*.sh \
|
||||
; do
|
||||
case $(basename $f) in
|
||||
(sxmo_common.sh|sxmo_deviceprofile_*.sh|sxmo_hook_icons.sh|sxmo_init.sh)
|
||||
# these are sourced by other scripts: don't wrap them else the `exec` in the wrapper breaks the outer script
|
||||
;;
|
||||
(*)
|
||||
wrapProgram "$f" \
|
||||
--prefix PATH : "${lib.makeBinPath runtimeDeps}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
providedSessions = [ "sxmo" "swmo" ];
|
||||
updateScript = gitUpdater { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://git.sr.ht/~mil/sxmo-utils";
|
||||
description = "Contains the scripts and small C programs that glues the sxmo enviroment together";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ colinsane ];
|
||||
platforms = lib.platforms.linux;
|
||||
in {
|
||||
stable = callPackage ./common.nix {
|
||||
version = "1.14.2";
|
||||
hash = "sha256-1bGCUhf/bt9I8BjG/G7sjYBzLh28iZSC20ml647a3J4=";
|
||||
patches = patches.merged ++ patches.unmerged;
|
||||
};
|
||||
latest = callPackage ./common.nix {
|
||||
version = "unstable-2023-08-11";
|
||||
rev = "095678e77fcd9ad2c1ed1ffc98fc66d2f19ccf64";
|
||||
hash = "sha256-TGj3zcwW7aS/5KXcUt0jyESZcNqHY/JZ5HCTgT7Qsbk=";
|
||||
patches = patches.unmerged;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -55,7 +55,9 @@ let
|
|||
sane-weather = callPackage ./additional/sane-weather { };
|
||||
static-nix-shell = callPackage ./additional/static-nix-shell { };
|
||||
sublime-music-mobile = callPackage ./additional/sublime-music-mobile { };
|
||||
sxmo-utils = callPackage ./additional/sxmo-utils { };
|
||||
sxmo-utils' = lib.recurseIntoAttrs (callPackage ./additional/sxmo-utils { });
|
||||
sxmo-utils = sxmo-utils'.stable;
|
||||
sxmo-utils-latest = sxmo-utils'.latest;
|
||||
tow-boot-pinephone = callPackage ./additional/tow-boot-pinephone { };
|
||||
tree-sitter-nix-shell = callPackage ./additional/tree-sitter-nix-shell { };
|
||||
unftp = callPackage ./additional/unftp { };
|
||||
|
|
Loading…
Reference in New Issue
Block a user