meta: Move phone config to separate module

Makes it possible to enable phone support for different devices in the
future.

Note that programs.man.generateCaches in home-manager is handled at the
system level to avoid having to later override it with mkForce.
This commit is contained in:
Donovan Glover 2024-09-09 13:08:19 -04:00
parent 5790f1bbde
commit fc11acbe79
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
3 changed files with 105 additions and 80 deletions

View File

@ -1,14 +1,12 @@
{
self,
pkgs,
config,
lib,
...
}:
let
inherit (lib) mkIf mkForce;
inherit (config.modules.system) username;
inherit (builtins) attrValues;
in
{
@ -38,24 +36,6 @@ in
xdg-user-dirs
xresources
;
config = {
programs.man.generateCaches = mkForce false;
};
};
environment = {
sessionVariables = {
LIBGL_ALWAYS_SOFTWARE = "true";
};
systemPackages = with pkgs; [
chatty
megapixels
livi
gnome-contacts
eog
];
};
modules = {
@ -66,85 +46,28 @@ in
};
hardware.keyboardBinds = true;
phone.enable = true;
};
i18n.inputMethod.enable = mkForce false;
programs = {
calls.enable = true;
cdemu.enable = mkForce false;
hyprland.enable = mkForce false;
thunar.enable = mkForce false;
};
networking = {
wireless.enable = false;
wireguard.enable = true;
networkmanager.ensureProfiles.profiles = {
mobile = {
connection = {
id = "4G";
type = "gsm";
};
gsm.apn = "NXTGENPHONE";
ipv4.method = "auto";
ipv6 = {
addr-gen-mode = "default";
method = "auto";
};
};
};
firewall.checkReversePath = mkForce false;
};
services = {
xserver = {
displayManager.lightdm.enable = false;
desktopManager.phosh = {
enable = true;
group = "users";
user = username;
};
};
udisks2.enable = mkForce false;
pipewire.enable = mkForce false;
greetd.enable = mkForce false;
};
boot = {
enableContainers = false;
binfmt.emulatedSystems = mkForce [ ];
loader.systemd-boot.enable = mkIf (pkgs.system == "aarch64-linux") (mkForce false);
kernel.sysctl = {
"vm.dirty_background_ratio" = 5;
"vm.dirty_ratio" = 10;
};
};
documentation = {
enable = false;
man.generateCaches = false;
};
hardware.graphics.enable32Bit = mkForce false;
powerManagement = {
enable = true;
cpufreq = rec {
min = 816000;
max = min;
};
cpuFreqGovernor = "performance";
};
}

102
modules/phone.nix Normal file
View File

@ -0,0 +1,102 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkForce
;
inherit (config.modules.system) username;
cfg = config.modules.phone;
in
{
options.modules.phone = {
enable = mkEnableOption "phone support";
};
config = mkIf cfg.enable {
environment = {
sessionVariables = {
LIBGL_ALWAYS_SOFTWARE = "true";
};
systemPackages = with pkgs; [
chatty
megapixels
livi
gnome-contacts
eog
];
};
programs.calls.enable = true;
networking = {
wireless.enable = false;
wireguard.enable = true;
networkmanager.ensureProfiles.profiles = {
mobile = {
connection = {
id = "4G";
type = "gsm";
};
gsm.apn = "NXTGENPHONE";
ipv4.method = "auto";
ipv6 = {
addr-gen-mode = "default";
method = "auto";
};
};
};
firewall.checkReversePath = mkForce false;
};
documentation = {
enable = false;
man.generateCaches = false;
};
services = {
xserver = {
displayManager.lightdm.enable = false;
desktopManager.phosh = {
enable = true;
group = "users";
user = username;
};
};
};
boot = {
enableContainers = false;
kernel.sysctl = {
"vm.dirty_background_ratio" = 5;
"vm.dirty_ratio" = 10;
};
};
powerManagement = {
enable = true;
cpufreq = rec {
min = 816000;
max = min;
};
cpuFreqGovernor = "performance";
};
};
}

View File

@ -179,7 +179,7 @@ in
inherit (cfg) stateVersion;
};
programs.man.generateCaches = true;
programs.man.generateCaches = mkIf (!isPhone) true;
};
users.${username}.home = {