Flake for my NixOS devices
1{...}: {
2 config,
3 lib,
4 ...
5}: {
6 options.cow.role-laptop = {
7 enable = lib.mkEnableOption "configuring a laptop with a GUI and bean setup for mobile use";
8 fingerPrintSensor = lib.mkEnableOption "fprintd and persist prints";
9 powersave =
10 (lib.mkEnableOption "power saving and battery health options with TLP")
11 // {
12 default = true;
13 };
14 };
15
16 config = lib.mkIf config.cow.role-laptop.enable {
17 home-manager.users.bean.cow = lib.mkIf config.cow.bean.enable {
18 music.enable = true;
19 news.enable = true;
20 qmplay2.enable = true;
21 sync.enable = true;
22 dev.enable = true;
23 };
24
25 cow = {
26 base.enable = true;
27 bean.enable = true;
28 firewall.openForUsers = true;
29 print.enable = true;
30 hm.enable = true;
31 network = {
32 enable = true;
33 bluetooth = true;
34 wireless = true;
35 };
36 cat.enable = true;
37 gdi = {
38 enable = true;
39 doIdle = true;
40 showGreet = true;
41 };
42 audio.enable = true;
43 imperm.keep = lib.optional config.cow.role-laptop.fingerPrintSensor "/var/lib/fprint";
44 };
45
46 # Set to null as TLP will manage the frequency governor for us
47 powerManagement.cpuFreqGovernor = lib.mkIf config.cow.role-laptop.powersave (
48 if config.cow.audio.tweaks.enable
49 then (lib.mkForce null)
50 else null
51 );
52
53 services.tlp = lib.mkIf config.cow.role-laptop.powersave {
54 enable = true;
55 pd.enable = true;
56 };
57
58 services.fprintd = lib.mkIf config.cow.role-laptop.fingerPrintSensor {
59 enable = true;
60 };
61 };
62}