tony / oxwm

Branch: 46596a9
Switch branches/tags
master
Sigmanificient retreive the dependency from the derivation d4ac9b5 2025-12-14
86 lines · 2.2 KB Raw Blame History
1 {
2 description = "oxwm - A dynamic window manager.";
3 inputs = {
4 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5 };
6 outputs = {
7 self,
8 nixpkgs,
9 }: let
10 systems = ["x86_64-linux" "aarch64-linux"];
11
12 forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
13 in {
14 packages = forAllSystems (pkgs: rec {
15 default = pkgs.callPackage ./default.nix {
16 # use git rev for non tagged releases
17 gitRev = self.rev or self.dirtyRev or null;
18 };
19 oxwm = default;
20 });
21
22 devShells = forAllSystems (pkgs: {
23 default = pkgs.mkShell {
24 inputsFrom = [self.packages.${pkgs.stdenv.hostPlatform.system}.oxwm];
25 packages = [
26 pkgs.rustc
27 pkgs.cargo
28 pkgs.alacritty
29 pkgs.just
30 pkgs.xorg.xorgserver
31 ];
32 shellHook = ''
33 export PS1="(oxwm-dev) $PS1"
34 '';
35 env.RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
36 };
37 });
38
39 formatter = forAllSystems (pkgs: pkgs.alejandra);
40
41 nixosModules.default = {
42 config,
43 lib,
44 pkgs,
45 ...
46 }: let
47 inherit (lib) mkEnableOption mkOption mkIf types;
48 cfg = config.services.xserver.windowManager.oxwm;
49 in {
50 options.services.xserver.windowManager.oxwm = {
51 enable = mkEnableOption "oxwm window manager";
52 package = mkOption {
53 type = types.package;
54 default = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
55 description = "The oxwm package to use";
56 };
57 extraSessionCommands = mkOption {
58 type = types.lines;
59 default = "";
60 description = "Shell commands executed just before oxwm is started";
61 };
62 };
63
64 config = mkIf cfg.enable {
65 services.xserver.windowManager.session = lib.singleton {
66 name = "oxwm";
67 start = ''
68 ${cfg.extraSessionCommands}
69 export _JAVA_AWT_WM_NONREPARENTING=1
70 ${cfg.package}/bin/oxwm &
71 waitPID=$!
72 '';
73 };
74
75 environment.systemPackages = [
76 cfg.package
77 ];
78
79 environment.pathsToLink = [
80 "/share/oxwm"
81 "/share/xsessions"
82 ];
83 };
84 };
85 };
86 }