diff --git a/phone/configuration.nix b/phone/configuration.nix index 32cc5b18..c99e3ed8 100644 --- a/phone/configuration.nix +++ b/phone/configuration.nix @@ -1,12 +1,6 @@ { config, lib, pkgs, ... }: { - imports = [ - (import { device = "pine64-pinephone"; }) - ./hardware-configuration.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"; diff --git a/phone/flake.lock b/phone/flake.lock new file mode 100644 index 00000000..b15768bf --- /dev/null +++ b/phone/flake.lock @@ -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 +} diff --git a/phone/flake.nix b/phone/flake.nix new file mode 100644 index 00000000..1eff9679 --- /dev/null +++ b/phone/flake.nix @@ -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 + ]; + }; + }; + }; +} diff --git a/phone/phosh.nix b/phone/phosh.nix new file mode 100644 index 00000000..bbeb4368 --- /dev/null +++ b/phone/phosh.nix @@ -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. + ''; + } + ]; +}