hermes: Refactor and split config to separate modules
- asus : charge control - audio : pipewire - hardware : boot, encryption etc
This commit is contained in:
parent
12b44b9550
commit
97fc6fc0de
4 changed files with 81 additions and 60 deletions
23
hosts/hermes/asus.nix
Normal file
23
hosts/hermes/asus.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
services.asusd = {
|
||||
enable = true;
|
||||
asusdConfig =
|
||||
''
|
||||
"bat_charge_limit": 80,
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.battery-charge-threshold = {
|
||||
wantedBy = [ "local-fs.target" "suspend.target" ];
|
||||
after = [ "local-fs.target" "suspend.target" ];
|
||||
description = "Set the battery charge threshold to 80%";
|
||||
startLimitBurst = 5;
|
||||
startLimitIntervalSec = 1;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${pkgs.runtimeShell} -c 'echo 80 > /sys/class/power_supply/BAT?/charge_control_end_threshold'";
|
||||
};
|
||||
};
|
||||
}
|
15
hosts/hermes/audio.nix
Normal file
15
hosts/hermes/audio.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ ... }:
|
||||
{
|
||||
# Enable sound with pipewire.
|
||||
sound.enable = true;
|
||||
hardware.bluetooth.enable = true;
|
||||
hardware.pulseaudio.enable = false;
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
};
|
||||
}
|
|
@ -1,7 +1,13 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./hardware-configuration.nix ];
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./hardware.nix
|
||||
|
||||
./asus.nix
|
||||
./audio.nix
|
||||
];
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
|
@ -25,68 +31,9 @@
|
|||
man.enable = true;
|
||||
};
|
||||
|
||||
boot = {
|
||||
binfmt.emulatedSystems = [ "aarch64-linux" ];
|
||||
|
||||
loader.systemd-boot.enable = true;
|
||||
loader.efi.canTouchEfiVariables = true;
|
||||
loader.efi.efiSysMountPoint = "/boot/efi";
|
||||
supportedFilesystems = [ "ntfs" ];
|
||||
|
||||
# Setup keyfile
|
||||
initrd.secrets = {
|
||||
"/crypto_keyfile.bin" = null;
|
||||
};
|
||||
|
||||
# Enable swap on luks
|
||||
initrd.luks.devices."luks-8271922a-e889-4f04-8e87-07f0bcde890d".device = "/dev/disk/by-uuid/8271922a-e889-4f04-8e87-07f0bcde890d";
|
||||
initrd.luks.devices."luks-8271922a-e889-4f04-8e87-07f0bcde890d".keyFile = "/crypto_keyfile.bin";
|
||||
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
};
|
||||
|
||||
# Enable touchpad support (enabled default in most desktopManager).
|
||||
services.xserver.libinput.enable = true;
|
||||
services.xserver.libinput.touchpad.naturalScrolling = true;
|
||||
services.xserver.libinput.touchpad.middleEmulation = true;
|
||||
services.xserver.libinput.touchpad.tapping = true;
|
||||
# Enable CUPS to print documents.
|
||||
services.printing.enable = true;
|
||||
|
||||
# Enable sound with pipewire.
|
||||
sound.enable = true;
|
||||
hardware.bluetooth.enable = true;
|
||||
hardware.pulseaudio.enable = false;
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
};
|
||||
|
||||
services.asusd = {
|
||||
enable = true;
|
||||
asusdConfig =
|
||||
''
|
||||
"bat_charge_limit": 80,
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.battery-charge-threshold = {
|
||||
wantedBy = [ "local-fs.target" "suspend.target" ];
|
||||
after = [ "local-fs.target" "suspend.target" ];
|
||||
description = "Set the battery charge threshold to 80%";
|
||||
startLimitBurst = 5;
|
||||
startLimitIntervalSec = 1;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${pkgs.runtimeShell} -c 'echo 80 > /sys/class/power_supply/BAT?/charge_control_end_threshold'";
|
||||
};
|
||||
};
|
||||
|
||||
environment = {
|
||||
etc = with pkgs; {
|
||||
"jdk".source = jdk;
|
||||
|
|
36
hosts/hermes/hardware.nix
Normal file
36
hosts/hermes/hardware.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
boot = {
|
||||
binfmt.emulatedSystems = [ "aarch64-linux" ];
|
||||
|
||||
loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
efiSysMountPoint = "/boot/efi";
|
||||
};
|
||||
};
|
||||
supportedFilesystems = [ "ntfs" ];
|
||||
|
||||
# Setup keyfile
|
||||
initrd.secrets = {
|
||||
"/crypto_keyfile.bin" = null;
|
||||
};
|
||||
|
||||
# Enable swap on luks
|
||||
initrd.luks.devices."luks-8271922a-e889-4f04-8e87-07f0bcde890d".device = "/dev/disk/by-uuid/8271922a-e889-4f04-8e87-07f0bcde890d";
|
||||
initrd.luks.devices."luks-8271922a-e889-4f04-8e87-07f0bcde890d".keyFile = "/crypto_keyfile.bin";
|
||||
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
};
|
||||
|
||||
# Enable touchpad support (enabled default in most desktopManager).
|
||||
services.xserver.libinput = {
|
||||
enable = true;
|
||||
touchpad = {
|
||||
naturalScrolling = true;
|
||||
middleEmulation = true;
|
||||
tapping = true;
|
||||
};
|
||||
};
|
||||
}
|
Reference in a new issue