From 9c7195b40bb1273ca679a5d2f2553d09d7e9571c Mon Sep 17 00:00:00 2001 From: Random Dude Date: Mon, 23 Mar 2026 22:41:30 +0530 Subject: [PATCH] modules/i3: init --- modules/i3/check.nix | 32 ++++++++++++++++++++++++++++++++ modules/i3/module.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 modules/i3/check.nix create mode 100644 modules/i3/module.nix diff --git a/modules/i3/check.nix b/modules/i3/check.nix new file mode 100644 index 0000000..02172d6 --- /dev/null +++ b/modules/i3/check.nix @@ -0,0 +1,32 @@ +{ + pkgs, + self, +}: + +let + i3Wrapped = + (self.wrapperModules.i3.apply { + inherit pkgs; + + configFile.content = '' + # Test config + set $mod Mod4 + bindsym $mod+Return exec alacritty + bindsym $mod+Shift+q kill + ''; + + }).wrapper; + +in +pkgs.runCommand "i3-test" { nativeBuildInputs = [ pkgs.dbus ]; } '' + + export DBUS_SESSION_BUS_ADDRESS="unix:path=$PWD/bus" + dbus-daemon --session --address="$DBUS_SESSION_BUS_ADDRESS" --nofork --nopidfile --print-address & + DBUS_PID=$! + + "${i3Wrapped}/bin/i3" --version | grep -q "${i3Wrapped.version}" + + kill $DBUS_PID 2>/dev/null || true + + touch $out +'' diff --git a/modules/i3/module.nix b/modules/i3/module.nix new file mode 100644 index 0000000..f836426 --- /dev/null +++ b/modules/i3/module.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + wlib, + ... +}: +{ + _class = "wrapper"; + options = { + configFile = lib.mkOption { + type = wlib.types.file config.pkgs; + default.content = ""; + description = '' + I3 Window Manager configuration. + ''; + }; + }; + + config.flags = { + "--config" = toString config.configFile.path; + }; + + config.package = config.pkgs.i3; + config.meta.maintainers = [ + lib.maintainers.randomdude + ]; + config.meta.platforms = lib.platforms.linux; +}