nix/modules/stuff/timer.nix
2024-11-08 21:14:57 +01:00

39 lines
1.2 KiB
Nix

{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.timer;
user = config.chuj.system.user;
in {
options.chuj.stuff.timer = {
enable = mkEnableOption "timer";
};
config = mkIf cfg.enable {
environment.systemPackages = let
timer = (pkgs.stdenv.mkDerivation {
name = "timer";
src = pkgs.fetchFromGitea {
domain = "codeberg.org";
owner = "krizej";
repo = "bins";
rev = "1f45e92ea4c700dd220ce11ecad8d56268ea08ce";
hash = "sha256-5MnE4n1bCt2DPTejCcwVozIa7ITUdekryETELOL0gxE=";
};
buildPhase = ''
mkdir -p $out/bin/
cc timer.c -o $out/bin/timer
'';
});
in [
(pkgs.writeShellScriptBin "timer" ''
${lib.getExe pkgs.alacritty} -o "font.size=32" --class TerminalTimer --title timer --command "${timer}/bin/timer"
'')
];
home-manager.users.${user}.xsession.windowManager.i3.config = mkIf config.chuj.stuff.i3.enable {
window.commands = [{
criteria.class = "TerminalTimer";
# epic hardcoding!
command = "resize set 215 55";
}];
floating.criteria = [{ class = "TerminalTimer"; }];
};
};
}