some generally (I hope) useful config for the Pinephone
This commit is contained in:
parent
6d4dfbe029
commit
70da3a582d
59
pinephone.nix
Normal file
59
pinephone.nix
Normal file
@ -0,0 +1,59 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
# configuration.nix contains settings applicable to _my_ pinephone
|
||||
# pinephone.nix contains settings applicable to eufon on pinephones.
|
||||
# module.nix contains settings applicable to eufon generally
|
||||
|
||||
{
|
||||
config = {
|
||||
powerManagement = {
|
||||
enable = true;
|
||||
cpuFreqGovernor = "ondemand";
|
||||
};
|
||||
mobile.boot.stage-1.firmware = [
|
||||
config.mobile.device.firmware
|
||||
];
|
||||
hardware.sensor.iio.enable = true;
|
||||
hardware.firmware = [ config.mobile.device.firmware ];
|
||||
|
||||
services.fwupd = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
let refresh-bootfs = (import ./refresh-bootfs.nix { inherit config pkgs lib; });
|
||||
in with pkgs; [
|
||||
dtc
|
||||
file
|
||||
refresh-bootfs
|
||||
];
|
||||
|
||||
environment.etc."fwupd/remotes.d/testing.conf" = {
|
||||
mode = "0644";
|
||||
text = ''
|
||||
[fwupd Remote]
|
||||
|
||||
Enabled=true
|
||||
Title=Linux Vendor Firmware Service (testing)
|
||||
MetadataURI=https://cdn.fwupd.org/downloads/firmware-testing.xml.gz
|
||||
ReportURI=https://fwupd.org/lvfs/firmware/report
|
||||
OrderBefore=lvfs,fwupd
|
||||
AutomaticReports=false
|
||||
ApprovalRequired=false
|
||||
'';
|
||||
};
|
||||
|
||||
nixpkgs = {
|
||||
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||
"pine64-pinephone-firmware"
|
||||
];
|
||||
|
||||
};
|
||||
# boot.loader.generic-extlinux-compatible.enable = lib.mkForce true;
|
||||
hardware.opengl = {
|
||||
enable = true;
|
||||
driSupport = true;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
43
refresh-bootfs.nix
Normal file
43
refresh-bootfs.nix
Normal file
@ -0,0 +1,43 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
# nixos/mobile-nixos don't currently (June 2022) update the kernel and
|
||||
# initrd used by the bootloader when nixos-rebuild is run. This is a
|
||||
# workaround until they do. Mount your boot filesystem somewhere
|
||||
# and run "refresh-bootfs /path/to/mounted/bootfs" after switching
|
||||
# configuration
|
||||
|
||||
let
|
||||
inherit (config.mobile.outputs) recovery stage-0;
|
||||
inherit (pkgs) writeScriptBin buildPackages imageBuilder runCommandNoCC;
|
||||
|
||||
kernel = stage-0.mobile.boot.stage-1.kernel.package;
|
||||
kernel_file = "${kernel}/${if kernel ? file then kernel.file else pkgs.stdenv.hostPlatform.linux-kernel.target}";
|
||||
# bootscr = runCommandNoCC "boot.scr" {
|
||||
# nativeBuildInputs = [
|
||||
# buildPackages.ubootTools
|
||||
# ];
|
||||
# } ''
|
||||
# mkimage -C none -A arm64 -T script -d {bootcmd} $out
|
||||
# '';
|
||||
|
||||
in writeScriptBin "refresh-bootfs" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
test -n "$1" || exit 1
|
||||
test -d "$1" || exit 1
|
||||
cd $1
|
||||
test -f ./boot.scr || exit 1
|
||||
mkdir -vp mobile-nixos/{boot,recovery}
|
||||
(
|
||||
cd mobile-nixos/boot
|
||||
cp -v ${stage-0.mobile.outputs.initrd} stage-1
|
||||
cp -v ${kernel_file} kernel
|
||||
cp -vr ${kernel}/dtbs dtbs
|
||||
)
|
||||
(
|
||||
cd mobile-nixos/recovery
|
||||
cp -v ${recovery.mobile.outputs.initrd} stage-1
|
||||
cp -v ${kernel_file} kernel
|
||||
cp -vr ${kernel}/dtbs dtbs
|
||||
)
|
||||
# cp -v {bootscr} ./boot.scr
|
||||
''
|
Loading…
Reference in New Issue
Block a user