From 82e28cda1c923d48a7f0110f84b806542053163c Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Sun, 29 Aug 2021 01:37:48 +0000 Subject: [PATCH] Add dptx-dummy so that dptx.bin gets into the initrd --- externals/packages/dptx-dummy/.gitignore | 1 + externals/packages/dptx-dummy/default.nix | 26 +++++++++++++++++++ externals/packages/dptx-dummy/src/Makefile | 1 + .../packages/dptx-dummy/src/dptx-dummy.c | 6 +++++ system/mistmane/default.nix | 9 +++++++ 5 files changed, 43 insertions(+) create mode 100644 externals/packages/dptx-dummy/.gitignore create mode 100644 externals/packages/dptx-dummy/default.nix create mode 100644 externals/packages/dptx-dummy/src/Makefile create mode 100644 externals/packages/dptx-dummy/src/dptx-dummy.c diff --git a/externals/packages/dptx-dummy/.gitignore b/externals/packages/dptx-dummy/.gitignore new file mode 100644 index 0000000..e31b50d --- /dev/null +++ b/externals/packages/dptx-dummy/.gitignore @@ -0,0 +1 @@ +*.cmd diff --git a/externals/packages/dptx-dummy/default.nix b/externals/packages/dptx-dummy/default.nix new file mode 100644 index 0000000..f3dbe5c --- /dev/null +++ b/externals/packages/dptx-dummy/default.nix @@ -0,0 +1,26 @@ +{ stdenv, lib, kernel }: + +stdenv.mkDerivation rec { + pname = "dptx-dummy"; + version = "0.1"; + src = ./src; + nativeBuildInputs = kernel.moduleBuildDependencies; + setSourceRoot = '' + export sourceRoot=$(pwd)/src; + ''; + makeFlags = [ + "-C" + "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "M=$(sourceRoot)" + ]; + buildFlags = [ "modules" ]; + installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ]; + installTargets = [ "modules_install" ]; + meta = with lib; { + description = "Dummy module that requires rockchip/dptx.bin"; + homepage = "https://artem.ist"; + license = licenses.gpl2; + maintainers = [ maintainers.artemist ]; + platforms = platforms.linux; + }; +} diff --git a/externals/packages/dptx-dummy/src/Makefile b/externals/packages/dptx-dummy/src/Makefile new file mode 100644 index 0000000..f7d027e --- /dev/null +++ b/externals/packages/dptx-dummy/src/Makefile @@ -0,0 +1 @@ +obj-m := dptx-dummy.o diff --git a/externals/packages/dptx-dummy/src/dptx-dummy.c b/externals/packages/dptx-dummy/src/dptx-dummy.c new file mode 100644 index 0000000..bf319af --- /dev/null +++ b/externals/packages/dptx-dummy/src/dptx-dummy.c @@ -0,0 +1,6 @@ +#include + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Artemis Tosini "); +MODULE_DESCRIPTION("Dummy module that requires rockchip/dptx.bin"); +MODULE_FIRMWARE("rockchip/dptx.bin"); diff --git a/system/mistmane/default.nix b/system/mistmane/default.nix index d07c8c2..78d285e 100644 --- a/system/mistmane/default.nix +++ b/system/mistmane/default.nix @@ -55,5 +55,14 @@ extraConfig = lib.mkForce "HandlePowerKey=lock"; }; + swapDevices = [{ + device = "/dev/disk/by-partuuid/3f4fb4d3-1e13-f64a-a435-8f866833c2b1"; + randomEncryption = true; + }]; + + # rockchip/dptx.bin isn't in the initrd. Instead of fix nixpkgs let's do something incredibly cursed + boot.extraModulePackages = [ (pkgs.callPackage ../../externals/packages/dptx-dummy { kernel = config.boot.kernelPackages.kernel; }) ]; + boot.initrd.availableKernelModules = [ "dptx-dummy" ]; + system.stateVersion = "21.11"; }