Skip to content

Instantly share code, notes, and snippets.

@Krutonium
Last active September 8, 2025 16:41
Show Gist options
  • Select an option

  • Save Krutonium/0538999e08fffef34b8e075f7de6e7f0 to your computer and use it in GitHub Desktop.

Select an option

Save Krutonium/0538999e08fffef34b8e075f7de6e7f0 to your computer and use it in GitHub Desktop.
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1757068644,
"narHash": "sha256-NOrUtIhTkIIumj1E/Rsv1J37Yi3xGStISEo8tZm3KW4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8eb28adfa3dc4de28e792e3bf49fcf9007ca8ac9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
{
description = "Static lshw cross-compile for armv7 with musl and full features";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
cross = import nixpkgs {
localSystem = system;
crossSystem = {
config = "armv7l-unknown-linux-musleabihf";
libc = "musl";
abi = "eabihf";
cpu = "armv7l";
platform = pkgs.lib.systems.platforms.armv7l-hf-multiplatform;
};
};
in {
packages.${system}.lshw-armv7-static = cross.stdenv.mkDerivation {
pname = "lshw";
version = "B.02.20";
hardeningDisable = [ "all" ];
src = pkgs.fetchFromGitHub {
owner = "lyonel";
repo = "lshw";
rev = "B.02.20";
# run `nix-prefetch-url --unpack https://github.com/lyonel/lshw/archive/refs/tags/B.02.20.tar.gz`
sha256 = "sha256-4etC7ymMgn1Q4f98DNASv8vn0AT55dYPdacZo6GRDw0=";
};
nativeBuildInputs = [
pkgs.makeWrapper
pkgs.pkg-config
pkgs.git
];
buildInputs = [
cross.zlib
cross.pciutils
cross.libcap
];
makeFlags = [ "static" ];
CFLAGS = "-O2 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard";
LDFLAGS = "-static";
installPhase = ''
mkdir -p $out/bin
cp ./src/lshw-static $out/bin/lshw
'';
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment