-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89e029b
commit d64e5b2
Showing
3 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
description = "Install ASUSTOR kernel modules on NixOS"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
}; | ||
|
||
outputs = { self, nixpkgs }: | ||
let | ||
system = "x86_64-linux"; | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
module = | ||
({ stdenv, lib, kernel, ... }: | ||
|
||
stdenv.mkDerivation rec { | ||
name = "asustor-platform-driver-${version}-${kernel.version}"; | ||
version = "0.1"; | ||
|
||
src = ./.; | ||
|
||
hardeningDisable = [ "pic" "format" ]; | ||
nativeBuildInputs = kernel.moduleBuildDependencies; | ||
|
||
buildFlags = [ | ||
"KERNEL_MODULES=${kernel.dev}/lib/modules/${kernel.modDirVersion}" | ||
]; | ||
installFlags = [ | ||
"KERNEL_MODULES=${placeholder "out"}/lib/modules/${kernel.modDirVersion}" | ||
]; | ||
|
||
preConfigure = '' | ||
sed -i '/depmod/d' Makefile | ||
''; | ||
|
||
meta = with lib; { | ||
description = "A kernel module to support ASUSTOR devices"; | ||
homepage = "https://github.com/mafredri/asustor-platform-driver"; | ||
license = licenses.gpl3; | ||
maintainers = [ ]; | ||
platforms = platforms.linux; | ||
}; | ||
}); | ||
in | ||
{ | ||
nixosModules.default = ({ config, lib, ... }: | ||
let | ||
asustor-platform-driver = config.boot.kernelPackages.callPackage module { }; | ||
in | ||
{ | ||
options = { | ||
hardware.asustor.enable = lib.mkEnableOption "Enable the ASUSTOR kernel module"; | ||
}; | ||
config = lib.mkIf config.hardware.asustor.enable { | ||
boot.extraModulePackages = [ asustor-platform-driver ]; | ||
}; | ||
}); | ||
formatter.${system} = pkgs.nixpkgs-fmt; | ||
}; | ||
} |