feat(sleep-or-die): fix my sleep schedule

This commit is contained in:
Artur Manuel 2025-02-24 02:50:37 +00:00
commit 6d555ec898
Signed by: amadaluzia
SSH key fingerprint: SHA256:Zwg7gBuZyaG48ucAZneJwltiXu0+tJb7c3lYt9AYlLg
9 changed files with 141 additions and 5 deletions

17
flake.lock generated
View file

@ -235,6 +235,22 @@
"type": "github" "type": "github"
} }
}, },
"gimp-nixpkgs": {
"locked": {
"lastModified": 1735507908,
"narHash": "sha256-VA+khC0S0di6w5Yv1kBNRpAihnt2prT/ehQzsKMhEoA=",
"owner": "jtojnar",
"repo": "nixpkgs",
"rev": "771cf18187fefcfaababd35834917c621447fee8",
"type": "github"
},
"original": {
"owner": "jtojnar",
"ref": "gimp-meson",
"repo": "nixpkgs",
"type": "github"
}
},
"git-hooks-nix": { "git-hooks-nix": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
@ -610,6 +626,7 @@
"chaotic": "chaotic", "chaotic": "chaotic",
"disko": "disko", "disko": "disko",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"gimp-nixpkgs": "gimp-nixpkgs",
"git-hooks-nix": "git-hooks-nix", "git-hooks-nix": "git-hooks-nix",
"hetch": "hetch", "hetch": "hetch",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",

View file

@ -65,6 +65,12 @@
url = "https://codeberg.org/amadaluzia/alqages.git"; url = "https://codeberg.org/amadaluzia/alqages.git";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
gimp-nixpkgs = {
type = "github";
owner = "jtojnar";
repo = "nixpkgs";
ref = "gimp-meson";
};
}; };
outputs = inputs @ {flake-parts, ...}: outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake { flake-parts.lib.mkFlake {

View file

@ -29,13 +29,26 @@
enable = true; enable = true;
package = pkgs.amadaluzian-waybar; package = pkgs.amadaluzian-waybar;
}; };
sleep-or-die = {
enable = true;
title = "It's bed time, lil bro.";
message = "Go to bed now vro... you don't want to see a nice guy lose his temper... You have one hour.";
image = ../../media/king_von.png;
sound = ../../media/majoras_mask_bell.wav;
};
direnv.enable = true; direnv.enable = true;
git.enable = true; git.enable = true;
openssh.enable = true; openssh.enable = true;
}; };
shells.xonsh = { shells = {
enable = true; nushell = {
package = pkgs.amadaluzian-xonsh; enable = true;
package = pkgs.amadaluzian-nu;
};
xonsh = {
enable = true;
package = pkgs.amadaluzian-xonsh;
};
}; };
system.pipewire.enable = true; system.pipewire.enable = true;
wms.niri.enable = true; wms.niri.enable = true;

View file

@ -508,6 +508,6 @@ binds {
} }
cursor { cursor {
xcursor-theme "Simp1e-Nord-Dark" xcursor-theme "Simp1e-Gruvbox-Dark"
xcursor-size 24 xcursor-size 24
} }

View file

@ -1,10 +1,11 @@
{ {
inputs, inputs,
pkgs, pkgs,
config,
... ...
}: { }: {
alqueva.users.artur = { alqueva.users.artur = {
shell = pkgs.amadaluzian-nu; shell = config.alqueva.shells.nushell.package;
tmpfiles = { tmpfiles = {
".config/qutebrowser/config.py" = ./configs/qutebrowser/config.py; ".config/qutebrowser/config.py" = ./configs/qutebrowser/config.py;
".config/qutebrowser/theme" = ./configs/qutebrowser/theme; ".config/qutebrowser/theme" = ./configs/qutebrowser/theme;
@ -42,6 +43,7 @@
dino dino
; ;
inherit (inputs.hetch.packages.${pkgs.system}) hetch; inherit (inputs.hetch.packages.${pkgs.system}) hetch;
inherit (inputs.gimp-nixpkgs.legacyPackages.${pkgs.system}) gimp;
}; };
groups = [ groups = [
"wheel" "wheel"

View file

@ -0,0 +1,75 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.alqueva.programs.sleep-or-die;
inherit (lib) mkOption mkEnableOption types mkIf;
sleep-or-die = let
image =
if cfg.image == null
then ""
else "-i ${cfg.image}";
sound =
if cfg.sound == null
then ""
else "ffplay -nodisp -autoexit ${cfg.sound}";
in
pkgs.writeShellApplication {
name = "sod";
runtimeInputs = [
pkgs.libnotify
pkgs.ffmpeg
];
text = ''
notify-send -u critical "${cfg.title}" "${cfg.message}" ${image}
${sound}
shutdown +60 "This was automatically invoked by 'sleep-or-die'"
'';
};
in {
options.alqueva.programs.sleep-or-die = {
enable = mkEnableOption "sleep-or-die";
title = mkOption {
type = types.str;
description = "The title of the notification";
default = "Go to sleep!";
};
message = mkOption {
type = types.str;
description = "The message of the notification";
default = "You are missing on sleep! You have one hour to use your PC before it shuts off.";
};
image = mkOption {
type = types.nullOr types.path;
description = "The image to display on the notification.";
default = null;
};
sound = mkOption {
type = types.nullOr types.path;
description = "The sound to play on notification.";
default = null;
};
startAt = mkOption {
type = types.str;
default = "20:00:00";
description = "The time to start the daemon.";
};
};
config = mkIf cfg.enable {
systemd.user.services.sleep-or-die = {
inherit (cfg) startAt;
serviceConfig = {
RestartSec = 5;
ExecStart = "${lib.getExe' sleep-or-die "sod"}";
};
};
};
}

23
hosts/shared/nushell.nix Normal file
View file

@ -0,0 +1,23 @@
{
lib,
pkgs,
config,
...
}: let
cfg = config.alqueva.shells.nushell;
in {
options.alqueva.shells.nushell = {
enable = lib.mkEnableOption "Nushell";
package = lib.mkPackageOption pkgs "nushell" {};
};
config = lib.mkIf cfg.enable {
environment = {
systemPackages = [cfg.package];
shells = [
(lib.getExe' cfg.package "nu")
"/run/current-system/sw/bin/nu"
];
};
};
}

BIN
media/king_von.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
media/majoras_mask_bell.wav Normal file

Binary file not shown.