diff --git a/README.md b/README.md index 937bf17..4b4918e 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,20 @@ # nixos x13s > [!CAUTION] -> This project is unmaintained. +> This project is partially maintained. +> It receives kernel updates, until mainline will provide a fully functional experience. 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. -## Binary cache - -A binary cache is provided through Cachix so you can avoid re-building the kernel. - -https://app.cachix.org/cache/nixos-x13s - -Ensure you are not overriding the nixpkgs input when consuming this flake, or you may not be able to take advantages of this cache. - -NixOS configuration example: - -```nix - nix.settings = { - substituters = [ - "https://nixos-x13s.cachix.org" - ]; - trusted-public-keys = [ - "nixos-x13s.cachix.org-1:SzroHbidolBD3Sf6UusXp12YZ+a5ynWv0RtYF0btFos=" - ]; - }; -``` - ## Add with a flake ```nix { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - nixos-x13s.url = "git+https://codeberg.org/adamcstephens/nixos-x13s"; + nixos-x13s.url = "git+https://codeberg.org/steveej/nixos-x13s"; }; outputs = @@ -46,13 +26,7 @@ NixOS configuration example: inputs.nixos-x13s.nixosModules.default { nixos-x13s.enable = true; - nixos-x13s.kernel = "jhovold"; # jhovold is default, but mainline supported - - # install multiple kernels! note this increases eval time for each specialization - specialisation = { - # note that activation of each specialization is required to copy the dtb to the EFI, and thus boot - mainline.configuration.nixos-x13s.kernel = "mainline"; - }; + nixos-x13s.kernel = "jhovold"; # jhovold is default # allow unfree firmware nixpkgs.config.allowUnfree = true; @@ -66,25 +40,6 @@ NixOS configuration example: } ``` -## Add using not a flake - -Clone the repository: - -``` -git clone https://codeberg.org/adamcstephens/nixos-x13s /etc/nixos/nixos-x13s -``` - -Then reference the module in your `configuration.nix` and use the module as documented in the flake example above: - -```nix - imports = - [ - ./nixos-x13s/module.nix - ]; - nixos-x13s.enable = true; - ... -``` - ## UEFI Update ISO This repository provides a package which can output the USB UEFI Update ISO. This will be updated as Lenovo releases new versions. diff --git a/flake.lock b/flake.lock index 3dc68ab..422ac12 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1719994518, - "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "lastModified": 1725234343, + "narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "rev": "567b938d64d4b4112ee253b9274472dc3a346eb6", "type": "github" }, "original": { @@ -18,13 +18,30 @@ "type": "github" } }, + "linux-jhovold": { + "flake": false, + "locked": { + "lastModified": 1728631036, + "narHash": "sha256-1LnClVjY6WS+IR9eqPFA7gzXm0cio3mY23NXj9cKHHs=", + "owner": "jhovold", + "repo": "linux", + "rev": "6a97bc22fa36010400b91e6d5979741c391112c3", + "type": "github" + }, + "original": { + "owner": "jhovold", + "ref": "wip/sc8280xp-6.12-rc2", + "repo": "linux", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1722062969, - "narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=", + "lastModified": 1725432240, + "narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3", + "rev": "ad416d066ca1222956472ab7d0555a6946746a80", "type": "github" }, "original": { @@ -36,19 +53,20 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1719876945, - "narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" } }, "root": { "inputs": { "flake-parts": "flake-parts", + "linux-jhovold": "linux-jhovold", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index f0ea0ca..a0a9d0c 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,9 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; + + linux-jhovold.url = "github:jhovold/linux/wip/sc8280xp-6.12-rc2"; + linux-jhovold.flake = false; }; outputs = @@ -21,7 +24,7 @@ { pkgs, ... }: { devShells = rec { - default = pkgs.mkShellNoCC { packages = [ pkgs.npins ] ++ ci.nativeBuildInputs; }; + default = pkgs.mkShellNoCC { packages = ci.nativeBuildInputs; }; ci = pkgs.mkShellNoCC { packages = [ @@ -36,9 +39,16 @@ ]; }; }; + + formatter = pkgs.nixfmt-rfc-style; }; - flake.nixosModules.default = import ./module.nix { inherit dtbName; }; + flake.nixosModules.default = import ./module.nix { + inherit dtbName; + + # FIXME: don't hardcode this with the arch + x13sPackages = self.packages.aarch64-linux; + }; flake.nixosConfigurations = { example = inputs.nixpkgs.lib.nixosSystem { @@ -49,7 +59,7 @@ { config, pkgs, ... }: { nixos-x13s.enable = true; - nixos-x13s.kernel = "jhovold"; # jhovold is default, but mainline supported + nixos-x13s.kernel = "jhovold"; # jhovold is default # allow unfree firmware nixpkgs.config.allowUnfree = true; diff --git a/module.nix b/module.nix index 61c066a..0038fbe 100644 --- a/module.nix +++ b/module.nix @@ -1,4 +1,4 @@ -{ dtbName }: +{ dtbName, x13sPackages }: { config, lib, @@ -9,12 +9,7 @@ let cfg = config.nixos-x13s; - x13sPackages = import ./packages/default.nix { inherit lib pkgs; }; - linuxPackages_x13s = - if cfg.kernel == "mainline" then - pkgs.linuxPackages_latest - else pkgs.linuxPackagesFor ( if cfg.kernel == "jhovold" then x13sPackages.linux_jhovold else throw "Unsupported kernel" ); @@ -48,21 +43,13 @@ in kernel = lib.mkOption { type = lib.types.enum [ "jhovold" - "mainline" ]; - description = "Which patched kernel to use. jhovold is the latest RC or release with some x13s specific patches, and mainline is nixos latest"; + description = "Which patched kernel to use. jhovold is the latest RC or release with some x13s specific patches."; default = "jhovold"; }; }; config = lib.mkIf cfg.enable { - assertions = [ - { - assertion = false; - message = "adamcstephens/nixos-x13s is no longer maintained"; - } - ]; - environment.systemPackages = [ pkgs.efibootmgr ]; hardware.enableAllFirmware = true; @@ -91,30 +78,30 @@ in "clk_ignore_unused" "pd_ignore_unused" "arm64.nopauth" - # "regulator_ignore_unused" # allows for > 30 sec to load msm, at the potential cost of power + "regulator_ignore_unused" # allows for > 30 sec to load msm, at the potential cost of power ]; initrd = { kernelModules = [ "nvme" - "phy-qcom-qmp-pcie" - "pcie-qcom" + "phy_qcom_qmp_pcie" + "pcie_qcom" - "i2c-core" - "i2c-hid" - "i2c-hid-of" - "i2c-qcom-geni" + "i2c_core" + "i2c_hid" + "i2c_hid-of" + "i2c_qcom-geni" "leds_qcom_lpg" "pwm_bl" "qrtr" "pmic_glink_altmode" "gpio_sbu_mux" - "phy-qcom-qmp-combo" + "phy_qcom_qmp_combo" "gpucc_sc8280xp" "dispcc_sc8280xp" "phy_qcom_edp" - "panel-edp" + "panel_edp" "msm" ]; }; diff --git a/npins/default.nix b/npins/default.nix deleted file mode 100644 index 4a7c372..0000000 --- a/npins/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -# Generated by npins. Do not modify; will be overwritten regularly -let - data = builtins.fromJSON (builtins.readFile ./sources.json); - version = data.version; - - mkSource = spec: - assert spec ? type; let - path = - if spec.type == "Git" then mkGitSource spec - else if spec.type == "GitRelease" then mkGitSource spec - else if spec.type == "PyPi" then mkPyPiSource spec - else if spec.type == "Channel" then mkChannelSource spec - else builtins.throw "Unknown source type ${spec.type}"; - in - spec // { outPath = path; }; - - mkGitSource = { repository, revision, url ? null, hash, ... }: - assert repository ? type; - # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository - # In the latter case, there we will always be an url to the tarball - if url != null then - (builtins.fetchTarball { - inherit url; - sha256 = hash; # FIXME: check nix version & use SRI hashes - }) - else assert repository.type == "Git"; builtins.fetchGit { - url = repository.url; - rev = revision; - # hash = hash; - }; - - mkPyPiSource = { url, hash, ... }: - builtins.fetchurl { - inherit url; - sha256 = hash; - }; - - mkChannelSource = { url, hash, ... }: - builtins.fetchTarball { - inherit url; - sha256 = hash; - }; -in -if version == 3 then - builtins.mapAttrs (_: mkSource) data.pins -else - throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" diff --git a/npins/sources.json b/npins/sources.json deleted file mode 100644 index 6224ea5..0000000 --- a/npins/sources.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "pins": { - "linux-jhovold": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "jhovold", - "repo": "linux" - }, - "branch": "wip/sc8280xp-6.11-rc1", - "revision": "9c6b81022b9c277d65c68e25f4cfd52f33ef8f28", - "url": "https://github.com/jhovold/linux/archive/9c6b81022b9c277d65c68e25f4cfd52f33ef8f28.tar.gz", - "hash": "13c6r67iy8y750f8zpals4l941lshxx3w3ar1ss9dizsqjsghdsr" - } - }, - "version": 3 -} \ No newline at end of file diff --git a/packages/default.nix b/packages/default.nix index f4a84f7..5674e77 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,6 +1,10 @@ -{ lib, pkgs, ... }: +{ + inputs, + lib, + pkgs, + ... +}: let - sources = import ../npins; linux_x13s_pkg = { version, buildLinux, ... }@args: @@ -9,15 +13,20 @@ let // { modDirVersion = version; - kernelPatches = (args.kernelPatches or [ ]) ++ [ ]; + structuredExtraConfig = with lib.kernel; { + MODULE_COMPRESS = yes; + MODULE_COMPRESS_ALL = yes; + MODULE_COMPRESS_XZ = yes; + }; + extraMeta.branch = lib.versions.majorMinor version; } ); in { linux_jhovold = pkgs.callPackage linux_x13s_pkg { - src = sources.linux-jhovold; - version = "6.11.0-rc1"; + src = inputs.linux-jhovold; + version = "6.12.0-rc2"; defconfig = "johan_defconfig"; }; diff --git a/packages/part.nix b/packages/part.nix index a665de7..6983c9a 100644 --- a/packages/part.nix +++ b/packages/part.nix @@ -1,4 +1,9 @@ -{ lib, withSystem, ... }: +{ + inputs, + lib, + withSystem, + ... +}: { perSystem = { pkgs, ... }: @@ -10,6 +15,6 @@ }; flake.packages.aarch64-linux = withSystem "aarch64-linux" ( - { pkgs, ... }: import ./default.nix { inherit lib pkgs; } + { pkgs, ... }: import ./default.nix { inherit inputs lib pkgs; } ); } diff --git a/update.py b/update.py deleted file mode 100755 index efcb733..0000000 --- a/update.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python3 - -from github import Github -import sys -import re -from packaging.version import Version -from subprocess import run - -latest_version: str = "0" -latest_branch: str = "" -previous_version: str = "" - -with Github() as gh: - for branch in gh.get_user("jhovold").get_repo("linux").get_branches(): - v = re.match("wip/sc8280xp-((v?6.[0-9]+)(-rc[0-9]+)?)", branch.name) - if v != None and Version(v.group(1)) > Version(latest_version): - # add .0 to version - latest_version = f"{v.group(2)}.0{v.group(3) or ''}" - latest_branch = v.group(0) - -print("branch: " + latest_branch) -print("latest: " + latest_version) - -with open("packages/default.nix", "r") as f: - lines = f.readlines() - -for line in lines: - v = re.match(r'^\s*version = "(6[.0-9-rc]+)";.*$', line) - if v != None: - previous_version = v.group(1) - -print("previous: " + previous_version) - -if previous_version == latest_version: - print("No update found, exiting.") - sys.exit(1) - -with open("packages/default.nix", "w") as f: - for line in lines: - f.write( - re.sub( - r'^(\s*version = ")6[.0-9-rc]+(";.*$)', - rf"\g<1>{latest_version}\2", - line, - ) - ) - -run( - f"npins add --name linux-jhovold github --branch {latest_branch} jhovold linux".split( - " " - ) -) - -run("git add npins/ packages/default.nix".split(" ")) -run(["git", "commit", "-m", f"jhovold: {previous_version} -> {latest_version}"])