epic timer!

This commit is contained in:
krizej 2024-11-08 21:14:32 +01:00
parent 7a59fc2a74
commit 281ec88147
3 changed files with 42 additions and 1 deletions

View file

@ -73,6 +73,7 @@
xdg.enable = true; xdg.enable = true;
stuff = { stuff = {
timer.enable = true;
xserver.enable = true; xserver.enable = true;
sddm.enable = true; sddm.enable = true;
alacritty.enable = true; alacritty.enable = true;

View file

@ -24,5 +24,6 @@
./stuff/other-dev-programs.nix ./stuff/other-dev-programs.nix
./stuff/mpd.nix ./stuff/mpd.nix
./stuff/xdg.nix ./stuff/xdg.nix
./stuff/timer.nix
]; ];
} }

39
modules/stuff/timer.nix Normal file
View file

@ -0,0 +1,39 @@
{ 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"; }];
};
};
}