2023-11-19 23:44:48 +00:00
|
|
|
{ stdenv
|
|
|
|
, bash
|
|
|
|
, bc
|
|
|
|
, bemenu
|
|
|
|
, bonsai
|
|
|
|
, brightnessctl
|
|
|
|
, buildPackages
|
|
|
|
, busybox
|
2023-11-29 12:31:36 +00:00
|
|
|
, codemadness-frontends_0_6 ? null # 2023-11-28: alpine is stuck at 0.6, and i think it exposes a different API
|
2023-11-19 23:44:48 +00:00
|
|
|
, conky
|
|
|
|
, coreutils
|
|
|
|
, curl
|
|
|
|
, dbus
|
|
|
|
, dmenu
|
2023-11-19 23:53:37 +00:00
|
|
|
, fetchFromSourcehut
|
2023-07-09 07:48:10 +00:00
|
|
|
, fetchpatch
|
2023-11-19 23:44:48 +00:00
|
|
|
, gnugrep
|
2024-01-01 06:15:31 +00:00
|
|
|
, gojq
|
2023-11-19 23:44:48 +00:00
|
|
|
, grim
|
|
|
|
, inotify-tools
|
|
|
|
, j4-dmenu-desktop
|
|
|
|
, jq
|
|
|
|
, lib
|
|
|
|
, libnotify
|
|
|
|
, libxml2
|
|
|
|
, lisgd
|
|
|
|
, makeBinaryWrapper
|
|
|
|
, mako
|
|
|
|
, modemmanager
|
|
|
|
, nettools
|
|
|
|
, networkmanager
|
|
|
|
, playerctl
|
|
|
|
, procps
|
|
|
|
, pulseaudio
|
|
|
|
, rsync
|
|
|
|
, scdoc
|
|
|
|
, scrot
|
|
|
|
, sfeed
|
|
|
|
, slurp
|
|
|
|
, superd
|
|
|
|
, sway
|
|
|
|
, swayidle
|
|
|
|
, systemd
|
2023-11-19 23:55:41 +00:00
|
|
|
, unstableGitUpdater
|
2023-11-20 04:49:38 +00:00
|
|
|
, upower
|
2023-11-19 23:44:48 +00:00
|
|
|
, wob
|
|
|
|
, wl-clipboard
|
|
|
|
, wtype
|
|
|
|
, wvkbd
|
|
|
|
, xdg-user-dirs
|
2023-12-13 02:51:47 +00:00
|
|
|
, xdg-utils
|
2023-11-19 23:44:48 +00:00
|
|
|
, xdotool
|
|
|
|
, xrdb
|
|
|
|
, supportSway ? true
|
|
|
|
, supportDwm ? false
|
2023-12-13 02:53:31 +00:00
|
|
|
, preferSystemd ? true
|
2023-12-13 02:51:47 +00:00
|
|
|
, preferXdgOpen ? true
|
2023-05-16 07:08:04 +00:00
|
|
|
}:
|
2023-11-19 23:44:48 +00:00
|
|
|
|
2023-06-23 02:12:23 +00:00
|
|
|
let
|
2023-11-19 23:44:48 +00:00
|
|
|
# anything which any sxmo script or default hook in this package might invoke
|
|
|
|
runtimeDeps = [
|
|
|
|
bc # also in busybox
|
|
|
|
bonsai
|
|
|
|
brightnessctl
|
2023-11-29 12:31:36 +00:00
|
|
|
codemadness-frontends_0_6 # for sxmo_youtube.sh
|
2023-11-19 23:44:48 +00:00
|
|
|
conky
|
|
|
|
curl
|
|
|
|
dbus
|
|
|
|
gnugrep # also in busybox
|
2024-01-01 06:15:31 +00:00
|
|
|
gojq # TODO: scripts/core/sxmo_wm.sh should use `jq` instead of `gojq`
|
2023-11-19 23:44:48 +00:00
|
|
|
inotify-tools
|
|
|
|
j4-dmenu-desktop
|
|
|
|
jq
|
|
|
|
libnotify
|
|
|
|
libxml2.bin # for xmllint; sxmo_weather.sh, sxmo_surf_linkset.sh
|
|
|
|
lisgd
|
|
|
|
mako
|
|
|
|
modemmanager # mmcli
|
|
|
|
nettools # netstat
|
|
|
|
networkmanager # nmcli
|
|
|
|
playerctl
|
|
|
|
procps # pgrep
|
|
|
|
pulseaudio # pactl
|
|
|
|
sfeed
|
2023-11-20 04:49:38 +00:00
|
|
|
upower # used by sxmo_battery_monitor.sh, sxmo_hook_battery.sh
|
2023-11-19 23:44:48 +00:00
|
|
|
wob
|
|
|
|
xdg-user-dirs # used by sxmo_hook_start.sh
|
|
|
|
xrdb # for sxmo_xinit AND sxmo_winit
|
|
|
|
] ++ (
|
|
|
|
if preferSystemd then [ systemd ] else [ superd ]
|
|
|
|
) ++ lib.optionals supportSway [
|
|
|
|
bemenu
|
|
|
|
grim
|
|
|
|
slurp # for sxmo_screenshot.sh
|
|
|
|
sway
|
|
|
|
swayidle
|
|
|
|
wl-clipboard # for wl-copy; sxmo_screenshot.sh
|
|
|
|
wtype # for sxmo_type
|
|
|
|
wvkbd # sxmo_winit.sh
|
|
|
|
] ++ lib.optionals supportDwm [
|
|
|
|
dmenu
|
|
|
|
scrot # sxmo_screenshot.sh
|
|
|
|
xdotool
|
2023-12-13 02:51:47 +00:00
|
|
|
] ++ lib.optionals preferXdgOpen [ xdg-utils ];
|
2023-11-19 23:44:48 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "sxmo-utils";
|
2024-02-18 04:57:20 +00:00
|
|
|
version = "unstable-2024-02-05";
|
2023-11-19 23:44:48 +00:00
|
|
|
|
2023-11-19 23:53:37 +00:00
|
|
|
src = fetchFromSourcehut {
|
|
|
|
owner = "~mil";
|
|
|
|
repo = "sxmo-utils";
|
2024-02-18 04:57:20 +00:00
|
|
|
rev = "df6b3d3d0deac028d750b0556ef335582772b2bd";
|
|
|
|
hash = "sha256-nZDWG3yakMCDZEMIUlmQ0vyqWBXro5XaeH/oIMbHSTU=";
|
2023-11-19 23:44:48 +00:00
|
|
|
};
|
|
|
|
|
2023-11-19 23:40:56 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
2023-12-11 03:27:58 +00:00
|
|
|
name = "only alias jq=gojq if the latter is available";
|
|
|
|
url = "https://git.uninsane.org/colin/sxmo-utils/commit/e0caaeb4219ba3b92d358a16dfa85bcd09a89adf.patch";
|
|
|
|
hash = "sha256-EuJeHEEmewpipfpEy54pmyBaxhu5KBg7rX5n2kg+iMs=";
|
2023-11-19 23:40:56 +00:00
|
|
|
})
|
|
|
|
(fetchpatch {
|
2023-12-30 11:41:36 +00:00
|
|
|
name = "apps: add Lemoa";
|
|
|
|
url = "https://git.uninsane.org/colin/sxmo-utils/commit/54948ab328d751fc380c7fca032f0b7403070dbf.patch";
|
|
|
|
hash = "sha256-xFvzfz4g9F3VI+wxmrz2aqGokV4YjBRlnnKg5GJbhqA=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name ="apps: add Notejot";
|
|
|
|
url = "https://git.uninsane.org/colin/sxmo-utils/commit/bb862e0f89906c4d59484414f194469626e4c229.patch";
|
|
|
|
hash = "sha256-Sjma5ZKCd3VGk7EzzY5d1JySr3L38nA87pZuMITaxGU=";
|
2023-11-19 23:40:56 +00:00
|
|
|
})
|
2023-12-11 03:27:58 +00:00
|
|
|
|
|
|
|
(fetchpatch {
|
|
|
|
name = "sxmo_migrate: add option to disable configversion checks";
|
|
|
|
url = "https://lists.sr.ht/~mil/sxmo-devel/patches/44155/mbox";
|
|
|
|
hash = "sha256-ZcUD2UWPM8PxGM9TBnGe8JCJgMC72OZYzctDf2o7Ub0=";
|
|
|
|
})
|
|
|
|
|
2023-11-19 23:40:56 +00:00
|
|
|
(fetchpatch {
|
|
|
|
# experimental patch to launch apps via `swaymsg exec -- `
|
|
|
|
# this allows them to detach from sxmo_appmenu.sh (so, `pstree` looks cleaner)
|
|
|
|
# and more importantly they don't inherit the environment of sxmo internals (i.e. PATH).
|
|
|
|
# suggested by Aren in #sxmo.
|
|
|
|
#
|
|
|
|
# old pstree look:
|
|
|
|
# - sxmo_hook_inputhandler.sh volup_one
|
|
|
|
# - sxmo_appmenu.sh
|
|
|
|
# - sxmo_appmenu.sh applications
|
|
|
|
# - <application, e.g. chatty>
|
|
|
|
name = "sxmo_hook_apps: launch apps via the window manager";
|
|
|
|
url = "https://git.uninsane.org/colin/sxmo-utils/commit/0087acfecedf9d1663c8b526ed32e1e2c3fc97f9.patch";
|
|
|
|
hash = "sha256-YwlGM/vx3ZrBShXJJYuUa7FTPQ4CFP/tYffJzUxC7tI=";
|
|
|
|
})
|
|
|
|
# (fetchpatch {
|
|
|
|
# name = "sxmo_log: print to console";
|
|
|
|
# url = "https://git.uninsane.org/colin/sxmo-utils/commit/030280cb83298ea44656e69db4f2693d0ea35eb9.patch";
|
|
|
|
# hash = "sha256-dc71eztkXaZyy+hm5teCw9lI9hKS68pPoP53KiBm5Fg=";
|
|
|
|
# })
|
2023-12-13 02:51:47 +00:00
|
|
|
] ++ lib.optionals preferXdgOpen [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "sxmo_open: use xdg-open";
|
|
|
|
url = "https://git.uninsane.org/colin/sxmo-utils/commit/8897aa5ef869be879e2419f70a16afd710f053fe.patch";
|
|
|
|
hash = "sha256-jvMSDJdOGeN2VGnuQ6UT/1gmFJtzTXTxt0WJ9gPInpU=";
|
|
|
|
})
|
2023-11-19 23:40:56 +00:00
|
|
|
];
|
2023-11-19 23:44:48 +00:00
|
|
|
|
|
|
|
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/services/*.service \
|
|
|
|
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"
|
|
|
|
'' + lib.optionalString preferSystemd ''
|
|
|
|
shopt -s globstar
|
|
|
|
sed -i 's/superctl status "$1" | grep -q started/systemctl --user is-active --quiet "$1"/g' **/*.sh
|
|
|
|
sed -i 's/superctl/systemctl --user/g' **/*.sh
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeBinaryWrapper
|
|
|
|
scdoc
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [ bash ]; # needed here so stdenv's `patchShebangsAuto` hook sets the right interpreter
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=${placeholder "out"}"
|
|
|
|
"SYSCONFDIR=${placeholder "out"}/etc"
|
|
|
|
"DESTDIR="
|
|
|
|
"OPENRC=0"
|
|
|
|
# TODO: use SERVICEDIR and EXTERNAL_SERVICES=0 to integrate superd/systemd better
|
|
|
|
];
|
|
|
|
preInstall = ''
|
|
|
|
# busybox is used by setup_config_version.sh, but placing it in nativeBuildInputs breaks the nix builder
|
|
|
|
PATH="$PATH:${buildPackages.busybox}/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# we don't wrap sxmo_common.sh or sxmo_init.sh
|
|
|
|
# which is unfortunate, for non-sxmo-utils files that might source those.
|
|
|
|
# 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 nix wrapper breaks the outer script
|
|
|
|
;;
|
|
|
|
(*)
|
|
|
|
wrapProgram "$f" \
|
|
|
|
--suffix PATH : "${lib.makeBinPath runtimeDeps}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
inherit runtimeDeps;
|
|
|
|
providedSessions = (lib.optional supportSway "swmo") ++ (lib.optional supportDwm "sxmo");
|
2023-11-19 23:55:41 +00:00
|
|
|
updateScript = unstableGitUpdater { };
|
2023-11-19 23:44:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2023-05-16 07:08:04 +00:00
|
|
|
};
|
|
|
|
}
|