Compare commits

...

3 commits

10 changed files with 465 additions and 121 deletions

View file

@ -4,6 +4,7 @@ keys:
- &host-raspite age1nugzw24upk8pz5lyz2z89qk8se4gpcsg3ypcs58nykncr56sevrsm8qpvj - &host-raspite age1nugzw24upk8pz5lyz2z89qk8se4gpcsg3ypcs58nykncr56sevrsm8qpvj
- &host-sgp-00 age13s6rwd3wjk2x5wkn69tdczhl3l5d7mfmlv90efsv4q67jne43qss9tcakx - &host-sgp-00 age13s6rwd3wjk2x5wkn69tdczhl3l5d7mfmlv90efsv4q67jne43qss9tcakx
- &host-tok-00 age1t5nw2jx4dw67jkf72uxcxt72j7lq3xyj35lvl09f8kala90h2g2s2a5yvj - &host-tok-00 age1t5nw2jx4dw67jkf72uxcxt72j7lq3xyj35lvl09f8kala90h2g2s2a5yvj
- &host-la-00 age1fw2sqaa5s9c8ml6ncsexkj8ar4288387ju92ytjys4awf9aw6smqqz94dh
- &host-massicot age1jle2auermhswqtehww9gqada8car5aczrx43ztzqf9wtcld0sfmqzaecta - &host-massicot age1jle2auermhswqtehww9gqada8car5aczrx43ztzqf9wtcld0sfmqzaecta
creation_rules: creation_rules:
- path_regex: machines/calcite/secrets.yaml - path_regex: machines/calcite/secrets.yaml
@ -31,6 +32,11 @@ creation_rules:
- age: - age:
- *xin - *xin
- *host-tok-00 - *host-tok-00
- path_regex: machines/dolomite/secrets/la-00.yaml
key_groups:
- age:
- *xin
- *host-la-00
- path_regex: machines/secrets.yaml - path_regex: machines/secrets.yaml
key_groups: key_groups:
- age: - age:
@ -39,6 +45,7 @@ creation_rules:
- *host-raspite - *host-raspite
- *host-sgp-00 - *host-sgp-00
- *host-tok-00 - *host-tok-00
- *host-la-00
- *host-massicot - *host-massicot
- path_regex: home/xin/secrets.yaml - path_regex: home/xin/secrets.yaml
key_groups: key_groups:

View file

@ -203,6 +203,7 @@
element-desktop element-desktop
tdesktop tdesktop
qq qq
wechat-uos
# Password manager # Password manager
bitwarden bitwarden

View file

@ -0,0 +1,38 @@
{ config, lib, pkgs, modulesPath, ... }:
let
cfg = config.isBandwagon;
in
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
options = {
isBandwagon = lib.mkEnableOption "Bandwagon instance";
};
config = lib.mkIf cfg.isBandwagon {
boot.initrd.availableKernelModules = [ "ata_piix" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "xfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
};
swapDevices = [ ];
boot.loader.grub.enable = lib.mkForce true;
boot.loader.grub.version = lib.mkForce 2;
boot.loader.grub.device = lib.mkForce "/dev/sda";
networking.useDHCP = false;
networking.interfaces.ens18.useDHCP = true;
networking.interfaces.ens19.useDHCP = true;
};
}

View file

