initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# generated by zon2nix (https://github.com/nix-community/zon2nix)
|
||||
|
||||
{ linkFarm, fetchzip, fetchgit }:
|
||||
|
||||
linkFarm "zig-packages" [
|
||||
{
|
||||
name = "wayland-0.6.0-lQa1kqz8AQADQmdNJsNhLoNHcnEGEUjrOaPV-dtEnEmX";
|
||||
path = fetchzip {
|
||||
url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.6.0.tar.gz";
|
||||
hash = "sha256-3m/ITNhZUJ/5uD/Tqm+0uZSktGoYgWF5oldOqOCUkIE=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "xkbcommon-0.4.0-VDqIe0i2AgDRsok2GpMFYJ8SVhQS10_PI2M_CnHXsJJZ";
|
||||
path = fetchzip {
|
||||
url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.4.0.tar.gz";
|
||||
hash = "sha256-zQkmP/cuhAtjOLqYS5D15khKzpqyhbyZ0TD6/8jOkqE=";
|
||||
};
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,77 @@
|
||||
self:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.programs.att_wm;
|
||||
in
|
||||
{
|
||||
options.programs.att_wm = {
|
||||
enable = lib.mkEnableOption "att_wm, a dwm-like window manager for river";
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = self.packages.${pkgs.stdenv.hostPlatform.system}.att_wm;
|
||||
defaultText = lib.literalMD "the flake's `att_wm` package";
|
||||
description = "The att_wm package to use.";
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
example = lib.literalExpression "./config.zig";
|
||||
description = ''
|
||||
A replacement for att_wm's `src/config.zig`. att_wm is configured at
|
||||
compile time in the manner of dwm, so setting this rebuilds it.
|
||||
'';
|
||||
};
|
||||
|
||||
autostart = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
example = [ "quickshell" ];
|
||||
description = ''
|
||||
Commands appended to river's init script, run once the session starts.
|
||||
att_wm itself is always started last and kept in the foreground.
|
||||
'';
|
||||
};
|
||||
|
||||
riverPackage = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.river;
|
||||
description = "The river package the init script is written for.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (
|
||||
let
|
||||
att_wm =
|
||||
if cfg.settings == null then
|
||||
cfg.package
|
||||
else
|
||||
cfg.package.override { configFile = cfg.settings; };
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
att_wm
|
||||
cfg.riverPackage
|
||||
];
|
||||
|
||||
# river runs this executable on startup and expects the window manager to
|
||||
# connect; keeping att_wm in the foreground ties the session's lifetime to
|
||||
# it, so quitting att_wm ends the session cleanly.
|
||||
xdg.configFile."river/init" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!${pkgs.runtimeShell}
|
||||
${lib.concatMapStringsSep "\n" (c: "${c} &") cfg.autostart}
|
||||
exec ${lib.getExe att_wm}
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
{
|
||||
lib,
|
||||
self,
|
||||
stdenv,
|
||||
callPackage,
|
||||
zig,
|
||||
pkg-config,
|
||||
wayland,
|
||||
wayland-protocols,
|
||||
wayland-scanner,
|
||||
libxkbcommon,
|
||||
# Path to a replacement src/config.zig. dwm-style compile-time configuration:
|
||||
# att_wm.override { configFile = ./my-config.zig; }
|
||||
# Deliberately not called `config`: callPackage would fill that from the
|
||||
# nixpkgs config set.
|
||||
configFile ? null,
|
||||
}:
|
||||
|
||||
let
|
||||
deps = callPackage ./deps.nix { };
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "att_wm";
|
||||
version = "0.1.0";
|
||||
|
||||
src = lib.cleanSource self;
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
zig
|
||||
pkg-config
|
||||
wayland-scanner
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
wayland
|
||||
wayland-protocols
|
||||
wayland-scanner
|
||||
libxkbcommon
|
||||
];
|
||||
|
||||
zigBuildFlags = [
|
||||
"--system"
|
||||
"${deps}"
|
||||
"-Dpie"
|
||||
]
|
||||
++ lib.optional (configFile != null) "-Dconfig=${configFile}";
|
||||
|
||||
doCheck = true;
|
||||
|
||||
# The check phase gets its own flag list, so it needs --system too; without
|
||||
# it `zig build test` tries to fetch the dependencies over the network and
|
||||
# fails in the sandbox.
|
||||
zigCheckFlags = [
|
||||
"--system"
|
||||
"${deps}"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "A dwm-like window manager for the river Wayland compositor";
|
||||
longDescription = ''
|
||||
att_wm implements river-window-management-v1, providing dwm's window
|
||||
management model — tags, a master/stack layout, monocle and tabbed
|
||||
layouts — on top of river 0.4's non-monolithic compositor. Tag and window
|
||||
state is published over a JSON-lines unix socket for bars such as
|
||||
quickshell, and driven back the other way with the att_wmctl CLI.
|
||||
'';
|
||||
license = lib.licenses.gpl3Only;
|
||||
platforms = lib.platforms.linux;
|
||||
mainProgram = "att_wm";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user