Add mobile support (PinePhone Pro)

This commit is contained in:
Kiana Sheibani 2023-01-07 20:54:12 -05:00
parent 5c30019fc3
commit 46c858faa0
4 changed files with 90 additions and 4 deletions

View file

@ -1,6 +1,7 @@
{ config, pkgs, nur, username, fullname, ... }:
let
inherit (config.custom) platform;
inherit (config) platform;
isMobile = platform == "mobile";
hashedPassword =
if platform == "desktop" then
@ -43,7 +44,8 @@ in
users.users.${username} = {
isNormalUser = true;
description = fullname;
extraGroups = [ "wheel" "networkmanager" ]; # Enable sudo for the user.
extraGroups = [ "wheel" "networkmanager" ]
++ lib.optionals isMobile [ "dialout" "feedbackd" "video" ];
shell = pkgs.fish;
inherit hashedPassword;
};
@ -66,8 +68,8 @@ in
fontconfig = {
enable = true;
defaultFonts = {
serif = [ "Noto Serif" ];
sansSerif = [ "Noto Sans" ];
serif = lib.optional (!isMobile) "Noto Serif";
sansSerif = lib.optional (!isMobile) "Noto Sans";
monospace = [ "VictorMono" ];
};
};
@ -86,3 +88,11 @@ in
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.11"; # Did you read the comment?
}
// lib.mkIf (platform == "mobile") {
hardware.bluetooth.enable = true;
hardware.pulseaudio.package = pkgs.pulseAudioFull;
zramSwap.enable = true;
services.xserver.desktopManager.phosh.user = username;
}

View file

@ -3,7 +3,10 @@ description = "System conf";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nur.url = "github:nix-community/NUR";
nixos-hardware.url = "github:NixOS/nixos-hardware";
mobile-nixos.url = "github:wentam/mobile-nixos/ppp-pr";
mobile-nixos.flake = false;
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
@ -66,6 +69,29 @@ outputs = { self,
}
];
};
"${username}-mobile" = lib.makeOverridable lib.nixosSystem {
inherit system;
modules = [
./config
{ _module.args = moduleArgs;
platform = "mobile"; }
./platform.nix
./hardware-configuration/mobile.nix
home-manager.nixosModules.home-manager
(import ${mobile-nixos}/lib/configuration.nix { device = "pine64-pinephonepro"; })
${mobile-nixos}/examples/phosh/phosh.nix
{
home-manager.users.${username} = import ./mobile/home-manager.nix;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.sharedModules = [ ./platform.nix { platform = "mobile"; } ];
home-manager.extraSpecialArgs = moduleArgs;
}
];
};
};
};
}

View file

@ -0,0 +1,12 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
fileSystems."/" =
{ device = "/dev/disk/by-uuid/0e34be6f-a042-433e-bcfc-9df254a571c3";
fsType = "ext4";
};
nix.settings.max-jobs = lib.mkDefault 3;
}

38
mobile/home-manager.nix Normal file
View file

@ -0,0 +1,38 @@
{ config, pkgs, username, fullname, ... }:
{
home.username = username;
home.homeDirectory = "/home/" + username;
home.stateVersion = "22.11";
imports = [ ../home-manager/shell ];
xdg.enable = true;
xdg.userDirs.enable = true;
programs.git = {
enable = true;
userName = fullname;
userEmail = "kiana.a.sheibani@gmail.com";
extraConfig = {
credential.helper = "store";
git.allowForcePush = true;
init.defaultBranch = "main";
user.signingkey = "6CB106C25E86A9F7";
commit.gpgsign = true;
};
};
programs.gpg.enable = true;
services.gpg-agent = {
enable = true;
enableSshSupport = true;
pinentryFlavor = "curses";
extraConfig = ''
allow-emacs-pinentry
allow-loopback-pinentry
'';
};
}