feat: add modprobed-db service

This commit is contained in:
Dmitriy Kholkin 2025-06-07 18:15:44 +03:00
parent 428980743c
commit 4daf75938f
Signed by: AtaraxiaDev
GPG Key ID: FD266B810DF48DF2
3 changed files with 65 additions and 2 deletions

View File

@ -64,6 +64,7 @@ in
home-manager.users.${defaultUser} = {
ataraxia.defaults.role = "desktop";
ataraxia.theme.catppuccin.enable = true;
ataraxia.services.modprobed-db.enable = true;
persist.state.directories = [
".config/sops/age"

View File

@ -0,0 +1,46 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkPackageOption mkIf;
cfg = config.ataraxia.services.modprobed-db;
in
{
options = {
ataraxia.services.modprobed-db = {
enable = mkEnableOption "modprobed-db service to scan and store new kernel modules";
package = mkPackageOption pkgs "modprobed-db" { };
};
};
config = mkIf cfg.enable {
systemd.user = {
services.modprobed-db = {
Unit = {
Description = "modprobed-db service to scan and store new kernel modules";
Wants = [ "modprobed-db.timer" ];
};
Service = {
ExecStart = "${cfg.package}/bin/modprobed-db storesilent";
Type = "simple";
};
Install.WantedBy = [ "default.target" ];
};
timers.modprobed-db = {
Unit.PartOf = [ "modprobed-db.service" ];
Timer = {
Persistent = true;
OnUnitActiveSec = "1h";
};
Install.WantedBy = [ "timers.target" ];
};
};
persist.state.directories = [
".config/modprobed-db"
];
};
}

View File

@ -1,6 +1,5 @@
inputs: _final: prev:
inputs: final: prev:
let
inherit inputs;
inherit (prev.hostPlatform) system;
unstable = import inputs.nixpkgs-unstable {
config = {
@ -47,6 +46,7 @@ in
# Move modprobed config to subdir. Easier to use with impermanence
modprobed-db = prev.modprobed-db.overrideAttrs (oa: {
nativeBuildInputs = [ prev.makeWrapper ] ++ oa.nativeBuildInputs or [ ];
postPatch =
(oa.postPatch or "")
+ ''
@ -55,6 +55,22 @@ in
substituteInPlace ./common/modprobed-db.skel \
--replace-fail "/.config" "/.config/modprobed-db"
'';
postInstall =
(oa.postInstall or "")
+ ''
wrapProgram $out/bin/modprobed-db \
--set PATH ${
with final;
lib.makeBinPath [
gawk
getent
coreutils
gnugrep
gnused
kmod
]
}
'';
});
pass-secret-service = prev.pass-secret-service.overrideAttrs (_: {