update: fixed issues and update flake inputs

This commit is contained in:
danny 2025-12-29 16:03:31 +08:00
parent 4b6183f0ec
commit b3c5ad2880
80 changed files with 3307 additions and 2059 deletions

View file

@ -1,5 +1,8 @@
{
imports = [
./ntfy-client.nix
./hyprlock.nix
./sunsetr.nix
./noctalia.nix
];
}

59
home/options/hyprlock.nix Normal file
View file

@ -0,0 +1,59 @@
{ config, lib, ... }:
let
inherit (lib)
mkOption
types
isList
elemAt
mapAttrs
hasAttr
any
length
;
cfg = config.programs.hyprlock;
in
{
options.programs.hyprlock = {
monitors = mkOption {
default = [ ];
type = with types; listOf str;
};
excludeMonitor = mkOption {
default = [
"general"
"background"
"animations"
];
type = with types; listOf str;
};
settings = mkOption {
apply =
v:
if length cfg.monitors == 0 then
v
else
mapAttrs (
name: value:
let
mainMonitor = elemAt cfg.monitors 0;
applyMonitor =
attrs:
if hasAttr "monitor" attrs then
attrs
else
(
attrs
// {
monitor = mainMonitor;
}
);
in
if any (m: name == m) cfg.excludeMonitor then
value
else
(if (isList value) then (map applyMonitor value) else applyMonitor value)
) v;
};
};
}

57
home/options/noctalia.nix Normal file
View file

@ -0,0 +1,57 @@
{ config, lib, ... }:
let
inherit (lib)
mkOption
types
elem
isList
filter
listToAttrs
concatMap
nameValuePair
attrNames
isAttrs
;
filterAttrsRecursive' =
pred: set:
# Attrs
if isAttrs set then
listToAttrs (
concatMap (
name:
let
v = set.${name};
in
if pred name v then
[
(nameValuePair name (filterAttrsRecursive' pred v))
]
else
[ ]
) (attrNames set)
)
# List
else if isList set then
filter (x: pred "" x) (map (x: filterAttrsRecursive' pred x) set)
else
set;
cfg = config.programs.noctalia-shell;
in
{
options.programs.noctalia-shell = {
filteredIds = mkOption {
type = with types; listOf str;
default = [ ];
};
settings = mkOption {
apply =
v:
filterAttrsRecursive' (
name: value: if value ? id then !(elem value.id cfg.filteredIds) else true
) v;
};
};
}

32
home/options/sunsetr.nix Normal file
View file

@ -0,0 +1,32 @@
{ config, lib, ... }:
let
inherit (lib)
mkIf
mkEnableOption
mkPackageOption
getExe'
;
cfg = config.services.sunsetr;
in
{
options.services.sunsetr = {
enable = mkEnableOption "Enable sunsetr.";
package = mkPackageOption "sunsetr";
};
config = mkIf cfg.enable {
systemd.user.services.sunsetr = {
Install = {
WantedBy = [ "graphical-session.target" ];
};
Unit = {
Description = "Blue light filter";
};
Service = {
ExecStart = "${getExe' cfg.package "sunsetr"}";
Restart = "always";
RestartSec = 2;
};
};
};
}