mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-06-24 03:31:23 +02:00
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:
parent
9db81fe743
commit
de6685fe5f
21
flake.lock
generated
21
flake.lock
generated
@ -225,26 +225,6 @@
|
|||||||
"type": "github"
|
"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": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1736883708,
|
"lastModified": 1736883708,
|
||||||
@ -264,7 +244,6 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"mobile-nixos": "mobile-nixos",
|
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"sakaya": "sakaya",
|
"sakaya": "sakaya",
|
||||||
"stylix": "stylix"
|
"stylix": "stylix"
|
||||||
|
11
flake.nix
11
flake.nix
@ -20,11 +20,6 @@
|
|||||||
url = "github:donovanglover/sakaya";
|
url = "github:donovanglover/sakaya";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
mobile-nixos = {
|
|
||||||
url = "github:donovanglover/mobile-nixos";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
@ -84,12 +79,6 @@
|
|||||||
modules = listFilesRecursive ./hosts/laptop;
|
modules = listFilesRecursive ./hosts/laptop;
|
||||||
};
|
};
|
||||||
|
|
||||||
mobile-nixos = nixosSystem {
|
|
||||||
system = "aarch64-linux";
|
|
||||||
specialArgs.nix-config = self;
|
|
||||||
modules = listFilesRecursive ./hosts/phone;
|
|
||||||
};
|
|
||||||
|
|
||||||
iso = nixosSystem {
|
iso = nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
specialArgs.nix-config = self;
|
specialArgs.nix-config = self;
|
||||||
|
@ -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";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@ -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;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,9 +1,7 @@
|
|||||||
{ config, nixosConfig, ... }:
|
{ config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (config.home) homeDirectory;
|
inherit (config.home) homeDirectory;
|
||||||
|
|
||||||
isPhone = nixosConfig.programs.calls.enable;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
xdg = {
|
xdg = {
|
||||||
@ -15,11 +13,11 @@ in
|
|||||||
publicShare = null;
|
publicShare = null;
|
||||||
|
|
||||||
desktop = homeDirectory;
|
desktop = homeDirectory;
|
||||||
download = if isPhone then homeDirectory else "${homeDirectory}/ダウンロード";
|
download = "${homeDirectory}/ダウンロード";
|
||||||
documents = if isPhone then homeDirectory else "${homeDirectory}/ドキュメント";
|
documents = "${homeDirectory}/ドキュメント";
|
||||||
music = if isPhone then homeDirectory else "${homeDirectory}/音楽";
|
music = "${homeDirectory}/音楽";
|
||||||
pictures = if isPhone then homeDirectory else "${homeDirectory}/画像";
|
pictures = "${homeDirectory}/画像";
|
||||||
videos = if isPhone then homeDirectory else "${homeDirectory}/ビデオ";
|
videos = "${homeDirectory}/ビデオ";
|
||||||
};
|
};
|
||||||
|
|
||||||
configFile."user-dirs.locale".text = "ja_JP";
|
configFile."user-dirs.locale".text = "ja_JP";
|
||||||
|
@ -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;
|
|
||||||
};
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
@ -17,8 +17,6 @@ let
|
|||||||
|
|
||||||
inherit (cfg) bloat;
|
inherit (cfg) bloat;
|
||||||
|
|
||||||
isPhone = config.programs.calls.enable;
|
|
||||||
|
|
||||||
cfg = config.modules.desktop;
|
cfg = config.modules.desktop;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@ -27,14 +25,14 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
hardware.graphics.enable32Bit = mkIf (!isPhone) true;
|
hardware.graphics.enable32Bit = true;
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
hyprland.enable = mkIf (!isContainer && !isPhone) true;
|
hyprland.enable = mkIf (!isContainer) true;
|
||||||
cdemu.enable = mkIf (!isPhone) true;
|
cdemu.enable = true;
|
||||||
|
|
||||||
thunar = {
|
thunar = {
|
||||||
enable = mkIf (!isPhone) true;
|
enable = true;
|
||||||
|
|
||||||
plugins = with pkgs.xfce; [
|
plugins = with pkgs.xfce; [
|
||||||
thunar-volman
|
thunar-volman
|
||||||
@ -42,7 +40,7 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
i18n.inputMethod = mkIf (!isPhone) {
|
i18n.inputMethod = {
|
||||||
enable = true;
|
enable = true;
|
||||||
type = "fcitx5";
|
type = "fcitx5";
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
udisks2 = mkIf (!isPhone) {
|
udisks2 = {
|
||||||
enable = true;
|
enable = true;
|
||||||
mountOnMedia = true;
|
mountOnMedia = true;
|
||||||
};
|
};
|
||||||
@ -80,7 +78,7 @@ in
|
|||||||
displayManager.startx.enable = true;
|
displayManager.startx.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
pipewire = mkIf (!isPhone) {
|
pipewire = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
alsa = {
|
alsa = {
|
||||||
@ -91,7 +89,7 @@ in
|
|||||||
pulse.enable = true;
|
pulse.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
greetd = mkIf (!isContainer && !isPhone) {
|
greetd = mkIf (!isContainer) {
|
||||||
enable = true;
|
enable = true;
|
||||||
restart = false;
|
restart = false;
|
||||||
|
|
||||||
|
@ -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";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@ -27,8 +27,6 @@ let
|
|||||||
allowDevPort
|
allowDevPort
|
||||||
;
|
;
|
||||||
|
|
||||||
isPhone = config.programs.calls.enable;
|
|
||||||
|
|
||||||
cfg = config.modules.system;
|
cfg = config.modules.system;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@ -155,7 +153,7 @@ in
|
|||||||
|
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
uid = 1000;
|
uid = 1000;
|
||||||
password = mkIf (hashedPassword == null && !isContainer) (if isPhone then "1234" else username);
|
password = mkIf (hashedPassword == null && !isContainer) username;
|
||||||
|
|
||||||
extraGroups =
|
extraGroups =
|
||||||
if isContainer then
|
if isContainer then
|
||||||
@ -181,7 +179,7 @@ in
|
|||||||
inherit (cfg) stateVersion;
|
inherit (cfg) stateVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.man.generateCaches = mkIf (!isPhone) true;
|
programs.man.generateCaches = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.${username}.home = {
|
users.${username}.home = {
|
||||||
|
@ -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;
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user