Migrate to snowfall lib
This commit is contained in:
1
modules/nixos/system/hw/base/default.nix
Normal file
1
modules/nixos/system/hw/base/default.nix
Normal file
@ -0,0 +1 @@
|
||||
{ ... }: { services.fwupd.enable = true; }
|
12
modules/nixos/system/hw/boot/default.nix
Normal file
12
modules/nixos/system/hw/boot/default.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{ ... }: {
|
||||
boot.loader = {
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 8;
|
||||
};
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
efiSysMountPoint = "/boot/efi";
|
||||
};
|
||||
};
|
||||
}
|
6
modules/nixos/system/hw/fs/default.nix
Normal file
6
modules/nixos/system/hw/fs/default.nix
Normal file
@ -0,0 +1,6 @@
|
||||
{ pkgs, ... }: {
|
||||
services.fstrim.enable = true;
|
||||
services.gvfs.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [ gvfs nfs-utils ];
|
||||
}
|
1
modules/nixos/system/hw/opengl/default.nix
Normal file
1
modules/nixos/system/hw/opengl/default.nix
Normal file
@ -0,0 +1 @@
|
||||
{ ... }: { hardware.opengl = { enable = true; }; }
|
42
modules/nixos/system/hw/power/default.nix
Normal file
42
modules/nixos/system/hw/power/default.nix
Normal file
@ -0,0 +1,42 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
let cfg = config.hostcfg.make.power;
|
||||
in {
|
||||
config = lib.mkIf cfg {
|
||||
services.tlp = {
|
||||
enable = true;
|
||||
settings = {
|
||||
START_CHARGE_THRESH_BAT0 = 75;
|
||||
STOP_CHARGE_THRESH_BAT0 = 90;
|
||||
CPU_SCALING_GOVERNOR_ON_AC = "performance";
|
||||
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.battery_monitor = {
|
||||
wants = [ "display-manager.service" ];
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
script = ''
|
||||
prev_val=100
|
||||
check () { [[ $1 -ge $val ]] && [[ $1 -lt $prev_val ]]; }
|
||||
notify () {
|
||||
${pkgs.libnotify}/bin/notify-send -a Battery "$@" \
|
||||
-h "int:value:$val" "Discharging" "$val%, $remaining"
|
||||
}
|
||||
while true; do
|
||||
IFS=: read _ bat0 < <(${pkgs.acpi}/bin/acpi -b)
|
||||
IFS=\ , read status val remaining <<<"$bat0"
|
||||
val=''${val%\%}
|
||||
if [[ $status = Discharging ]]; then
|
||||
echo "$val%, $remaining"
|
||||
if check 30 || check 25 || check 20; then notify
|
||||
elif check 15 || [[ $val -le 10 ]]; then notify -u critical
|
||||
fi
|
||||
fi
|
||||
prev_val=$val
|
||||
# Sleep longer when battery is high to save CPU
|
||||
if [[ $val -gt 30 ]]; then sleep 10m; elif [[ $val -ge 20 ]]; then sleep 5m; else sleep 1m; fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
13
modules/nixos/system/hw/udev/default.nix
Normal file
13
modules/nixos/system/hw/udev/default.nix
Normal file
@ -0,0 +1,13 @@
|
||||
{ ... }: {
|
||||
systemd.services.systemd-udevd.restartIfChanged = false;
|
||||
|
||||
services.udev.extraRules = ''
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2104", ATTRS{idProduct}=="0127", GROUP="plugdev", TAG+="uaccess"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2104", ATTRS{idProduct}=="0118", GROUP="plugdev", TAG+="uaccess"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2104", ATTRS{idProduct}=="0106", GROUP="plugdev", TAG+="uaccess"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2104", ATTRS{idProduct}=="0128", GROUP="plugdev", TAG+="uaccess"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2104", ATTRS{idProduct}=="010a", GROUP="plugdev", TAG+="uaccess"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2104", ATTRS{idProduct}=="0102", GROUP="plugdev", TAG+="uaccess"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2104", ATTRS{idProduct}=="0313", GROUP="plugdev", TAG+="uaccess"
|
||||
'';
|
||||
}
|
18
modules/nixos/system/hw/virt/default.nix
Normal file
18
modules/nixos/system/hw/virt/default.nix
Normal file
@ -0,0 +1,18 @@
|
||||
{ lib, config, ... }:
|
||||
let cfg = config.hostcfg.make.virt;
|
||||
in {
|
||||
config = lib.mkIf cfg {
|
||||
virtualisation = {
|
||||
# libvirtd.enable = true;
|
||||
# waydroid.enable = true;
|
||||
# lxd.enable = true;
|
||||
docker = {
|
||||
enable = true;
|
||||
rootless = {
|
||||
enable = true;
|
||||
setSocketVariable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user