-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixos/uwsm: init module, temporarily import the package derivation here
- Loading branch information
1 parent
a81caa3
commit 7de078c
Showing
5 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
config, | ||
lib, | ||
pkgs, | ||
... | ||
}: | ||
let | ||
cfg = config.programs.uwsm; | ||
hyprlandCfg = config.programs.hyprland; | ||
swayCfg = config.programs.sway; | ||
in | ||
{ | ||
options.programs.uwsm = { | ||
enable = lib.mkEnableOption ''uwsm, which wraps standalone | ||
Wayland compositors into a set of Systemd units on the fly | ||
''; | ||
package = lib.mkPackageOption pkgs "uwsm" {}; | ||
hyprlandSupport = lib.mkEnableOption null // { | ||
default = cfg.enable && hyprlandCfg.enable; | ||
}; | ||
swaySupport = lib.mkEnableOption null // { | ||
default = cfg.enable && swayCfg.enable; | ||
}; | ||
|
||
finalPackage = lib.mkOption { | ||
type = lib.types.package; | ||
readOnly = true; | ||
default = cfg.package.override { | ||
hyprland = hyprlandCfg.package; | ||
sway = swayCfg.package; | ||
inherit (cfg) hyprlandSupport swaySupport; | ||
}; | ||
defaultText = lib.literalExpression | ||
"`programs.uwsm.package` with applied configuration"; | ||
description = '' | ||
The uwsm package after applying configuration. | ||
''; | ||
}; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
environment.systemPackages = [ cfg.finalPackage ]; | ||
systemd.packages = [ cfg.finalPackage ]; | ||
services.dbus.implementation = "broker"; | ||
|
||
services.displayManager.sessionPackages = lib.optionals cfg.hyprlandSupport [ | ||
(pkgs.callPackage ./uwsm-wm-wrapper.nix { | ||
uwsm = cfg.finalPackage; | ||
wmName = "Hyprland"; | ||
wmCmd = "hyprland"; | ||
}) | ||
] ++ lib.optionals cfg.swaySupport [ | ||
(pkgs.callPackage ./uwsm-wm-wrapper.nix { | ||
uwsm = cfg.finalPackage; | ||
wmName = "Sway"; | ||
wmCmd = "sway"; | ||
}) | ||
]; | ||
}; | ||
|
||
meta.maintainers = with lib.maintainers; [ johnrtitor ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
stdenv, | ||
lib, | ||
fetchFromGitHub, | ||
makeBinaryWrapper, | ||
meson, | ||
ninja, | ||
scdoc, | ||
pkg-config, | ||
nix-update-script, | ||
bash, | ||
dmenu, | ||
libnotify, | ||
newt, | ||
python3Packages, | ||
util-linux, | ||
fumonSupport ? true, | ||
uuctlSupport ? true, | ||
uwsmAppSupport ? true, | ||
hyprlandSupport ? false, | ||
swaySupport ? false, | ||
hyprland, | ||
sway, | ||
}: | ||
let | ||
python = python3Packages.python.withPackages (ps: [ | ||
ps.pydbus | ||
ps.dbus-python | ||
ps.pyxdg | ||
]); | ||
in | ||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "uwsm"; | ||
version = "0.17.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "Vladimir-csp"; | ||
repo = "uwsm"; | ||
rev = "refs/tags/v${finalAttrs.version}"; | ||
hash = "sha256-M2j7l5XTSS2IzaJofAHct1tuAO2A9Ps9mCgAWKEvzoE="; | ||
}; | ||
|
||
patches = [ ./uwsm-path.patch ]; | ||
|
||
nativeBuildInputs = [ | ||
makeBinaryWrapper | ||
meson | ||
ninja | ||
pkg-config | ||
scdoc | ||
]; | ||
|
||
propagatedBuildInputs = [ | ||
util-linux # waitpid | ||
newt # whiptail | ||
dmenu # for uuctl | ||
libnotify # notify | ||
bash # sh | ||
python | ||
]; | ||
|
||
mesonFlags = [ | ||
"--prefix=${placeholder "out"}" | ||
(lib.mapAttrsToList lib.mesonEnable { | ||
"uwsm-app" = uwsmAppSupport; | ||
"fumon" = fumonSupport; | ||
"uuctl" = uuctlSupport; | ||
"man-pages" = true; | ||
}) | ||
]; | ||
|
||
passthru = { | ||
updateScript = nix-update-script { }; | ||
}; | ||
|
||
postInstall = '' | ||
wrapProgram $out/bin/uwsm \ | ||
--prefix PATH : ${ | ||
lib.makeBinPath ( | ||
finalAttrs.propagatedBuildInputs | ||
++ (lib.optional hyprlandSupport hyprland) | ||
++ (lib.optional swaySupport sway) | ||
) | ||
} | ||
${lib.optionalString uuctlSupport '' | ||
wrapProgram $out/bin/uuctl \ | ||
--prefix PATH : ${lib.makeBinPath finalAttrs.propagatedBuildInputs} | ||
''} | ||
''; | ||
|
||
meta = { | ||
description = "Universal wayland session manager"; | ||
homepage = "https://github.com/Vladimir-csp/uwsm"; | ||
mainProgram = "uwsm"; | ||
license = lib.licenses.mit; | ||
maintainers = with lib.maintainers; [ johnrtitor ]; | ||
platforms = lib.platforms.linux; | ||
}; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
diff --git a/uwsm/main.py b/uwsm/main.py | ||
index d13208d..864ceb1 100644 | ||
--- a/uwsm/main.py | ||
+++ b/uwsm/main.py | ||
@@ -1429,10 +1429,12 @@ def generate_units(): | ||
) | ||
# for bindpid use lightweight waitpid binary if available, | ||
# otherwise use aux waitpid shim | ||
- if which("waitpid"): | ||
- bindpid_cmd = "waitpid -e" | ||
+ # Ensure that the binary can be found in the service file | ||
+ waitpid_path = which("waitpid") | ||
+ if waitpid_path: | ||
+ bindpid_cmd = f"{waitpid_path} -e" | ||
else: | ||
- bindpid_cmd = "uwsm aux waitpid" | ||
+ bindpid_cmd = f"{BIN_PATH} aux waitpid" | ||
update_unit( | ||
"[email protected]", | ||
dedent( | ||
@@ -2631,8 +2633,13 @@ def prepare_env(): | ||
random_mark = f"MARK_{random_hex(16)}_MARK" | ||
shell_code = prepare_env_gen_sh(random_mark) | ||
|
||
+ sh_path = which("sh") | ||
+ if not sh_path: | ||
+ print_error(f'"sh" is not in PATH!') | ||
+ sys.exit(1) | ||
+ | ||
sprc = subprocess.run( | ||
- ["sh", "-"], | ||
+ [sh_path, "-"], | ||
text=True, | ||
input=shell_code, | ||
capture_output=True, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
lib, | ||
stdenvNoCC, | ||
writeText, | ||
uwsm, | ||
wmName ? "Example", | ||
wmCmd ? "example", | ||
}: | ||
let | ||
wm-desktop-entry = writeText "${wmName}_uwsm.desktop" '' | ||
[Desktop Entry] | ||
Name=${wmName} (with UWSM) | ||
Comment=${wmName} compositor managed by UWSM | ||
Exec=${lib.getExe uwsm} start -S -- ${wmCmd} | ||
Type=Application | ||
''; | ||
in stdenvNoCC.mkDerivation { | ||
pname = "${wmName}_uwsm"; | ||
version = "1.0.0"; | ||
dontUnpack = true; | ||
dontBuild = true; | ||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/share/wayland-sessions | ||
cp ${wm-desktop-entry} $out/share/wayland-sessions/${wmName}_uwsm.desktop | ||
runHook postInstall | ||
''; | ||
passthru.providedSessions = ["${wmName}_uwsm"]; | ||
} |