mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-05 01:37:24 +08:00
chore: format repo using treefmt-nix and nixfmt-rfc-style
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config =
|
||||
lib.mkIf config.hardware.librem5.audio
|
||||
{
|
||||
services.dbus.packages = [ pkgs.callaudiod ];
|
||||
}
|
||||
lib.mkIf config.hardware.librem5.audio {
|
||||
services.dbus.packages = [ pkgs.callaudiod ];
|
||||
}
|
||||
// (
|
||||
let
|
||||
paConfig = {
|
||||
@@ -18,24 +19,25 @@
|
||||
'';
|
||||
};
|
||||
in
|
||||
if lib.versionOlder (lib.versions.majorMinor lib.version) "25.05"
|
||||
then {
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.hardware.pulseaudio.enable;
|
||||
message = "Call audio on Librem5 requires pulse audio to be enabled through `hardware.pulseaudio.enable`.";
|
||||
}
|
||||
];
|
||||
hardware.pulseaudio = paConfig;
|
||||
}
|
||||
else {
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.services.pulseaudio.enable;
|
||||
message = "Call audio on Librem5 requires pulse audio to be enabled through `services.pulseaudio.enable`.";
|
||||
}
|
||||
];
|
||||
services.pulseaudio = paConfig;
|
||||
}
|
||||
if lib.versionOlder (lib.versions.majorMinor lib.version) "25.05" then
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.hardware.pulseaudio.enable;
|
||||
message = "Call audio on Librem5 requires pulse audio to be enabled through `hardware.pulseaudio.enable`.";
|
||||
}
|
||||
];
|
||||
hardware.pulseaudio = paConfig;
|
||||
}
|
||||
else
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.services.pulseaudio.enable;
|
||||
message = "Call audio on Librem5 requires pulse audio to be enabled through `services.pulseaudio.enable`.";
|
||||
}
|
||||
];
|
||||
services.pulseaudio = paConfig;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.hardware.librem5;
|
||||
linuxPackages_librem5 = pkgs.linuxPackagesFor (pkgs.callPackage ./kernel.nix { });
|
||||
ubootLibrem5 = pkgs.callPackage ./u-boot { };
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
hardware.librem5 = {
|
||||
package = lib.mkOption {
|
||||
@@ -11,7 +17,11 @@ in {
|
||||
default = pkgs.callPackage ./librem5-base { };
|
||||
};
|
||||
wifiCard = lib.mkOption {
|
||||
type = lib.types.enum [ "redpine" "sparklan" "none" ];
|
||||
type = lib.types.enum [
|
||||
"redpine"
|
||||
"sparklan"
|
||||
"none"
|
||||
];
|
||||
description = ''
|
||||
Which wi-fi card is installed in your phone.
|
||||
|
||||
|
||||
@@ -1,28 +1,31 @@
|
||||
{ lib
|
||||
, buildLinux
|
||||
, fetchFromGitLab
|
||||
, ...
|
||||
} @ args:
|
||||
buildLinux (args
|
||||
{
|
||||
lib,
|
||||
buildLinux,
|
||||
fetchFromGitLab,
|
||||
...
|
||||
}@args:
|
||||
buildLinux (
|
||||
args
|
||||
// rec {
|
||||
defconfig = "librem5_defconfig";
|
||||
version = "6.6.74-librem5";
|
||||
modDirVersion = version;
|
||||
src = fetchFromGitLab {
|
||||
domain = "source.puri.sm";
|
||||
owner = "Librem5";
|
||||
repo = "linux";
|
||||
rev = "pureos/6.6.74pureos1";
|
||||
hash = "sha256-qUPY+2fHVu7SFc+Uf8U7QtkQJJsE/4I1SavpLqJ/34c=";
|
||||
};
|
||||
kernelPatches = [ ];
|
||||
# see https://github.com/NixOS/nixpkgs/pull/366004
|
||||
ignoreConfigErrors = true;
|
||||
defconfig = "librem5_defconfig";
|
||||
version = "6.6.74-librem5";
|
||||
modDirVersion = version;
|
||||
src = fetchFromGitLab {
|
||||
domain = "source.puri.sm";
|
||||
owner = "Librem5";
|
||||
repo = "linux";
|
||||
rev = "pureos/6.6.74pureos1";
|
||||
hash = "sha256-qUPY+2fHVu7SFc+Uf8U7QtkQJJsE/4I1SavpLqJ/34c=";
|
||||
};
|
||||
kernelPatches = [ ];
|
||||
# see https://github.com/NixOS/nixpkgs/pull/366004
|
||||
ignoreConfigErrors = true;
|
||||
|
||||
structuredExtraConfig = with lib.kernel; {
|
||||
# buildLinux overrides this and defaults to 32, so go back to the value defined librem5_defconfig
|
||||
# this is required for millipixels to take photos, otherwise the VIDIOC_REQ_BUFS ioctl returns ENOMEM
|
||||
CMA_SIZE_MBYTES = lib.mkForce (freeform "320");
|
||||
};
|
||||
}
|
||||
// args.argsOverride or { })
|
||||
structuredExtraConfig = with lib.kernel; {
|
||||
# buildLinux overrides this and defaults to 32, so go back to the value defined librem5_defconfig
|
||||
# this is required for millipixels to take photos, otherwise the VIDIOC_REQ_BUFS ioctl returns ENOMEM
|
||||
CMA_SIZE_MBYTES = lib.mkForce (freeform "320");
|
||||
};
|
||||
}
|
||||
// args.argsOverride or { }
|
||||
)
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
{ stdenv, fetchFromGitLab, shellcheck, kmod, lib }:
|
||||
{
|
||||
stdenv,
|
||||
fetchFromGitLab,
|
||||
shellcheck,
|
||||
kmod,
|
||||
lib,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "librem5-base";
|
||||
version = "unstable";
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
lib.mkIf config.hardware.librem5.lockdownFix {
|
||||
# We blacklist the drivers so they don't load during early boot when the sensors are disconnected,
|
||||
boot.blacklistedKernelModules = [
|
||||
@@ -17,10 +22,10 @@ lib.mkIf config.hardware.librem5.lockdownFix {
|
||||
};
|
||||
|
||||
# udev rules from librem5-base handle going into "lockdown mode" and back.
|
||||
assertions = [{
|
||||
assertion = with config.hardware.librem5;
|
||||
lockdownFix -> installUdevPackages;
|
||||
message =
|
||||
"'hardware.librem5.lockdownFix' requires 'hardware.librem5.installUdevPackages', but it is not enabled.";
|
||||
}];
|
||||
assertions = [
|
||||
{
|
||||
assertion = with config.hardware.librem5; lockdownFix -> installUdevPackages;
|
||||
message = "'hardware.librem5.lockdownFix' requires 'hardware.librem5.installUdevPackages', but it is not enabled.";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
{ stdenv, gcc11Stdenv, buildUBoot, fetchurl, fetchFromGitLab, lib, bison }:
|
||||
{
|
||||
stdenv,
|
||||
gcc11Stdenv,
|
||||
buildUBoot,
|
||||
fetchurl,
|
||||
fetchFromGitLab,
|
||||
lib,
|
||||
bison,
|
||||
}:
|
||||
let
|
||||
firmware-imx = stdenv.mkDerivation (fa: {
|
||||
pname = "firmware-imx";
|
||||
@@ -20,7 +28,7 @@ let
|
||||
meta.license = lib.licenses.unfree;
|
||||
});
|
||||
|
||||
arm-trusted-firmware-imx8mq = gcc11Stdenv.mkDerivation (fa: {
|
||||
arm-trusted-firmware-imx8mq = gcc11Stdenv.mkDerivation (_fa: {
|
||||
pname = "arm-trusted-firmware-bl31";
|
||||
version = "unstable-2020-07-08";
|
||||
src = fetchFromGitLab {
|
||||
@@ -33,7 +41,10 @@ let
|
||||
enableParallelBuilding = true;
|
||||
hardeningDisable = [ "all" ];
|
||||
NIX_LDFLAGS = "--no-warn-rwx-segments";
|
||||
buildFlags = [ "PLAT=imx8mq" "bl31" ];
|
||||
buildFlags = [
|
||||
"PLAT=imx8mq"
|
||||
"bl31"
|
||||
];
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp build/imx8mq/release/bl31.bin $out
|
||||
@@ -51,7 +62,7 @@ let
|
||||
rev = "956aa590c93977992743b41c45d3c7ee5a024915"; # this is the latest commit on the upstream/librem5 branch
|
||||
hash = "sha256-MsIIlarN+WFFEzc0ptLAgS7BwJ6Cosy42xo0EwPn1AU=";
|
||||
};
|
||||
patches = [];
|
||||
patches = [ ];
|
||||
BL31 = "${arm-trusted-firmware-imx8mq}/bl31.bin";
|
||||
preConfigure = ''
|
||||
cp $BL31 .
|
||||
|
||||
Reference in New Issue
Block a user