Skip to content

Commit 3cf1e83

Browse files
authored
Merge pull request #143 from randomdude16671/modules/i3
modules/i3: init
2 parents 724be05 + 9c7195b commit 3cf1e83

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

modules/i3/check.nix

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
pkgs,
3+
self,
4+
}:
5+
6+
let
7+
i3Wrapped =
8+
(self.wrapperModules.i3.apply {
9+
inherit pkgs;
10+
11+
configFile.content = ''
12+
# Test config
13+
set $mod Mod4
14+
bindsym $mod+Return exec alacritty
15+
bindsym $mod+Shift+q kill
16+
'';
17+
18+
}).wrapper;
19+
20+
in
21+
pkgs.runCommand "i3-test" { nativeBuildInputs = [ pkgs.dbus ]; } ''
22+
23+
export DBUS_SESSION_BUS_ADDRESS="unix:path=$PWD/bus"
24+
dbus-daemon --session --address="$DBUS_SESSION_BUS_ADDRESS" --nofork --nopidfile --print-address &
25+
DBUS_PID=$!
26+
27+
"${i3Wrapped}/bin/i3" --version | grep -q "${i3Wrapped.version}"
28+
29+
kill $DBUS_PID 2>/dev/null || true
30+
31+
touch $out
32+
''

modules/i3/module.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
config,
3+
lib,
4+
wlib,
5+
...
6+
}:
7+
{
8+
_class = "wrapper";
9+
options = {
10+
configFile = lib.mkOption {
11+
type = wlib.types.file config.pkgs;
12+
default.content = "";
13+
description = ''
14+
I3 Window Manager configuration.
15+
'';
16+
};
17+
};
18+
19+
config.flags = {
20+
"--config" = toString config.configFile.path;
21+
};
22+
23+
config.package = config.pkgs.i3;
24+
config.meta.maintainers = [
25+
lib.maintainers.randomdude
26+
];
27+
config.meta.platforms = lib.platforms.linux;
28+
}

0 commit comments

Comments
 (0)