Created
August 2, 2022 16:58
-
-
Save telent/05b202fbfe75ec5991d0fb611cfde5a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ lib, pkgs, config, ... }: | |
let | |
inherit (lib.strings) makeBinPath; | |
app = pkgs.callPackage ../mobile-nixos/examples/hello/app {}; | |
hello-gui = pkgs.mobile-nixos.stage-1.script-loader.wrap { | |
name = "hello-gui"; | |
applet = "${app}/libexec/app.mrb"; | |
env = { | |
PATH = "${makeBinPath (with pkgs;[ | |
systemd # journalctl | |
glibc # iconv | |
utillinux # lsblk | |
input-utils # lsinput | |
])}:$PATH"; | |
}; | |
}; | |
in | |
{ | |
mobile.boot.stage-1.networking.enable = lib.mkDefault true; | |
mobile.adbd.enable = lib.mkForce true; | |
networking = { | |
hostName = "phoen"; # Define your hostname. | |
networkmanager.enable = false; | |
wireless = { | |
enable = true; | |
networks = { | |
telent = { | |
psk = "ha ha ha"; | |
} ; | |
}; | |
}; | |
}; | |
boot.postBootCommands = lib.mkOrder (-1) '' | |
brightness=10 | |
echo "Setting brightness to $brightness" | |
if [ -e /sys/class/backlight/backlight/brightness ]; then | |
echo $(($(cat /sys/class/backlight/backlight/max_brightness) * brightness / 100)) > /sys/class/backlight/backlight/brightness | |
elif [ -e /sys/class/leds/lcd-backlight/max_brightness ]; then | |
echo $(($(cat /sys/class/leds/lcd-backlight/max_brightness) * brightness / 100)) > /sys/class/leds/lcd-backlight/brightness | |
elif [ -e /sys/class/leds/lcd-backlight/brightness ]; then | |
# Assumes max brightness is 100... probably wrong, but good enough, eh. | |
echo $brightness > /sys/class/leds/lcd-backlight/brightness | |
fi | |
''; | |
time.timeZone = "Europe/London"; | |
services.openssh.enable = true; | |
users.users.dan = | |
let dan = (import /home/dan/src/telent-nixos-config/users.nix {inherit pkgs;}).dan ; | |
in dan // { packages = []; initialPassword = "terces"; }; | |
system.stateVersion = "22.05"; # there was a comment? | |
systemd.services.sshd.wantedBy = lib.mkOverride 10 [ "multi-user.target" ]; | |
services.openssh.permitRootLogin = lib.mkForce "yes"; | |
services.getty.autologinUser = "nixos"; | |
# The LVGUI interface can be used with volume keys for selecting | |
# and power to activate an option. | |
# Without this, logind just powers off :). | |
services.logind.extraConfig = '' | |
HandlePowerKey=ignore | |
''; | |
system.build = { | |
app-simulator = app.simulator; | |
}; | |
environment.systemPackages = with pkgs; [ | |
hello-gui | |
input-utils | |
]; | |
systemd.services.hello-gui = { | |
description = "GUI for the hello example of Mobile NixOS"; | |
wantedBy = [ "multi-user.target" ]; | |
serviceConfig = { | |
Restart = "always"; | |
SyslogIdentifier = "hello-gui"; | |
ExecStart = '' | |
${hello-gui}/bin/hello-gui | |
''; | |
}; | |
}; | |
mobile.boot.stage-1.ssh.enable = true; | |
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ | |
"motorola-potter-firmware" | |
]; | |
hardware.firmware = [ | |
(config.mobile.device.firmware.override { | |
modem = ./local/potter/modem; | |
}) | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment