mirror of
https://codeberg.org/mart-w/nixos-x13s.git
synced 2024-11-14 19:54:47 +01:00
Merge pull request 'main' (#2) from adamcstephens/nixos-x13s:main into main
Reviewed-on: https://codeberg.org/mart-w/nixos-x13s/pulls/2
This commit is contained in:
commit
f6a0df91fb
|
@ -1,5 +1,8 @@
|
||||||
# nixos x13s
|
# nixos x13s
|
||||||
|
|
||||||
|
> [!CAUTION]
|
||||||
|
> This project is unmaintained.
|
||||||
|
|
||||||
This repository aims to provide easy, shared, support for Lenovo X13s on Linux.
|
This repository aims to provide easy, shared, support for Lenovo X13s on Linux.
|
||||||
|
|
||||||
The support for this machine is constantly improving in mainline kernel and upstream packages. Eventually the goal is that this repository is no longer necessary.
|
The support for this machine is constantly improving in mainline kernel and upstream packages. Eventually the goal is that this repository is no longer necessary.
|
||||||
|
|
20
flake.lock
20
flake.lock
|
@ -5,11 +5,11 @@
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717285511,
|
"lastModified": 1719994518,
|
||||||
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
|
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
|
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1719254875,
|
"lastModified": 1722062969,
|
||||||
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
|
"narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
|
"rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -36,14 +36,14 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717284937,
|
"lastModified": 1719876945,
|
||||||
"narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=",
|
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
|
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
|
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
|
|
71
flake.nix
71
flake.nix
|
@ -36,10 +36,6 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = {
|
|
||||||
iso = self.nixosConfigurations.iso.config.system.build.isoImage;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.nixosModules.default = import ./module.nix { inherit dtbName; };
|
flake.nixosModules.default = import ./module.nix { inherit dtbName; };
|
||||||
|
@ -49,21 +45,19 @@
|
||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
self.nixosModules.default
|
self.nixosModules.default
|
||||||
|
(
|
||||||
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
nixos-x13s.enable = true;
|
nixos-x13s.enable = true;
|
||||||
nixos-x13s.kernel = "jhovold"; # jhovold is default, but mainline supported
|
nixos-x13s.kernel = "jhovold"; # jhovold is default, but mainline supported
|
||||||
|
|
||||||
# install multiple kernels! note this increases eval time for each specialization
|
|
||||||
# specialisation = {
|
|
||||||
# mainline.configuration.nixos-x13s.kernel = "mainline";
|
|
||||||
# };
|
|
||||||
|
|
||||||
# allow unfree firmware
|
# allow unfree firmware
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
# define your fileSystems
|
# define your fileSystems
|
||||||
fileSystems."/".device = "/dev/notreal";
|
fileSystems."/".device = "/dev/notreal";
|
||||||
}
|
}
|
||||||
|
)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,12 +67,45 @@
|
||||||
|
|
||||||
self.nixosModules.default
|
self.nixosModules.default
|
||||||
(
|
(
|
||||||
{ modulesPath, config, ... }:
|
{
|
||||||
|
modulesPath,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
dtb = "${config.boot.kernelPackages.kernel}/dtbs/qcom/${dtbName}";
|
image = import "${inputs.nixpkgs}/nixos/lib/make-disk-image.nix" {
|
||||||
|
inherit config lib pkgs;
|
||||||
|
|
||||||
|
name = "nixos-x13s-bootstrap";
|
||||||
|
diskSize = "auto";
|
||||||
|
format = "raw";
|
||||||
|
partitionTableType = "efi";
|
||||||
|
copyChannel = false;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ "${toString modulesPath}/installer/cd-dvd/iso-image.nix" ];
|
hardware.deviceTree = {
|
||||||
|
enable = true;
|
||||||
|
name = "qcom/${dtbName}";
|
||||||
|
};
|
||||||
|
|
||||||
|
system.build.bootstrap-image = image;
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
initrd = {
|
||||||
|
systemd.enable = true;
|
||||||
|
systemd.emergencyAccess = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
loader = {
|
||||||
|
grub.enable = false;
|
||||||
|
systemd-boot.enable = true;
|
||||||
|
systemd-boot.graceful = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
@ -87,16 +114,16 @@
|
||||||
bluetoothMac = "02:68:b3:29:da:98";
|
bluetoothMac = "02:68:b3:29:da:98";
|
||||||
};
|
};
|
||||||
|
|
||||||
isoImage = {
|
fileSystems = {
|
||||||
makeEfiBootable = true;
|
"/boot" = {
|
||||||
makeUsbBootable = true;
|
fsType = "vfat";
|
||||||
|
device = "/dev/disk/by-label/ESP";
|
||||||
contents = [
|
};
|
||||||
{
|
"/" = {
|
||||||
source = dtb;
|
device = "/dev/disk/by-label/nixos";
|
||||||
target = "/x13s.dtb";
|
fsType = "ext4";
|
||||||
}
|
autoResize = true;
|
||||||
];
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
50
module.nix
50
module.nix
|
@ -20,6 +20,21 @@ let
|
||||||
);
|
);
|
||||||
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}";
|
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}";
|
||||||
dtbEfiPath = "dtbs/x13s.dtb";
|
dtbEfiPath = "dtbs/x13s.dtb";
|
||||||
|
|
||||||
|
modulesClosure = pkgs.makeModulesClosure {
|
||||||
|
rootModules = config.boot.initrd.availableKernelModules ++ config.boot.initrd.kernelModules;
|
||||||
|
kernel = config.system.modulesTree;
|
||||||
|
firmware = config.hardware.firmware;
|
||||||
|
allowMissing = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
modulesWithExtra = pkgs.symlinkJoin {
|
||||||
|
name = "modules-closure";
|
||||||
|
paths = [
|
||||||
|
modulesClosure
|
||||||
|
x13sPackages.graphics-firmware
|
||||||
|
];
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.nixos-x13s = {
|
options.nixos-x13s = {
|
||||||
|
@ -41,28 +56,24 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
environment.systemPackages = [
|
assertions = [
|
||||||
pkgs.efibootmgr
|
{
|
||||||
(x13sPackages.uncompressed-firmware.override {
|
assertion = false;
|
||||||
firmwareFilesList = lib.flatten options.hardware.firmware.definitions;
|
message = "adamcstephens/nixos-x13s is no longer maintained";
|
||||||
})
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.pathsToLink = [ "/share/uncompressed-firmware" ];
|
environment.systemPackages = [ pkgs.efibootmgr ];
|
||||||
|
|
||||||
hardware.enableAllFirmware = true;
|
hardware.enableAllFirmware = true;
|
||||||
hardware.firmware = [ x13sPackages."x13s/extra-firmware" ];
|
hardware.firmware = lib.mkBefore [ x13sPackages.graphics-firmware ];
|
||||||
|
|
||||||
systemd.services.pd-mapper = {
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "${lib.getExe x13sPackages.pd-mapper}";
|
|
||||||
Restart = "always";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
initrd.systemd.enable = true;
|
||||||
|
initrd.systemd.contents = {
|
||||||
|
"/lib".source = lib.mkForce "${modulesWithExtra}/lib";
|
||||||
|
};
|
||||||
|
|
||||||
loader.efi.canTouchEfiVariables = true;
|
loader.efi.canTouchEfiVariables = true;
|
||||||
loader.systemd-boot.enable = lib.mkDefault true;
|
loader.systemd-boot.enable = lib.mkDefault true;
|
||||||
loader.systemd-boot.extraFiles = {
|
loader.systemd-boot.extraFiles = {
|
||||||
|
@ -79,11 +90,8 @@ in
|
||||||
"efi=noruntime"
|
"efi=noruntime"
|
||||||
"clk_ignore_unused"
|
"clk_ignore_unused"
|
||||||
"pd_ignore_unused"
|
"pd_ignore_unused"
|
||||||
"regulator_ignore_unused"
|
|
||||||
"arm64.nopauth"
|
"arm64.nopauth"
|
||||||
|
# "regulator_ignore_unused" # allows for > 30 sec to load msm, at the potential cost of power
|
||||||
# blacklist graphics in initrd so the firmware can load from disk
|
|
||||||
"rd.driver.blacklist=msm"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
initrd = {
|
initrd = {
|
||||||
|
@ -107,7 +115,7 @@ in
|
||||||
"dispcc_sc8280xp"
|
"dispcc_sc8280xp"
|
||||||
"phy_qcom_edp"
|
"phy_qcom_edp"
|
||||||
"panel-edp"
|
"panel-edp"
|
||||||
# "msm"
|
"msm"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
"owner": "jhovold",
|
"owner": "jhovold",
|
||||||
"repo": "linux"
|
"repo": "linux"
|
||||||
},
|
},
|
||||||
"branch": "wip/sc8280xp-6.10-rc5",
|
"branch": "wip/sc8280xp-6.11-rc1",
|
||||||
"revision": "fb34a1d838d061d9e2199656b832bb2ebc2dc5e3",
|
"revision": "9c6b81022b9c277d65c68e25f4cfd52f33ef8f28",
|
||||||
"url": "https://github.com/jhovold/linux/archive/fb34a1d838d061d9e2199656b832bb2ebc2dc5e3.tar.gz",
|
"url": "https://github.com/jhovold/linux/archive/9c6b81022b9c277d65c68e25f4cfd52f33ef8f28.tar.gz",
|
||||||
"hash": "07gsf26954qi9lspbzlc4xsan4vbiyzbfnpwbwyaxcqfibzfg6vg"
|
"hash": "13c6r67iy8y750f8zpals4l941lshxx3w3ar1ss9dizsqjsghdsr"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version": 3
|
"version": 3
|
||||||
|
|
|
@ -14,17 +14,23 @@ let
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
rec {
|
{
|
||||||
linux_jhovold = pkgs.callPackage linux_x13s_pkg {
|
linux_jhovold = pkgs.callPackage linux_x13s_pkg {
|
||||||
src = sources.linux-jhovold;
|
src = sources.linux-jhovold;
|
||||||
version = "6.10.0-rc5";
|
version = "6.11.0-rc1";
|
||||||
defconfig = "johan_defconfig";
|
defconfig = "johan_defconfig";
|
||||||
};
|
};
|
||||||
|
|
||||||
pd-mapper = pkgs.callPackage ./pd-mapper { inherit qrtr; };
|
graphics-firmware =
|
||||||
qrtr = pkgs.callPackage ./qrtr { };
|
let
|
||||||
|
gpu-src = pkgs.fetchurl {
|
||||||
"x13s/extra-firmware" = pkgs.callPackage ./extra-firmware.nix { };
|
url = "https://download.lenovo.com/pccbbs/mobiles/n3hdr20w.exe";
|
||||||
|
hash = "sha256-Jwyl9uKOnjpwfHd+VaGHjYs9x8cUuRdFCERuXqaJwEY=";
|
||||||
uncompressed-firmware = pkgs.callPackage ./uncompressed-firmware.nix { };
|
};
|
||||||
|
in
|
||||||
|
pkgs.runCommand "graphics-firmware" { } ''
|
||||||
|
mkdir -vp "$out/lib/firmware/qcom/sc8280xp/LENOVO/21BX"
|
||||||
|
${lib.getExe pkgs.innoextract} ${gpu-src}
|
||||||
|
cp -v code\$GetExtractPath\$/*/*.mbn "$out/lib/firmware/qcom/sc8280xp/LENOVO/21BX/"
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
{ stdenvNoCC, fetchFromGitHub }:
|
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
|
||||||
pname = "x13s-extra-firmware";
|
|
||||||
version = "1.0.0";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "ironrobin";
|
|
||||||
repo = "x13s-alarm";
|
|
||||||
rev = "efa51c3b519f75b3983aef67855b1561d9828771";
|
|
||||||
sha256 = "sha256-weETbWXz9aL2pDQDKk7fkb1ecQH0qrhUYDs2E5EiJcI=";
|
|
||||||
};
|
|
||||||
|
|
||||||
dontFixup = true;
|
|
||||||
dontBuild = true;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/lib/firmware/qcom/sc8280xp/LENOVO/21BX
|
|
||||||
cp x13s-firmware/qcvss8280.mbn $out/lib/firmware/qcom/sc8280xp/LENOVO/21BX/
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
{
|
|
||||||
stdenv,
|
|
||||||
lib,
|
|
||||||
fetchFromGitHub,
|
|
||||||
qrtr,
|
|
||||||
xz,
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
pname = "pd-mapper";
|
|
||||||
version = "unstable-2023-09-01";
|
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
qrtr
|
|
||||||
xz
|
|
||||||
];
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "andersson";
|
|
||||||
repo = "pd-mapper";
|
|
||||||
rev = "10997ba7c43a3787a40b6b1b161408033e716374";
|
|
||||||
hash = "sha256-qGrYNoPCxtdpTdbkSmB39+6/pSXml96Aul8b9opF9Lc=";
|
|
||||||
};
|
|
||||||
|
|
||||||
patches = [ ./pd-mapper-firmware-path.diff ];
|
|
||||||
|
|
||||||
installFlags = [ "prefix=$(out)" ];
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "Qualcomm PD mapper";
|
|
||||||
homepage = "https://github.com/andersson/pd-mapper";
|
|
||||||
license = licenses.bsd3;
|
|
||||||
mainProgram = "pd-mapper";
|
|
||||||
platforms = platforms.aarch64;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
diff --git a/pd-mapper.c b/pd-mapper.c
|
|
||||||
index 65c4b80..669d9a0 100644
|
|
||||||
--- a/pd-mapper.c
|
|
||||||
+++ b/pd-mapper.c
|
|
||||||
@@ -194,7 +194,7 @@ static int pd_load_map(const char *file)
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef ANDROID
|
|
||||||
-#define FIRMWARE_BASE "/lib/firmware/"
|
|
||||||
+#define FIRMWARE_BASE "/run/current-system/sw/share/uncompressed-firmware/"
|
|
||||||
#else
|
|
||||||
#define FIRMWARE_BASE "/vendor/firmware/"
|
|
||||||
#endif
|
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
stdenv,
|
|
||||||
lib,
|
|
||||||
fetchFromGitHub,
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
pname = "qrtr";
|
|
||||||
version = "unstable-2023-01-17";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "andersson";
|
|
||||||
repo = "qrtr";
|
|
||||||
rev = "d0d471c96e7d112fac6f48bd11f9e8ce209c04d2";
|
|
||||||
hash = "sha256-KF0gCBRw3BDJdK1s+dYhHkokVTHwRFO58ho0IwHPehc=";
|
|
||||||
};
|
|
||||||
|
|
||||||
installFlags = [ "prefix=$(out)" ];
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "QMI IDL compiler";
|
|
||||||
homepage = "https://github.com/andersson/qrtr";
|
|
||||||
license = licenses.bsd3;
|
|
||||||
platforms = platforms.aarch64;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
runCommand,
|
|
||||||
buildEnv,
|
|
||||||
firmwareFilesList ? [ ],
|
|
||||||
}:
|
|
||||||
runCommand "qcom-modem-uncompressed-firmware-share"
|
|
||||||
{
|
|
||||||
firmwareFiles = buildEnv {
|
|
||||||
name = "qcom-modem-uncompressed-firmware";
|
|
||||||
paths = firmwareFilesList;
|
|
||||||
pathsToLink = [
|
|
||||||
"/lib/firmware/rmtfs"
|
|
||||||
"/lib/firmware/qcom"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
''
|
|
||||||
PS4=" $ "
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
mkdir -p $out/share/
|
|
||||||
ln -s $firmwareFiles/lib/firmware/ $out/share/uncompressed-firmware
|
|
||||||
)
|
|
||||||
''
|
|
Loading…
Reference in a new issue