{ 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.14-rc4"; linux-jhovold.flake = false; x13s-bt-linux-firmware = { flake = false; # 2024-12-05 now required by jhovold's (and soon mainline) kernel. need two files from here: hpnv21.b8c hpnv21g.b8c # url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/qca/hpnv21.b8c?id=8d24066f829b97966818fd0d9b5881190670f53f"; url = "git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git?rev=06aea4d8bfd5ca3624b56162b24339d7b0449913"; # revisions for this file: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/log/qca/hpbtfw21.tlv # 2024-07-29 # not working well # url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/qca/hpbtfw21.tlv?id=d118dc8ad5562ac0ae0c07be748cbe35a9361b47"; # 2024-05-30 # url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/qca/hpbtfw21.tlv?id=436b0a920352d13290043d9ec9e50c420ab10f92"; # 2023-12-18 # not working well # url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/qca/hpbtfw21.tlv?id=598f5bd22361d7e92eebe8452d1f8013a1d35b9a"; # 2013-01-17 # url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/qca/hpbtfw21.tlv?id=2ba1beaae0c649ce8a50baecc8df9e81cd524e65"; }; }; outputs = inputs@{ flake-parts, self, ... }: let dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb"; in flake-parts.lib.mkFlake { inherit inputs; } { imports = [ ./packages/part.nix ]; systems = [ "x86_64-linux" "aarch64-linux" ]; perSystem = { pkgs, inputs' , system, lib, ... }: { _module.args.pkgs = import inputs.nixpkgs { inherit system; overlays = [ (final: prev: { # overlay here }) ]; config = { }; }; devShells = rec { default = pkgs.mkShellNoCC { packages = ci.nativeBuildInputs; }; ci = pkgs.mkShellNoCC { packages = [ pkgs.cachix pkgs.jq pkgs.just (pkgs.python3.withPackages (py: [ py.PyGithub py.packaging ])) pkgs.pyright ]; }; }; formatter = pkgs.nixfmt-rfc-style; }; 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 { system = "aarch64-linux"; modules = [ self.nixosModules.default ( { config, pkgs, ... }: { nixos-x13s.enable = true; nixos-x13s.kernel = "jhovold"; # jhovold is default nixos-x13s.bluetoothMac = "02:68:b3:29:da:98"; # allow unfree firmware nixpkgs.config.allowUnfree = true; # define your fileSystems fileSystems."/".device = "/dev/notreal"; } ) ]; }; iso = inputs.nixpkgs.lib.nixosSystem { system = "aarch64-linux"; modules = [ self.nixosModules.default ( { modulesPath, config, lib, pkgs, ... }: let 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 { 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; nixos-x13s = { enable = true; bluetoothMac = "02:68:b3:29:da:98"; }; fileSystems = { "/boot" = { fsType = "vfat"; device = "/dev/disk/by-label/ESP"; }; "/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; autoResize = true; }; }; } ) ]; }; }; }; }