tony / oxwm

add desktop entry to package and cleanup nix module Browse files
emzywastaken committed 2025-10-11 parent 6ed620e commit 3fbd72efab235342e6ed27ff8c6e1b085ffc9b8e
Showing 2 changed files with 24 additions and 42 deletions. UnifiedSplit
+23 −10 default.nix
@@ -1,12 +1,13 @@
1 -{ lib
2 -, rustPlatform
3 -, pkg-config
4 -, xorg
5 -, freetype
6 -, fontconfig
1 +{
2 + lib,
3 + rustPlatform,
4 + pkg-config,
5 + xorg,
6 + freetype,
7 + fontconfig,
8 + makeDesktopItem,
7 9 }:
8 -
9 -rustPlatform.buildRustPackage {
10 +rustPlatform.buildRustPackage (finalAttrs: {
10 11 pname = "oxwm";
11 12 version = "0.1.0";
12 13
@@ -28,12 +29,24 @@ rustPlatform.buildRustPackage {
28 29 fontconfig
29 30 ];
30 31
32 + postInstall = let
33 + oxwmDesktopItem = makeDesktopItem rec {
34 + name = finalAttrs.pname;
35 + exec = name;
36 + desktopName = name;
37 + comment = finalAttrs.meta.description;
38 + };
39 + in ''
40 + install -Dt $out/share/xsessions ${oxwmDesktopItem}/share/applications/oxwm.desktop
41 + '';
42 +
43 + passthru.providedSessions = ["oxwm"];
44 +
31 45 meta = with lib; {
32 46 description = "A dynamic window manager written in Rust, inspired by dwm";
33 47 homepage = "https://github.com/tonybanters/oxwm";
34 48 license = licenses.gpl3;
35 - maintainers = [ ];
36 49 platforms = platforms.linux;
37 50 mainProgram = "oxwm";
38 51 };
39 -}
52 +})
+1 −32 flake.nix
@@ -46,21 +46,7 @@
46 46 ...
47 47 }: let
48 48 inherit (lib) mkEnableOption mkOption mkIf types;
49 -
50 49 cfg = config.services.xserver.windowManager.oxwm;
51 - oxwmDesktopItem = pkgs.writeTextFile {
52 - name = "oxwm.desktop";
53 - destination = "/share/xsessions/oxwm.desktop";
54 - text = ''
55 - [Desktop Entry]
56 - Name=OXWM
57 - Comment=A dynamic window manager written in Rust
58 - Exec=${cfg.package}/bin/oxwm
59 - Type=Application
60 - DesktopNames=OXWM
61 - '';
62 - passthru.providedSessions = ["oxwm"];
63 - };
64 50 in {
65 51 options.services.xserver.windowManager.oxwm = {
66 52 enable = mkEnableOption "oxwm window manager";
@@ -72,27 +58,10 @@
72 58 };
73 59
74 60 config = mkIf cfg.enable {
75 - services.xserver.windowManager.session = [
76 - {
77 - name = "oxwm";
78 - start = ''
79 - ${cfg.package}/bin/oxwm &
80 - waitPID=$!
81 - '';
82 - }
83 - ];
84 - services.displayManager.sessionPackages = [oxwmDesktopItem];
61 + services.displayManager.sessionPackages = [cfg.package];
85 62
86 63 environment.systemPackages = [
87 64 cfg.package
88 - pkgs.rustc
89 - pkgs.cargo
90 - pkgs.pkg-config
91 - pkgs.xorg.libX11
92 - pkgs.xorg.libXft
93 - pkgs.xorg.libXrender
94 - pkgs.freetype
95 - pkgs.fontconfig
96 65 ];
97 66 };
98 67 };