diff --git a/machines/AMD-Workstation/default.nix b/machines/AMD-Workstation/default.nix index a7878fe..a26f153 100644 --- a/machines/AMD-Workstation/default.nix +++ b/machines/AMD-Workstation/default.nix @@ -94,6 +94,7 @@ }]; }; + services.modprobed-db.enable = true; programs.nix-ld.enable = true; home-manager.users.${config.mainuser} = { home.packages = [ @@ -114,6 +115,8 @@ pkgs.exercism pkgs.packwiz pkgs.streamrip + + pkgs.modprobed-db ]; xdg.configFile."distrobox/distrobox.conf".text = '' container_always_pull="1" @@ -146,6 +149,7 @@ ".local/share/distrobox" ".mitmproxy" ".config/exercism" + ".config/modprobed-db" ".config/streamrip" ]; }; diff --git a/modules/modprobed-db.nix b/modules/modprobed-db.nix new file mode 100644 index 0000000..e2db3ab --- /dev/null +++ b/modules/modprobed-db.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkPackageOption mkIf; + + cfg = config.services.modprobed-db; +in +{ + options = { + 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 = { + description = "modprobed-db service to scan and store new kernel modules"; + wants = [ "modprobed-db.timer" ]; + wantedBy = [ "default.target" ]; + serviceConfig = { + ExecStart = "${cfg.package}/bin/modprobed-db storesilent"; + ExecStop = "${cfg.package}/bin/modprobed-db storesilent"; + Type = "simple"; + }; + path = builtins.attrValues { + inherit (pkgs) gawk getent coreutils gnugrep gnused kmod; + }; + }; + timers.modprobed-db = { + wantedBy = [ "timers.target" ]; + partOf = [ "modprobed-db.service" ]; + timerConfig = { + Persistent = true; + OnUnitActiveSec = "1h"; + }; + }; + }; + }; +} diff --git a/profiles/overlay.nix b/profiles/overlay.nix index 10b8de2..741b286 100644 --- a/profiles/overlay.nix +++ b/profiles/overlay.nix @@ -37,6 +37,15 @@ with lib; { wine = prev.wineWow64Packages.stagingFull; intel-vaapi-driver = prev.intel-vaapi-driver.override { enableHybridCodec = true; }; + modprobed-db = prev.modprobed-db.overrideAttrs (oa: { + postPatch = (oa.postPatch or "") + '' + substituteInPlace ./common/modprobed-db.in \ + --replace-fail "/modprobed-db.conf" "/modprobed-db/modprobed-db.conf" + substituteInPlace ./common/modprobed-db.skel \ + --replace-fail "/.config" "/.config/modprobed-db" + ''; + }); + neatvnc = prev.neatvnc.overrideAttrs (oa: { patches = [ ../patches/neatvnc.patch ] ++ oa.patches or [ ]; });