sorry but this ones just lots of shit

This commit is contained in:
2025-10-17 03:10:20 -05:00
parent 26d060e672
commit f5f1ad4580
10 changed files with 345 additions and 234 deletions

View File

@@ -1,18 +1,19 @@
{ pkgs, config, lib, ... }:
let
cfg = config.system.nvidia;
in
{
pkgs,
config,
lib,
...
}: let
cfg = config.system.nvidia;
in {
options.system.nvidia = {
enable = lib.mkEnableOption "enables nvidia";
};
config = lib.mkIf cfg.enable {
services.xserver.videoDrivers = [ "nvidia" ];
boot.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
# boot.kernelModules = [ "nvidia" ];
services.xserver.videoDrivers = ["nvidia"];
boot.kernelModules = ["nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm"];
# boot.kernelModules = [ "nvidia" ];
hardware.graphics = {
enable = true;
@@ -21,8 +22,8 @@ in
# enable nvidia proprietary driver
hardware.nvidia = {
modesetting.enable = true; # required
open = false; # use proprietary driver
modesetting.enable = true; # required
open = false; # use proprietary driver
nvidiaSettings = true; # no shit
powerManagement.enable = false; # can cause sleep issues
package = config.boot.kernelPackages.nvidiaPackages.stable;
@@ -32,6 +33,5 @@ in
hardware.nvidia-container-toolkit.enable = true;
virtualisation.docker.daemon.settings.features.cdi = true;
virtualisation.docker.rootless.daemon.settings.features.cdi = true;
};
}

View File

@@ -1,17 +1,18 @@
{ pkgs, config, lib, ... }:
let
cfg = config.system.podman;
in
{
pkgs,
config,
lib,
...
}: let
cfg = config.system.podman;
in {
options.system.podman = {
enable = lib.mkEnableOption "enables podman";
};
config = lib.mkIf cfg.enable {
# install the binary for compose
environment.systemPackages = with pkgs; [ podman-compose ];
environment.systemPackages = with pkgs; [podman-compose];
virtualisation = {
oci-containers.backend = "podman";

View File

@@ -1,10 +1,13 @@
{ pkgs, config, lib, inputs, ... }:
let
cfg = config.system.sops;
in
{
imports = [ inputs.sops-nix.nixosModules.sops ];
pkgs,
config,
lib,
inputs,
...
}: let
cfg = config.system.sops;
in {
imports = [inputs.sops-nix.nixosModules.sops];
options.system.sops = {
enable = lib.mkEnableOption "enables sops";
@@ -15,11 +18,10 @@ in
sops = {
defaultSopsFile = ../../../secrets/secrets.yaml;
defaultSopsFormat = "yaml";
# age.keyFile = "/home/blake/.config/sops/age/keys.txt";
age.keyFile = "/etc/sops/keys.txt";
secrets = {
"blake_passwd" = {
"blake_passwd" = {
owner = "root";
group = "root";
neededForUsers = true;

View File

@@ -4,40 +4,49 @@
lib,
...
}:
/*
# to enroll a yubikey (works like .ssh/known_hosts)
nix-shell -p pam_u2f
mkdir -p ~/.config/Yubico
pamu2fcfg > ~/.config/Yubico/u2f_keys
pamu2fcfg -n >> ~/.config/Yubico/u2f_keys (to add additional yubikeys)
# to test auth with pam
nix-shell -p pamtester
pamtester login <username> authenticate
pamtester sudo <username> authenticate
*/
let
service = "yubikey";
cfg = config.system.${service};
sec = config.sops.secrets;
homelab = config.homelab;
in
{
in {
options.system.${service} = {
enable = lib.mkEnableOption "enables ${service}";
mode = lib.mkOption {
type = lib.types.str;
default = "u2f";
description = "weather to run pam in u2f or challenge-response)";
type = lib.types.str;
default = "u2f";
description = "weather to run pam in u2f or challenge-response)";
};
lock_on_remove = lib.mkOption {
type = lib.types.bool;
default = false;
description = "enable automatic locking of device upon removal of yubikey";
type = lib.types.bool;
default = false;
description = "enable automatic locking of device upon removal of yubikey";
};
};
config = lib.mkIf cfg.enable {
security.pam.services = lib.mkIf (cfg.mode == "u2f") {
login.u2fAuth = true;
sudo.u2fAuth = true;
};
security.pam.yubico = lib.mkIf (cfg.mode == "challenge-response") {
enable = true;
debug = true;
mode = "challenge-response";
id = [ "<placeholder>" ];
enable = true;
debug = true;
mode = "challenge-response";
id = ["<placeholder>"];
};
services.udev.extraRules = lib.mkIf (cfg.lock_on_remove == true) ''
@@ -47,8 +56,6 @@ in
ENV{ID_VENDOR_ID}=="1050",\
ENV{ID_VENDOR}=="Yubico",\
RUN+="${pkgs.systemd}/bin/loginctl lock-sessions"
'';
'';
};
}