linuxPackages.system76-acpi: small improvements

- use `finalAttrs`
- use `tag` and `hash` in `src`
- add {pre,post} hooks to the `installPhase`
- remove `with lib;` from `meta`
This commit is contained in:
eljamm
2025-05-14 23:09:35 +02:00
parent 3b24475288
commit 4adde8f35b

View File

@@ -4,20 +4,17 @@
fetchFromGitHub,
kernel,
}:
let
stdenv.mkDerivation (finalAttrs: {
name = "system76-acpi-module-${finalAttrs.version}-${kernel.version}";
version = "1.0.2";
sha256 = "1i7zjn5cdv9h00fgjg46b8yrz4d3dqvfr25g3f13967ycy58m48h";
in
stdenv.mkDerivation {
name = "system76-acpi-module-${version}-${kernel.version}";
passthru.moduleName = "system76_acpi";
src = fetchFromGitHub {
owner = "pop-os";
repo = "system76-acpi-dkms";
rev = version;
inherit sha256;
tag = finalAttrs.version;
hash = "sha256-EJGKimf+mDSCG6+I7DZuo5GfPVqGPPkcADDtxoqV/8Q=";
};
hardeningDisable = [ "pic" ];
@@ -29,17 +26,21 @@ stdenv.mkDerivation {
];
installPhase = ''
runHook preInstall
install -D system76_acpi.ko $out/lib/modules/${kernel.modDirVersion}/misc/system76_acpi.ko
mkdir -p $out/lib/udev/hwdb.d
mv lib/udev/hwdb.d/* $out/lib/udev/hwdb.d
runHook postInstall
'';
# GCC 14 makes this an error by default, remove when fixed upstream
env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
meta = with lib; {
meta = {
maintainers = with lib.maintainers; [ ahoneybun ];
license = [ licenses.gpl2Only ];
license = [ lib.licenses.gpl2Only ];
platforms = [
"i686-linux"
"x86_64-linux"
@@ -51,4 +52,4 @@ stdenv.mkDerivation {
This provides the system76_acpi in-tree driver for systems missing it.
'';
};
}
})