@ -1,12 +1,19 @@
{ inputs, config, pkgs, lib, modulesPath, ... }: { inputs, config, pkgs, lib, modulesPath, ... }:
let
awsHosts = [ "sgp-00" "tok-00 "];
bwgHosts = [ "la-00" ];
in
{ {
imports = [ imports = [
../sops.nix ../sops.nix
"${modulesPath}/virtualisation/amazon-image.nix" ./bandwagon.nix
./lightsail.nix
]; ];
config = { config = {
isBandwagon = builtins.elem config.networking.hostName bwgHosts;
isLightsail = builtins.elem config.networking.hostName awsHosts;
sops = { sops = {
secrets = { secrets = {
wg_private_key = { wg_private_key = {
@ -19,7 +26,6 @@
}; };
}; };
}; };
boot.loader.grub.device = lib.mkForce "/dev/nvme0n1";
boot.kernel.sysctl = { boot.kernel.sysctl = {
"net.core.default_qdisc" = "fq"; "net.core.default_qdisc" = "fq";
"net.ipv4.tcp_congestion_control" = "bbr"; "net.ipv4.tcp_congestion_control" = "bbr";
@ -39,9 +45,9 @@
custom.prometheus = { custom.prometheus = {
enable = false; enable = false;
exporters.enable = true; exporters.enable = false;
grafana = { grafana = {
enable = true; enable = false;
password_file = config.sops.secrets.grafana_cloud_api.path; password_file = config.sops.secrets.grafana_cloud_api.path;
}; };
}; };

View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, modulesPath, ... }:
let
cfg = config.isLightsail;
in
{
imports = [ "${modulesPath}/virtualisation/amazon-image.nix" ];
options = {
isLightsail = lib.mkEnableOption "Lightsail instance";
};
config = lib.mkIf cfg.isLightsail{
boot.loader.grub.device = lib.mkForce "/dev/nvme0n1";
};
}

View file

@ -0,0 +1,31 @@
wg_private_key: ENC[AES256_GCM,data:jz/03kP/dj625Jweu0MEw9aGm3Z3M1f43cZqGy2eElCIDhD78n+zZAqOM8c=,iv:fZxuvZLx97YyDoafQXbqVYjqRYzZq90PJiri9vdjwro=,tag:0A9sGnSl3y3gpEuvsdRtGg==,type:str]
wg_ipv6_local_addr: ENC[AES256_GCM,data:W/uR+9kAKdXViAbZ0vEhC2eNwlzqX0x+LpzLrLCmQuVgRbZAtJCqfeE=,iv:pMZumU7fMV5MYX59hO7SEMLlG4m8DdPXeAiNgLxNzZk=,tag:xdGBpOBdWlc8Q9BDMv04sA==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1uw059wcwfvd9xuj0hpqzqpeg7qemecspjrsatg37wc7rs2pumfdsgken0c
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB4WjRVY3BKdVU1WERrVzla
L1NNYWp2SFZEaW84b0h1clFGRHVmRDhnM3o0CkUrZjZKNHp2TGtrTXpyOHNVckJw
VURjOEVaR3VQU1pJY2NaOFBQRjVIdWcKLS0tIFBQRWRnNnk4aWxsQVhhdUdVWWpy
aG9Oa3lOY0JjY2tFU3ZTazcyZW5SM0kKRfTrM65aI5LMOHoGsls3PWChrY5pEz91
EERpRd552+PxYBKvumI59mtdlD263d5kmlTxIIZXTOJ2fcl1bii2bg==
-----END AGE ENCRYPTED FILE-----
- recipient: age1fw2sqaa5s9c8ml6ncsexkj8ar4288387ju92ytjys4awf9aw6smqqz94dh
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBTdzk4ajV5ekNpZXNGTHdD
aVBLZDlSbzE1aG5LT0cvVVVlVDBNOWtackNVCjVnZDhYZmFoT21DZHNYT2pMVDF6
ZW5UY1ZFRFdtbDdPZHZIWUVuWjhJMk0KLS0tIGR4UUYwcjJtZUFYYlJSS2d6Q3hZ
WVJYSWhOaTEvNUdYTXV6OThPenJaY0UKv3WK6gacUxO6PFklkW+jDMG5FgIUuEvN
RvvI9ZXRD4QwKW1mpVrxbC+fRqlKawyyyyikvHFGJvpts4/88IcgUQ==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-04-15T11:37:57Z"
mac: ENC[AES256_GCM,data:iCgvJMijsUjdBT9hMQx4owYkbp2nV1jORB5HGtz5IPHgI9A5FXAAPFtaSGgQSI3twSkYMU94NULjumCyyWt3syH5KK9itHgHwONyVFieyXLiWozqpN2Z0SA5G4SnK3E6X273br9gwNAj33I2MdS/3K8b4EOO2yEzilWmrW7f3rk=,iv:UD7uHrtq4O6+EsWFrjegTXHtQUFcnhKsu4J0e0srDtk=,tag:b0eJEeUJPwi4+rDPeBY7oA==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1

View file

@ -3,62 +3,139 @@ with lib;
let let
cfg = config.custom-hm.vscode; cfg = config.custom-hm.vscode;
packages = {
nixPackages = {
systemPackages = with pkgs; [ nixd nixpkgs-fmt ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
jnoortheen.nix-ide
];
settings = {
"nix.enableLanguageServer" = true;
"nix.formatterPath" = "nixpkgs-fmt";
"nix.serverPath" = "nixd";
};
};
cxxPackages = {
systemPackages = with pkgs; [ clang-tools ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
llvm-vs-code-extensions.vscode-clangd
(ms-vscode.cmake-tools.overrideAttrs (_: { sourceRoot = "extension"; }))
twxs.cmake
];
settings = {
"cmake.configureOnEdit" = false;
"cmake.showOptionsMovedNotification" = false;
"cmake.showNotAllDocumentsSavedQuestion" = false;
};
};
pythonPackages = {
systemPackages = with pkgs; [ ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
ms-python.python
];
settings = { };
};
scalaPackages = {
systemPackages = with pkgs; [ ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
scala-lang.scala
scalameta.metals
];
settings = { };
};
latexPackages = {
systemPackages = with pkgs; [ texliveSmall ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
james-yu.latex-workshop
];
settings = {
"latex-workshop.latex.autoBuild.run" = "never";
"latex-workshop.latex.tools" = [
{ "name" = "xelatex";
"command" = "xelatex";
"args" = [ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "-pdf" "%DOCFILE%" ];
}
{ "name" = "pdflatex";
"command" = "pdflatex";
"args" = [ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "%DOCFILE%" ];
}
{ "name" = "bibtex"; "command" = "bibtex"; "args" = [ "%DOCFILE%" ]; }
];
"latex-workshop.latex.recipes" = [
{ "name" = "xelatex"; "tools" = [ "xelatex" ]; }
{ "name" = "pdflatex"; "tools" = [ "pdflatex" ]; }
{ "name" = "xe->bib->xe->xe"; "tools" = [ "xelatex" "bibtex" "xelatex" "xelatex" ]; }
{ "name" = "pdf->bib->pdf->pdf"; "tools" = [ "pdflatex" "bibtex" "pdflatex" "pdflatex" ]; }
];
"[latex]" = {
"editor.formatOnPaste" = false;
"editor.suggestSelection" = "recentlyusedbyprefix";
"editor.wordWrap" = "bounded";
"editor.wordWrapColumn" = 80;
"editor.unicodeHighlight.ambiguousCharacters" = false;
};
};
};
};
languages = [ "nix" "cxx" "python" "scala" "latex" ];
zipAttrsWithLanguageOption = (attr:
(map (l: (lib.mkIf cfg.languages.${l} packages."${l}Packages".${attr})) languages)
);
in in
{ {
options.custom-hm.vscode = { options.custom-hm.vscode = {
enable = mkEnableOption "Vscode config"; enable = mkEnableOption "Vscode config";
languages = {
nix = mkOption {
type = lib.types.bool;
default = true;
};
cxx = mkEnableOption "C++";
python = mkEnableOption "Python";
scala = mkEnableOption "Scala";
latex = mkEnableOption "Latex";
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = lib.mkMerge ([
pkgs.wl-clipboard-x11 [ pkgs.clang-tools ]
]; ] ++ zipAttrsWithLanguageOption "systemPackages");
programs.vscode = { programs.vscode = {
enable = true; enable = true;
enableUpdateCheck = false; enableUpdateCheck = false;
enableExtensionUpdateCheck = false; enableExtensionUpdateCheck = false;
mutableExtensionsDir = false; mutableExtensionsDir = false;
extensions = (with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [ extensions = lib.mkMerge ([
mkhl.direnv (with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
mkhl.direnv
bbenoist.nix ms-azuretools.vscode-docker
ms-azuretools.vscode-docker ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh vscodevim.vim
vscodevim.vim github.vscode-pull-request-github
github.vscode-pull-request-github gruntfuggly.todo-tree # todo highlight
gruntfuggly.todo-tree # todo highlight
# Language support # Markdown
# Python davidanson.vscode-markdownlint
ms-python.python # Latex
# Markdown # Scale / chisel
davidanson.vscode-markdownlint sterben.fpga-support
# C/C++
llvm-vs-code-extensions.vscode-clangd
# Nix
jnoortheen.nix-ide
# Latex
james-yu.latex-workshop
# Vue
vue.volar
# Scale / chisel
scala-lang.scala
scalameta.metals
(ms-vscode.cmake-tools.overrideAttrs (_: { sourceRoot = "extension"; })) ms-vscode-remote.remote-ssh-edit
twxs.cmake mushan.vscode-paste-image
])
sterben.fpga-support (with pkgs.vscode-extensions; [
waderyan.gitblame
ms-vscode-remote.remote-ssh-edit catppuccin.catppuccin-vsc
mushan.vscode-paste-image # Rust
]) ++ (with pkgs.vscode-extensions; [ rust-lang.rust-analyzer
waderyan.gitblame # ]) ++ ;
catppuccin.catppuccin-vsc ])
# Rust ] ++ zipAttrsWithLanguageOption "extension");
rust-lang.rust-analyzer userSettings = lib.mkMerge ([
]); {"workbench.colorTheme" = "Catppuccin Macchiato";
userSettings = {
"workbench.colorTheme" = "Catppuccin Macchiato";
"terminal.integrated.sendKeybindingsToShell" = true; "terminal.integrated.sendKeybindingsToShell" = true;
"extensions.ignoreRecommendations" = true; "extensions.ignoreRecommendations" = true;
"files.autoSave" = "afterDelay"; "files.autoSave" = "afterDelay";
@ -70,80 +147,10 @@ in
"git.autofetch" = false; "git.autofetch" = false;
"window.zoomLevel" = -1; "window.zoomLevel" = -1;
"nix.enableLanguageServer" = true; "extensions.experimental.affinity" = {
"vscodevim.vim" = 1;
"latex-workshop.latex.autoBuild.run" = "never";
"latex-workshop.latex.tools" = [
{
"name" = "xelatex";
"command" = "xelatex";
"args" = [
"-synctex=1"
"-interaction=nonstopmode"
"-file-line-error"
"-pdf"
"%DOCFILE%"
];
}
{
"name" = "pdflatex";
"command" = "pdflatex";
"args" = [
"-synctex=1"
"-interaction=nonstopmode"
"-file-line-error"
"%DOCFILE%"
];
}
{
"name" = "bibtex";
"command" = "bibtex";
"args" = [
"%DOCFILE%"
];
}
];
"latex-workshop.latex.recipes" = [
{
"name" = "xelatex";
"tools" = [
"xelatex"
];
}
{
"name" = "pdflatex";
"tools" = [
"pdflatex"
];
}
{
"name" = "xe->bib->xe->xe";
"tools" = [
"xelatex"
"bibtex"
"xelatex"
"xelatex"
];
}
{
"name" = "pdf->bib->pdf->pdf";
"tools" = [
"pdflatex"
"bibtex"
"pdflatex"
"pdflatex"
];
}
];
"[latex]" = {
"editor.formatOnPaste" = false;
"editor.suggestSelection" = "recentlyusedbyprefix";
"editor.wordWrap" = "bounded";
"editor.wordWrapColumn" = 80;
"editor.unicodeHighlight.ambiguousCharacters" = false;
}; };
"cmake.configureOnEdit" = false; }] ++ zipAttrsWithLanguageOption "settings");
};
}; };
}; };
} }

View file

@ -40,6 +40,8 @@
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
]; ];
accept-flake-config = "true";
log-lines = "300";
trusted-public-keys = [ trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="

View file

@ -3,8 +3,8 @@
{ {
nixpkgs.overlays = [ nixpkgs.overlays = [
(self: super: { (self: super: {
ssh-tpm-agent = ssh-tpm-agent = pkgs.callPackage ./pkgs/ssh-tpm-agent.nix { };
pkgs.callPackage ./pkgs/ssh-tpm-agent.nix { }; wechat-uos = pkgs.callPackage ./pkgs/wechat-uos.nix { };
}) })
]; ];
} }

View file

@ -0,0 +1,239 @@
{ stdenvNoCC
, stdenv
, lib
, fetchurl
, requireFile
, dpkg
, nss
, nspr
, xorg
, pango
, zlib
, atkmm
, libdrm
, libxkbcommon
, xcbutilwm
, xcbutilimage
, xcbutilkeysyms
, xcbutilrenderutil
, mesa
, alsa-lib
, wayland
, openssl_1_1
, atk
, qt6
, at-spi2-atk
, at-spi2-core
, dbus
, cups
, gtk3
, libxml2
, cairo
, freetype
, fontconfig
, vulkan-loader
, gdk-pixbuf
, libexif
, ffmpeg
, pulseaudio
, systemd
, libuuid
, expat
, bzip2
, glib
, libva
, libGL
, libnotify
, buildFHSEnv
, writeShellScript
, /**
License for wechat-uos, packed in a gz archive named "license.tar.gz".
It should have the following files:
license.tar.gz
etc
lsb-release
os-release
var
lib
uos-license
.license.json
uos
.license.key
*/
uosLicense ? requireFile {
name = "license.tar.gz";
url = "https://www.uniontech.com";
sha256 = "53760079c1a5b58f2fa3d5effe1ed35239590b288841d812229ef4e55b2dbd69";
}
}:
let
wechat-uos-env = stdenvNoCC.mkDerivation {
meta.priority = 1;
name = "wechat-uos-env";
buildCommand = ''
mkdir -p $out/etc
mkdir -p $out/lib/license
mkdir -p $out/usr/bin
mkdir -p $out/usr/share
mkdir -p $out/opt
mkdir -p $out/var
ln -s ${wechat}/opt/* $out/opt/
ln -s ${wechat}/usr/lib/wechat-uos/license/etc/os-release $out/etc/os-release
ln -s ${wechat}/usr/lib/wechat-uos/license/etc/lsb-release $out/etc/lsb-release
ln -s ${wechat}/usr/lib/wechat-uos/license/var/* $out/var/
ln -s ${wechat}/usr/lib/wechat-uos/license/libuosdevicea.so $out/lib/license/
'';
preferLocalBuild = true;
};
wechat-uos-runtime = with xorg; [
stdenv.cc.cc
stdenv.cc.libc
pango
zlib
xcbutilwm
xcbutilimage
xcbutilkeysyms
xcbutilrenderutil
libX11
libXt
libXext
libSM
libICE
libxcb
libxkbcommon
libxshmfence
libXi
libXft
libXcursor
libXfixes
libXScrnSaver
libXcomposite
libXdamage
libXtst
libXrandr
libnotify
atk
atkmm
cairo
at-spi2-atk
at-spi2-core
alsa-lib
dbus
cups
gtk3
gdk-pixbuf
libexif
ffmpeg
libva
freetype
fontconfig
libXrender
libuuid
expat
glib
nss
nspr
libGL
libxml2
pango
libdrm
mesa
vulkan-loader
systemd
wayland
pulseaudio
qt6.qt5compat
openssl_1_1
bzip2
];
wechat = stdenvNoCC.mkDerivation
rec {
pname = "wechat-uos";
version = "1.0.0.238";
src = {
x86_64-linux = fetchurl {
url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_${version}_amd64.deb";
hash = "sha256-NxAmZ526JaAzAjtAd9xScFnZBuwD6i2wX2/AEqtAyWs=";
};
aarch64-linux = fetchurl {
url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_${version}_arm64.deb";
hash = "sha256-3ru6KyBYXiuAlZuWhyyvtQCWbOJhGYzker3FS0788RE=";
};
loongarch64-linux = fetchurl {
url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_${version}_loongarch64.deb";
hash = "sha256-iuJeLMKD6v8J8iKw3+cyODN7PZQrLpi9p0//mkI0ujE=";
};
}.${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported.");
# Don't blame about this. WeChat requires some binary from here to work properly
uosSrc = {
x86_64-linux = fetchurl {
url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.weixin/com.tencent.weixin_2.1.5_amd64.deb";
hash = "sha256-vVN7w+oPXNTMJ/g1Rpw/AVLIytMXI+gLieNuddyyIYE=";
};
aarch64-linux = fetchurl {
url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.weixin/com.tencent.weixin_2.1.5_arm64.deb";
hash = "sha256-XvGFPYJlsYPqRyDycrBGzQdXn/5Da1AJP5LgRVY1pzI=";
};
loongarch64-linux = fetchurl {
url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.weixin/com.tencent.weixin_2.1.5_loongarch64.deb";
hash = "sha256-oa6rLE6QXMCPlbebto9Tv7xT3fFqYIlXL6WHpB2U35s=";
};
}.${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported.");
inherit uosLicense;
nativeBuildInputs = [ dpkg ];
unpackPhase = ''
runHook preUnpack
dpkg -x $src ./wechat-uos
dpkg -x $uosSrc ./wechat-uos-old-source
tar -xvf $uosLicense
runHook postUnpack
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r wechat-uos/* $out
mkdir -pv $out/usr/lib/wechat-uos/license
cp -r license/* $out/usr/lib/wechat-uos/license
cp -r wechat-uos-old-source/usr/lib/license/libuosdevicea.so $out/usr/lib/wechat-uos/license/
runHook postInstall
'';
meta = with lib; {
description = "Messaging app";
homepage = "https://weixin.qq.com/";
license = licenses.unfree;
platforms = [ "x86_64-linux" "aarch64-linux" "loongarch64-linux" ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; [ pokon548 ];
mainProgram = "wechat-uos";
};
};
in
buildFHSEnv {
inherit (wechat) name meta;
runScript = writeShellScript "wechat-uos-launcher" ''
export QT_QPA_PLATFORM=xcb
export LD_LIBRARY_PATH=${lib.makeLibraryPath wechat-uos-runtime}
${wechat.outPath}/opt/apps/com.tencent.wechat/files/wechat
'';
extraInstallCommands = ''
mkdir -p $out/share/applications
mkdir -p $out/share/icons
cp -r ${wechat.outPath}/opt/apps/com.tencent.wechat/entries/applications/com.tencent.wechat.desktop $out/share/applications
cp -r ${wechat.outPath}/opt/apps/com.tencent.wechat/entries/icons/* $out/share/icons/
mv $out/bin/$name $out/bin/wechat-uos
substituteInPlace $out/share/applications/com.tencent.wechat.desktop \
--replace-quiet 'Exec=/usr/bin/wechat' "Exec=$out/bin/wechat-uos --"
'';
targetPkgs = pkgs: [ wechat-uos-env ];
extraOutputsToInstall = [ "usr" "var/lib/uos" "var/uos" "etc" ];
}