meta: Migrate phosh options to phone module

Might try going beyond phosh later.
This commit is contained in:
Donovan Glover 2024-06-13 21:17:27 -04:00
parent b972766cc5
commit eb58e723e2
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
2 changed files with 50 additions and 39 deletions

50
modules/phone.nix Normal file
View File

@ -0,0 +1,50 @@
{ lib, pkgs, options, config, mobile-nixos, ... }:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.modules.phone;
in
{
imports = [
(import "${mobile-nixos}/lib/configuration.nix" {
device = "pine64-pinephone";
})
];
options.modules.phone = {
enable = mkEnableOption "PinePhone support";
};
config = mkIf cfg.enable {
mobile.beautification = {
silentBoot = lib.mkDefault true;
splash = lib.mkDefault true;
};
services.xserver.desktopManager.phosh = {
enable = true;
group = "users";
};
programs.calls.enable = true;
environment.systemPackages = with pkgs; [
chatty # IM and SMS
epiphany # Web browser
gnome-console # Terminal
megapixels # Camera
];
hardware.sensor.iio.enable = true;
assertions = [
{ assertion = options.services.xserver.desktopManager.phosh.user.isDefined;
message = ''
`services.xserver.desktopManager.phosh.user` not set.
When importing the phosh configuration in your system, you need to set `services.xserver.desktopManager.phosh.user` to the username of the session user.
'';
}
];
};
}

View File

@ -1,39 +0,0 @@
#
# This file represents safe opinionated defaults for a basic Phosh system.
#
# NOTE: this file and any it imports **have** to be safe to import from
# an end-user's config.
#
{ config, lib, pkgs, options, ... }:
{
mobile.beautification = {
silentBoot = lib.mkDefault true;
splash = lib.mkDefault true;
};
services.xserver.desktopManager.phosh = {
enable = true;
group = "users";
};
programs.calls.enable = true;
environment.systemPackages = with pkgs; [
chatty # IM and SMS
epiphany # Web browser
gnome-console # Terminal
megapixels # Camera
];
hardware.sensor.iio.enable = true;
assertions = [
{ assertion = options.services.xserver.desktopManager.phosh.user.isDefined;
message = ''
`services.xserver.desktopManager.phosh.user` not set.
When importing the phosh configuration in your system, you need to set `services.xserver.desktopManager.phosh.user` to the username of the session user.
'';
}
];
}