meta: move phone config out of nix-config

I originally thought a monorepo was the way to go here and, although it
worked, I do want to keep this config as simple as possible for people
that just want to see how to set up Hyprland/dwm on NixOS.

For those curious in running NixOS on a phone specifically, there will
soon be a separate mobile-config repository that should make learning
from it easier.
This commit is contained in:
Donovan Glover 2025-01-26 07:34:05 -05:00
parent 9db81fe743
commit de6685fe5f
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
11 changed files with 16 additions and 393 deletions

21
flake.lock generated
View File

@ -225,26 +225,6 @@
"type": "github"
}
},
"mobile-nixos": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1737174595,
"narHash": "sha256-9PypiQkyXtg8R3eZlNNu6Qafc/CmKfWyJB3qYx6tUNE=",
"owner": "donovanglover",
"repo": "mobile-nixos",
"rev": "816d7d125e0cb0e6a9b639e51e71d84e9dae572e",
"type": "github"
},
"original": {
"owner": "donovanglover",
"repo": "mobile-nixos",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1736883708,
@ -264,7 +244,6 @@
"root": {
"inputs": {
"home-manager": "home-manager",
"mobile-nixos": "mobile-nixos",
"nixpkgs": "nixpkgs",
"sakaya": "sakaya",
"stylix": "stylix"

View File

@ -20,11 +20,6 @@
url = "github:donovanglover/sakaya";
inputs.nixpkgs.follows = "nixpkgs";
};
mobile-nixos = {
url = "github:donovanglover/mobile-nixos";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
@ -84,12 +79,6 @@
modules = listFilesRecursive ./hosts/laptop;
};
mobile-nixos = nixosSystem {
system = "aarch64-linux";
specialArgs.nix-config = self;
modules = listFilesRecursive ./hosts/phone;
};
iso = nixosSystem {
system = "x86_64-linux";
specialArgs.nix-config = self;

View File

@ -1,68 +0,0 @@
{ pkgs, lib, ... }:
let
inherit (lib.gvariant) mkTuple mkUint32;
in
{
dconf.settings = {
"sm/puri/phosh" = {
app-filter-mode = [ ];
enable-suspend = true;
favorites = [
"org.gnome.Calls.desktop"
"sm.puri.Chatty.desktop"
"kitty.desktop"
"librewolf.desktop"
];
};
"sm/puri/phosh/lockscreen" = {
shuffle-keypad = true;
};
"sm/puri/phosh/plugins" = {
quick-settings = [
"night-light-quick-setting"
"caffeine-quick-setting"
];
};
"org/gnome/desktop/interface" = {
show-battery-percentage = true;
};
"org/postmarketos/megapixels" = {
save-raw = false;
postprocessor = "${pkgs.megapixels}/share/megapixels/postprocess.sh";
};
"org/gnome/desktop/session" = {
idle-delay = mkUint32 60;
};
"org/gnome/desktop/input-sources" = {
sources = [
(mkTuple [
"xkb"
"us"
])
(mkTuple [
"xkb"
"jp+kana"
])
];
};
"org/gnome/eog/ui" = {
image-gallery = true;
sidebar = false;
};
"org/gnome/settings-daemon/plugins/power" = {
sleep-inactive-ac-type = "nothing";
sleep-inactive-battery-type = "suspend";
};
};
}

View File

@ -1,34 +0,0 @@
{ lib, nixosConfig, ... }:
let
inherit (lib) mkIf;
isPhone = nixosConfig.programs.calls.enable;
no = {
name = "";
settings.Hidden = "true";
};
in
{
xdg.desktopEntries = mkIf isPhone {
anki = no;
htop = no;
fish = no;
nvim = no;
yazi = no;
qt5ct = no;
qt6ct = no;
gcdemu = no;
nixos-manual = no;
image-analyzer = no;
kvantummanager = no;
chromium-browser = no;
"org.gnome.Extensions" = no;
"org.pwmt.zathura" = no;
"org.gnome.eog" = no;
"org.gnome.Settings" = no;
"org.sigxcpu.Livi" = no;
};
}

View File

@ -1,9 +1,7 @@
{ config, nixosConfig, ... }:
{ config, ... }:
let
inherit (config.home) homeDirectory;
isPhone = nixosConfig.programs.calls.enable;
in
{
xdg = {
@ -15,11 +13,11 @@ in
publicShare = null;
desktop = homeDirectory;
download = if isPhone then homeDirectory else "${homeDirectory}/";
documents = if isPhone then homeDirectory else "${homeDirectory}/";
music = if isPhone then homeDirectory else "${homeDirectory}/";
pictures = if isPhone then homeDirectory else "${homeDirectory}/";
videos = if isPhone then homeDirectory else "${homeDirectory}/";
download = "${homeDirectory}/";
documents = "${homeDirectory}/";
music = "${homeDirectory}/";
pictures = "${homeDirectory}/";
videos = "${homeDirectory}/";
};
configFile."user-dirs.locale".text = "ja_JP";

View File

@ -1,51 +0,0 @@
{ nix-config, ... }:
let
inherit (builtins) attrValues;
in
{
imports =
attrValues nix-config.nixosModules
++ attrValues nix-config.inputs.mobile-nixos.nixosModules;
nixpkgs = {
overlays = with nix-config.overlays; [ phinger-cursors ];
config.permittedInsecurePackages = [
"olm-3.2.16"
];
};
home-manager.sharedModules = with nix-config.homeModules; [
dconf
eza
fish
git
gpg
gtk
htop
kitty
librewolf
neovim
starship
xdg-user-dirs
xresources
];
modules = {
system = {
hostName = "mobile-nixos";
stateVersion = "23.11";
mullvad = true;
};
hardware.keyboardBinds = true;
phone.enable = true;
};
mobile.beautification = {
silentBoot = true;
splash = true;
};
}

View File

@ -1,12 +0,0 @@
{ lib, ... }:
{
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/c27b4193-56f0-44e8-bc45-6f64e4b721da";
fsType = "ext4";
};
};
nix.settings.max-jobs = lib.mkDefault 2;
}

View File

@ -17,8 +17,6 @@ let
inherit (cfg) bloat;
isPhone = config.programs.calls.enable;
cfg = config.modules.desktop;
in
{
@ -27,14 +25,14 @@ in
};
config = {
hardware.graphics.enable32Bit = mkIf (!isPhone) true;
hardware.graphics.enable32Bit = true;
programs = {
hyprland.enable = mkIf (!isContainer && !isPhone) true;
cdemu.enable = mkIf (!isPhone) true;
hyprland.enable = mkIf (!isContainer) true;
cdemu.enable = true;
thunar = {
enable = mkIf (!isPhone) true;
enable = true;
plugins = with pkgs.xfce; [
thunar-volman
@ -42,7 +40,7 @@ in
};
};
i18n.inputMethod = mkIf (!isPhone) {
i18n.inputMethod = {
enable = true;
type = "fcitx5";
@ -56,7 +54,7 @@ in
};
services = {
udisks2 = mkIf (!isPhone) {
udisks2 = {
enable = true;
mountOnMedia = true;
};
@ -80,7 +78,7 @@ in
displayManager.startx.enable = true;
};
pipewire = mkIf (!isPhone) {
pipewire = {
enable = true;
alsa = {
@ -91,7 +89,7 @@ in
pulse.enable = true;
};
greetd = mkIf (!isContainer && !isPhone) {
greetd = mkIf (!isContainer) {
enable = true;
restart = false;

View File

@ -1,102 +0,0 @@
{
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

@ -27,8 +27,6 @@ let
allowDevPort
;
isPhone = config.programs.calls.enable;
cfg = config.modules.system;
in
{
@ -155,7 +153,7 @@ in
isNormalUser = true;
uid = 1000;
password = mkIf (hashedPassword == null && !isContainer) (if isPhone then "1234" else username);
password = mkIf (hashedPassword == null && !isContainer) username;
extraGroups =
if isContainer then
@ -181,7 +179,7 @@ in
inherit (cfg) stateVersion;
};
programs.man.generateCaches = mkIf (!isPhone) true;
programs.man.generateCaches = true;
};
users.${username}.home = {

View File

@ -1,72 +0,0 @@
{
lib,
stdenvNoCC,
writeTextFile,
makeWrapper,
fish,
v4l-utils,
ffmpeg,
}:
let
pinephone-video = writeTextFile {
name = "pinephone-video";
text = # fish
''
media-ctl -d1 --links '"gc2145 3-003c":0->1:0[0],"ov5640 3-004c":0->1:0[1]'
media-ctl -d1 --set-v4l2 '"ov5640 3-004c":0[fmt:UYVY8_2X8/1280x720@1/30]'
ffmpeg \
-input_format yuv420p \
-s 1280x720 \
-f video4linux2 \
-thread_queue_size 4096 \
-i /dev/video1 \
-f pulse \
-thread_queue_size 256 \
-i alsa_input.platform-sound.Voice_Call__DigitalMic__source \
-c:a libopus \
-c:v libx264 \
-preset ultrafast \
-qp 23 \
"$(date '+%x%a%R').mp4"
'';
};
in
stdenvNoCC.mkDerivation {
pname = "pinephone-scripts";
version = "0.1.0";
dontUnpack = true;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
install -Dm755 ${pinephone-video} $out/bin/pinephone-video
runHook postInstall
'';
postInstall = ''
for bin in $out/bin/*; do
wrapProgram "$bin" \
--prefix PATH ":" "${
lib.makeBinPath [
fish
v4l-utils
ffmpeg
]
}"
done
'';
meta = {
homepage = "https://github.com/donovanglover/nix-config";
description = "PinePhone-specific scripts like video recording";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ donovanglover ];
platforms = lib.platforms.linux;
};
}