auto-cpufreq added

This commit is contained in:
foglar 2024-12-27 10:32:32 +01:00
parent 34d77cf53b
commit d99d544813
4 changed files with 71 additions and 40 deletions

View File

@ -33,6 +33,26 @@
"type": "github" "type": "github"
} }
}, },
"auto-cpufreq": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1733175750,
"narHash": "sha256-tczSI0dnsitstia/uVt7FyGQbtuW8lMhhMYj0TRSAT4=",
"owner": "AdnanHodzic",
"repo": "auto-cpufreq",
"rev": "4dae1d4b59bedc1d57118a9eb704c2e1cde5f83c",
"type": "github"
},
"original": {
"owner": "AdnanHodzic",
"repo": "auto-cpufreq",
"type": "github"
}
},
"base16": { "base16": {
"inputs": { "inputs": {
"fromYaml": "fromYaml" "fromYaml": "fromYaml"
@ -641,6 +661,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"auto-cpufreq": "auto-cpufreq",
"firefox-addons": "firefox-addons", "firefox-addons": "firefox-addons",
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprland": "hyprland", "hyprland": "hyprland",

View File

@ -45,6 +45,11 @@
url = "github:Mic92/sops-nix"; url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
auto-cpufreq = {
url = "github:AdnanHodzic/auto-cpufreq";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { outputs = {
@ -98,6 +103,7 @@
inputs.stylix.nixosModules.stylix inputs.stylix.nixosModules.stylix
inputs.nix-ld.nixosModules.nix-ld inputs.nix-ld.nixosModules.nix-ld
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.auto-cpufreq.nixosModules.default
]; ];
}; };
ginoza = nixpkgs.lib.nixosSystem { ginoza = nixpkgs.lib.nixosSystem {

View File

@ -8,48 +8,54 @@
program.yubikey = { program.yubikey = {
enable = lib.mkEnableOption "Enable YubiKey authentication"; enable = lib.mkEnableOption "Enable YubiKey authentication";
}; };
program.yubikey = {
lock-on-remove = lib.mkEnableOption "Lock the session when the YubiKey is removed";
};
}; };
config = lib.mkIf config.program.yubikey.enable { config = lib.mkMerge [
environment.systemPackages = with pkgs; [ (lib.mkIf config.program.yubikey.enable {
yubioath-flutter environment.systemPackages = with pkgs; [
yubikey-manager yubioath-flutter
pam_u2f yubikey-manager
]; pam_u2f
];
# Only have to be connected to the notebook # Only have to be connected to the notebook
#security.pam.services = { #security.pam.services = {
# login.u2fAuth = true; # login.u2fAuth = true;
# sudo.u2fAuth = true; # sudo.u2fAuth = true;
#}; #};
security.pam.yubico = { security.pam.yubico = {
enable = true; enable = true;
debug = false; debug = false;
mode = "challenge-response"; mode = "challenge-response";
control = "sufficient"; control = "sufficient";
#! id = [ "1234567890" ]; #! id = [ "1234567890" ];
#! YubiKey ID is stored in SOPS #! YubiKey ID is stored in SOPS
#! and is set in the module configuration #! and is set in the module configuration
#! file ./sops/sops.nix #! file ./sops/sops.nix
}; };
services.pcscd = { services.pcscd = {
enable = true; enable = true;
}; };
programs.gnupg.agent = { programs.gnupg.agent = {
enable = true; enable = true;
enableSSHSupport = true; enableSSHSupport = true;
}; };
})
services.udev.extraRules = '' (lib.mkIf config.program.yubikey.lock-on-remove {
ACTION=="remove",\ services.udev.extraRules = ''
ENV{ID_BUS}=="usb",\ ACTION=="remove",\
ENV{ID_MODEL_ID}=="0407",\ ENV{ID_BUS}=="usb",\
ENV{ID_VENDOR_ID}=="1050",\ ENV{ID_MODEL_ID}=="0407",\
ENV{ID_VENDOR}=="Yubico",\ ENV{ID_VENDOR_ID}=="1050",\
RUN+="${pkgs.systemd}/bin/loginctl lock-sessions" ENV{ID_VENDOR}=="Yubico",\
''; RUN+="${pkgs.systemd}/bin/loginctl lock-sessions"
}; '';
})
];
} }

View File

@ -60,8 +60,6 @@
}; };
services.udisks2.enable = true; services.udisks2.enable = true;
services.power-profiles-daemon.enable = true;
security = { security = {
polkit.enable = true; polkit.enable = true;
pam.services.hyprlock = {}; pam.services.hyprlock = {};