tangled
alpha
login
or
join now
encode42.dev
/
nixos
0
fork
atom
Personal-use NixOS configuration
0
fork
atom
overview
issues
pulls
pipelines
Replace laptop module with battery
encode42.dev
3 months ago
d5c23ae4
6966831a
+17
-13
6 changed files
expand all
collapse all
unified
split
hardware
battery.nix
cpu
amd.nix
common.nix
intel.nix
laptop.nix
lib
mkSystem.nix
+14
hardware/battery.nix
···
1
1
+
{
2
2
+
config,
3
3
+
lib,
4
4
+
pkgs,
5
5
+
...
6
6
+
}:
7
7
+
8
8
+
{
9
9
+
# https://gist.github.com/balacij/492d27776ad7d3cde3e0b0ce0bc3a3f8/11a61171828fa0f76cd403686773c3d455d2c652
10
10
+
services.udev.extraRules = lib.mkIf config.services.desktopManager.gnome.enable ''
11
11
+
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="0",RUN+="${pkgs.power-profiles-daemon}/bin/powerprofilesctl set power-saver"
12
12
+
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="1",RUN+="${pkgs.power-profiles-daemon}/bin/powerprofilesctl set performance"
13
13
+
'';
14
14
+
}
-2
hardware/cpu/amd.nix
···
2
2
3
3
{
4
4
imports = [
5
5
-
./common.nix
6
6
-
7
5
nixos-hardware.nixosModules.common-cpu-amd
8
6
];
9
7
-5
hardware/cpu/common.nix
···
1
1
-
{ isLaptop, ... }:
2
2
-
3
3
-
{
4
4
-
#services.auto-cpufreq.enable = isLaptop; # TODO
5
5
-
}
-2
hardware/cpu/intel.nix
···
6
6
7
7
{
8
8
imports = [
9
9
-
./common.nix
10
10
-
11
9
nixos-hardware.nixosModules.common-cpu-intel
12
10
];
13
11
-3
hardware/laptop.nix
···
1
1
-
{
2
2
-
# TODO: Power management, mostly
3
3
-
}
+3
-1
lib/mkSystem.nix
···
49
49
}
50
50
]
51
51
++ builtins.attrValues inputs.encode42-packages.nixosModules
52
52
-
++ lib.optional isLaptop ../hardware/laptop.nix
52
52
+
++ lib.optionals isLaptop [
53
53
+
../hardware/battery.nix
54
54
+
]
53
55
++ extraModules;
54
56
55
57
specialArgs = {