phone: Add working flake

This is a working nix flake I wrote for the PinePhone on the PinePhone.
It successfully updated the system from a 2023-11-15 version to the
latest nixos-unstable release.
This commit is contained in:
Donovan Glover 2024-06-13 06:06:29 -04:00
parent 494f40e691
commit 6434f2b2fc
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
4 changed files with 114 additions and 6 deletions

View File

@ -1,12 +1,6 @@
{ config, lib, pkgs, ... }:
{
imports = [
(import <mobile-nixos/lib/configuration.nix> { device = "pine64-pinephone"; })
./hardware-configuration.nix
<mobile-nixos/examples/phosh/phosh.nix>
];
networking.hostName = "mobile-nixos";
#
@ -32,6 +26,8 @@
# It's recommended to keep enabled on these constrained devices
zramSwap.enable = true;
nix.settings.experimental-features = [ "nix-command" "flakes" "repl-flake" ];
# Auto-login for phosh
services.xserver.desktopManager.phosh = {
user = "user";

44
phone/flake.lock generated Normal file
View File

@ -0,0 +1,44 @@
{
"nodes": {
"mobile-nixos": {
"flake": false,
"locked": {
"lastModified": 1715627339,
"narHash": "sha256-HJ6V7hc64iBqXlZ8kH4sXmUzPH+0Hn6wYURmZmL5LFk=",
"owner": "NixOS",
"repo": "mobile-nixos",
"rev": "655c8830d5fe2eae79c8fc0bab8033b34c8456eb",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "mobile-nixos",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1718160348,
"narHash": "sha256-9YrUjdztqi4Gz8n3mBuqvCkMo4ojrA6nASwyIKWMpus=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "57d6973abba7ea108bac64ae7629e7431e0199b6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"mobile-nixos": "mobile-nixos",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

29
phone/flake.nix Normal file
View File

@ -0,0 +1,29 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
mobile-nixos = {
url = "github:NixOS/mobile-nixos";
flake = false;
};
};
outputs = { self, nixpkgs, mobile-nixos } @ attrs:
{
nixosConfigurations = {
mobile-nixos = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = attrs;
modules = [
(import "${mobile-nixos}/lib/configuration.nix" {
device = "pine64-pinephone";
})
./configuration.nix
./hardware-configuration.nix
./phosh.nix
];
};
};
};
}

39
phone/phosh.nix Normal file
View File

@ -0,0 +1,39 @@
#
# 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.
'';
}
];
}