-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathflake.nix
More file actions
59 lines (51 loc) · 1.75 KB
/
flake.nix
File metadata and controls
59 lines (51 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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.gpl2Plus;
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;
};
}