base testing

This commit is contained in:
2025-07-29 14:56:24 +04:00
parent fb70cbe10a
commit 0c48addc4b
6 changed files with 224 additions and 0 deletions

77
flake.lock generated Normal file
View File

@@ -0,0 +1,77 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1753694789,
"narHash": "sha256-cKgvtz6fKuK1Xr5LQW/zOUiAC0oSQoA9nOISB0pJZqM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dc9637876d0dcc8c9e5e22986b857632effeb727",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"systems": "systems_2"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

46
flake.nix Normal file
View File

@@ -0,0 +1,46 @@
{
description = "Scuggo Pkgs";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
systems.url = "github:nix-systems/default";
};
outputs =
{
self,
nixpkgs,
flake-utils,
systems,
}:
{
overlays.default =
final: prev: (import "${nixpkgs}/pkgs/top-level/by-name-overlay.nix" ./pkgs/by-name) final prev;
}
//
flake-utils.lib.eachSystem
[
"x86_64-linux"
"aarch64-linux"
]
(
system:
let
pkgs = import nixpkgs {
inherit system;
};
inherit (pkgs) lib;
scope = lib.makeScope pkgs.newScope (final: self.overlays.default (pkgs // final) pkgs);
workingPackages = lib.filterAttrs (_: pkg: !pkg.meta.broken) self.packages.${system};
in
{
inherit pkgs;
packages = lib.filterAttrs (
_: pkg: lib.isDerivation pkg && (lib.meta.availableOn pkgs.stdenv.hostPlatform pkg)
) scope;
checks = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") workingPackages;
}
);
}

View File

@@ -0,0 +1,22 @@
{
lib,
newScope,
callPackage,
fetchFromGitHub,
...
}:
let
src = fetchFromGitHub {
owner = "qca";
repo = "qca-swiss-army-knife";
rev = "7c191e5530d32391105653b276ab587d2af9e02a";
hash = "sha256-iE4lqyr3zmLcgFnsrDvQ/CKUV15ijqmIbUIs9sgMECg=";
};
in
lib.packagesFromDirectoryRecursive {
inherit callPackage newScope;
directory = ./tools;
}
# lib.makeScope newScope (self: {
# ath12k-tools = self.callPackage ./ath12k-tools.nix { inherit src; };
# })

View File

@@ -0,0 +1,14 @@
{ src, python3, ... }:
python3.pkgs.buildPythonApplication rec {
name = "ath12k-tools";
pyproject = false;
inherit src;
sourceRoot = "source/tools/scripts/ath12k";
installPhase = ''
install -Dm755 "ath12k-bdencoder" "$out/bin/ath12k-bdencoder"
install -Dm755 "ath12k-check" "$out/bin/ath12k-check"
install -Dm755 "ath12k-fw-repo" "$out/bin/ath12k-fw-repo"
install -Dm755 "ath12k-fwencoder" "$out/bin/ath12k-fwencoder"
'';
}

View File

@@ -0,0 +1,58 @@
{
msitools,
tree,
fetchurl,
lib,
stdenv,
...
}:
stdenv.mkDerivation (
let
fw_files = [
"adsp_dtbs.elf"
"adspr.jsn"
"adsps.jsn"
"adspua.jsn"
"battmgr.jsn"
"cdsp_dtbs.elf"
"cdspr.jsn"
"qcadsp8380.mbn"
"qccdsp8380.mbn"
"qcdxkmsuc8380.mbn"
];
in
{
name = "x1e80100-firmware";
src = fetchurl {
url = "https://download.microsoft.com/download/b7ca2c3f-d320-4795-be0f-529a0117abb4/SurfaceLaptop7_ARM_Win11_26100_25.061.7304.0.msi";
sha256 = "sha256-x75NsuZZr64XfGhjghIoiymdhhb/rM0iaV9EohwPbrs=";
};
nativeBuildInputs = [
msitools
tree
];
unpackPhase = ''
msiextract -C . $src
'';
buildPhase = ''
mkdir -p $out/lib/firmware/qcom/x1e80100/microsoft/Romulus
for file in ${lib.concatStringsSep " " fw_files}; do
echo -e "\tSearching for $file..."
fw_path=$(find . -type f -name "$file" -print | head -n 1)
if [[ -n "$fw_path" ]]; then
cp -v "$fw_path" "$out/lib/firmware/qcom/x1e80100/microsoft/Romulus/"
else
echo "Error: $file not found!"
exit 1
fi
done
cp $out/lib/firmware/qcom/x1e80100/microsoft/Romulus/qcdxkmsuc8380.mbn $out/lib/firmware/qcom/x1e80100/microsoft/qcdxkmsuc8380.mbn
'';
meta = {
platforms = [ "aarch64-linux" ];
};
}
)

7
pkgs/default.nix Normal file
View File

@@ -0,0 +1,7 @@
prev: final:
builtins.listToAttrs (
map (fn: {
name = fn;
value = prev.callPackage ./${fn} { };
}) (builtins.filter (fn: fn != "default.nix") (builtins.attrNames (builtins.readDir ./.)))
)