add timer

This commit is contained in:
Aditya 2024-09-11 09:37:54 +05:30
parent b528ac04a3
commit cb2394cd14
Signed by: aditya
SSH key fingerprint: SHA256:jL1IvWsjjlPtw6HvDIHfXfhO9IkIokNEyIfuFhSdoyU
4 changed files with 95 additions and 2 deletions

View file

@ -94,6 +94,24 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"git-hooks": { "git-hooks": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@ -209,9 +227,30 @@
"type": "github" "type": "github"
} }
}, },
"neve": { "monitor": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1726021638,
"narHash": "sha256-nnkyh02DAjbcg4w4sT+hKW77hW/tT8pQHK997wYjtUo=",
"owner": "akr2002",
"repo": "monitor",
"rev": "311fd173ec9fa1a71317f5d36d00de47cba2aec8",
"type": "github"
},
"original": {
"owner": "akr2002",
"repo": "monitor",
"type": "github"
}
},
"neve": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixvim": "nixvim" "nixvim": "nixvim"
}, },
@ -323,7 +362,7 @@
}, },
"nuschtosSearch": { "nuschtosSearch": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_3",
"nixpkgs": [ "nixpkgs": [
"neve", "neve",
"nixvim", "nixvim",
@ -368,6 +407,7 @@
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"master": "master", "master": "master",
"monitor": "monitor",
"neve": "neve", "neve": "neve",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"nyaa": "nyaa" "nyaa": "nyaa"
@ -403,6 +443,21 @@
"type": "github" "type": "github"
} }
}, },
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [

View file

@ -6,6 +6,10 @@
url = "github:nix-community/home-manager/master"; url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
monitor = {
url = "github:akr2002/monitor";
inputs.nixpkgs.follows = "nixpkgs";
};
#nv = { #nv = {
# url = "github:akr2002/nv"; # url = "github:akr2002/nv";
# inputs.nixpkgs.follows = "nixpkgs"; # inputs.nixpkgs.follows = "nixpkgs";

View file

@ -11,6 +11,7 @@
./kde-utils ./kde-utils
./kitty ./kitty
./media ./media
./monitor
./neovim ./neovim
./office ./office
./session-vars ./session-vars
@ -29,6 +30,7 @@
gnome-utils.enable = lib.mkDefault false; gnome-utils.enable = lib.mkDefault false;
kde-utils.enable = lib.mkDefault true; kde-utils.enable = lib.mkDefault true;
kitty.enable = lib.mkDefault true; kitty.enable = lib.mkDefault true;
monitor.enable = lib.mkDefault true;
neovim.enable = lib.mkDefault false; neovim.enable = lib.mkDefault false;
tmux.enable = lib.mkDefault true; tmux.enable = lib.mkDefault true;
vscode.enable = lib.mkDefault true; vscode.enable = lib.mkDefault true;

View file

@ -0,0 +1,32 @@
{
config,
inputs,
lib,
pkgs,
...
}: {
options = {
monitor.enable = lib.mkEnableOption "enable monitor";
};
config = lib.mkIf config.monitor.enable {
systemd.user.timers.monitor = {
Install.WantedBy = [ "timers.target" ];
Timer = {
OnBootSec = "1m";
OnUnitActiveSec = "1m";
Unit = "monitor.service";
};
};
systemd.user.services.monitor = {
Unit = {
Description = "A script to monitor websites.";
};
Install = {
WantedBy = [ "default.target" ];
};
Service = {
ExecStart = "${inputs.monitor.packages.${pkgs.system}.default}/bin/monitor";
};
};
};
}