From d69f0dd718a007a37b5e8abfee680120a3bc44ef Mon Sep 17 00:00:00 2001 From: QixYuanmeng <3286046540@qq.com> Date: Tue, 20 Aug 2024 00:01:42 +0800 Subject: [PATCH] add wechat --- flake.lock | 343 ++++++++++++++++-- flake.nix | 2 + home/base/core/java.nix | 15 + home/base/gui/dev-tools.nix | 1 + home/base/gui/media.nix | 4 + home/linux/base/shell.nix | 1 + home/linux/gui/base/custom/default.nix | 4 + .../custom/wechat-universal-bwrap/default.nix | 290 +++++++++++++++ home/linux/gui/base/misc.nix | 5 +- home/linux/gui/hyprland/conf/hyprland.conf | 3 +- .../gui/hyprland/conf/waybar/config.jsonc | 4 +- hosts/idols-ai/clahs.nix | 18 - hosts/idols-ai/impermanence.nix | 8 +- lib/nixosSystem.nix | 9 + modules/nixos/base/clahs.nix | 35 ++ modules/nixos/base/nix.nix | 1 - modules/nixos/desktop.nix | 1 + nix-secrets | 2 +- secrets/nixos.nix | 7 + 19 files changed, 693 insertions(+), 60 deletions(-) create mode 100644 home/base/core/java.nix create mode 100644 home/linux/gui/base/custom/default.nix create mode 100644 home/linux/gui/base/custom/wechat-universal-bwrap/default.nix delete mode 100644 hosts/idols-ai/clahs.nix create mode 100644 modules/nixos/base/clahs.nix diff --git a/flake.lock b/flake.lock index fe522f54..3398a7f3 100644 --- a/flake.lock +++ b/flake.lock @@ -112,6 +112,28 @@ "type": "github" } }, + "daeuniverse": { + "inputs": { + "devshell": "devshell", + "flake-parts": "flake-parts_2", + "nix-eval-jobs": "nix-eval-jobs", + "nixpkgs": "nixpkgs_3", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1721655093, + "narHash": "sha256-IiUd700gUN8jxeD1xJv+s1v9vW/ILgw0/KfJLNFyutY=", + "owner": "daeuniverse", + "repo": "flake.nix", + "rev": "140c54a145b5e88684e5e88e36230b6cdf6aff87", + "type": "github" + }, + "original": { + "owner": "daeuniverse", + "repo": "flake.nix", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -135,6 +157,24 @@ "type": "github" } }, + "devshell": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1722113426, + "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", + "owner": "numtide", + "repo": "devshell", + "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -204,6 +244,22 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -226,6 +282,45 @@ } }, "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "daeuniverse", + "nix-eval-jobs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "lanzaboote", @@ -246,9 +341,9 @@ "type": "github" } }, - "flake-parts_3": { + "flake-parts_5": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib" + "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { "lastModified": 1722555600, @@ -319,6 +414,28 @@ } }, "gitignore": { + "inputs": { + "nixpkgs": [ + "daeuniverse", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { "inputs": { "nixpkgs": [ "lanzaboote", @@ -340,7 +457,7 @@ "type": "github" } }, - "gitignore_2": { + "gitignore_3": { "inputs": { "nixpkgs": [ "pre-commit-hooks", @@ -443,8 +560,8 @@ "lanzaboote": { "inputs": { "crane": "crane_2", - "flake-compat": "flake-compat", - "flake-parts": "flake-parts_2", + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_4", "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" @@ -470,10 +587,10 @@ "mysecrets": { "flake": false, "locked": { - "lastModified": 1723991468, - "narHash": "sha256-BnIEoreQri8BebEqo4nkO2ealoefUbfdUZGNOXz45Vs=", + "lastModified": 1723996593, + "narHash": "sha256-Od2P1R00uYFJ7SfLBHa2unKrU/vlW0qTrMrh9pkvIrk=", "ref": "refs/heads/main", - "rev": "17f15c0840bb268224b32d0cf818700341931033", + "rev": "06be8855160f85244db6b43e7ec4ca33e699a7ad", "shallow": true, "type": "git", "url": "ssh://git@github.com/QixYuanmeng/nix-secrets.git" @@ -504,10 +621,31 @@ "type": "github" } }, - "nix-gaming": { + "nix-eval-jobs": { "inputs": { "flake-parts": "flake-parts_3", - "nixpkgs": "nixpkgs", + "nix-github-actions": "nix-github-actions", + "nixpkgs": "nixpkgs_2", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1723372011, + "narHash": "sha256-zqenoufFiPfobw74idorZMG8AXG3DnFzbHplt/Nkvrg=", + "owner": "nix-community", + "repo": "nix-eval-jobs", + "rev": "8802412b8747633e9d80639897e4d58fa6290909", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-eval-jobs", + "type": "github" + } + }, + "nix-gaming": { + "inputs": { + "flake-parts": "flake-parts_5", + "nixpkgs": "nixpkgs_4", "umu": "umu" }, "locked": { @@ -524,6 +662,28 @@ "type": "github" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "daeuniverse", + "nix-eval-jobs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720066371, + "narHash": "sha256-uPlLYH2S0ACj0IcgaK9Lsf4spmJoGejR9DotXiXSBZQ=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "622f829f5fe69310a866c8a6cd07e747c44ef820", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixlib": { "locked": { "lastModified": 1722732880, @@ -578,11 +738,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1723221148, - "narHash": "sha256-7pjpeQlZUNQ4eeVntytU3jkw9dFK3k1Htgk2iuXjaD8=", + "lastModified": 1722073938, + "narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "154bcb95ad51bc257c2ce4043a725de6ca700ef6", + "rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae", "type": "github" }, "original": { @@ -620,7 +780,35 @@ "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" } }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1722555339, + "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + } + }, "nixpkgs-stable": { + "locked": { + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { "locked": { "lastModified": 1710695816, "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", @@ -636,7 +824,7 @@ "type": "github" } }, - "nixpkgs-stable_2": { + "nixpkgs-stable_3": { "locked": { "lastModified": 1723282977, "narHash": "sha256-oTK91aOlA/4IsjNAZGMEBz7Sq1zBS0Ltu4/nIQdYDOg=", @@ -652,7 +840,7 @@ "type": "github" } }, - "nixpkgs-stable_3": { + "nixpkgs-stable_4": { "locked": { "lastModified": 1720386169, "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", @@ -685,6 +873,54 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1723221148, + "narHash": "sha256-7pjpeQlZUNQ4eeVntytU3jkw9dFK3k1Htgk2iuXjaD8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "154bcb95ad51bc257c2ce4043a725de6ca700ef6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1723637854, + "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1723221148, + "narHash": "sha256-7pjpeQlZUNQ4eeVntytU3jkw9dFK3k1Htgk2iuXjaD8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "154bcb95ad51bc257c2ce4043a725de6ca700ef6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { "locked": { "lastModified": 1723175592, "narHash": "sha256-M0xJ3FbDUc4fRZ84dPGx5VvgFsOzds77KiBMW/mMTnI=", @@ -700,7 +936,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_6": { "locked": { "lastModified": 1701436327, "narHash": "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE=", @@ -714,7 +950,7 @@ "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" } }, - "nixpkgs_4": { + "nixpkgs_7": { "locked": { "lastModified": 1702921762, "narHash": "sha256-O/rP7gulApQAB47u6szEd8Pn8Biw0d84j5iuP2tcxzY=", @@ -732,7 +968,7 @@ }, "nuenv": { "inputs": { - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_6", "rust-overlay": "rust-overlay_3" }, "locked": { @@ -766,7 +1002,7 @@ }, "nur-ryan4yin": { "inputs": { - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_7" }, "locked": { "lastModified": 1717568000, @@ -800,19 +1036,20 @@ }, "pre-commit-hooks": { "inputs": { - "flake-compat": "flake-compat_2", - "gitignore": "gitignore_2", + "flake-compat": "flake-compat", + "gitignore": "gitignore", "nixpkgs": [ + "daeuniverse", "nixpkgs" ], - "nixpkgs-stable": "nixpkgs-stable_3" + "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1723202784, - "narHash": "sha256-qbhjc/NEGaDbyy0ucycubq4N3//gDFFH3DOmp1D3u1Q=", + "lastModified": 1723803910, + "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "c7012d0c18567c889b948781bc74a501e92275d1", + "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", "type": "github" }, "original": { @@ -827,12 +1064,12 @@ "lanzaboote", "flake-compat" ], - "gitignore": "gitignore", + "gitignore": "gitignore_2", "nixpkgs": [ "lanzaboote", "nixpkgs" ], - "nixpkgs-stable": "nixpkgs-stable" + "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { "lastModified": 1717664902, @@ -848,10 +1085,34 @@ "type": "github" } }, + "pre-commit-hooks_2": { + "inputs": { + "flake-compat": "flake-compat_3", + "gitignore": "gitignore_3", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_4" + }, + "locked": { + "lastModified": 1723202784, + "narHash": "sha256-qbhjc/NEGaDbyy0ucycubq4N3//gDFFH3DOmp1D3u1Q=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "c7012d0c18567c889b948781bc74a501e92275d1", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", "anyrun": "anyrun", + "daeuniverse": "daeuniverse", "disko": "disko", "doomemacs": "doomemacs", "haumea": "haumea", @@ -863,15 +1124,15 @@ "nix-gaming": "nix-gaming", "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_5", "nixpkgs-darwin": "nixpkgs-darwin", - "nixpkgs-stable": "nixpkgs-stable_2", + "nixpkgs-stable": "nixpkgs-stable_3", "nixpkgs-unstable": "nixpkgs-unstable", "nuenv": "nuenv", "nur": "nur", "nur-ryan4yin": "nur-ryan4yin", "polybar-themes": "polybar-themes", - "pre-commit-hooks": "pre-commit-hooks", + "pre-commit-hooks": "pre-commit-hooks_2", "wallpapers": "wallpapers" } }, @@ -1022,6 +1283,28 @@ "type": "github" } }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "daeuniverse", + "nix-eval-jobs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1723303070, + "narHash": "sha256-krGNVA30yptyRonohQ+i9cnK+CfCpedg6z3qzqVJcTs=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "14c092e0326de759e16b37535161b3cb9770cea3", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "umu": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index f8491e15..2584e81e 100644 --- a/flake.nix +++ b/flake.nix @@ -139,5 +139,7 @@ # inputs.nixpkgs.follows = "nixpkgs"; }; nur.url = "github:nix-community/NUR"; + + daeuniverse.url = "github:daeuniverse/flake.nix"; }; } diff --git a/home/base/core/java.nix b/home/base/core/java.nix new file mode 100644 index 00000000..617a50b6 --- /dev/null +++ b/home/base/core/java.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: + +let + additionalJDKs = with pkgs; [ jdk17 jdk8 jdk22 ]; +in +{ + # ... + programs.java = { /*...*/ }; + + home.sessionPath = [ "$HOME/.jdks" ]; + home.file = (builtins.listToAttrs (builtins.map (jdk: { + name = ".java/${jdk.version}"; + value = { source = jdk; }; + }) additionalJDKs)); +} \ No newline at end of file diff --git a/home/base/gui/dev-tools.nix b/home/base/gui/dev-tools.nix index a585ecbb..e1935c67 100644 --- a/home/base/gui/dev-tools.nix +++ b/home/base/gui/dev-tools.nix @@ -7,5 +7,6 @@ # IDEs jetbrains.pycharm-professional jetbrains.idea-ultimate + ]; } diff --git a/home/base/gui/media.nix b/home/base/gui/media.nix index aa8b2353..e91e502d 100644 --- a/home/base/gui/media.nix +++ b/home/base/gui/media.nix @@ -1,10 +1,13 @@ { pkgs, config, + pkgs-unstable, ... }: + # processing audio/video { + home.packages = with pkgs; [ ffmpeg-full @@ -12,5 +15,6 @@ viu # Terminal image viewer with native support for iTerm and Kitty imagemagick graphviz + v4l-utils ]; } diff --git a/home/linux/base/shell.nix b/home/linux/base/shell.nix index 7bab02f7..22c4a8cf 100644 --- a/home/linux/base/shell.nix +++ b/home/linux/base/shell.nix @@ -7,6 +7,7 @@ c = config.xdg.configHome; cache = config.xdg.cacheHome; in rec { + home.homeDirectory = "/home/${myvars.username}"; # environment variables that always set at login diff --git a/home/linux/gui/base/custom/default.nix b/home/linux/gui/base/custom/default.nix new file mode 100644 index 00000000..65dd2d08 --- /dev/null +++ b/home/linux/gui/base/custom/default.nix @@ -0,0 +1,4 @@ +{pkgs, pkgs-unstable, ... }: +{ + wechat-universal-bwrap = pkgs.callPackage ./wechat-universal-bwrap { }; +} \ No newline at end of file diff --git a/home/linux/gui/base/custom/wechat-universal-bwrap/default.nix b/home/linux/gui/base/custom/wechat-universal-bwrap/default.nix new file mode 100644 index 00000000..981700f3 --- /dev/null +++ b/home/linux/gui/base/custom/wechat-universal-bwrap/default.nix @@ -0,0 +1,290 @@ +{ stdenv, fetchurl +, buildFHSUserEnvBubblewrap +, writeShellScript +, makeDesktopItem +, writeShellScriptBin +, rpmextract +, makeWrapper +, autoPatchelfHook +, copyDesktopItems +, lib + +, alsa-lib +, at-spi2-atk +, at-spi2-core +, mesa +, nss +, pango +, xdg-desktop-portal +, xdg-user-dirs +, xorg +, cairo +, gtk3 +, gtk4 +, libglvnd +, libpulseaudio +, libva +, pciutils +, udev +, libxkbcommon + +}: +let + libraries = [ + alsa-lib + at-spi2-atk + at-spi2-core + mesa + nss + pango + xdg-desktop-portal + xdg-user-dirs + xorg.libXcursor + xorg.libXdamage + xorg.libXrandr + xorg.xcbutilimage + xorg.xcbutilkeysyms + xorg.xcbutilrenderutil + xorg.xcbutilwm + xorg.libXcomposite + cairo + gtk3 + gtk4 + libglvnd + libpulseaudio + libva + pciutils + udev + libxkbcommon + ]; + + _lib_uos = "libuosdevicea"; + _pkgname = "wechat-universal"; + ver = "1.0.0.242"; + xdg-dir = "${xdg-user-dirs}/bin"; + + # From https://github.com/7Ji-PKGBUILDs/wechat-universal-bwrap + # Adapted from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=wechat-universal-bwrap + wechat-universal-license = stdenv.mkDerivation { + pname = "${_pkgname}-license"; + version = "0.0.1"; + src = builtins.fetchGit { + url = "https://github.com/7Ji-PKGBUILDs/wechat-universal-bwrap.git"; + ref = "master"; + rev = "5e8ad25218b82b9bbacb0bd43dce2feb85998889"; + }; + + buildPhase = '' + echo "Building ${_lib_uos}.so stub by Zephyr Lykos..." + mv libuosdevicea.Makefile Makefile + make + ''; + installPhase = '' + mkdir -p $out + echo "Fixing licenses..." + install -dm755 $out/usr/lib/license + install -Dm755 ${_lib_uos}.so $out/lib/license/${_lib_uos}.so + echo "DISTRIB_ID=uos" | + install -Dm755 /dev/stdin $out/etc/lsb-release + ''; + }; + + wechat-universal-src = stdenv.mkDerivation rec { + + pname = "${_pkgname}-source"; + version = "${ver}"; + + src = fetchurl { + url = "https://mirrors.opencloudos.tech/opencloudos/9.2/extras/x86_64/os/Packages/wechat-beta_${version}_amd64.rpm"; + hash = "sha256-/5fXEfPHHL6G75Ph0EpoGvXD6V4BiPS0EQZM7SgZ1xk="; + }; + + nativeBuildInputs = [ + rpmextract + makeWrapper + autoPatchelfHook + ]; + buildInputs = libraries; + + unpackCmd = "rpmextract $src"; + sourceRoot = "."; + + installPhase = '' + mkdir -p $out + mv opt/wechat-beta opt/${_pkgname} + cp -r opt $out + ''; + }; + + + startScript = writeShellScript "wechat-start" '' + export QT_QPA_PLATFORM=xcb + if [[ ''${XMODIFIERS} =~ fcitx ]]; then + export QT_IM_MODULE=fcitx + export GTK_IM_MODULE=fcitx + elif [[ ''${XMODIFIERS} =~ ibus ]]; then + export QT_IM_MODULE=ibus + export GTK_IM_MODULE=ibus + export IBUS_USE_PORTAL=1 + fi + exec ${wechat-universal-src}/opt/${_pkgname}/wechat + ''; + + # Adapted from https://aur.archlinux.org/cgit/aur.git/tree/fake_dde-file-manager?h=wechat-universal-bwrap + fake-dde-file-manager = writeShellScriptBin "dde-file-manager" '' + _show_item="" + _item="" + for _arg in "''$@"; do + if [[ "''${_arg}" == --show-item ]]; then + _show_item='y' + else + [[ -z "''${_item}" ]] && _item="''${_arg}" + fi + done + if [[ "''${_show_item}" ]]; then + _path=$(readlink -f -- "''${_item}") # Resolve this to absolute path that's same across host / guest + echo "Fake deepin file manager: dbus-send to open ''${_path} in file manager" + if [[ -d "''${_path}" ]]; then + # WeChat pass both files and folders in the same way, if we use ShowItems for folders, + # it would open that folder's parent folder, which is not right. + _object=ShowFolders + _target=folders + else + _object=ShowItems + _target=items + fi + exec dbus-send --print-reply --dest=org.freedesktop.FileManager1 \ + /org/freedesktop/FileManager1 \ + org.freedesktop.FileManager1."''${_object}" \ + array:string:"file://''${_path}" \ + string:fake-dde-file-manager-show-"''${_target}" + # We should not fall to here, but add a fallback anyway + echo "Fake deepin file manager: fallback: xdg-open to show ''${_path} in file manager" + exec xdg-open "''${_path}" + else + echo "Fake deepin file manager: xdg-open with args ''$@" + exec xdg-open "''$@" + fi + ''; + fhs = buildFHSUserEnvBubblewrap { + name = "${_pkgname}"; + + targetPkgs = + pkgs: [ + fake-dde-file-manager + wechat-universal-license + wechat-universal-src + ] + ++ + libraries; + + runScript = startScript; + + extraPreBwrapCmds = '' + # Data folder setup + # If user has declared a custom data dir, no need to query xdg for documents dir, but always resolve that to absolute path + if [[ "''${WECHAT_DATA_DIR}" ]]; then + WECHAT_DATA_DIR=$(readlink -f -- "''${WECHAT_DATA_DIR}") + else + XDG_DOCUMENTS_DIR="''${XDG_DOCUMENTS_DIR:-$(${xdg-dir}/xdg-user-dir DOCUMENTS)}" + if [[ -z "''${XDG_DOCUMENTS_DIR}" ]]; then + echo 'Error: Failed to get XDG_DOCUMENTS_DIR, refuse to continue' + exit 1 + fi + WECHAT_DATA_DIR="''${XDG_DOCUMENTS_DIR}/WeChat_Data" + fi + WECHAT_FILES_DIR="''${WECHAT_DATA_DIR}/xwechat_files" + WECHAT_HOME_DIR="''${WECHAT_DATA_DIR}/home" + mkdir -p "''${WECHAT_FILES_DIR}" + mkdir -p "''${WECHAT_HOME_DIR}" + + ''; + + extraBwrapArgs = [ + "--tmpfs /home" + "--tmpfs /root" + "--bind \${WECHAT_HOME_DIR} \${HOME}" + "--bind \${WECHAT_FILES_DIR} \${WECHAT_FILES_DIR}" + "--chdir $HOME" + "--setenv QT_QPA_PLATFORM xcb" + # "--setenv QT_AUTO_SCREEN_SCALE_FACTOR 1" + + "--ro-bind-try \${HOME}/.fontconfig{,}" + "--ro-bind-try \${HOME}/.fonts{,}" + "--ro-bind-try \${HOME}/.config/fontconfig{,}" + "--ro-bind-try \${HOME}/.local/share/fonts{,}" + "--ro-bind-try \${HOME}/.icons{,}" + "--ro-bind-try \${HOME}/.local/share/.icons{,}" + ]; + + unshareUser = true; + unshareIpc = true; + unsharePid = true; + unshareNet = false; + unshareUts = true; + unshareCgroup = true; + privateTmp = true; + }; +in +stdenv.mkDerivation rec { + + pname = "${_pkgname}-bwrap"; + version = "${ver}"; + + dontUnpack = true; + + buildInputs = libraries; + + nativeBuildInputs = [ + makeWrapper + autoPatchelfHook + copyDesktopItems + ]; + + installPhase = '' + mkdir -p $out/bin + echo 'Installing icons...' + # for res in 16 32 48 64 128 256; do + # install -Dm644 \ + # ${wechat-universal-src}/opt/apps/com.tencent.wechat/entries/icons/hicolor/''${res}x''${res}/apps/com.tencent.wechat.png \ + # $out/share/icons/hicolor/''${res}x''${res}/apps/${_pkgname}.png + # done + install -DTm644 ${wechat-universal-src}/opt/${_pkgname}/icons/wechat.png $out/usr/share/icons/hicolor/256x256/apps/${_pkgname}.png + makeWrapper ${fhs}/bin/${_pkgname} $out/bin/${pname} + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + name = "${_pkgname}"; + desktopName = "WeChat Universal"; + exec = "${pname} %U"; + terminal = false; + icon = "${_pkgname}"; + startupWMClass = "wechat"; + comment = "WeChat Universal Desktop Edition"; + categories = [ "Utility" "Network" "InstantMessaging" "Chat" ]; + keywords = [ + "wechat" + "weixin" + "${_pkgname}" + ]; + extraConfig = { + "Name[zh_CN]" = "微信 Universal"; + "Name[zh_TW]" = "微信 Universal"; + "Comment[zh_CN]" = "微信桌面版 Universal"; + "Comment[zh_TW]" = "微信桌面版 Universal"; + }; + }) + ]; + + meta = with lib; { + description = '' + WeChat desktop with sandbox enabled + (Adapted from https://aur.archlinux.org/packages/wechat-universal-bwrap) + ''; + homepage = "https://weixin.qq.com/"; + platforms = [ "x86_64-linux" ]; + license = licenses.unfreeRedistributable; + }; +} \ No newline at end of file diff --git a/home/linux/gui/base/misc.nix b/home/linux/gui/base/misc.nix index 48647dd3..724dc2c6 100644 --- a/home/linux/gui/base/misc.nix +++ b/home/linux/gui/base/misc.nix @@ -4,7 +4,6 @@ nur, ... }: { - home.packages = with pkgs; [ # GUI apps # e-book viewer(.epub/.mobi/...) @@ -15,7 +14,7 @@ telegram-desktop #discord pkgs-unstable.qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq - + # pkgs-unstable.wechat-uos # remote desktop(rdp connect) remmina freerdp # required by remmina @@ -27,6 +26,8 @@ pkgs.nur.repos.linyinfeng.wemeet wpsoffice-cn + + feishu ]; # GitHub CLI tool diff --git a/home/linux/gui/hyprland/conf/hyprland.conf b/home/linux/gui/hyprland/conf/hyprland.conf index 31850158..b6bbffc8 100644 --- a/home/linux/gui/hyprland/conf/hyprland.conf +++ b/home/linux/gui/hyprland/conf/hyprland.conf @@ -196,4 +196,5 @@ exec-once=cp ~/.config/fcitx5/profile-bak ~/.config/fcitx5/profile # restore exec-once=fcitx5 -d --replace # start fcitx5 daemon bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r -monitor=eDP-1,highres,auto,1 \ No newline at end of file +monitor=eDP-1,highres,auto,1 +monitor=HDMI-A-1,1920x1080,auto-left,1 \ No newline at end of file diff --git a/home/linux/gui/hyprland/conf/waybar/config.jsonc b/home/linux/gui/hyprland/conf/waybar/config.jsonc index 1afda573..6ba80c83 100644 --- a/home/linux/gui/hyprland/conf/waybar/config.jsonc +++ b/home/linux/gui/hyprland/conf/waybar/config.jsonc @@ -160,8 +160,8 @@ "spacing": 5, }, "battery": { - "bat": "BAT0", - "adapter": "ADP0", + "bat": "BAT1", + "adapter": "ACAD", "interval": 60, "states": { "warning": 30, diff --git a/hosts/idols-ai/clahs.nix b/hosts/idols-ai/clahs.nix deleted file mode 100644 index c7c37af5..00000000 --- a/hosts/idols-ai/clahs.nix +++ /dev/null @@ -1,18 +0,0 @@ -{config,...} -: -{ - services.mihomo = { - enable = true; - tunMode = true; - configFile = config.age.secrets."config.yaml".path; - webui = pkgs.metacubexd; - }; - systemd.services.mihomo.serviceConfig.ExecStartPre = [ - "${pkgs.coreutils}/bin/ln -sf ${pkgs.v2ray-geoip}/share/v2ray/geoip.dat /var/lib/private/mihomo/GeoIP.dat" - "${pkgs.coreutils}/bin/ln -sf ${pkgs.v2ray-domain-list-community}/share/v2ray/geosite.dat /var/lib/private/mihomo/GeoSite.dat" - ]; - - networking.proxy.default = "http://127.0.0.1:7890"; - networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - networking.firewall.allowedTCPPorts = [9090]; -} \ No newline at end of file diff --git a/hosts/idols-ai/impermanence.nix b/hosts/idols-ai/impermanence.nix index fa6a305e..2af081fb 100644 --- a/hosts/idols-ai/impermanence.nix +++ b/hosts/idols-ai/impermanence.nix @@ -38,7 +38,7 @@ "/etc/secureboot" # lanzaboote - secure boot # my secrets "/etc/agenix/" - + "/etc/daed/" "/var/log" "/var/lib" @@ -65,11 +65,9 @@ "Videos" "HowNewProjects" "Projects" + + ".java" - { - directory = ".cache/JetBrains"; - mode = "0755"; - } { directory = ".gnupg"; mode = "0700"; diff --git a/lib/nixosSystem.nix b/lib/nixosSystem.nix index e521d536..2f867718 100644 --- a/lib/nixosSystem.nix +++ b/lib/nixosSystem.nix @@ -14,6 +14,15 @@ in nixpkgs.lib.nixosSystem { inherit system specialArgs; modules = + [ + inputs.daeuniverse.nixosModules.dae + inputs.daeuniverse.nixosModules.daed + { + environment.systemPackages = + with inputs.daeuniverse.packages.x86_64-linux; + [ dae daed ]; + } + ] ++ [ { nixpkgs.overlays = [ inputs.nur.overlay ]; } inputs.nur.nixosModules.nur diff --git a/modules/nixos/base/clahs.nix b/modules/nixos/base/clahs.nix new file mode 100644 index 00000000..b1c743dd --- /dev/null +++ b/modules/nixos/base/clahs.nix @@ -0,0 +1,35 @@ +{config, pkgs, inputs, ...} +: +{ + # services.mihomo = { + # enable = true; + # tunMode = true; + # configFile = config.age.secrets."config.yaml".path; + # webui = pkgs.metacubexd; + # }; + # systemd.services.mihomo.serviceConfig.ExecStartPre = [ + # "${pkgs.coreutils}/bin/ln -sf ${pkgs.v2ray-geoip}/share/v2ray/geoip.dat /var/lib/private/mihomo/GeoIP.dat" + # "${pkgs.coreutils}/bin/ln -sf ${pkgs.v2ray-domain-list-community}/share/v2ray/geosite.dat /var/lib/private/mihomo/GeoSite.dat" + # ]; + + # networking.proxy.default = "http://127.0.0.1:7890"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + # networking.firewall.allowedTCPPorts = [9090]; + services.dae = { + enable = true; + package = pkgs.dae; + configFile = config.age.secrets."config.dae".path; + disableTxChecksumIpGeneric = false; + assets = with pkgs; [ v2ray-geoip v2ray-domain-list-community ]; + }; + + services.daed = { + enable = true; + + openFirewall = { + enable = true; + port = 12345; + }; + }; + +} \ No newline at end of file diff --git a/modules/nixos/base/nix.nix b/modules/nixos/base/nix.nix index 48babe0a..70ddf186 100644 --- a/modules/nixos/base/nix.nix +++ b/modules/nixos/base/nix.nix @@ -5,7 +5,6 @@ }: { # to install chrome, you need to enable unfree packages nixpkgs.config.allowUnfree = lib.mkForce true; - # do garbage collection weekly to keep disk usage low nix.gc = { automatic = lib.mkDefault true; diff --git a/modules/nixos/desktop.nix b/modules/nixos/desktop.nix index c81783c1..8343bc32 100644 --- a/modules/nixos/desktop.nix +++ b/modules/nixos/desktop.nix @@ -3,6 +3,7 @@ config, lib, myvars, + inputs, ... }: with lib; let diff --git a/nix-secrets b/nix-secrets index 17f15c08..06be8855 160000 --- a/nix-secrets +++ b/nix-secrets @@ -1 +1 @@ -Subproject commit 17f15c0840bb268224b32d0cf818700341931033 +Subproject commit 06be8855160f85244db6b43e7ec4ca33e699a7ad diff --git a/secrets/nixos.nix b/secrets/nixos.nix index 7f3fd61b..c0407dcd 100644 --- a/secrets/nixos.nix +++ b/secrets/nixos.nix @@ -141,6 +141,13 @@ in { } // user_readable; + + "config.dae" = + { + file = "${mysecrets}/config.dae"; + } + // user_readable; + # # alias-for-work # "alias-for-work.nushell" = # {