diff --git a/hosts/desktop/default.nix b/hosts/desktop/default.nix index 386d361..623b2a1 100644 --- a/hosts/desktop/default.nix +++ b/hosts/desktop/default.nix @@ -73,6 +73,7 @@ xdg.enable = true; stuff = { + timer.enable = true; xserver.enable = true; sddm.enable = true; alacritty.enable = true; diff --git a/modules/default.nix b/modules/default.nix index 14d0f1a..cad03ab 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -24,5 +24,6 @@ ./stuff/other-dev-programs.nix ./stuff/mpd.nix ./stuff/xdg.nix + ./stuff/timer.nix ]; -} \ No newline at end of file +} diff --git a/modules/stuff/timer.nix b/modules/stuff/timer.nix new file mode 100644 index 0000000..b9c79d2 --- /dev/null +++ b/modules/stuff/timer.nix @@ -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"; }]; + }; + }; +}