From 1adde1ba0e939220462b632a79407ad2a3b36fa5 Mon Sep 17 00:00:00 2001 From: chayleaf Date: Sun, 11 Jun 2023 21:48:35 +0700 Subject: [PATCH] update inputs; bpi-r3: build kernel from source --- flake.lock | 49 +++++++++-------- flake.nix | 13 +++-- home/common/waybar.nix | 7 +-- home/hosts/nixmsi.nix | 27 ++-------- overlays.nix | 2 +- pkgs/default.nix | 87 +++++++++++++++++++++++++------ pkgs/maubot.nix | 7 +++ system/hardware/bpi_r3.nix | 6 +-- system/hosts/nixserver/matrix.nix | 4 +- system/hosts/router/image.nix | 2 +- 10 files changed, 123 insertions(+), 81 deletions(-) diff --git a/flake.lock b/flake.lock index 89c25fa..ea7d8c0 100644 --- a/flake.lock +++ b/flake.lock @@ -91,11 +91,11 @@ ] }, "locked": { - "lastModified": 1684824189, - "narHash": "sha256-k3nCkn5Qy67rCguuw6YkGuL6hOUNRKxQoKOjnapk5sU=", + "lastModified": 1686391840, + "narHash": "sha256-5S0APl6Mfm6a37taHwvuf11UHnAX0+PnoWQbsYbMUnc=", "owner": "nix-community", "repo": "home-manager", - "rev": "58eb968c21d309a6c2b020ea8d64e25c38ceebba", + "rev": "0144ac418ef633bfc9dbd89b8c199ad3a617c59f", "type": "github" }, "original": { @@ -127,11 +127,11 @@ ] }, "locked": { - "lastModified": 1684835544, - "narHash": "sha256-RfxqpIUbVDcKsTw/e4Oc+ywrmWX1p4JrAOfpPFVXZ0k=", + "lastModified": 1686489662, + "narHash": "sha256-kEuKsjWoFm3EeeiSwqHlUyV1wTxJu6/kfzrhuIwaIEQ=", "owner": "fufexan", "repo": "nix-gaming", - "rev": "057ae3f4ded2a24fecd674a861bc7e08ad74b3ca", + "rev": "b32aeea96b838977a27804ba6a2cf2188f4b16af", "type": "github" }, "original": { @@ -142,11 +142,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1684899633, - "narHash": "sha256-NtwerXX8UFsoNy6k+DukJMriWtEjQtMU/Urbff2O2Dg=", + "lastModified": 1686452266, + "narHash": "sha256-zLKiX0iu6jZFeZDpR1gE6fNyMr8eiM8GLnj9SoUCjFs=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "4cc688ee711159b9bcb5a367be44007934e1a49d", + "rev": "2a807ad6e8dc458db08588b78cc3c0f0ec4ff321", "type": "github" }, "original": { @@ -168,11 +168,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1684964237, - "narHash": "sha256-dDS+GhdZN2MAa2FJKFGM2gpgAXhx+xoMkpVsRx9qpDE=", + "lastModified": 1686468558, + "narHash": "sha256-K69Ojlx3N8I6tRTZsrKFMIqK4yrnJ6/PjfKZi3wchYg=", "owner": "simple-nixos-mailserver", "repo": "nixos-mailserver", - "rev": "1bcfcf786bc289ca1bd2c9d29d6f02d9141b1da3", + "rev": "290d00f6db4e80467013728819ad73dd4a394d9a", "type": "gitlab" }, "original": { @@ -183,11 +183,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1684844536, - "narHash": "sha256-M7HhXYVqAuNb25r/d3FOO0z4GxPqDIZp5UjHFbBgw0Q=", + "lastModified": 1686412476, + "narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d30264c2691128adc261d7c9388033645f0e742b", + "rev": "21951114383770f96ae528d0ae68824557768e81", "type": "github" }, "original": { @@ -222,27 +222,26 @@ ] }, "locked": { - "lastModified": 1684668267, - "narHash": "sha256-AKnX12OwVEqXDv8Th2QDT96MPvC8Zv5KCtVdqc7l3hY=", + "lastModified": 1685774289, + "narHash": "sha256-7NXZ2S2FZzYW8lvX+zZ7x3wwCpjMLVK2tNL/u6JdSeE=", "owner": "chayleaf", "repo": "notlua", - "rev": "469652092f4f2e951b0db29027b05346b32d8122", + "rev": "12e810bf2c571ae80ae4fda4f8c63e40b8f9b392", "type": "github" }, "original": { "owner": "chayleaf", "repo": "notlua", - "rev": "469652092f4f2e951b0db29027b05346b32d8122", "type": "github" } }, "nur": { "locked": { - "lastModified": 1684959207, - "narHash": "sha256-lROs3YxWZDGeEPrcv0AYEfyps+gSW01E/VoTkmHU768=", + "lastModified": 1686488164, + "narHash": "sha256-DGfmD8ZCu9Xp0rB1tUct8FNlvz/orRr30DXeI9+fnPU=", "owner": "nix-community", "repo": "NUR", - "rev": "c4e46e935ba827acf70979c5e02a8431cf14cc5a", + "rev": "daf7100b6147114c5f0a68583ba50e15d82e9788", "type": "github" }, "original": { @@ -273,11 +272,11 @@ ] }, "locked": { - "lastModified": 1684894917, - "narHash": "sha256-kwKCfmliHIxKuIjnM95TRcQxM/4AAEIZ+4A9nDJ6cJs=", + "lastModified": 1686450923, + "narHash": "sha256-a7B9VT2NHJWRCerHmZagAXu3z2QHJKhxUhzjh5vAnXU=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "9ea38d547100edcf0da19aaebbdffa2810585495", + "rev": "4b3cb15179af3b8d640a29fa85cc9f332b4123e6", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 5db2c21..ccd5589 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; notlua = { - url = "github:chayleaf/notlua/469652092f4f2e951b0db29027b05346b32d8122"; + url = "github:chayleaf/notlua"; inputs.nixpkgs.follows = "nixpkgs"; }; nixos-mailserver = { @@ -58,6 +58,7 @@ # can't use callPackage ./pkgs here, idk why; use import instead overlay = self: super: import ./pkgs { pkgs = super; + pkgs' = self; lib = super.lib; nur = import nur { pkgs = super; @@ -171,9 +172,10 @@ ({ config, pkgs, lib, ...}: { nixpkgs.overlays = [ overlay ]; nix.package = lib.mkDefault pkgs.nixFlakes; - nix.extraOptions = '' + # this is only needed if nixos doesnt set plugin-files already + /*nix.extraOptions = '' plugin-files = ${pkgs.nix-plugins.override { nix = config.nix.package; }}/lib/nix/plugins/libnix-extra-builtins.so - ''; + '';*/ }) (getPrivUser hostname username) ]; @@ -206,9 +208,10 @@ ({ config, pkgs, lib, ... }: { nixpkgs.overlays = [ overlay ]; nix.package = lib.mkDefault pkgs.nixFlakes; - nix.extraOptions = '' + # this is only needed if nixos doesnt set plugin-files already + /*nix.extraOptions = '' plugin-files = ${pkgs.nix-plugins.override { nix = config.nix.package; }}/lib/nix/plugins/libnix-extra-builtins.so - ''; + '';*/ }) ]; }); diff --git a/home/common/waybar.nix b/home/common/waybar.nix index 29a4939..a8ab1a1 100644 --- a/home/common/waybar.nix +++ b/home/common/waybar.nix @@ -3,16 +3,17 @@ services.playerctld.enable = config.wayland.windowManager.sway.enable; programs.waybar = { enable = config.wayland.windowManager.sway.enable; - package = (pkgs.waybar.override { + package = pkgs.waybar.override { withMediaPlayer = true; - }).overrideAttrs (old: { + }; + /*).overrideAttrs (old: { src = pkgs.fetchFromGitHub { owner = "chayleaf"; repo = "Waybar"; rev = "3091cf4a009e92665325c0dd61adf5ab367786a3"; sha256 = "sha256-zH4hbQ8+9TYRVW/XYqmAVsi0vsSPn1LPqXxr0gi0j1E="; }; - }); + });*/ settings = [{ layer = "bottom"; # position = "bottom"; diff --git a/home/hosts/nixmsi.nix b/home/hosts/nixmsi.nix index fb0aa0b..e1ee66b 100644 --- a/home/hosts/nixmsi.nix +++ b/home/hosts/nixmsi.nix @@ -63,30 +63,9 @@ ghidra cutter openrgb piper steam-run steam - ((osu-lazer-bin.override { - gmrun_enable = false; - }).overrideAttrs (old: { - paths = assert builtins.length old.paths == 2; - let - osu = builtins.head old.paths; - osu' = osu.overrideAttrs (old: { - installPhase = builtins.replaceStrings - ["runHook postInstall"] - ["sed -i 's:exec :exec ${obs-studio-plugins.obs-vkcapture}/bin/obs-gamecapture :g' $out/bin/osu-lazer\nrunHook postInstall"] - old.installPhase; - }); - in assert osu.pname == "osu-lazer-bin"; [ - osu' - (makeDesktopItem { - name = osu'.pname; - exec = "${osu'.outPath}/bin/osu-lazer"; - icon = "${osu'.outPath}/osu.png"; - comment = "A free-to-win rhythm game. Rhythm is just a *click* away!"; - desktopName = "osu!"; - categories = ["Game"]; - }) - ]; - })) + (osu-lazer-bin.override { + command_prefix = "${obs-studio-plugins.obs-vkcapture}/bin/obs-gamecapture"; + }) taisei techmino (wrapOBS { diff --git a/overlays.nix b/overlays.nix index 40a060c..0306c13 100644 --- a/overlays.nix +++ b/overlays.nix @@ -1,2 +1,2 @@ # [ (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")) ] -[ (import ) (import ).overlays.default ] +[ (import ).overlays.default (import ) (import ).overlays.default ] diff --git a/pkgs/default.nix b/pkgs/default.nix index bdb7ebc..a2b18f7 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -2,6 +2,7 @@ , lib , nur , nix-gaming +, pkgs' ? pkgs , ... }: let inherit (pkgs) callPackage; @@ -159,25 +160,77 @@ rec { ''; fixupPhase = "true"; }; - linux_bpiR3 = (pkgs.buildLinux ({ - version = "6.3"; - modDirVersion = "6.3.0"; - - src = pkgs.fetchFromGitHub { - owner = "frank-w"; - repo = "BPI-Router-Linux"; - rev = "6.3-main"; - hash = lib.fakeHash; + linux_bpiR3 = pkgs.linux_testing.override { + stdenv = pkgs'.ccacheStdenv; + buildPackages = pkgs'.buildPackages // { + stdenv = pkgs'.buildPackages.ccacheStdenv; }; - - defconfig = "mt7986a_bpi-r3"; - })).overrideAttrs (old: { - postConfigure = '' - sed -i "$buildRoot/.config" -e 's%^CONFIG_LOCALVERSION=.*%CONFIG_LOCALVERSION=""%' - sed -i "$buildRoot/include/config/auto.conf" -e 's%^CONFIG_LOCALVERSION=.*%CONFIG_LOCALVERSION=""%' - ''; - }); + structuredExtraConfig = with lib.kernel; { + COMMON_CLK_MEDIATEK = yes; + COMMON_CLK_MT7986 = yes; + COMMON_CLK_MT7986_ETHSYS = yes; + MEDIATEK_GE_PHY = yes; + MEDIATEK_WATCHDOG = yes; + MTD_NAND_ECC_MEDIATEK = yes; + MTD_NAND_ECC_SW_HAMMING = yes; + MTD_NAND_MTK = yes; + MTD_SPI_NAND = yes; + MTD_UBI = yes; + MTD_UBI_BLOCK = yes; + MTK_EFUSE = yes; + MTK_HSDMA = yes; + MTK_INFRACFG = yes; + MTK_PMIC_WRAP = yes; + MTK_SCPSYS = yes; + MTK_SCPSYS_PM_DOMAINS = yes; + MTK_THERMAL = yes; + MTK_TIMER = yes; + NET_DSA_MT7530 = module; + NET_DSA_TAG_MTK = module; + NET_MEDIATEK_SOC = module; + NET_MEDIATEK_SOC_WED = yes; + NET_MEDIATEK_STAR_EMAC = module; + NET_SWITCHDEV = yes; + NET_VENDOR_MEDIATEK = yes; + PCIE_MEDIATEK = yes; + PCIE_MEDIATEK_GEN3 = yes; + PINCTRL_MT7986 = yes; + PINCTRL_MTK = yes; + PINCTRL_MTK_MOORE = yes; + PINCTRL_MTK_V2 = yes; + PWM_MEDIATEK = yes; + MT7915E = module; + MT7986_WMAC = yes; + SPI_MT65XX = yes; + SPI_MTK_NOR = yes; + SPI_MTK_SNFI = yes; + MMC_MTK = yes; + }; + }; linuxPackages_bpiR3 = pkgs.linuxPackagesFor linux_bpiR3; + ccacheWrapper = pkgs.ccacheWrapper.override { + extraConfig = '' + export CCACHE_COMPRESS=1 + export CCACHE_DIR="/var/cache/ccache" + export CCACHE_UMASK=007 + if [ ! -d "$CCACHE_DIR" ]; then + echo "=====" + echo "Directory '$CCACHE_DIR' does not exist" + echo "Please create it with:" + echo " sudo mkdir -m0770 '$CCACHE_DIR'" + echo " sudo chown root:nixbld '$CCACHE_DIR'" + echo "=====" + exit 1 + fi + if [ ! -w "$CCACHE_DIR" ]; then + echo "=====" + echo "Directory '$CCACHE_DIR' is not accessible for user $(whoami)" + echo "Please verify its access permissions" + echo "=====" + exit 1 + fi + ''; + }; firefox-addons = lib.recurseIntoAttrs (callPackage ./firefox-addons { inherit nur sources; }); mpvScripts = pkgs.mpvScripts // (callPackage ./mpv-scripts { }); diff --git a/pkgs/maubot.nix b/pkgs/maubot.nix index 2da0c85..9d6aae2 100644 --- a/pkgs/maubot.nix +++ b/pkgs/maubot.nix @@ -8,6 +8,13 @@ let python = python3.override { packageOverrides = self: super: { + aiosqlite = super.aiosqlite.overrideAttrs (old: rec { + version = "0.18.0"; + src = old.src.override { + rev = "refs/tags/v${version}"; + hash = "sha256-yPGSKqjOz1EY5/V0oKz2EiZ90q2O4TINoXdxHuB7Gqk="; + }; + }); sqlalchemy = super.buildPythonPackage rec { pname = "SQLAlchemy"; version = "1.3.24"; diff --git a/system/hardware/bpi_r3.nix b/system/hardware/bpi_r3.nix index f5555ec..df2d897 100644 --- a/system/hardware/bpi_r3.nix +++ b/system/hardware/bpi_r3.nix @@ -9,8 +9,8 @@ # i'm not about to build a kernel on every update without an arm device... # i guess i could use my phone for building it, but no, not interested - boot.kernelPackages = pkgs.linuxPackages_testing; - # boot.kernelPackages = pkgs.linuxPackages_bpiR3; + # boot.kernelPackages = pkgs.linuxPackages_testing; + boot.kernelPackages = pkgs.linuxPackages_bpiR3; hardware.deviceTree.enable = true; hardware.deviceTree.filter = "*mt7986*"; @@ -18,7 +18,7 @@ # # disable a bunch of useless drivers # boot.initrd.includeDefaultModules = false; - # boot.initrd.availableKernelModules = [ "mmc_block" "dm_mod" "rfkill" "cfg80211" "mt7915e" "ubi" "sdhci" "sd_mod" "sr_mod" "xhci_pci" ]; + boot.initrd.availableKernelModules = [ "mmc_block" "dm_mod" "rfkill" "cfg80211" "mt7915e" ]; boot.kernelParams = [ "console=ttyS0,115200" ]; boot.initrd.compressor = "zstd"; diff --git a/system/hosts/nixserver/matrix.nix b/system/hosts/nixserver/matrix.nix index 029db3e..2d060c2 100644 --- a/system/hosts/nixserver/matrix.nix +++ b/system/hosts/nixserver/matrix.nix @@ -43,8 +43,8 @@ in { }; }; - systemd.services.heisenbridge.wants = [ "matrix-synapse.service" ]; - systemd.services.heisenbridge.after = [ "matrix-synapse.service" ]; + # systemd.services.heisenbridge.wants = [ "matrix-synapse.service" ]; + # systemd.services.heisenbridge.after = [ "matrix-synapse.service" ]; services.heisenbridge = { enable = true; homeserver = "http://${lib.quoteListenAddr matrixAddr}:${toString matrixPort}/"; diff --git a/system/hosts/router/image.nix b/system/hosts/router/image.nix index 4e31223..9748a0c 100644 --- a/system/hosts/router/image.nix +++ b/system/hosts/router/image.nix @@ -69,7 +69,7 @@ vmTools.runInLinuxVM (runCommand "bpi-r3-fs" { truncate -s ${toString ((rootPartEnd - rootPartStart + 1) * 512)} ./tmp.img ${btrfs-progs}/bin/mkfs.btrfs \ --label NIXOS_SD \ - --uuid "44444444-4444-4444-8888-888888888889" \ + --uuid "44444444-4444-4444-8888-888888888888" \ ./tmp.img ''; # i give up on making this work in a nix derivation, just do the rest in a script (./image.sh)