this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Finally got applesmc-next modules loading!

+61 -45
+40 -37
.config/nixos/prismo/applesmc-next.nix
··· 1 - { stdenv, lib, fetchFromGitHub, kernel, kmod }: 2 - let 3 - src = 4 - fetchFromGitHub { 5 - owner = "c---"; 6 - repo = "applesmc-next"; 7 - rev = "${version}"; 8 - sha256 = "sha256-Kh34suuoCLSBZH64EzqgIMJHjRVowmL94MEhHgx4GNg="; 9 - }; 1 + { stdenv, lib, fetchFromGitHub, kernel, kmod, pkgs ? import <nixpkgs> }: 2 + let 3 + kernelPrefix = "lib/modules/${kernel.modDirVersion}"; 4 + in 5 + stdenv.mkDerivation rec { 6 + version = "0.1.5"; 7 + name = "applesmc-${version}-${kernel.version}"; 8 + 9 + src = 10 + fetchFromGitHub { 11 + owner = "c---"; 12 + repo = "applesmc-next"; 13 + rev = "${version}"; 14 + sha256 = "sha256-Kh34suuoCLSBZH64EzqgIMJHjRVowmL94MEhHgx4GNg="; 15 + }; 10 16 11 - version = "0.1.5"; 17 + hardeningDisable = [ "pic" ]; 18 + nativeBuildInputs = kernel.moduleBuildDependencies; 12 19 13 - hardeningDisable = [ "pic" ]; 14 - nativeBuildInputs = kernel.moduleBuildDependencies; 20 + makeFlags = kernel.makeFlags ++ [ 21 + "KVER=${kernel.modDirVersion}" 22 + "KBUILD_DIR=${kernel.dev}/${kernelPrefix}/build" 23 + ]; 15 24 16 - makeFlags = [ 17 - "KVER=${kernel.modDirVersion}" 18 - "KBUILD_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" 19 - ]; 25 + preInstall = 26 + # https://docs.kernel.org/staging/xz.html#notes-on-compression-options 27 + '' 28 + xz --check=crc32 --lzma2=dict=512KiB applesmc/applesmc.ko 29 + xz --check=crc32 --lzma2=dict=512KiB sbs/sbs.ko 30 + ''; 20 31 21 - meta = with lib; { 22 - description = "Patches to Linux kernel to allow setting battery charge thresholds on Apple devices."; 23 - homepage = "https://github.com/c---/applesmc-next"; 24 - license = licenses.gpl2; 25 - maintainers = []; 26 - platforms = platforms.linux; 27 - }; 28 - in 29 - { 30 - applesmc = 31 - stdenv.mkDerivation rec { 32 - inherit src version hardeningDisable nativeBuildInputs makeFlags meta; 32 + installPhase = 33 + '' 34 + runHook preInstall 33 35 34 - name = "applesmc-${version}-${kernel.version}"; 35 - installPhase = "mv applesmc/applesmc.ko $out"; 36 - }; 36 + install -D applesmc/applesmc.ko.xz -m 444 -t $out/${kernelPrefix}/kernel/drivers/hwmon 37 + install -D sbs/sbs.ko.xz -m 444 -t $out/${kernelPrefix}/kernel/drivers/acpi 37 38 38 - sbs = 39 - stdenv.mkDerivation rec { 40 - inherit src version hardeningDisable nativeBuildInputs makeFlags meta; 39 + runHook postInstall 40 + ''; 41 41 42 - name = "sbs-${version}-${kernel.version}"; 43 - installPhase = "mv sbs/sbs.ko $out"; 42 + meta = with lib; { 43 + description = "Patches to Linux kernel to allow setting battery charge thresholds on Apple devices."; 44 + homepage = "https://github.com/c---/applesmc-next"; 45 + license = licenses.gpl2; 46 + platforms = platforms.linux; 44 47 }; 45 - } 48 + }
+21 -8
.config/nixos/prismo/configuration.nix
··· 1 1 # To apply this file, symlink this directory to /etc/nixos 2 2 # E.g. `rm -rf /etc/nixos && ln -s $PWD /etc/nixos` 3 - 4 - { config, pkgs, ... }: 5 - 3 + { config, lib, pkgs, ... }: 6 4 { 7 5 imports = 8 6 [ ··· 16 14 nix.settings.experimental-features = [ "nix-command" "flakes" ]; 17 15 18 16 # ========================================================================== 19 - # Boot configuration 17 + # Boot / kernel configuration 20 18 # ========================================================================== 21 - boot.loader.systemd-boot.enable = true; 22 - boot.loader.efi.canTouchEfiVariables = true; 19 + boot = { 20 + loader = { 21 + systemd-boot.enable = true; 22 + efi.canTouchEfiVariables = true; 23 + }; 24 + 25 + extraModulePackages = 26 + let 27 + applesmc-next = with config.boot.kernelPackages; 28 + # Set custom kernel modules to be higher priority, so they override 29 + # default kernel module files (which seem to have priority 0) 30 + lib.meta.hiPrio (callPackage ./applesmc-next.nix {}); 31 + in 32 + [ applesmc-next ]; 23 33 34 + # I think these might autoload anyway but let's load explicitly just in case 35 + kernelModules = [ "applesmc" "sbs" ]; 36 + }; 24 37 25 38 # ========================================================================== 26 39 # Networking configuration ··· 113 126 services.mbpfan = { 114 127 enable = true; 115 128 aggressive = true; 129 + # verbose = true; 116 130 }; 117 131 118 - /* # TODO: needs applesmc-next for thresholds to work 119 - # maybe also use powertop from powerManagement instead of packages? 132 + /* # TODO: needs applesmc-next helper script for thresholds to work 120 133 services.tlp = { 121 134 enable = true; 122 135 settings = {