Compare commits

...

94 Commits

Author SHA1 Message Date
chn
71f0a9ab87 暂存 2024-08-22 09:59:14 +08:00
chn
0763319f0d devices.xmupc1: add tunnel guide 2024-08-21 20:04:40 +08:00
chn
c7f7a46c2d users.zqq: add ssh key 2024-08-21 19:09:24 +08:00
chn
49f5c72e90 Revert "devices.vps6: add forward to xmupc1 and xmupc2"
This reverts commit ffbdad9cd7.
2024-08-21 19:03:04 +08:00
chn
ffbdad9cd7 devices.vps6: add forward to xmupc1 and xmupc2 2024-08-21 18:31:59 +08:00
chn
a682c67fac users.zqq: init 2024-08-21 17:57:07 +08:00
chn
a618d4c1e7 Revert "devices.xmupc2: add archive directories"
This reverts commit 9429674b54.
2024-08-21 17:53:33 +08:00
chn
dff42c3ab7 update misskey 2024-08-21 10:38:36 +08:00
chn
aade294318 services.writefreely: init 2024-08-21 10:19:15 +08:00
chn
56dce415c3 devices.pc: change busId 2024-08-20 18:07:42 +08:00
chn
26896b20e0 devices.nas: fix 2024-08-20 15:35:33 +08:00
chn
b5019a144e hardware.gpu: fix 2024-08-20 12:03:54 +08:00
chn
73dec27855 services.nextcloud: fix 2024-08-19 21:25:43 +08:00
chn
6168d570aa hardware.gpu: add gpu tools 2024-08-19 20:08:11 +08:00
chn
39beeb7519 devices.surface: install 2024-08-19 14:40:48 +08:00
chn
652126a6f0 Revert "services.wireguard: 整理"
This reverts commit 06dde69ced.
2024-08-19 09:39:48 +08:00
chn
06dde69ced services.wireguard: 整理 2024-08-19 09:39:34 +08:00
chn
e7e5bb9ba4 packages.biu: fix eigen 2024-08-18 23:34:51 +08:00
chn
3a11512c53 devices.pc: add windows boot entry 2024-08-18 12:56:49 +08:00
chn
3003f79c22 devices.surface: disable vasp 2024-08-18 12:26:00 +08:00
chn
cd5f61f5cc devices.pc: add zen specialisation 2024-08-17 23:37:40 +08:00
chn
869e993cc2 fix libreoffice 2024-08-17 22:52:55 +08:00
chn
18a1fa529c devices.pc: add generic specialisation 2024-08-17 22:36:31 +08:00
chn
b6b3d106c2 fix kernel bug 2024-08-17 17:57:33 +08:00
chn
d65b5a2768 devices.pc: nvidia switch to production 2024-08-17 16:33:32 +08:00
chn
37b9df52a5 Revert "devices.pc: remove cachyos configuration"
This reverts commit fa4aec5641.
2024-08-17 15:02:45 +08:00
chn
933bf44edc hardware.cpus: remove iommu workaround 2024-08-17 14:39:25 +08:00
chn
e5ae5a3980 Revert "devices.pc: kernel add lantian patch"
This reverts commit 57aeb9a12e.
2024-08-17 14:39:00 +08:00
chn
57aeb9a12e devices.pc: kernel add lantian patch 2024-08-17 13:56:27 +08:00
chn
7edb72b51f fix grub 2024-08-17 12:50:14 +08:00
chn
44eb056f49 fix grub 2024-08-17 12:14:02 +08:00
chn
e408f9c488 system.kernel: add amdgpu patch 2024-08-17 10:38:21 +08:00
chn
ffdd9e63c5 system.catppuccin: disable grub theme 2024-08-17 10:32:51 +08:00
chn
38f600277c Revert "devices: remove surface, add steamdeck"
This reverts commit fba6519bc6.
2024-08-17 08:30:40 +08:00
chn
a293326f9d hardware.gpu: fix nvidia hibernation 2024-08-17 08:07:09 +08:00
chn
afe2f17526 packages.desktop: fix powerdevil settings 2024-08-17 07:37:59 +08:00
chn
9d4c89cf17 fix build 2024-08-16 17:17:12 +08:00
chn
13184ce627 packages.git-lfs-transfer: fix 2024-08-16 08:10:26 +08:00
chn
513ca90a80 update everything 2024-08-15 12:23:07 +08:00
chn
296487607b hardware.gpu: do not use open driver explicitly 2024-08-15 12:11:02 +08:00
chn
fa4aec5641 devices.pc: remove cachyos configuration 2024-08-15 12:02:18 +08:00
chn
cdb6b37080 flake: fix 2024-08-14 09:59:31 +08:00
chn
39af3963a5 packages.nvhpc: update 2024-08-14 09:56:00 +08:00
chn
8918a99d2c packages.steam: add openssl_1_1 2024-08-14 09:06:29 +08:00
chn
a6ebc8e7cb system: enable all locales 2024-08-13 23:50:16 +08:00
chn
13e5485863 packages.biu: add Eigen serialization 2024-08-13 23:44:54 +08:00
chn
c03d217f73 packages.ufo: fix 2024-08-11 18:01:46 +08:00
chn
536de32207 packages.server: add ffsend 2024-08-07 23:27:04 +08:00
chn
31ac9ee496 devices.vps7: switch to xanmod 2024-08-07 19:15:51 +08:00
chn
45812e5bc9 Revert "system.gui: remove KWIN_DRM_DISABLE_TRIPLE_BUFFERING"
This reverts commit 91a88141ad.
2024-08-05 15:01:09 +08:00
chn
91a88141ad system.gui: remove KWIN_DRM_DISABLE_TRIPLE_BUFFERING 2024-08-05 11:11:06 +08:00
chn
f97e9325fa hardware.steamdeck: fix bios update 2024-08-04 23:12:37 +08:00
chn
d6928c035f setvices.vaultwarden: fix 2024-08-04 15:38:08 +08:00
chn
7bc00c77a3 system: disable binfmt envfs nix-ld by default 2024-08-04 14:43:14 +08:00
chn
3e50d2b57b packages.steam: fix 2024-08-04 14:43:06 +08:00
chn
137f83ed38 packages.steam: add proton-ge 2024-08-04 09:47:28 +08:00
chn
97f6eed32c update misskey 2024-08-03 23:14:07 +08:00
chn
db8d826825 整理 packages 2024-08-03 17:52:26 +08:00
chn
0187a236bb devices.nas: remove root1 root2 2024-08-03 16:35:43 +08:00
chn
51b9ca5023 packages: add sleepy-launcher 2024-08-02 19:52:42 +08:00
chn
b46932524c hardware.steamdeck: use prerelease decky-loader 2024-08-02 17:54:57 +08:00
chn
41b2c08f48 system: disable ipfs for now 2024-08-02 17:18:08 +08:00
chn
d6de265cbb packages: move some packages to desktop-extra 2024-08-02 09:18:56 +08:00
chn
d1331c6b0c devices.steamdeck: fix aagl 2024-08-01 23:48:44 +08:00
chn
dc7e408200 packages.plasma: disable auto-suspend 2024-08-01 19:53:24 +08:00
chn
88e21a4d99 packages: move aagl to desktop-extra 2024-08-01 19:40:23 +08:00
chn
47ebaec698 fix steam cjk font 2024-08-01 19:39:12 +08:00
chn
ae61dfb1d9 hardware.steamdeck: enable touch screen support 2024-08-01 19:31:27 +08:00
chn
f5bf3bff8f devices.steamdeck: install 2024-08-01 11:29:10 +08:00
chn
699c76ccc4 packages.hpcstat: update doc 2024-08-01 01:27:22 +08:00
chn
4bde656017 system.initrd: add unl0kr support 2024-08-01 00:37:37 +08:00
chn
570befc1f5 move local/pkgs -> packages 2024-08-01 00:25:23 +08:00
chn
aa70bbe0e4 move local/lib -> lib.nix 2024-08-01 00:21:18 +08:00
chn
bb5d5229a5 system.nixpkgs: fix 2024-07-31 12:55:06 +08:00
chn
12e6b1e42e system.nixpkgs: fix 2024-07-31 10:55:51 +08:00
chn
aca32969c1 devices.nas: remove gui 2024-07-31 10:44:21 +08:00
chn
7a468bc611 fix some warnings 2024-07-31 08:59:06 +08:00
chn
113b5468d1 fix steamdeck support 2024-07-31 08:36:29 +08:00
chn
2e42bbabf2 fix steamdeck 2024-07-30 23:29:25 +08:00
chn
4fe4a96807 update nixpkgs 2024-07-30 23:08:37 +08:00
chn
fba6519bc6 devices: remove surface, add steamdeck 2024-07-30 23:05:48 +08:00
chn
5348faf83b localPackages.vasp.hdf5-nvhpc: fix 2024-07-30 16:21:05 +08:00
chn
76b5c5dd16 localPackages.mumax: fix 2024-07-30 08:46:26 +08:00
chn
21f3e095e6 packages.desktop-extra: fix 2024-07-30 08:28:56 +08:00
chn
9185cf65cb system.kernel: fix 2024-07-30 08:28:52 +08:00
chn
6e16e52064 services.snapper: fix 2024-07-29 22:49:27 +08:00
chn
245e4897c6 packages.workstation: fix 2024-07-29 22:43:13 +08:00
chn
7c53d4c351 services.ollama: fix 2024-07-29 22:05:11 +08:00
chn
167ed596d8 hardware.sound: fix 2024-07-29 14:43:59 +08:00
chn
c5a318a918 update everything 2024-07-29 13:36:18 +08:00
chn
5ca6cc05f3 devices.pc: add advanced uefi settings 2024-07-25 22:54:41 +08:00
chn
247c1d945a packages.ssh: fix surface 2024-07-25 22:34:56 +08:00
chn
2d45e5c9f5 packages.desktop-extra: add onedrive 2024-07-25 21:45:00 +08:00
chn
2df2bfd0cf packages.server: add libva-utils 2024-07-25 21:44:01 +08:00
248 changed files with 1935 additions and 1061 deletions

1
.gitattributes vendored
View File

@@ -2,3 +2,4 @@
*.icm filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.efi filter=lfs diff=lfs merge=lfs -text

View File

@@ -10,12 +10,11 @@ inputs:
{
mount =
{
vfat."/dev/disk/by-uuid/13BC-F0C9" = "/boot/efi";
vfat."/dev/disk/by-uuid/627D-1FAA" = "/boot";
btrfs =
{
"/dev/disk/by-uuid/0e184f3b-af6c-4f5d-926a-2559f2dc3063"."/boot" = "/boot";
"/dev/mapper/nix"."/nix" = "/nix";
"/dev/mapper/root1" =
"/dev/mapper/root3" =
{
"/nix/rootfs" = "/nix/rootfs";
"/nix/persistent" = "/nix/persistent";
@@ -30,8 +29,6 @@ inputs:
enable = true;
devices =
{
"/dev/disk/by-uuid/5cf1d19d-b4a5-4e67-8e10-f63f0d5bb649".mapper = "root1";
"/dev/disk/by-uuid/aa684baf-fd8a-459c-99ba-11eb7636cb0d".mapper = "root2";
"/dev/disk/by-uuid/a47f06e1-dc90-40a4-89ea-7c74226a5449".mapper = "root3";
"/dev/disk/by-uuid/b3408fb5-68de-405b-9587-5e6fbd459ea2".mapper = "root4";
"/dev/disk/by-uuid/a779198f-cce9-4c3d-a64a-9ec45f6f5495" = { mapper = "nix"; ssd = true; };
@@ -39,14 +36,12 @@ inputs:
delayedMount = [ "/" "/nix" ];
};
swap = [ "/nix/swap/swap" ];
rollingRootfs.waitDevices = [ "/dev/mapper/root2" "/dev/mapper/root3" "/dev/mapper/root4" ];
rollingRootfs.waitDevices = [ "/dev/mapper/root4" ];
};
initrd.sshd.enable = true;
grub.installDevice = "efi";
nixpkgs.march = "silvermont";
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
networking = { hostname = "nas"; networkd = {}; };
gui = { enable = true; preferred = false; };
};
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
services =
@@ -67,18 +62,7 @@ inputs:
publicKey = "xCYRbZEaGloMk7Awr00UR3JcDJy4AzVp4QvGNoyEgFY=";
wireguardIp = "192.168.83.4";
};
xrdp = { enable = true; hostname = [ "nas.chn.moe" ]; };
firewall.trustedInterfaces = [ "virbr0" ];
};
packages.packageSet = "desktop-extra";
virtualization = { docker.enable = true; kvmHost = { enable = true; gui = true; }; };
};
networking.nat =
{
enable = true;
internalInterfaces = [ "enp3s0" ];
externalInterface = "virbr0";
forwardPorts = [{ sourcePort = 515; proto = "tcp"; destination = "192.168.122.166:515"; }];
};
};
}

BIN
devices/pc/bios/Bootx64.efi LFS Normal file

Binary file not shown.

BIN
devices/pc/bios/DisplayEngine.efi LFS Normal file

Binary file not shown.

BIN
devices/pc/bios/SetupBrowser.efi LFS Normal file

Binary file not shown.

BIN
devices/pc/bios/UiApp.efi LFS Normal file

Binary file not shown.

View File

@@ -10,12 +10,8 @@ inputs:
{
mount =
{
vfat."/dev/disk/by-uuid/E58F-416A" = "/boot/efi";
btrfs =
{
"/dev/disk/by-uuid/066be4fd-8617-4fe1-9654-c133c2996d33"."/" = "/boot";
"/dev/mapper/root1" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
vfat."/dev/disk/by-uuid/7A60-4232" = "/boot";
btrfs."/dev/mapper/root1" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
decrypt.auto =
{
@@ -27,12 +23,7 @@ inputs:
resume = "/dev/mapper/swap";
rollingRootfs = {};
};
grub =
{
# TODO: install windows
# windowsEntries = { "7317-1DB6" = "Windows"; "7321-FA9C" = "Windows for malware"; };
installDevice = "efi";
};
grub.windowsEntries."7AF0-D2F2" = "Windows";
nix =
{
marches =
@@ -58,7 +49,7 @@ inputs:
kernel =
{
variant = "xanmod-latest";
patches = [ "cjktty" "hibernate-progress" ];
patches = [ "hibernate-progress" "amdgpu" ];
modules.modprobeConfig =
[ "options iwlwifi power_save=0" "options iwlmvm power_scheme=1" "options iwlwifi uapsd_disable=1" ];
};
@@ -72,11 +63,10 @@ inputs:
gpu =
{
type = "amd+nvidia";
nvidia = { prime.busId = { amd = "6:0:0"; nvidia = "1:0:0"; }; dynamicBoost = true; driver = "beta"; };
nvidia = { prime.busId = { amd = "5:0:0"; nvidia = "1:0:0"; }; dynamicBoost = true; driver = "latest"; };
};
legion = {};
};
packages.packageSet = "workstation";
virtualization =
{
waydroid.enable = true;
@@ -149,11 +139,28 @@ inputs:
};
bugs = [ "xmunet" "backlight" "amdpstate" ];
};
boot.kernelParams =
[
"acpi_osi=!" ''acpi_osi="Windows 2015"''
"amdgpu.sg_display=0" # 混合模式下避免外接屏幕闪烁,和内置外接屏幕延迟
];
boot =
{
kernelParams = [ "acpi_osi=!" ''acpi_osi="Windows 2015"'' ];
loader.grub =
{
extraFiles =
{
"DisplayEngine.efi" = ./bios/DisplayEngine.efi;
"SetupBrowser.efi" = ./bios/SetupBrowser.efi;
"UiApp.efi" = ./bios/UiApp.efi;
"EFI/Boot/Bootx64.efi" = ./bios/Bootx64.efi;
};
extraEntries =
''
menuentry 'Advanced UEFI Firmware Settings' {
insmod fat
insmod chain
chainloader @bootRoot@/EFI/Boot/Bootx64.efi
}
'';
};
};
# 禁止鼠标等在睡眠时唤醒
services.udev.extraRules = ''ACTION=="add", ATTR{power/wakeup}="disabled"'';
networking.extraHosts = "74.211.99.69 mirism.one beta.mirism.one ng01.mirism.one";
@@ -176,10 +183,10 @@ inputs:
};
system.nixos.tags = [ "nvidia" ];
};
cachyos.configuration =
zen.configuration =
{
nixos.system.kernel.variant = inputs.lib.mkForce "cachyos";
system.nixos.tags = [ "cachyos" ];
nixos.system.kernel = { variant = inputs.lib.mkForce "zen"; patches = inputs.lib.mkForce []; };
system.nixos.tags = [ "zen" ];
};
};
};

View File

@@ -10,13 +10,13 @@ inputs:
{
mount =
{
vfat."/dev/disk/by-uuid/CE84-E0D8" = "/boot/efi";
# TODO: reparition
vfat."/dev/disk/by-uuid/CE84-E0D8" = "/boot";
btrfs."/dev/disk/by-uuid/61f51d93-d3e5-4028-a903-332fafbfd365" =
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; "/nix/boot" = "/boot"; };
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; };
};
rollingRootfs = {};
};
grub.installDevice = "efi";
networking = { hostname = "pcarm"; networkd = {}; };
nixpkgs.arch = "aarch64";
kernel.variant = "nixos";

View File

@@ -10,23 +10,18 @@ inputs:
{
mount =
{
vfat."/dev/disk/by-uuid/AE90-1DD1" = "/boot/efi";
btrfs =
{
"/dev/disk/by-uuid/5a043ec5-7b47-4b0d-ad89-8c3ce5650fcd"."/" = "/boot";
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
# TODO: reparition
vfat."/dev/disk/by-uuid/AE90-1DD1" = "/boot";
btrfs."/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
decrypt.auto."/dev/disk/by-uuid/a9e4a508-3f0b-492e-b932-e2019be28615" = { mapper = "root"; ssd = true; };
rollingRootfs = {};
};
grub.installDevice = "efi";
kernel.variant = "xanmod-latest";
networking.hostname = "pcvm";
initrd.sshd.enable = true;
};
hardware.cpus = [ "amd" ];
packages.packageSet = "server";
services.sshd = {};
};
};

View File

@@ -10,14 +10,14 @@ inputs:
{
mount =
{
vfat."/dev/disk/by-uuid/ABC6-6B3E" = "/boot/efi";
# TODO: reparition
vfat."/dev/disk/by-uuid/ABC6-6B3E" = "/boot";
btrfs."/dev/disk/by-uuid/c459c6c0-23a6-4ef2-945a-0bfafa9a45b6" =
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; "/nix/boot" = "/boot"; };
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; };
};
swap = [ "/nix/swap/swap" ];
rollingRootfs = {};
};
grub.installDevice = "efi";
networking = { hostname = "pi3b"; networkd = {}; };
nixpkgs.arch = "aarch64";
kernel.variant = "nixos";

View File

@@ -11,38 +11,41 @@ inputs:
{
mount =
{
vfat."/dev/disk/by-uuid/7179-9C69" = "/boot/efi";
btrfs =
{
"/dev/disk/by-uuid/c6d35075-85fe-4129-aaa8-f436ab85ce43"."/boot" = "/boot";
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
vfat."/dev/disk/by-uuid/4596-D670" = "/boot";
btrfs."/dev/mapper/root1" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
decrypt.auto =
{
"/dev/disk/by-uuid/4f7420f9-ea19-4713-b084-2ac8f0a963ac" = { mapper = "root"; ssd = true; };
"/dev/disk/by-uuid/88bd9d44-928b-40a2-8f3d-6dcd257c4601" =
{ mapper = "swap"; ssd = true; before = [ "root" ]; };
"/dev/disk/by-uuid/eda0042b-ffd5-47d1-b828-4cf99d744c9f" = { mapper = "root1"; ssd = true; };
"/dev/disk/by-uuid/41d83848-f3dd-4b2f-946f-de1d2ae1cbd4" = { mapper = "swap"; ssd = true; };
};
swap = [ "/dev/mapper/swap" ];
resume = "/dev/mapper/swap";
rollingRootfs = {};
};
nixpkgs.march = "skylake";
grub.installDevice = "efi";
nix = { substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ]; githubToken.enable = true; };
kernel = { variant = "xanmod-lts"; patches = [ "cjktty" "lantian" "surface" "hibernate-progress" ]; };
kernel = { variant = "xanmod-lts"; patches = [ "surface" "hibernate-progress" ]; };
networking.hostname = "surface";
gui.enable = true;
gui = { enable = true; touchscreen = true; };
initrd.unl0kr = {};
};
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
packages.packageSet = "desktop-extra";
virtualization = { docker.enable = true; waydroid.enable = true; };
services =
{
snapper.enable = true;
sshd = {};
xray.client.enable = true;
xray.client =
{
enable = true;
dnsmasq.hosts = builtins.listToAttrs (builtins.map
(name: { inherit name; value = "0.0.0.0"; })
[
"log-upload.mihoyo.com" "uspider.yuanshen.com" "ys-log-upload.mihoyo.com"
"dispatchcnglobal.yuanshen.com"
]);
};
firewall.trustedInterfaces = [ "virbr0" ];
wireguard =
{
@@ -54,8 +57,8 @@ inputs:
beesd.instances.root = { device = "/"; hashTableSizeMB = 512; };
};
bugs = [ "xmunet" "suspend-hibernate-no-platform" ];
packages.vasp = null;
};
environment.systemPackages = with inputs.pkgs; [ maliit-keyboard maliit-framework ];
powerManagement.resumeCommands = ''${inputs.pkgs.systemd}/bin/systemctl restart iptsd'';
services.iptsd.config =
{

View File

@@ -53,16 +53,16 @@ inputs:
(site: { name = "${site}.chn.moe"; value.upstream.address = "wireguard.vps7.chn.moe"; })
[
"xn--s8w913fdga" "misskey" "synapse" "syncv3.synapse" "matrix" "syncv3.matrix"
"send" "kkmeeting" "api" "git" "grafana" "vikunja"
"send" "kkmeeting" "api" "git" "grafana" "vikunja" "write"
]));
applications =
{
element.instances."element.chn.moe" = {};
synapse-admin.instances."synapse-admin.chn.moe" = {};
catalog.enable = true;
blog.enable = true;
main.enable = true;
nekomia.enable = true;
blog.enable = true;
};
};
coturn = {};
@@ -80,6 +80,7 @@ inputs:
};
beesd.instances.root = { device = "/"; hashTableSizeMB = 64; };
};
user.users = [ "chn" "zqq" ];
};
specialisation.generic.configuration =
{

View File

@@ -30,7 +30,6 @@ inputs:
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
initrd.sshd.enable = true;
networking = { hostname = "vps7"; networkd = {}; };
kernel.variant = "cachyos-server";
};
services =
{
@@ -69,6 +68,7 @@ inputs:
vikunja.enable = true;
chatgpt = {};
xray.server = { serverName = "xserver.vps7.chn.moe"; userNumber = 4; };
writefreely = {};
};
};
specialisation.generic.configuration =

View File

@@ -54,11 +54,13 @@ synapse:
signing-key: ENC[AES256_GCM,data:hzxxDbGp1L09O7+ueUSa5lJOY/QvF2zvHdpueEHjaPQEToQt9mr2loeTQHC7ObTegfLb9UHrI1jn4A==,iv:KngfahwYZZmDQ5LeOUPWptTMGAC8TZm1G0FWcrwCwsw=,tag:U9pW6/boBIpiswn67Ezrfw==,type:str]
sliding-sync: ENC[AES256_GCM,data:BeA6g98IWDP6hnLFI77QqG6esDwB6j3OPzAv3eJxWoTajAsByHSgSYP1vHN5Iok6IgvSSmkf0/HiOJy1Ca8IIA==,iv:ca+t/rYwc/fAVUcz0JTmrRQCOcbDNscbnE8BpHkx/OE=,tag:eEfhUChUt4kRnO82XqRY4g==,type:str]
vaultwarden:
admin_token: ENC[AES256_GCM,data:muavuOY88Lm4rSEoCp4IIPp7Z+sqf36VwpnPgf+K6IwwFkUgYM1GO80ogReYWqqUM6ij1Yzl5D9ncUbq+aGTKQ==,iv:jA4MRJlz71CMmPnWjb2tGbbIoMkEsESUowhXDckKKMI=,tag:l0HaJmnU29YeFUxjOgN3Kg==,type:str]
#ENC[AES256_GCM,data:yFDD8GHjZWHN/Yh53DseevKAhDVwrHX60e8sGZnF4BUsUuPA/4S2PRzj7CtlpFzUH3kb0i+HkLKRvbchg93U3as=,iv:JGG7daEKs0oMKTNVi9GS7PrXn/8rFtVkHknACsEQR+g=,tag:RSN6fojLsI4dcuPu2eTiWA==,type:comment]
admin_token: ENC[AES256_GCM,data:OpjREmxJSRj+aGVoP8KKRE7ClNqRtaV8va4WLVmpl1AO6D0q/GapJvhORHQb5s5ZjIAgvWTz1w+fh050Q9sPwRsNUke3FIcyeNy7k0PHgnnVIdxnU1Vn9KMz/SovjQ0/qEQ7tArvW/EXtKfwnP9lsz9m94VBvA==,iv:9AvDqMa2PeQOSrP2th3YBgA2RxPl3oKZTyUzi/yjRTM=,tag:HYFTQDgWvBsHQk8IZxWkfw==,type:str]
mariadb:
photoprism: ENC[AES256_GCM,data:TF1SZVFnvzyE+7vrHYYUS4Juqhbiw9QcJx7p3Xj88xyBFcTqS1YjzAKs/9GQ1PuzdBrt6hXm/XtJILHiuktnSg==,iv:sd9sQEuIePL6LzUYbFtmdecJ57sMrkF0coalBf8KFqQ=,tag:P/knaKYTJ+aXu4l6IixISA==,type:str]
freshrss: ENC[AES256_GCM,data:ydqCbj3UbsLC1e++p5ixb5Kpmk2BsYd0urcfw8T51Is5N1/gQ7P0zgR33AOteAxw2oj85WQZhxu3eAN7BCXV5A==,iv:1oiMo1wwFNXiTZLsf4UPZSJfKFIWLI3h947TC06CVy4=,tag:Otq1oeKBnWXhqNilfsywPQ==,type:str]
huginn: ENC[AES256_GCM,data:1Tdg1WDwGgFSXdChgif8knWS24BIFYnmaiSjJXxs5uj/v/5fJ1alb4K4XHW/kFRjQbuAOFfJiJ9ogJ1KAyk17A==,iv:qLMaQpVaKrjP7g2lWzhaNLghxwiV4YJmyYY1hrpu5I8=,tag:566JCENvOxgwD7tM3aQBiw==,type:str]
writefreely: ENC[AES256_GCM,data:+5jsON4SpeWKWZWlbn233XuQ/6HDzaS3XxUxDbUqAp8S/XGmn/QuFK2f375QJEiyZsnrIYkbN/CiOjdTw+nNzg==,iv:8mKqWegyxrT6908P5G0olVZzpP+BwpE7SYODEry7F3A=,tag:HeYoT0RFJGzX6DWcBQy7Jg==,type:str]
photoprism:
adminPassword: ENC[AES256_GCM,data:gB81joOfS8h05BNy2YmD/N0cpLPa/vAduDcQBeHiY/WkcnvqSXnXsOfnvbP74KQfoP4W35oFkfyGVPUBSB83tg==,iv:AkN2NoqMXVHQA9fHTTR7xbEapEqy/D61mHn7O23hyYk=,tag:WV+siDA3VnRkOYnP4Z9Qhw==,type:str]
nextcloud:
@@ -116,6 +118,8 @@ xray-server:
#ENC[AES256_GCM,data:j83rYg==,iv:3oEdAoVz7aMcezcy2chTO0LQTtKpTrJJoQZx3PC03BU=,tag:ABteEIyr2Y6MbGQhmrQySQ==,type:comment]
user3: ENC[AES256_GCM,data:Uk0Ax9FVzmmYs+ggWy7z6FEkuj2tppGlvnQdoW6PDI1VA9oI,iv:wSxigXleRUalQR1/TzKfdUVrdyEUuq+Wg42gSv1QMAI=,tag:qn6nBWv6MlGhMarCfI13BA==,type:str]
private-key: ENC[AES256_GCM,data:TarrinCFzWkB5zCc7i7f3B3tFfxrF+cGnrg4bw9CAGKWBazSJHCviY8Imw==,iv:azHdrc6AlgS9RPwGVsYRb8bBeC/askCdut1rnv9TA3I=,tag:AT2lLraKVgbp9GmlLJiI+w==,type:str]
writefreely:
chn: ENC[AES256_GCM,data:YvhPa69sVdiljm9Ix6yQh6YCEpFvC9iw5Yx72MBcGr7+swdbvWDAfMmGFY066mAPvhpwZX/IEivKvrS0t/OSnw==,iv:7s2yEb30YaCAtNeevbur0HL28nXHVIqmCx6Bngh+HWk=,tag:yx0JK8RNQMVcYLBSxNj+uw==,type:str]
sops:
kms: []
gcp_kms: []
@@ -140,8 +144,8 @@ sops:
SnFHS1Z0SXUzTFdEd29KTy9DU3Y3R0UKfhh+rUmWDrf+UGjclP57dHipPLFoXSqy
HdelmfV6q4/c7ppx2E+oZw3VNgoZCsrxxzYZfwxHJiZb+5vkE0D8iA==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-07-11T13:55:38Z"
mac: ENC[AES256_GCM,data:5mYdz+1v6LZBW2TiM6CROaU6TUtFemOvbqJUQfqO3Lr8UnDM9AdH/fD//xDYNR1T1tMhBJf04Jchle7jRl45HKCzuyOGFOABu2m25nJeJGGDTSVDaRUUgCcmN4NQ0h1ep9gmZM9u2g5KLdmenXqcVD2tVgWNLykHtEZ/MyyEPC4=,iv:te1/rjBWhBIvJol51S4hehI4gxr3nsTH+YhmINDfy0U=,tag:mGXzGi309B1er8atMJta3g==,type:str]
lastmodified: "2024-08-20T15:48:48Z"
mac: ENC[AES256_GCM,data:buEby7ZmmEFARmRp3r7JwYdMck87u4c3TGkeF2pkc5ORnqIgwSH1XVSjlbK8vTBWz2FKXeQh9wkX3BMaam9dU873/yPBe54BnbZNggZ7jDDEpSTeddfTsM8mrka0xDO3CUHbwCsqYWFm4NLAbCfRPKhrjvSJVyEC85K3eO45Z6M=,iv:/7cOdSi6oiaaFRkSnR+1/XXapjlQdMgom31xrpIGXHk=,tag:XW4WX93bw45zPweblW4Dtg==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1
version: 3.9.0

View File

@@ -10,10 +10,11 @@ inputs:
{
mount =
{
vfat."/dev/disk/by-uuid/467C-02E3" = "/boot/efi";
# TODO: reparition
vfat."/dev/disk/by-uuid/467C-02E3" = "/boot";
btrfs =
{
"/dev/disk/by-uuid/2f9060bc-09b5-4348-ad0f-3a43a91d158b" = { "/nix" = "/nix"; "/nix/boot" = "/boot"; };
"/dev/disk/by-uuid/2f9060bc-09b5-4348-ad0f-3a43a91d158b"."/nix" = "/nix";
"/dev/disk/by-uuid/a04a1fb0-e4ed-4c91-9846-2f9e716f6e12" =
{
"/nix/rootfs" = "/nix/rootfs";
@@ -26,7 +27,6 @@ inputs:
swap = [ "/nix/swap/swap" ];
rollingRootfs = {};
};
grub.installDevice = "efi";
nixpkgs =
{
march = "znver3";
@@ -52,7 +52,6 @@ inputs:
nix.remote.slave.enable = true;
};
hardware = { cpus = [ "amd" ]; gpu.type = "nvidia"; };
packages.packageSet = "workstation";
virtualization = { waydroid.enable = true; docker.enable = true; kvmHost = { enable = true; gui = true; }; };
services =
{
@@ -91,7 +90,7 @@ inputs:
hpcstat = {};
};
bugs = [ "xmunet" "amdpstate" ];
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
user.users = [ "chn" "xll" "zem" "yjq" "gb" "zqq" ];
};
services.hardware.bolt.enable = true;
};

View File

@@ -15,6 +15,8 @@ users:
yjq: ENC[AES256_GCM,data:ua0DINHutjt2Pk+SfHRQRV99mT3Cnw6rRKO8VRIAlP0dY6QhK9wkNdyRYWYRBKVrWgyFQMGNFYAxIpymjF/X7mBOVI2sOHLgkw==,iv:PUZ6S0KICuqoSA2sDLxdL4gtAOQnQXOUY+5f3qDZgpc=,tag:f39P34vAUOrV23BsKkRarA==,type:str]
#ENC[AES256_GCM,data:6qNjSdjck4Vz,iv:c/GNqCNgRgwgL+2f6Vumtjb/ub9WCBSy8R02NRCDqk8=,tag:b/tucJsHTjSfcK0vgHtE8A==,type:comment]
gb: ENC[AES256_GCM,data:3eAKBiJoC1owCHTFd3Xq8vI8VK980evePc92xCXJJ21M9D1MdbwN8ySZ3Ovjk7VfQmEo8oRv1Ll1sftyrXYoeTHmJsNDxCpR6A==,iv:Ju/ERNuGrgO5kYlbvmkbLJkgiW3Elou34AsJTFITCUg=,tag:POVlxYh9kZ1BMSbt97IVOQ==,type:str]
#ENC[AES256_GCM,data:oniighfvCNGWUwdhqg==,iv:RVUuZBqCd111QJ7MpgYBuP4fDCzm4NZAtbua9kXkrJM=,tag:21zF8E/3lBTDr54I9NKPVg==,type:comment]
zqq: ENC[AES256_GCM,data:Vjbbs8xIlH3+of7+kLGFVp4bIizU8D5R1qRbCqP5FhzTadXA8KD9/uiYxtrV3oxYGwZ/RlLvriHMClob4ihyDF4U2t8Dc4eVqA==,iv:FjCftpfKPZYThiNOyNkhx9uNyWIsjC5sK5WWcaEBtiY=,tag:MTL490c2SeFGx3EhxEdvkA==,type:str]
mariadb:
slurm: ENC[AES256_GCM,data:qQMD8SKNmxb3PdScXNqppF9zkX7dV5i7rvljvZuhiI5zLnu77qYCHBW6ymh0mrY14N9NjxmQZhZWX/H8TvBlcg==,iv:J5N3LjCYW3QmuEkMBpl7qvPFW1Z9ZoPLkj45jKcIW9U=,tag:Tl+ld07+lVkmzt7f/f2MqQ==,type:str]
hpcstat:
@@ -46,8 +48,8 @@ sops:
ZDNHUjE2QVlCV3p0NHdKYW5IMHVBZzQKkZtfyvfroOntg3yRjMw4jQHiQj8eaB2h
IeIHfW4y01mmVT2ofbtB0xYpjcl4gtUlQ8X3tn5iJ9P8gcVo0G598A==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-07-22T02:35:09Z"
mac: ENC[AES256_GCM,data:Gr4933UL8jZatR1osg29K/fGKJn/k7yZ2orPJOm0WMgs2bka8uGa5dIEJDTveKKJGk+iItXDUtsxM9C+0FwmrdSgrshg2LIjN8Nw0Mg9YjGjl3BXYH9ushN39+h+Ig5Q1nL7iJF5QF7bPULeFw0jO+6XJhCO/+LGa+DMzw+SyRM=,iv:4/Bev1xBXGRtkJooBqAz+y5vuIqkpLgvNIgBfoidW9M=,tag:/aDiuZROEY5NF4bT5YGURg==,type:str]
lastmodified: "2024-08-21T09:56:03Z"
mac: ENC[AES256_GCM,data:9+AR9Y6ik+BH1Spk62LSTU1NFQ8ID0YROF+yf8ss2RqhfP6/5+lsrNjGC7gnEEMYF8UWVtChUuljIK3Q4MtT64JhDWgp8tenbpkJnRFGylzEe37MYajdDY7nrPP7iPUPNvS1ndo6vp/yuEigBXVhCtpjMObj7zIdGnLbtz0sczA=,iv:gNb8gVp9adnlZsMM2afOlFe46Vy15ELmC9vGaaeaInY=,tag:rltLL3WSZytjEemgjCy6Ng==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1
version: 3.9.0

39
devices/xmupc1/tunnel.md Normal file
View File

@@ -0,0 +1,39 @@
# 使用 SSH 隧道连接
在学校外且不使用厦大 VPN 时,无法直接连接到学校的服务器,可以通过下面的方法连接到:
首先连接到 vps6.chn.moe。这个服务器在校外洛杉矶因此可以直接连接到。
同时,它通过别的方式与学校的服务器保持着连接,利用这个保持着的连接,跳回到学校的服务器。
这个跳转的过程不需要手动操作,只需要将软件设置好即可。
## PuTTY
1. 首先设置一个名为 `vps6` 的会话。
1. 在 Session 页,填入 `vps6.chn.moe` 作为 Host Name。
2. 在 Connection -> SSH -> Auth -> Credentials 页,在 “Private key file for authentication“ 选择密钥文件。
3. 在 Connection -> Data 页,在 “Auto-login username” 填写用户名。
4. 回到 Session 页,在 “Saved Sessions” 填入 `vps6` 并点击 “Save” 保存配置。
2. 再设置一个名为 `wireguard.xmupc1` 的会话。
1. 在 Session 页,填入 `wireguard.xmupc1.chn.moe` 作为 Host Name。
2. 在 Connection -> SSH -> Auth -> Credentials 页和 Connection -> Data 页,需要修改的设置与在 `vps6` 会话中相同。
3. 在 Connection -> Proxy 页,设置 Proxy type 为 `SSH to proxy and use port forwarding`Proxy hostname 为 `vps6`
4. 回到 Session 页,在 “Saved Sessions” 填入 `wireguard.xmupc1` 并点击 “Save” 保存配置。
之后双击双击 `wireguard.xmupc1` 会话即可连接到学校的服务器。
## WinSCP
1. 在登陆界面,点击 “新建站点”。
1. 设置 “文件协议” 为 `SCP`,“主机名” 为 `wireguard.xmupc1.chn.moe`,并输入用户名。
2. 然后点击右下角 “高级” 继续修改设置。
3. 在 连接 -> 隧道 页,勾选 “通过 SSH 隧道进行连接”,主机名填写 `vps6.chn.moe`,选择密钥文件,并填写用户名。
4. 在 SSH -> 验证 页,选择密钥文件。
5. 点击 “确定”,再点击 “保存”。
## OpenSSH
下面是一个命令的示例:
```bash
ssh -J username@vps6.chn.moe username@wireguard.xmupc1.chn.moe
```

View File

@@ -10,17 +10,16 @@ inputs:
{
mount =
{
vfat."/dev/disk/by-uuid/23CA-F4C4" = "/boot/efi";
vfat."/dev/disk/by-uuid/23CA-F4C4" = "/boot";
btrfs =
{
"/dev/disk/by-uuid/d187e03c-a2b6-455b-931a-8d35b529edac" =
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; "/nix/boot" = "/boot"; };
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; };
};
};
swap = [ "/nix/swap/swap" ];
rollingRootfs = {};
};
grub.installDevice = "efi";
nixpkgs =
{
march = "skylake";
@@ -46,7 +45,6 @@ inputs:
nix.remote.slave.enable = true;
};
hardware = { cpus = [ "intel" ]; gpu.type = "nvidia"; };
packages.packageSet = "workstation";
virtualization = { waydroid.enable = true; docker.enable = true; kvmHost = { enable = true; gui = true; }; };
services =
{
@@ -75,14 +73,7 @@ inputs:
groupshare = {};
};
bugs = [ "xmunet" ];
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
};
environment.persistence."/nix/archive" =
{
hideMounts = true;
users.chn.directories = builtins.map
(dir: { directory = "repo/${dir}"; user = "chn"; group = "chn"; mode = "0755"; })
[ "lammps-SiC" "linwei-stuff" ];
user.users = [ "chn" "xll" "zem" "yjq" "gb" "zqq" ];
};
};
}

View File

@@ -15,6 +15,8 @@ users:
yjq: ENC[AES256_GCM,data:sGPQ0xALULREnhzl9g/V91M5osMglsSps6R4gYn5OZc/4xVC1phF3qajVN3YMOr7kKgkHbF2Rjm6/2vuK0k1iYZnFswUAmFlmw==,iv:5vG1hn7SlX6HCpas2BgxBSwWqLby8OCxcH3EKNvceIc=,tag:TVwFBAuosKnEOZecq1phXw==,type:str]
#ENC[AES256_GCM,data:ALHxkRABA+ll,iv:r1IDiHLFcTdLID3q16zrLTavAwQfddC7bXMKcFZFveI=,tag:4Pd0/Q1BmH4gJjaM4hbqqQ==,type:comment]
gb: ENC[AES256_GCM,data:z4CrtdmdLJJ0qZzr7qvihnluJQgjtciX56KdEmtemiRu0llEJk9qz6a23aJ7m40Sfc38elF1/LsvjOuBOC87+BVkKDCj76phag==,iv:WrFVxkr3snmqDXZx5kAYCLp7ixEIzxoT7El3rV7Ovqg=,tag:iExf2Y/HObHQrKMTRvqn7A==,type:str]
#ENC[AES256_GCM,data:UoNCXbGIHDNsmyCJxw==,iv:uTNvqg4xm7E+yn8vFaaihbEGEhLTZ2FNFNCYzdgiDlU=,tag:4bRSZbx6FFzA6MiBYVu0qw==,type:comment]
zqq: ENC[AES256_GCM,data:sfgufV++PfTrdeUBXZhmF1JoSpD8Nj+m0QKFrUMJG/pHb0AUagJEWEJwPsI+m91tZE0qxM271ks+WKqLElmyD4Ftw7ywWzTE0Q==,iv:R05QFUF+fvIHidWpHIR/D/e+UeciS5ehnx1kx+saCgM=,tag:3Awnd+pUQRxjjQ58SUX7Mg==,type:str]
mariadb:
slurm: ENC[AES256_GCM,data:9wLQ1zF/kDaiw0s3UaRpiHgmngU7u6hwyqpddSjev0+Z0v58Q2oiJtK8vn+2VlSxx5ACfqEFbzp0PZYAxd575w==,iv:q9JTkgDymOwkbZ/PaxRAAQrtO96QmGgZcQuLTFCMoS4=,tag:dwOHlOTgZqT/1jQ+oGf7UQ==,type:str]
sops:
@@ -41,8 +43,8 @@ sops:
M0xoL1dQR0kvMWpzN0RMNWVCTFQxNFUKj9LPjBo5NGOrGYNvu8qZ13PLYjLEWllU
LARzEn4XgkeHckouwvxZYMCx7WxmAruRWaOvnxTIczzSNP7wIrqnkA==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-05-10T08:54:10Z"
mac: ENC[AES256_GCM,data:4n7bAGzORwd6vHl/Cs5YT8VZaSdfvxUm6e+fw7PYC2ov8XoRlJKU/Bci8Sbwcy2H6OjbkdRYA61cB2wAjtEY1x9N/c6qvUAOjTvOtcXoQQex8d+aMnJsFfJQ70GHCZE+KRTmy1SAMn+N00Oy0FDisdQe/jIZuWyav5j62CKqLqc=,iv:YEhiXU2IgXy4A0ZLsNY7kFqXJM5RBHE4IZwlRoF8XMA=,tag:aVc0r2g1QkY42NP59p4m2w==,type:str]
lastmodified: "2024-08-21T09:56:44Z"
mac: ENC[AES256_GCM,data:COodLhpL5EA5g15lgimsuxs1vmqJrLDVgtjw+0FLKTq6E1pcQ+zJl+dD0b9u5fYy9BBf56TI8TLJahVPR0eGxbDFlHmx8M9GStlTqaOE3jRsDT8GsihdlvLokyVt8jEfAnaWESTIgfehVL2TrLlsMnIsoVHrzdlEhX5ATXA3QOg=,iv:U/EwFmYWOcxi7ItkR/+MT8gTu7UobH5pxS00qrH/yyU=,tag:RVMcx4X0IS9yvpHrF0owpg==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1
version: 3.9.0

323
flake.lock generated
View File

@@ -8,11 +8,11 @@
]
},
"locked": {
"lastModified": 1721398837,
"narHash": "sha256-RnBEAbH8a6CogvyjV3d4c+LI/udbygrsGOtZfbRRaUc=",
"lastModified": 1722680456,
"narHash": "sha256-q3ZxjLD/6WnAGwihLlRLoEzIEaVE1AqnH5h1TePYP/I=",
"owner": "ezKEa",
"repo": "aagl-gtk-on-nix",
"rev": "d57b317f94c290f5720fa38fd16c926a8929143e",
"rev": "54264a57d0c58afd12888eb1c576f96ca811530c",
"type": "github"
},
"original": {
@@ -24,11 +24,11 @@
"blurred-wallpaper": {
"flake": false,
"locked": {
"lastModified": 1717574881,
"narHash": "sha256-PUr73+1a0F347IlCPWNa3hM3tSoZRqVu6O4XF/EzjIA=",
"lastModified": 1721745357,
"narHash": "sha256-+MjnVsGHqitQytxiAH39Kx9SXuTEFfIC14Ayzu4yE4I=",
"owner": "bouteillerAlan",
"repo": "blurredwallpaper",
"rev": "f91ca4ea4eb628b0a156fe9db0660ce1913a31cb",
"rev": "661a067215a2a9efffc6846bc166405d0a90da96",
"type": "github"
},
"original": {
@@ -59,11 +59,11 @@
},
"catppuccin": {
"locked": {
"lastModified": 1719915848,
"narHash": "sha256-zq+CMkdT8A9z74HonwspXp8HsX4OvP4uaVdD98AO6as=",
"lastModified": 1723691425,
"narHash": "sha256-F25VvHFMaqr26b7goaVWspXaK6XTRFz8RnILV+9OPkk=",
"owner": "catppuccin",
"repo": "nix",
"rev": "9345073d27d91ab66c1b6ab65df322906992aa59",
"rev": "552056779a136092eb6358c573d925630172fc30",
"type": "github"
},
"original": {
@@ -75,6 +75,7 @@
"chaotic": {
"inputs": {
"compare-to": "compare-to",
"fenix": "fenix",
"flake-schemas": "flake-schemas",
"home-manager": [
"home-manager"
@@ -87,11 +88,11 @@
"yafas": "yafas"
},
"locked": {
"lastModified": 1720162329,
"narHash": "sha256-iB9PZYreHYjp9t8BNMgmyfXA9ed5lFRayKsx03L2yQo=",
"lastModified": 1723531925,
"narHash": "sha256-QPETOkVNZwm3Zx0FRfkrPWScbc46I5QwIOdBmByYtKg=",
"owner": "chaotic-cx",
"repo": "nyx",
"rev": "793fa1b40c4dec81ee8eb7104fdd35aed7b96ab1",
"rev": "b8b1c616f8b869af7bce3179ad423e3d45b0d079",
"type": "github"
},
"original": {
@@ -180,21 +181,17 @@
},
"devshell": {
"inputs": {
"flake-utils": [
"nur-linyinfeng",
"flake-utils"
],
"nixpkgs": [
"nur-linyinfeng",
"nixpkgs"
]
},
"locked": {
"lastModified": 1717408969,
"narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=",
"lastModified": 1722113426,
"narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=",
"owner": "numtide",
"repo": "devshell",
"rev": "1ebbe68d57457c8cae98145410b164b5477761f4",
"rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae",
"type": "github"
},
"original": {
@@ -206,11 +203,11 @@
"eigen": {
"flake": false,
"locked": {
"lastModified": 1719474966,
"narHash": "sha256-qmFsmFEQCDH+TRFc8+5BsYAG1ybL08fWhn8NpM6H6xY=",
"lastModified": 1723671724,
"narHash": "sha256-ZYRLIWSqTCUjPvUXONCPlLxUBIlgoF8P/oWEFeJSBuk=",
"owner": "libeigen",
"repo": "eigen",
"rev": "33d0937c6bdf5ec999939fb17f2a553183d14a74",
"rev": "92e373e6f553dd842337c8467f4ddb669e0e9199",
"type": "gitlab"
},
"original": {
@@ -241,6 +238,44 @@
"type": "github"
}
},
"fcitx5-virtualkeyboard-ui": {
"flake": false,
"locked": {
"lastModified": 1724249565,
"narHash": "sha256-flMCrq4HEhugiwKXCd4xZkgZVF+XUo0C+L0OhRXCfIE=",
"owner": "CHN-beta",
"repo": "fcitx5-virtualkeyboard-ui",
"rev": "695bf005da908c79f1d461c3b0801ce651f34ade",
"type": "github"
},
"original": {
"owner": "CHN-beta",
"repo": "fcitx5-virtualkeyboard-ui",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"chaotic",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1723444276,
"narHash": "sha256-ErWXmB84hedrDmeaHOaFFfNShC21AopTfM4x4rlvk3c=",
"owner": "nix-community",
"repo": "fenix",
"rev": "70c22198ab822aa93c92a7ec0933908b17131edd",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@@ -368,11 +403,11 @@
]
},
"locked": {
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
@@ -386,11 +421,11 @@
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
@@ -470,11 +505,11 @@
"git-lfs-transfer": {
"flake": false,
"locked": {
"lastModified": 1720471270,
"narHash": "sha256-8r3D6d6nbv5vL33PskgSixoIZt7+wqXYWAxE5KoqAzg=",
"lastModified": 1723210978,
"narHash": "sha256-V/IvjUSWmp/QbSuaHzMT0AF4dqam1Ay8Uei5+11cmT8=",
"owner": "charmbracelet",
"repo": "git-lfs-transfer",
"rev": "bacbfdb68d928c8c16a08e75b6c6c67cc314a0b8",
"rev": "2cab0ea18f7e5c07a6cc5490f861b6815abad119",
"type": "github"
},
"original": {
@@ -528,11 +563,11 @@
]
},
"locked": {
"lastModified": 1720167120,
"narHash": "sha256-K9JYdlPiyaXp33JRg7CT8rMwH56e4ncXSsXW/YKnNXc=",
"lastModified": 1723399884,
"narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "bbe6e94737289c8cb92d4d8f9199fbfe4f11c0ba",
"rev": "086f619dd991a4d355c07837448244029fc2d9ab",
"type": "github"
},
"original": {
@@ -565,11 +600,11 @@
]
},
"locked": {
"lastModified": 1719631702,
"narHash": "sha256-HMWxIehVO8pHp7OlqBYliiLOds34UJHSRn5FPdEb1j8=",
"lastModified": 1723367191,
"narHash": "sha256-noi5tre7BLtxImN38jEHeVOtOG1Xu37sJFwHKSAPHjo=",
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"rev": "2f9668e19aff06550cd154c87c0af120735a56a4",
"rev": "91178062f365b64eece94c5dff93e09b07e87d9d",
"type": "github"
},
"original": {
@@ -597,11 +632,11 @@
"lepton": {
"flake": false,
"locked": {
"lastModified": 1719817324,
"narHash": "sha256-19aivAOvXeFOnsP5XhitK3+xk1lwUyXoTK8BE84qbFQ=",
"lastModified": 1723185812,
"narHash": "sha256-Mtnoit1CAGJoc8eiJ+0vfGc9v+3tomm8V8/tWfeAj7o=",
"owner": "black7375",
"repo": "Firefox-UI-Fix",
"rev": "362f34bece31a0e89b87d036547a56fc2c412d0c",
"rev": "c79922aa45ff04a62e04ef0f8562dc53990b5208",
"type": "github"
},
"original": {
@@ -613,11 +648,11 @@
"linux-surface": {
"flake": false,
"locked": {
"lastModified": 1719778916,
"narHash": "sha256-CfxfDxzCMwrZg375n89rljR6hchJQQ+SOHTBgNCR82w=",
"lastModified": 1723804050,
"narHash": "sha256-MYwEgnw3KjEm6oh39XUmCq12tKdH+0QZj9SZlWbwyxo=",
"owner": "linux-surface",
"repo": "linux-surface",
"rev": "dbc445a23d3b546447eab6d46b49ed76af544070",
"rev": "4439a5efb6516c443df5f52173cb55aef01560d1",
"type": "github"
},
"original": {
@@ -629,11 +664,11 @@
"lmod": {
"flake": false,
"locked": {
"lastModified": 1719265824,
"narHash": "sha256-p/kYQ2hiWwOQS6I8urJvqY7Gz8SGunUkR3ZTqgMiVvY=",
"lastModified": 1723142745,
"narHash": "sha256-bNTOW6MffUpiGEfZxP1MSioa2MpYW456wymXHO5Uvr4=",
"owner": "TACC",
"repo": "Lmod",
"rev": "a66999b861c1d3ac5025338493455fe2aa1c89df",
"rev": "efd893e9a2dab1300a0d6f3ea998dc3503fd8d39",
"type": "github"
},
"original": {
@@ -661,11 +696,11 @@
"misskey": {
"flake": false,
"locked": {
"lastModified": 1717405331,
"narHash": "sha256-NV/H8ah8YKpnzytR4OFKf23TPPlOdyGYesbRZDznAb4=",
"lastModified": 1724207820,
"narHash": "sha256-tm4YTpKqI7g4ACn8vkJUIFQmKcHlcDTkoBCrHEd3fp8=",
"ref": "refs/heads/chn-mod",
"rev": "93f76cfe6a458915a3980d389d4c1dec3c117aaa",
"revCount": 25668,
"rev": "ac5c495d437fcdba2c523308119477a750440f3d",
"revCount": 25947,
"submodules": true,
"type": "git",
"url": "https://github.com/CHN-beta/misskey"
@@ -708,6 +743,22 @@
"type": "github"
}
},
"nc4nix": {
"flake": false,
"locked": {
"lastModified": 1724033015,
"narHash": "sha256-L0HSyoCAfrPF0zdlMmwu7Bpcqz43UsRFkTnXPZjLRiY=",
"owner": "helsinki-systems",
"repo": "nc4nix",
"rev": "924dc2b20cac3bf48f7204d58255a9c62bf80f96",
"type": "github"
},
"original": {
"owner": "helsinki-systems",
"repo": "nc4nix",
"type": "github"
}
},
"nix-fast-build": {
"inputs": {
"flake-parts": "flake-parts_2",
@@ -732,11 +783,11 @@
},
"nix-flatpak": {
"locked": {
"lastModified": 1711997375,
"narHash": "sha256-KvU4gOtuFMS9Il67glRGtdNfguAINT9pCaXtvCL8uI8=",
"lastModified": 1721549352,
"narHash": "sha256-nlXJa8RSOX0kykrIYW33ukoHYq+FOSNztHLLgqKwOp8=",
"owner": "gmodena",
"repo": "nix-flatpak",
"rev": "45bf66f7068db79b552da864c0e87452be624d6c",
"rev": "dbce39ea8664820ba9037caaf1e2fad365ed6b4b",
"type": "github"
},
"original": {
@@ -775,11 +826,11 @@
]
},
"locked": {
"lastModified": 1719832725,
"narHash": "sha256-dr8DkeS74KVNTgi8BE0BiUKALb+EKlMIV86G2xPYO64=",
"lastModified": 1723352546,
"narHash": "sha256-WTIrvp0yV8ODd6lxAq4F7EbrPQv0gscBnyfn559c3k8=",
"owner": "Mic92",
"repo": "nix-index-database",
"rev": "2917972ed34ce292309b3a4976286f8b5c08db27",
"rev": "ec78079a904d7d55e81a0468d764d0fffb50ac06",
"type": "github"
},
"original": {
@@ -796,11 +847,11 @@
]
},
"locked": {
"lastModified": 1719832725,
"narHash": "sha256-dr8DkeS74KVNTgi8BE0BiUKALb+EKlMIV86G2xPYO64=",
"lastModified": 1723352546,
"narHash": "sha256-WTIrvp0yV8ODd6lxAq4F7EbrPQv0gscBnyfn559c3k8=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "2917972ed34ce292309b3a4976286f8b5c08db27",
"rev": "ec78079a904d7d55e81a0468d764d0fffb50ac06",
"type": "github"
},
"original": {
@@ -818,11 +869,11 @@
]
},
"locked": {
"lastModified": 1720142793,
"narHash": "sha256-KhKF1VEMT5vz0vv1HZy0IOTEp2ZU1UD4ZgJAkOFbhIg=",
"lastModified": 1723685172,
"narHash": "sha256-TXrwOBvk9yQnfS9zgyG6jWJA7bK+UVfnSoGX1Gp4/uU=",
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"rev": "8d57c84024068180130f3c0a2103dda967a0ddc2",
"rev": "e470c879f34c9f3915d7f1fe95c33f9a958f8c10",
"type": "github"
},
"original": {
@@ -833,11 +884,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1719984813,
"narHash": "sha256-/zRdv5J5exywcZXxIatB0Megh1QUs2vC7BCyvBB73ZA=",
"lastModified": 1723854545,
"narHash": "sha256-3CE8MTrYLMNzPr90Y09Js3EI9D0MR3JnQtYENVcdKB4=",
"owner": "CHN-beta",
"repo": "nixos-hardware",
"rev": "a939cbb5dfd3648debce81492a17b0bafa301948",
"rev": "0b3a6ecaa0be2e528b6a5619cf29aea77b61e5bc",
"type": "github"
},
"original": {
@@ -848,11 +899,11 @@
},
"nixos-stable": {
"locked": {
"lastModified": 1719957072,
"narHash": "sha256-gvFhEf5nszouwLAkT9nWsDzocUTqLWHuL++dvNjMp9I=",
"lastModified": 1720535198,
"narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7144d6241f02d171d25fba3edeaf15e0f2592105",
"rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5",
"type": "github"
},
"original": {
@@ -864,11 +915,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1721902831,
"narHash": "sha256-uFGwC+vSal+vOWKz3s2NaCMTsYbNTEZ+fzq6GmMcSIc=",
"lastModified": 1724171353,
"narHash": "sha256-Qdxgirl1bChkSnTgvHibkzF0wnak6HtRA0bLB4cindQ=",
"owner": "CHN-beta",
"repo": "nixpkgs",
"rev": "bc8602014bfa0a631e87ac3edf883e83323782ac",
"rev": "3f0bb934a09d868ce7e5a4a4ce415afb71a2655e",
"type": "github"
},
"original": {
@@ -942,6 +993,22 @@
"type": "github"
}
},
"nixpkgs-24_05": {
"locked": {
"lastModified": 1723556749,
"narHash": "sha256-+CHVZnTnIYRLYsARInHYoWkujzcRkLY/gXm3s5bE52o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4a92571f9207810b559c9eac203d1f4d79830073",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1714640452,
@@ -956,28 +1023,28 @@
},
"nixpkgs-lib_2": {
"locked": {
"lastModified": 1719876945,
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
"lastModified": 1722555339,
"narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1718811006,
"narHash": "sha256-0Y8IrGhRmBmT7HHXlxxepg2t8j1X90++qRN3lukGaIk=",
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "03d771e513ce90147b65fe922d87d3a0356fc125",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
@@ -1012,11 +1079,11 @@
"treefmt-nix": "treefmt-nix_3"
},
"locked": {
"lastModified": 1720117827,
"narHash": "sha256-C9BXXBAm6Nwog7AqFxKsqUOo5/fbzq4rYkCw/fVVLiw=",
"lastModified": 1723573880,
"narHash": "sha256-OWRxvKlh7+s4VhYiLEC8Dr5MLQ6vlTWFgCTIkO80XMs=",
"owner": "linyinfeng",
"repo": "nur-packages",
"rev": "3838eac2cfe996847926bde071166da3f9d94715",
"rev": "70d09e1e7c10f81b697e3ac2315cbf6779ed62b0",
"type": "github"
},
"original": {
@@ -1032,16 +1099,17 @@
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-24_05": "nixpkgs-24_05",
"nvfetcher": "nvfetcher_2",
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
"treefmt-nix": "treefmt-nix_4"
},
"locked": {
"lastModified": 1720176115,
"narHash": "sha256-YjBj9W2BKIcTtFQbu5lSYSfGh2/JXpSd5zpXtdxT8Sc=",
"lastModified": 1723629877,
"narHash": "sha256-gd0Dnx1igw1wHvkmihrtVPf/9sWdHgWCsCTpQglBZs0=",
"owner": "xddxdd",
"repo": "nur-packages",
"rev": "ca3f342474efb6418cc1dab4da7cb225691cafae",
"rev": "68859480c1412142ad1e011b9f41f12bbee132c1",
"type": "github"
},
"original": {
@@ -1105,11 +1173,11 @@
"openxlsx": {
"flake": false,
"locked": {
"lastModified": 1716560554,
"narHash": "sha256-Aqn1830lG4g7BbwEeePhvGawLarmrIMnF2MXROTUBCw=",
"lastModified": 1722960074,
"narHash": "sha256-KaexHI/Bl3aChkt2glN2oRJREYqFSOAO0Qn6pPccSXw=",
"owner": "troldal",
"repo": "OpenXLSX",
"rev": "f85f7f1bd632094b5d78d4d1f575955fc3801886",
"rev": "06425d541d09907799e93a4226691126bd60af5e",
"type": "github"
},
"original": {
@@ -1128,11 +1196,11 @@
]
},
"locked": {
"lastModified": 1720168075,
"narHash": "sha256-Nb/8+zrOPbU9EBMterwQPTUonqwj6Czd0CCCNM4SROA=",
"lastModified": 1723587631,
"narHash": "sha256-FZ27DsgOROvv/4Cvo34UcIqEJLQ6cKIWHcQsM3zLN3I=",
"owner": "pjones",
"repo": "plasma-manager",
"rev": "71c3fb6eb0767923335662aa33a06f983c2fbeae",
"rev": "76dab4ba280ddd1b6c5aec0bb0aa0ace201c39ae",
"type": "github"
},
"original": {
@@ -1152,11 +1220,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1719259945,
"narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=",
"lastModified": 1723202784,
"narHash": "sha256-qbhjc/NEGaDbyy0ucycubq4N3//gDFFH3DOmp1D3u1Q=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07",
"rev": "c7012d0c18567c889b948781bc74a501e92275d1",
"type": "github"
},
"original": {
@@ -1172,11 +1240,11 @@
]
},
"locked": {
"lastModified": 1719919782,
"narHash": "sha256-XBo+DCmhSv2Va4JbbiXv870mr6nEWZPzEgMCRcme/B8=",
"lastModified": 1723036528,
"narHash": "sha256-/w7Yv1c16nz9O8DQQsBUNWLaR1Y278g8ebHCTD8Wb1E=",
"owner": "Nix-QChem",
"repo": "NixOS-QChem",
"rev": "a9dd2cbc2b6968f66a4fae811f3e23a091c993f6",
"rev": "437d809ed9c6cdc4cee9b0e1d04ac6061f8f30f1",
"type": "github"
},
"original": {
@@ -1199,6 +1267,7 @@
"date": "date",
"eigen": "eigen",
"envfs": "envfs",
"fcitx5-virtualkeyboard-ui": "fcitx5-virtualkeyboard-ui",
"git-lfs-transfer": "git-lfs-transfer",
"gricad": "gricad",
"home-manager": "home-manager",
@@ -1211,6 +1280,7 @@
"misskey": "misskey",
"mumax": "mumax",
"nameof": "nameof",
"nc4nix": "nc4nix",
"nix-fast-build": "nix-fast-build",
"nix-flatpak": "nix-flatpak",
"nix-index-database": "nix-index-database",
@@ -1242,11 +1312,11 @@
"rsshub": {
"flake": false,
"locked": {
"lastModified": 1720178553,
"narHash": "sha256-er/hFd0rX2Btw+nheg0zpolMOLPPtmRZWeCyXS5SlMg=",
"lastModified": 1723692588,
"narHash": "sha256-4z39e+om3z3Rcm66NmV5VUfbMueZ/iE+A51SvDf4I9c=",
"owner": "DIYgod",
"repo": "RSSHub",
"rev": "68c7430fbb3d158c88f95beeb5881352d1d4caf1",
"rev": "351578a8767f8faa06a26eeace168622503e7682",
"type": "github"
},
"original": {
@@ -1255,14 +1325,31 @@
"type": "github"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1723304838,
"narHash": "sha256-xAxVDxuvCs8WWkrxVWjCiqxTkHhGj7sSppr1YMuEdT8=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "0daeb5c0b05cfdf2101b0f078c27539099bf38e6",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"rycee": {
"flake": false,
"locked": {
"lastModified": 1720167363,
"narHash": "sha256-GIQZdHXLC2u7QyXAtb9WsOqwmRpeCqcqX/AR7INiiXY=",
"lastModified": 1723694590,
"narHash": "sha256-7cufibbD4mf84wPBOTq0bNYjtUz5/Aq1azv9Nil5bzk=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "cea36a02a4619e009d7fac7df1bc2acba825c5a4",
"rev": "bc49bde3aa2e9408a22bf62d2faf4358508ce4b6",
"type": "gitlab"
},
"original": {
@@ -1313,11 +1400,11 @@
]
},
"locked": {
"lastModified": 1719873517,
"narHash": "sha256-D1dxZmXf6M2h5lNE1m6orojuUawVPjogbGRsqSBX+1g=",
"lastModified": 1723501126,
"narHash": "sha256-N9IcHgj/p1+2Pvk8P4Zc1bfrMwld5PcosVA0nL6IGdE=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "a11224af8d824935f363928074b4717ca2e280db",
"rev": "be0eec2d27563590194a9206f551a6f73d52fa34",
"type": "github"
},
"original": {
@@ -1468,11 +1555,11 @@
]
},
"locked": {
"lastModified": 1719887753,
"narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=",
"lastModified": 1723454642,
"narHash": "sha256-S0Gvsenh0II7EAaoc9158ZB4vYyuycvMGKGxIbERNAM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c",
"rev": "349de7bc435bdff37785c2466f054ed1766173be",
"type": "github"
},
"original": {
@@ -1489,11 +1576,11 @@
]
},
"locked": {
"lastModified": 1719887753,
"narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=",
"lastModified": 1723454642,
"narHash": "sha256-S0Gvsenh0II7EAaoc9158ZB4vYyuycvMGKGxIbERNAM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c",
"rev": "349de7bc435bdff37785c2466f054ed1766173be",
"type": "github"
},
"original": {
@@ -1505,11 +1592,11 @@
"v-sim": {
"flake": false,
"locked": {
"lastModified": 1715973671,
"narHash": "sha256-+QNK8hXhqHw/WRHBZ2DAuOl2QIAT53YaFUI5qfBHGLg=",
"lastModified": 1722003028,
"narHash": "sha256-qGnlSrUwwVhCu3kSlklwQg08S7mFZ/RcfsVv3phuuko=",
"owner": "l_sim",
"repo": "v_sim",
"rev": "0816f29dca18c0f500936c6e7f3c5e687617e682",
"rev": "1b77971358002d3e92b18021551029e9db33e509",
"type": "gitlab"
},
"original": {
@@ -1546,11 +1633,11 @@
"zpp-bits": {
"flake": false,
"locked": {
"lastModified": 1720100883,
"narHash": "sha256-EDMg+bvyCjKbUIZD0wahvr+0+fTwOvJiQ/gv5r8PexM=",
"lastModified": 1721553062,
"narHash": "sha256-rqL/xEhPzgCA16DP/LIix75VtqKpBS5Rm56fb5cxaGo=",
"owner": "eyalz800",
"repo": "zpp_bits",
"rev": "5f980b00bc47fb486ba5902e0be4e1d08c297f50",
"rev": "81be2fa9652658e7b4a77f9f6ea3970eb3bbef6f",
"type": "github"
},
"original": {

View File

@@ -65,6 +65,8 @@
sqlite-orm = { url = "github:fnc12/sqlite_orm"; flake = false; };
sockpp = { url = "github:fpagliughi/sockpp"; flake = false; };
git-lfs-transfer = { url = "github:charmbracelet/git-lfs-transfer"; flake = false; };
nc4nix = { url = "github:helsinki-systems/nc4nix"; flake = false; };
fcitx5-virtualkeyboard-ui = { url = "github:CHN-beta/fcitx5-virtualkeyboard-ui"; flake = false; };
# does not support lfs yet
# nixos-wallpaper = { url = "git+https://git.chn.moe/chn/nixos-wallpaper.git"; flake = false; };
@@ -72,60 +74,53 @@
outputs = inputs:
let
localLib = import ./local/lib inputs.nixpkgs.lib;
localLib = import ./lib.nix inputs.nixpkgs.lib;
devices = builtins.filter (dir: (builtins.readDir ./devices/${dir})."default.nix" or null == "regular" )
(builtins.attrNames (builtins.readDir ./devices));
in
{
packages = rec
packages.x86_64-linux = rec
{
x86_64-linux = rec
pkgs = (import inputs.nixpkgs
{
pkgs = (import inputs.nixpkgs
{
system = "x86_64-linux";
config.allowUnfree = true;
overlays = [ inputs.self.overlays.default ];
crossOverlays = [(final: prev:
system = "x86_64-linux";
config.allowUnfree = true;
overlays = [ inputs.self.overlays.default ];
});
default = inputs.nixpkgs.legacyPackages.x86_64-linux.writeText "systems"
(builtins.concatStringsSep "\n" (builtins.map
(system: builtins.toString inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel)
devices));
hpcstat =
let
openssh = (pkgs.pkgsStatic.openssh.override { withLdns = false; etcDir = null; }).overrideAttrs
(prev: { doCheck = false; patches = prev.patches ++ [ ./packages/hpcstat/openssh.patch ];});
duc = pkgs.pkgsStatic.duc.override { enableCairo = false; cairo = null; pango = null; };
in pkgs.pkgsStatic.localPackages.hpcstat.override
{ inherit openssh duc; standalone = true; version = inputs.self.rev or "dirty"; };
ufo =
let
range-v3 = pkgs.pkgsStatic.range-v3.overrideAttrs (prev:
{
boost = prev.boost.override { zstd = null; };
magic-enum = prev.magic-enum.overrideAttrs (prev: { cmakeFlags = prev.cmakeFlags ++
[ "-DMAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF" "-DMAGIC_ENUM_OPT_BUILD_TESTS=OFF" ]; });
range-v3 = prev.range-v3.overrideAttrs (prev: { cmakeFlags = prev.cmakeFlags ++
[ "-DRANGE_V3_DOCS=OFF" "-DRANGE_V3_TESTS=OFF" "-DRANGE_V3_EXAMPLES=OFF" ]; });
abseil-cpp = prev.abseil-cpp.overrideAttrs (prev: { buildInputs = prev.buildInputs ++
[ final.windows.pthreads ]; });
})];
});
default = inputs.nixpkgs.legacyPackages.x86_64-linux.writeText "systems"
(builtins.concatStringsSep "\n" (builtins.map
(system: builtins.toString inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel)
devices));
hpcstat =
let
openssh = (pkgs.pkgsStatic.openssh.override { withLdns = false; etcDir = null; }).overrideAttrs
(prev: { doCheck = false; patches = prev.patches ++ [ ./local/pkgs/hpcstat/openssh.patch ];});
duc = pkgs.pkgsStatic.duc.override { enableCairo = false; cairo = null; pango = null; };
in pkgs.pkgsStatic.localPackages.hpcstat.override
{ inherit openssh duc; standalone = true; version = inputs.self.rev or "dirty"; };
ufo = pkgs.pkgsStatic.localPackages.ufo.override { version = inputs.self.rev or "dirty"; };
chn-bsub = pkgs.pkgsStatic.localPackages.chn-bsub;
}
// (
builtins.listToAttrs (builtins.map
(system:
{
name = system;
value = inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel;
})
devices)
);
x86_64-w64-mingw32 = rec
cmakeFlags = prev.cmakeFlags or []
++ [ "-DRANGE_V3_DOCS=OFF" "-DRANGE_V3_TESTS=OFF" "-DRANGE_V3_EXAMPLES=OFF" ];
doCheck = false;
});
tbb = pkgs.pkgsStatic.tbb_2021_11.overrideAttrs (prev: { cmakeFlags = prev.cmakeFlags or [] ++
[ "-DTBB_TEST=OFF" ]; });
biu = pkgs.pkgsStatic.localPackages.biu.override { inherit range-v3; };
matplotplusplus = pkgs.pkgsStatic.localPackages.matplotplusplus.override { libtiff = null; };
in pkgs.pkgsStatic.localPackages.ufo.override { inherit biu tbb matplotplusplus; };
chn-bsub = pkgs.pkgsStatic.localPackages.chn-bsub;
}
// (builtins.listToAttrs (builtins.map
(system:
{
pkgs = x86_64-linux.pkgs.pkgsCross.mingwW64Static;
winjob = pkgs.localPackages.winjob;
};
};
name = system;
value = inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel;
})
devices)
);
nixosConfigurations =
(
(builtins.listToAttrs (builtins.map
@@ -140,7 +135,7 @@
[
(moduleInputs: { config.nixpkgs.overlays = [(prev: final:
# replace pkgs with final to avoid infinite recursion
{ localPackages = import ./local/pkgs (moduleInputs // { pkgs = final; }); })]; })
{ localPackages = import ./packages (moduleInputs // { pkgs = final; }); })]; })
./modules
./devices/${system}
];
@@ -156,7 +151,7 @@
[
(moduleInputs: { config.nixpkgs.overlays = [(prev: final:
# replace pkgs with final to avoid infinite recursion
{ localPackages = import ./local/pkgs (moduleInputs // { pkgs = final; }); })]; })
{ localPackages = import ./packages (moduleInputs // { pkgs = final; }); })]; })
./modules
./devices/pi3b
];
@@ -164,7 +159,7 @@
}
);
overlays.default = final: prev:
{ localPackages = (import ./local/pkgs { inherit (inputs) lib; pkgs = final; topInputs = inputs; }); };
{ localPackages = (import ./packages { inherit (inputs) lib; pkgs = final; topInputs = inputs; }); };
config = { archive = false; branch = "production"; };
devShells.x86_64-linux = let inherit (inputs.self.packages.x86_64-linux) pkgs; in
{

View File

@@ -1,54 +0,0 @@
# pragma once
# include <vector>
# include <span>
# include <Eigen/Dense>
# include <biu/concepts.hpp>
namespace biu
{
namespace detail_::eigen
{
// user-specified size of destination container: dynamic, unspecified(use default), or fixed
constexpr std::size_t dynamicSize = std::dynamic_extent, unspecifiedSize = std::dynamic_extent - 1;
static_assert(std::dynamic_extent == std::numeric_limits<std::size_t>::max());
// supported types of standard containers
template <typename T, typename Scalar> struct SpecializationOfArrayHelper : std::false_type {};
template <typename Scalar, std::size_t N>
struct SpecializationOfArrayHelper<std::array<Scalar, N>, Scalar> : std::true_type {};
template <typename Scalar, std::size_t N>
struct SpecializationOfArrayHelper<std::array<Scalar, N>, void> : std::true_type {};
template <typename T, typename Scalar = void> concept SpecializationOfArray =
SpecializationOfArrayHelper<T, Scalar>::value;
template <typename T, typename Scalar> concept StandardContainer =
SpecializationOf<T, std::vector, Scalar> || SpecializationOfArray<T, Scalar>;
// helper operator| to specify the size of the destination container
// usage: some_value | toEigen<Row, Col>
template <std::size_t Row, std::size_t Col> struct ToEigenHelper {};
template <std::size_t Row = unspecifiedSize, std::size_t Col = unspecifiedSize>
inline constexpr ToEigenHelper<Row, Col> toEigen;
// convert 1D standard container to Eigen::Vector
// if no size is specified, convert std::vector to dynamic-size Eigen::Vector,
// std::array to fixed-size Eigen::Vector;
// if size is std::dynamic_extent, always convert to dynamic-size Eigen::Vector
// if size is specified as a number, convert to fixed-size Eigen::Vector if specified size equals the size of the
// input, otherwise throw an error
template <template <int N> typename Callback, std::size_t ToSize> auto deduce_eigen_size(auto&& container);
template <Arithmetic T, StandardContainer<T> From, std::size_t ToSize> auto operator|
(const From&, const ToEigenHelper<ToSize, unspecifiedSize>&);
// convert 2D standard container to Eigen::Matrix
// the same rules as above apply
// besides, all rows must have the same size, otherwise throw an error
template
<
Arithmetic T, StandardContainer<T> FromPerRow, StandardContainer<FromPerRow> From,
std::size_t ToRow, std::size_t ToCol
>
auto operator|(const From&, const ToEigenHelper<ToRow, ToCol>&);
// TODO: implement fromEigen
}
inline namespace eigen { using detail_::eigen::toEigen; using detail_::eigen::operator|; }
}

View File

@@ -1,29 +0,0 @@
# pragma once
# include <biu/eigen.hpp>
// TODO: fix biu::logger
// # include <biu/logger.hpp>
# include <range/v3/view.hpp>
namespace biu
{
namespace detail_::eigen
{
template <template <int N> typename Callback, std::size_t ToSize> auto deduce_eigen_size(auto&& from)
{
if constexpr (ToSize == dynamicSize)
return Callback<Eigen::Dynamic>()(from.data(), from.size());
else if constexpr (ToSize == unspecifiedSize)
if constexpr (SpecializationOfArray<decltype(from)>)
return Callback<from.size()>()(from.data());
else
return Callback<Eigen::Dynamic>()(from.data(), from.size());
else
if (from.size() != ToSize)
// TODO: use biu::logger
throw std::invalid_argument("biu::toEigen: size mismatch");
else
return Callback<ToSize>()(from.data());
}
// TODO: implement 2D case
}
}

View File

@@ -1,214 +1 @@
# 设置 SSH agent forwarding
为了区分登陆 jykang@hpc.xmu.edu.cn 时使用的密钥并分密钥统计使用情况需要启用一项名为“SSH agent forwarding”的功能。
接下来的内容将带领您在 Windows 系统上配置 SSH agent forwarding。
> [!NOTE]
> 在 Linux 上的配置方法放在了文章末尾。大多数用户不需要阅读。
要启用“SSH agent forwarding”需要下面三个步骤
1. 启动 Pageant 并添加密钥。 **这一步骤每次登陆前都需要执行。**
2. 配置 PuTTY使 PuTTY 在每次登陆时不直接使用密钥,而是利用 Pageant 完成认证。这一步骤只需要执行一次。
3. 配置 WinSCP使 WinSCP 在每次登陆时不直接使用密钥,而是利用 Pageant 完成认证。这一步骤只需要执行一次。
接下来将分别说明这三个步骤。
## Pageant:
1. 找到 Pageant 程序。Pageant 会随着 PuTTY 一起安装,一般来说您可以直接在开始菜单中搜索 “pageant” 找到它,也可以在 PuTTY 的安装目录中找到它。
2. 启动 Pageant。启动后可能没有任何反应也可能有一个黑框闪过这是正常的。只要右下角的系统托盘中出现了 pageant 的图标就可以了。
![](pageant1.png)
3. 双击 Pageant 图标,打开 Pageant 窗口。选择 “Add Key”然后选择您的密钥文件。
![](pageant2.png)
4. 在使用服务器期间保持 Pageant 启动(可以关闭 Pageant 的窗口,但不要在系统托盘中右键退出)。
5. 使用完毕后,在系统托盘中右键退出 Pageant。
> [!NOTE]
> 无论是使用 WinSCP 还是 PuTTY每次使用前都需要如此启动 Pageant 并添加密钥。
> [!TIP]
> 如果您觉得每次打开 Pageant 都要手动添加密钥很麻烦,并且熟悉 Windows 命令行的使用,
> 可以编写一个批处理文件(将下方代码用记事本保存,然后将扩展名从 `.txt` 改为 `.bat`),每次双击该文件即可启动 Pageant 并自动添加密钥:
>
> `"C:\ProgramData\chocolatey\bin\PAGEANT.EXE" "Z:\.ssh\id_rsa.ppk"`
>
> 其中第一个引号内为 Pageant 的路径,第二个引号内为您的密钥文件的路径。也可以将该批处理文件放入开机启动项中,使得 Pageant 在开机时自动启动。
>
> 因为每个人的密钥文件以及 Pageant 的路径都可能不同,所以这里无法提供通用的批处理文件。
## PuTTY:
1. 在 Connection -> SSH -> Auth勾选“Attempt authentication using Pageant”和“Allow agent forwarding”。
![](putty1.png)
2. 在 Connection -> SSH -> Auth -> Credentials清空 “Private key file for authentication”然后保存。
![](putty2.png)
3. (选做但推荐)在 Connection -> Data 中,将 “Auto-login username” 设置为 `jykang`,这样每次登陆时就不需要手动输入用户名了。
## WinSCP:
1. 在 SSH -> Authentication勾选 “使用 Pageant 进行认证”,勾选 “允许代理转发”,清空 “密钥文件”,然后保存。
![](winscp1.png)
2. (选做)如果您需要通过 WinSCP 打开 PuTTY 的话,需要在 WinSCP 主界面 -> 工具 -> 选项 -> 集成 -> 应用程序路径中,
在原来的基础上增加 `-A` 参数。
![](winscp2.png)
> [!TIP]
> 如果 WinSCP 不让你直接修改那个字符串,就把它复制到记事本里修改,然后再复制回去。
至此,您已经成功配置了 SSH agent forwarding。
之后使用 PuTTY 登陆 `jykang@hpc.xmu.edu.cn` 时,会收到包含了您的名字的提示(如图所示),表明您已经成功启用了 SSH agent forwarding。
![](putty3.png)
> [!NOTE]
> 无论是 PuTTY 还是 WinSCP改完设置后都记得保存。
> [!IMPORTANT]
> 如果您确认已经按照教程设置好了却仍然不能连接,可以尝试将 WinSCP 和 PuTTY 都更新到最新。
>
> 我测试使用的版本是PuTTY 0.78 和 WinSCP 6.3.3。
---
# 其它内容
接下来的内容不是使用 jykang@hpc.xmu.edu.cn 的必需内容,不须要阅读。
如果您按照上面的步骤配置 SSH agent forwarding 失败,那么请再次仔细阅读上面的内容,**接下来的内容对您没有帮助**。
接下来的内容包括:
* 解释为什么不转发 agent 就无法区分不同密钥。
* 介绍一些可能有用的附加功能,例如区分使用同一个密钥的不同用户,以及如何设置任务进度微信通知。
## 为什么不转发 agent 就无法区分不同密钥?
如果你好奇为什么不使用 Pageant 就无法区分使用不同密钥的登陆:
SSH 连接并不是直接由 jykang 用户处理的,
而是由一个名为 `sshd` 的程序处理,它通常以 `root` 用户的身份运行。
在完成认证后,`sshd` 会将 Windows 电脑发来的信息解密后转发给以 `jykang` 用户运行的进程,
并将以 `jykang` 用户运行的进程的输出加密后发回给 Windows 电脑。
我们只能控制 `jykang` 用户运行的进程,但这里拿不到任何关于密钥的信息。
```mermaid
flowchart TB
subgraph "Run on windows"
A[(密钥文件)] -.->|从硬盘读取| B["SSH client (putty, WinSCP, etc.)"]
end
subgraph "Run on hpc by root"
C["SSH server (sshd)"]
end
B <--> |"认证信息 & 加密的数据"| C
subgraph "Run on hpc by <b>jykang</b>"
D["Other programs (bash, VASP, etc.)"]
end
C <--> |"解密后的数据(不包含密钥信息)"| D
```
Pageant 程序就是所谓的“SSH agent”。“SSH agent forwarding” 就是将到 Pageant 的连接通过已经建立的 SSH 连接转发给远程服务器,
使得远程服务器可以与 Pageant 通信,进而读取密钥信息。
“SSH agent forwarding” 典型的用途是在远程服务器上使用本地的密钥再次登陆其他服务器,而不是为了区分使用不同密钥的登陆。
```mermaid
flowchart TB
subgraph "Run on windows"
A[(密钥文件)] -.->|从硬盘读取| E["SSH agent (pageant)"]
E <-->|认证信息| B["SSH client (putty, WinSCP, etc.)"]
end
subgraph "Run on hpc by root"
C["SSH server (sshd)"]
end
B <--> |"认证信息 & 加密的数据"| C
subgraph "Run on hpc by <b>jykang</b>"
D["Other programs (bash, VASP, etc.)"]
end
C <--> |"解密后的数据(不包含密钥信息)"| D
E <-...-> |"通过已经建立的 SSH 连接转发密钥信息"| D
```
事实上linux 的管理(统计用户使用的资源,等)非常依赖于不同的用户,即用高权限的用户去管理低权限的用户。
大家都使用同一个账户的情况下,很多管理的功能没有现成的解决方案(要自己手写代码、思考如何设计),甚至完全无法实现。
整这个东西真的挺麻烦的。我也嫌麻烦(而且我要做的事情比大多数用户多得多)。要不是康老师一定要我做,我才不会做。
如果你嫌这些麻烦,与其埋怨我,不如去建议自己的导师去自己申请一个账号用。
## 设置子账户:
一个老师拿到密钥后,可能会将它分发给多个不同的学生。
如果希望区分不同学生的使用情况,可以修改 `TERM` 变量,加上 `hpcstat_subaccount:your_name:` 前缀,
以此来进一步区分使用同一个密钥的不同用户。
对于 PuTTY 来说,`TERM` 变量在 Connection -> Data -> Ternimal-type string 中修改。
例如,如果原本的 `TERM` 变量是 `xterm`,那么修改后的 `TERM` 变量可以是 `hpcstat_subaccount:chn:xterm`
`TERM` 变量只在交互式登陆时有效,因此无法在 WinSCP 中使用。
如果设置了这个参数,那么会额外统计不同子账户的使用情况(登陆次数、投递的任务、占用的核时,等)。
是否设置这个参数都不影响按密钥统计的功能(即,按照密钥统计的核时,是所有使用这个密钥的用户的总和,无论是否设置了这个参数)。
同时,子账户的统计结果也仅供参考,事实上这个统计结果很容易造假
(如果 A 和 B 都使用同一个密钥登陆,那么显然 B 可以在 TERM 中填入 A 的名字以假装自己是 A把自己用的核时都算到 A 头上)。
> [!CAUTION]
> 如果 `TERM` 变量的格式设置得不正确PuTTY 登陆后一些程序会无法正常工作,因此尝试时应该仔细且小心。
## PuTTY 登陆时自动跳转:
如果您希望在登陆时自动跳转到自己的目录下,可以在 `TERM` 中再增加以下前缀:`chn_cd:your_path:`
例如,将 `TERM` 变量修改为 `chn_cd:linwei/chn:xterm`,那么使用 PuTTY 登陆后会自动跳转到 `linwei/chn` 目录下。
如果同时使用了 `hpcstat_subaccount``chn_cd`,那么 `hpcstat_subaccount` 必须在 `chn_cd` 之后,
例如 `chn_cd:linwei/chn:hpcstat_subaccount:chn:xterm`
## 任务进度微信通知:
用微信打开下面的链接:
```
https://wxpusher.zjiecode.com/wxuser/?type=1&id=75864#/follow
```
您应该会被引导去关注一个公众号WxPusher 消息推送平台)。关注这个公众号之后会收到一条包含 UID 的消息。
然后把下面的信息发给我:
* 您的 UID
* 您使用的密钥的指纹(用 PuTTY 登陆时会提示)
* 如果使用了子账户(在 `TERM` 中设置了 `hpcstat_subaccount`),还需要告诉我您设置的子账户名
之后您投递的任务有新进度(例如,开始运行、运行结束)时就会通过这个公众号收到通知。
需要注意的是,这个 UID 会被明文写到 jykang 上的文件里。
也就是说存在这样的风险:有权限登陆 jykang 的人都有权限通过这个公众号给您发消息。
## 在 Linux 上配置 SSH agent forwarding
1. 使用以下命令将 `.ppk` 的私钥部分拆分出来:
```bash
puttygen id_rsa.ppk -O private-openssh -o ./id_rsa
```
确保 `id_rsa` 的权限为 `600`。
2. 在 `~/.ssh/config` 中添加以下内容:
```
Host jykang
AddKeysToAgent yes
ForwardAgent yes
IdentityFile ~/path/to/id_rsa
```
然后就可以正常使用了,例如:
```bash
ssh jykang
```
Moved to [../../../../packages/hpcstat/doc/setup.md](../../../../packages/hpcstat/doc/setup.md)

Binary file not shown.

View File

@@ -1,18 +0,0 @@
{
stdenv, src, cmake, pkg-config, substituteAll,
gnuplot, libjpeg, libtiff, zlib, libpng, lapack, blas, fftw, opencv, nodesoup, cimg, glfw, libGL, python3, glad
}: stdenv.mkDerivation
{
name = "matplotplusplus";
inherit src;
cmakeFlags =
[
"-DBUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_EXAMPLES=OFF"
"-DMATPLOTPP_WITH_SYSTEM_NODESOUP=ON" "-DMATPLOTPP_WITH_SYSTEM_CIMG=ON"
"-DMATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND=ON" "-DGLAD_REPRODUCIBLE=ON"
];
buildInputs = [ gnuplot libjpeg libtiff zlib libpng lapack blas fftw opencv nodesoup cimg glfw libGL glad ];
nativeBuildInputs = [ cmake pkg-config python3 ];
propagatedBuildInputs = [ libGL glad glfw ];
propagatedNativeBuildInputs = [ python3 ];
}

View File

@@ -1,10 +0,0 @@
{
stdenv, cmake, pkg-config,
yaml-cpp, eigen, fmt, concurrencpp, highfive, tbb, glad, matplotplusplus, biu, zpp-bits
}: stdenv.mkDerivation
{
name = "ufo";
src = ./.;
buildInputs = [ yaml-cpp eigen fmt concurrencpp highfive tbb glad matplotplusplus biu zpp-bits ];
nativeBuildInputs = [ cmake pkg-config ];
}

View File

@@ -18,9 +18,6 @@ inputs:
amd = [];
};
in builtins.concatLists (builtins.map (cpu: modules.${cpu}) cpus);
kernelParams =
let params = { intel = [ "intel_iommu=off" ]; amd = [ "amd_iommu=fullflush" ]; };
in builtins.concatLists (builtins.map (cpu: params.${cpu}) cpus);
};
environment.systemPackages =
let packages = with inputs.pkgs; { intel = []; amd = [ zenmonitor ]; };

View File

@@ -39,7 +39,6 @@ inputs:
{
hardware.pulseaudio.enable = false;
services.pipewire = { enable = true; alsa = { enable = true; support32Bit = true; }; pulse.enable = true; };
sound.enable = true;
security.rtkit.enable = true;
}
)

View File

@@ -21,7 +21,7 @@ inputs:
mode = mkOption { type = types.enum [ "offload" "sync" ]; default = "offload"; };
busId = mkOption { type = types.attrsOf types.nonEmptyStr; default = {}; };
};
driver = mkOption { type = types.enum [ "production" "beta" ]; default = "production"; };
driver = mkOption { type = types.enum [ "production" "latest" "beta" ]; default = "production"; };
};
};
config = let inherit (inputs.config.nixos.hardware) gpu; in inputs.lib.mkIf (gpu.type != null) (inputs.lib.mkMerge
@@ -34,7 +34,7 @@ inputs:
let modules =
{
intel = [ "i915" ];
nvidia = [ "nvidia" "nvidia_drm" "nvidia_modeset" ]; # nvidia-uvm should not be loaded
nvidia = []; # early loading breaks resume from hibernation
amd = [];
};
in builtins.concatLists (builtins.map (gpu: modules.${gpu}) gpus);
@@ -58,20 +58,27 @@ inputs:
powerManagement.enable = true;
dynamicBoost.enable = inputs.lib.mkIf gpu.nvidia.dynamicBoost true;
nvidiaSettings = true;
forceFullCompositionPipeline = true;
package =
let actualDriver = { production = "legacy_535"; }.${gpu.nvidia.driver} or gpu.nvidia.driver;
in inputs.config.boot.kernelPackages.nvidiaPackages.${actualDriver};
package = inputs.config.boot.kernelPackages.nvidiaPackages.${gpu.nvidia.driver};
open = true; # TODO: remove when 560 is stable
prime.allowExternalGpu = true;
# nvidia 555 package have some bug, should use open
open = inputs.lib.mkIf (gpu.nvidia.driver == "beta") true;
};
};
boot.blacklistedKernelModules = [ "nouveau" ];
environment.variables.VDPAU_DRIVER = inputs.lib.mkIf (builtins.elem "intel" gpus) "va_gl";
environment.variables =
if builtins.elem "nvidia" gpus then { VDPAU_DRIVER = "nvidia"; }
else if builtins.elem "intel" gpus then { VDPAU_DRIVER = "va_gl"; }
else {};
services.xserver.videoDrivers =
let driver = { intel = "modesetting"; amd = "amdgpu"; nvidia = "nvidia"; };
in builtins.map (gpu: driver.${gpu}) gpus;
nixos.packages.packages._packages =
let packages = with inputs.pkgs;
{
intel = [ intel-gpu-tools ];
nvidia = [ nvtopPackages.full ];
amd = [];
};
in builtins.concatLists (builtins.map (gpu: packages.${gpu}) gpus);
}
)
# nvidia prime offload

View File

@@ -1,6 +1,11 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop-extra" inputs.config.nixos.packages._packageSets)
options.nixos.packages.chromium = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule {});
default = if inputs.config.nixos.system.gui.enable then {} else null;
};
config = let inherit (inputs.config.nixos.packages) chromium; in inputs.lib.mkIf (chromium != null)
{
programs.chromium = { enable = true; extraOpts.PasswordManagerEnabled = false; };
};

View File

@@ -1,47 +1,21 @@
inputs:
{
imports = inputs.localLib.findModules ./.;
options.nixos.packages =
let
inherit (inputs.lib) mkOption types;
packageSets =
[
# no gui, only used for specific purpose
"server"
"server-extra"
# gui, for daily use, but not install large programs such as matlab
"desktop"
"desktop-extra"
# nearly everything
"workstation"
];
in
{
packageSet = mkOption
{
type = types.enum packageSets;
default = if inputs.config.nixos.system.gui.enable then "desktop" else "server";
};
extraPackages = mkOption { type = types.listOf types.unspecified; default = []; };
excludePackages = mkOption { type = types.listOf types.unspecified; default = []; };
extraPythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
excludePythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
extraPrebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
excludePrebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
_packageSets = mkOption
{
type = types.listOf types.nonEmptyStr;
readOnly = true;
default = builtins.genList (i: builtins.elemAt packageSets i)
((inputs.localLib.findIndex inputs.config.nixos.packages.packageSet packageSets) + 1);
};
_packages = mkOption { type = types.listOf types.unspecified; default = []; };
_pythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
_prebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
};
options.nixos.packages.packages = let inherit (inputs.lib) mkOption types; in
{
extraPackages = mkOption { type = types.listOf types.unspecified; default = []; };
excludePackages = mkOption { type = types.listOf types.unspecified; default = []; };
extraPythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
excludePythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
extraPrebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
excludePrebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
_packages = mkOption { type = types.listOf types.unspecified; default = []; };
_pythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
_prebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
};
config =
{
environment.systemPackages = let inherit (inputs.lib.lists) subtractLists; in with inputs.config.nixos.packages;
environment.systemPackages = with inputs.config.nixos.packages.packages;
(inputs.lib.lists.subtractLists excludePackages (_packages ++ extraPackages))
++ [
(inputs.pkgs.python3.withPackages (pythonPackages:

View File

@@ -1,46 +0,0 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop-extra" inputs.config.nixos.packages._packageSets)
{
nixos =
{
packages = with inputs.pkgs;
{
_packages =
[
# system management
btrfs-assistant snapper-gui kdePackages.qtstyleplugin-kvantum ventoy-full cpu-x
inputs.pkgs."pkgs-23.11".etcher
# password and key management
yubikey-manager yubikey-manager-qt yubikey-personalization yubikey-personalization-gui bitwarden
# download
qbittorrent nur-xddxdd.baidupcs-go wgetpaste
# development
scrcpy weston cage openbox krita
# media
spotify yesplaymusic simplescreenrecorder imagemagick gimp netease-cloud-music-gtk vlc obs-studio
waifu2x-converter-cpp inkscape blender whalebird paraview
# editor
typora
# news
fluent-reader
# nix tools
nixpkgs-fmt appimage-run nixd nix-serve node2nix nix-prefetch-github prefetch-npm-deps
nix-prefetch-docker
# instant messager
element-desktop telegram-desktop discord fluffychat zoom-us signal-desktop slack nur-linyinfeng.wemeet
# browser
google-chrome tor-browser
# office
crow-translate zotero pandoc ydict libreoffice-qt texstudio poppler_utils pdftk gnuplot pdfchain hdfview
texliveFull
# math, physics and chemistry
octaveFull root ovito localPackages.vesta localPackages.vaspkit localPackages.v-sim
]
++ (builtins.filter (p: !((p.meta.broken or false) || (builtins.elem p.pname or null [ "falkon" ])))
(builtins.filter inputs.lib.isDerivation (builtins.attrValues kdePackages.kdeGear)));
};
};
programs.kdeconnect.enable = true;
};
}

View File

@@ -1,48 +1,124 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
options.nixos.packages.desktop = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule {});
default = if inputs.config.nixos.system.gui.enable then {} else null;
};
config = let inherit (inputs.config.nixos.packages) desktop; in inputs.lib.mkIf (desktop != null)
{
nixos =
{
packages._packages = with inputs.pkgs;
[
# system management
# TODO: module should add yubikey-touch-detector into path
gparted wayland-utils clinfo glxinfo vulkan-tools dracut yubikey-touch-detector
(
writeShellScriptBin "xclip"
''
#!${bash}/bin/bash
if [ "$XDG_SESSION_TYPE" = "x11" ]; then
exec ${xclip}/bin/xclip -sel clip "$@"
else
exec ${wl-clipboard-x11}/bin/xclip "$@"
fi
''
)
# color management
argyllcms xcalib
# networking
remmina putty mtr-gui
# media
mpv nomacs
# themes
catppuccin catppuccin-sddm catppuccin-cursors catppuccinifier-gui catppuccinifier-cli catppuccin-plymouth
(catppuccin-kde.override { flavour = [ "latte" ]; }) (catppuccin-kvantum.override { variant = "latte"; })
localPackages.slate localPackages.blurred-wallpaper tela-circle-icon-theme
# terminal
warp-terminal
# development
adb-sync
# desktop sharing
rustdesk-flutter
];
packages.packages =
{
_packages = with inputs.pkgs;
[
# system management
# TODO: module should add yubikey-touch-detector into path
gparted wayland-utils clinfo glxinfo vulkan-tools dracut yubikey-touch-detector btrfs-assistant snapper-gui
kdePackages.qtstyleplugin-kvantum ventoy-full cpu-x inputs.pkgs."pkgs-23.11".etcher wl-mirror
(
writeShellScriptBin "xclip"
''
#!${bash}/bin/bash
if [ "$XDG_SESSION_TYPE" = "x11" ]; then
exec ${xclip}/bin/xclip -sel clip "$@"
else
exec ${wl-clipboard-x11}/bin/xclip "$@"
fi
''
)
# color management
argyllcms xcalib
# networking
remmina putty mtr-gui
# media
mpv nomacs spotify yesplaymusic simplescreenrecorder imagemagick gimp netease-cloud-music-gtk vlc obs-studio
waifu2x-converter-cpp inkscape blender whalebird paraview
# themes
catppuccin catppuccin-sddm catppuccin-cursors catppuccinifier-gui catppuccinifier-cli catppuccin-plymouth
(catppuccin-kde.override { flavour = [ "latte" ]; }) (catppuccin-kvantum.override { variant = "latte"; })
localPackages.slate localPackages.blurred-wallpaper tela-circle-icon-theme
# terminal
warp-terminal
# development
adb-sync scrcpy weston cage openbox krita jetbrains.clion android-studio dbeaver-bin cling fprettify
aircrack-ng
# desktop sharing
rustdesk-flutter
# password and key management
yubikey-manager yubikey-manager-qt yubikey-personalization yubikey-personalization-gui bitwarden electrum
jabref
john crunch hashcat
# download
qbittorrent nur-xddxdd.baidupcs-go wgetpaste onedrive onedrivegui rclone
# editor
typora appflowy notion-app-enhanced joplin-desktop standardnotes logseq
# news
fluent-reader rssguard newsflash newsboat
# nix tools
nixpkgs-fmt appimage-run nixd nix-serve node2nix nix-prefetch-github prefetch-npm-deps nix-prefetch-docker
nix-template nil pnpm-lock-export bundix
# instant messager
element-desktop telegram-desktop discord fluffychat zoom-us signal-desktop slack nur-linyinfeng.wemeet
cinny-desktop nheko # qq nur-xddxdd.wechat-uos
# browser
google-chrome tor-browser microsoft-edge
# office
crow-translate zotero pandoc ydict libreoffice-qt texstudio poppler_utils pdftk gnuplot pdfchain hdfview
davinci-resolve
texliveFull
# math, physics and chemistry
octaveFull root ovito localPackages.vesta localPackages.vaspkit localPackages.v-sim
(mathematica.overrideAttrs (prev: { postInstall = prev.postInstall or "" + "ln -s ${src} $out/src"; }))
(quantum-espresso.override { stdenv = gcc14Stdenv; gfortran = gfortran14; }) jmol mpi
# virtualization
# TODO: broken on python 3.12: playonlinux
wineWowPackages.stagingFull virt-viewer bottles genymotion
# media
nur-xddxdd.svp
]
++ (builtins.filter (p: !((p.meta.broken or false) || (builtins.elem p.pname or null [ "falkon" "kalzium" ])))
(builtins.filter inputs.lib.isDerivation (builtins.attrValues kdePackages.kdeGear)));
# TODO: fix it
# ++ inputs.lib.optional (inputs.config.nixos.system.nixpkgs.march != null) localPackages.mumax;
_pythonPackages = [(pythonPackages: with pythonPackages;
[
phonopy scipy scikit-learn jupyterlab autograd # localPackages.pix2tex
# TODO: broken on python 3.12: tensorflow keras
])];
};
user.sharedModules =
[{
config.programs =
{
plasma =
{
enable = true;
configFile =
{
plasma-localerc = { Formats.LANG.value = "en_US.UTF-8"; Translations.LANGUAGE.value = "zh_CN"; };
baloofilerc."Basic Settings".Indexing-Enabled.value = false;
};
powerdevil = { AC.autoSuspend.action = "nothing"; battery.autoSuspend.action = "nothing"; };
};
obs-studio =
{
enable = true;
plugins = with inputs.pkgs.obs-studio-plugins; [ wlrobs obs-vaapi obs-nvfbc droidcam-obs obs-vkcapture ];
};
};
}];
};
programs =
{
adb.enable = true;
wireshark = { enable = true; package = inputs.pkgs.wireshark; };
yubikey-touch-detector.enable = true;
kdeconnect.enable = true;
anime-game-launcher = { enable = true; package = inputs.pkgs.anime-game-launcher; };
honkers-railway-launcher = { enable = true; package = inputs.pkgs.honkers-railway-launcher; };
sleepy-launcher = { enable = true; package = inputs.pkgs.sleepy-launcher; };
};
nixpkgs.overlays = [(final: prev:
{

View File

@@ -1,6 +1,11 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
options.nixos.packages.firefox = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule {});
default = if inputs.config.nixos.system.gui.enable then {} else null;
};
config = let inherit (inputs.config.nixos.packages) firefox; in inputs.lib.mkIf (firefox != null)
{
# still enable global firefox, to install language packs
programs.firefox =

View File

@@ -1,11 +1,12 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop-extra" inputs.config.nixos.packages._packageSets)
options.nixos.packages.flatpak = let inherit (inputs.lib) mkOption types; in mkOption
{
services.flatpak =
{
enable = true;
uninstallUnmanaged = true;
};
type = types.nullOr (types.submodule {});
default = if inputs.config.nixos.system.gui.enable then {} else null;
};
config = let inherit (inputs.config.nixos.packages) flatpak; in inputs.lib.mkIf (flatpak != null)
{
services.flatpak = { enable = true; uninstallUnmanaged = true; };
};
}

View File

@@ -1,6 +1,8 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
options.nixos.packages.git = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = {}; };
config = let inherit (inputs.config.nixos.packages) git; in inputs.lib.mkIf (git != null)
{
programs.git =
{
@@ -15,6 +17,6 @@ inputs:
receive.denyCurrentBranch = "warn"; # 允许 push 到非 bare 的仓库
};
};
nixos.packages._packages = [ inputs.pkgs.localPackages.git-lfs-transfer ]; # make pure ssh lfs work
nixos.packages.packages._packages = [ inputs.pkgs.localPackages.git-lfs-transfer ]; # make pure ssh lfs work
};
}

View File

@@ -1,6 +1,8 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
options.nixos.packages.gpg = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = {}; };
config = let inherit (inputs.config.nixos.packages) gpg; in inputs.lib.mkIf (gpg != null)
{
programs.gnupg.agent.enable = true;
};

View File

@@ -1,18 +0,0 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
{
nixos.user.sharedModules =
[{
config.programs.plasma =
{
enable = true;
configFile =
{
plasma-localerc = { Formats.LANG.value = "en_US.UTF-8"; Translations.LANGUAGE.value = "zh_CN"; };
baloofilerc."Basic Settings".Indexing-Enabled.value = false;
};
};
}];
};
}

View File

@@ -1,32 +0,0 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "server-extra" inputs.config.nixos.packages._packageSets)
{
nixos =
{
packages = with inputs.pkgs;
{
_packages =
[
# shell
ksh
# basic tools
neofetch
# office
todo-txt-cli pdfgrep ffmpeg-full
# development
hexo-cli gh nix-init
]
++ (with inputs.config.boot.kernelPackages; [ cpupower usbip ])
++ (inputs.lib.optional (inputs.config.nixos.system.nixpkgs.arch == "x86_64") rar);
_pythonPackages = [(pythonPackages: with pythonPackages;
[
openai python-telegram-bot fastapi pypdf2 pandas matplotlib plotly gunicorn redis jinja2
certifi charset-normalizer idna orjson psycopg2 inquirerpy requests tqdm pydbus
])];
};
};
programs.yazi.enable = true;
services.fwupd.enable = true;
};
}

View File

@@ -1,41 +1,53 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
options.nixos.packages.server = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = {}; };
config = let inherit (inputs.config.nixos.packages) server; in inputs.lib.mkIf (server != null)
{
nixos.packages._packages = with inputs.pkgs;
[
# basic tools
beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq zellij ipfetch localPackages.pslist
fastfetch reptyr nushell duc ncdu progress
# lsxx
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors
# top
iotop iftop htop btop powertop s-tui
# editor
nano bat
# downloader
wget aria2 curl yt-dlp
# file manager
tree eza trash-cli lsd broot file xdg-ninja mlocate
# compress
pigz upx unzip zip lzip p7zip
# file system management
sshfs e2fsprogs duperemove compsize exfatprogs
# disk management
smartmontools hdparm
# encryption and authentication
apacheHttpd openssl ssh-to-age gnupg age sops pam_u2f yubico-piv-tool
# networking
ipset iptables iproute2 dig nettools traceroute tcping-go whois tcpdump nmap inetutils wireguard-tools
# nix tools
nix-output-monitor nix-tree ssh-to-age (callPackage "${inputs.topInputs.nix-fast-build}" {}) nix-inspect
# development
gdb try inputs.topInputs.plasma-manager.packages.${inputs.pkgs.system}.rc2nix rr
# stupid things
toilet lolcat
]
++ (with inputs.config.boot.kernelPackages; [ cpupower usbip ])
++ (inputs.lib.optional (inputs.config.nixos.system.nixpkgs.arch == "x86_64") rar);
nixos.packages.packages =
{
_packages = with inputs.pkgs;
[
# basic tools
beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq zellij ipfetch localPackages.pslist
fastfetch reptyr nushell duc ncdu progress libva-utils ksh neofetch
# lsxx
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors
# top
iotop iftop htop btop powertop s-tui
# editor
nano bat
# downloader
wget aria2 curl yt-dlp ffsend
# file manager
tree eza trash-cli lsd broot file xdg-ninja mlocate
# compress
pigz upx unzip zip lzip p7zip
# file system management
sshfs e2fsprogs duperemove compsize exfatprogs
# disk management
smartmontools hdparm
# encryption and authentication
apacheHttpd openssl ssh-to-age gnupg age sops pam_u2f yubico-piv-tool
# networking
ipset iptables iproute2 dig nettools traceroute tcping-go whois tcpdump nmap inetutils wireguard-tools
# nix tools
nix-output-monitor nix-tree ssh-to-age (callPackage "${inputs.topInputs.nix-fast-build}" {}) nix-inspect
# development
gdb try inputs.topInputs.plasma-manager.packages.${inputs.pkgs.system}.rc2nix rr hexo-cli gh nix-init
# stupid things
toilet lolcat
# office
todo-txt-cli pdfgrep ffmpeg-full
]
++ (with inputs.config.boot.kernelPackages; [ cpupower usbip ])
++ (inputs.lib.optional (inputs.config.nixos.system.nixpkgs.arch == "x86_64") rar);
_pythonPackages = [(pythonPackages: with pythonPackages;
[
openai python-telegram-bot fastapi pypdf2 pandas matplotlib plotly gunicorn redis jinja2
certifi charset-normalizer idna orjson psycopg2 inquirerpy requests tqdm pydbus
])];
};
programs =
{
nix-index-database.comma.enable = true;
@@ -44,8 +56,13 @@ inputs:
autojump.enable = true;
direnv = { enable = true; nix-direnv.enable = true; };
mosh.enable = true;
yazi.enable = true;
};
services =
{
udev.packages = with inputs.pkgs; [ yubikey-personalization libfido2 ];
fwupd.enable = true;
};
services.udev.packages = with inputs.pkgs; [ yubikey-personalization libfido2 ];
home-manager = { useGlobalPkgs = true; useUserPackages = true; };
};
}

View File

@@ -1,6 +1,8 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
options.nixos.packages.ssh = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = {}; };
config = let inherit (inputs.config.nixos.packages) ssh; in inputs.lib.mkIf (ssh != null)
{
services.openssh.knownHosts =
let servers =
@@ -48,7 +50,7 @@ inputs:
surface =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIFdm3DcfHdcLP0oSpVrWwIZ/b9lZuakBSPwCFz2BdTJ7";
hostnames = [ "192.168.1.166" "wireguard.surface.chn.moe" "192.168.83.5" ];
hostnames = [ "192.168.1.4" "wireguard.surface.chn.moe" "192.168.83.5" ];
};
pc =
{

View File

@@ -1,6 +1,11 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop-extra" inputs.config.nixos.packages._packageSets)
options.nixos.packages.steam = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule {});
default = if inputs.config.nixos.system.gui.enable then {} else null;
};
config = let inherit (inputs.config.nixos.packages) steam; in inputs.lib.mkIf (steam != null)
{
programs.steam =
{
@@ -15,6 +20,12 @@ inputs:
'';
});
});
extraPackages = [ inputs.pkgs.openssl_1_1 ];
extraCompatPackages = [ inputs.pkgs.proton-ge-bin ];
remotePlay.openFirewall = true;
protontricks.enable = true;
localNetworkGameTransfers.openFirewall = true;
dedicatedServer.openFirewall = true;
};
};
}

View File

@@ -1,8 +1,14 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "workstation" inputs.config.nixos.packages._packageSets)
options.nixos.packages.vasp = let inherit (inputs.lib) mkOption types; in mkOption
{
nixos.packages._packages = inputs.lib.optionals (inputs.config.nixos.system.nixpkgs.march != null)
type = types.nullOr (types.submodule {});
default = if inputs.config.nixos.system.gui.enable then {} else null;
};
# TODO: add more options to correctly configure VASP
config = let inherit (inputs.config.nixos.packages) vasp; in inputs.lib.mkIf (vasp != null)
{
nixos.packages.packages._packages = inputs.lib.optionals (inputs.config.nixos.system.nixpkgs.march != null)
(with inputs.pkgs.localPackages.vasp; [ intel nvidia vtstscripts ]);
};
}

View File

@@ -1,6 +1,8 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
options.nixos.packages.vim = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = {}; };
config = let inherit (inputs.config.nixos.packages) vim; in inputs.lib.mkIf (vim != null)
{
nixos.user.sharedModules =
[{

View File

@@ -1,8 +1,13 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
options.nixos.packages.vscode = let inherit (inputs.lib) mkOption types; in mkOption
{
nixos.packages = with inputs.pkgs;
type = types.nullOr (types.submodule {});
default = if inputs.config.nixos.system.gui.enable then {} else null;
};
config = let inherit (inputs.config.nixos.packages) vscode; in inputs.lib.mkIf (vscode != null)
{
nixos.packages.packages = with inputs.pkgs;
{
_packages =
[(

View File

@@ -1,62 +0,0 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "workstation" inputs.config.nixos.packages._packageSets)
{
nixos =
{
packages = with inputs.pkgs;
{
_packages =
[
# password and key management
electrum jabref
# system management
wl-mirror nvtopPackages.full
# nix tools
nix-template nil pnpm-lock-export bundix
# instant messager
cinny-desktop nheko # qq nur-xddxdd.wechat-uos
# development
jetbrains.clion android-studio dbeaver-bin cling fprettify aircrack-ng
# install per project
# clang-tools_16 ccls
# media
nur-xddxdd.svp
# virtualization
wineWowPackages.stagingFull virt-viewer bottles # wine64
# text editor
appflowy notion-app-enhanced joplin-desktop standardnotes logseq
# math, physics and chemistry
(mathematica.overrideAttrs (prev: { postInstall = prev.postInstall or "" + "ln -s ${src} $out/src"; }))
(quantum-espresso.override { stdenv = gcc14Stdenv; gfortran = gfortran14; })
jmol mpi
# encryption and password management
john crunch hashcat
# container and vm
genymotion davinci-resolve playonlinux
# browser
microsoft-edge
# news
rssguard newsflash newsboat
] ++ inputs.lib.optional (inputs.config.nixos.system.nixpkgs.march != null) localPackages.mumax;
_pythonPackages = [(pythonPackages: with pythonPackages;
[
phonopy tensorflow keras scipy scikit-learn jupyterlab autograd # localPackages.pix2tex
])];
};
user.sharedModules =
[{
config.programs.obs-studio =
{
enable = true;
plugins = with inputs.pkgs.obs-studio-plugins; [ wlrobs obs-vaapi obs-nvfbc droidcam-obs obs-vkcapture ];
};
}];
};
programs =
{
anime-game-launcher = { enable = true; package = inputs.pkgs.anime-game-launcher; };
honkers-railway-launcher = { enable = true; package = inputs.pkgs.honkers-railway-launcher; };
};
};
}

View File

@@ -1,6 +1,8 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
options.nixos.packages.zsh = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = {}; };
config = let inherit (inputs.config.nixos.packages) zsh; in inputs.lib.mkIf (zsh != null)
{
nixos.user.sharedModules = [(home-inputs: { config.programs =
{
@@ -37,11 +39,7 @@ inputs:
name = "powerlevel10k";
src = "${inputs.pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k";
}
{
file = "p10k.zsh";
name = "powerlevel10k-config";
src = ./p10k-config;
}
{ file = "p10k.zsh"; name = "powerlevel10k-config"; src = ./p10k-config; }
{
name = "zsh-lsd";
src = inputs.pkgs.fetchFromGitHub
@@ -71,10 +69,7 @@ inputs:
autosuggestions.enable = true;
enableCompletion = true;
ohMyZsh =
{
enable = true;
plugins = [ "git" "colored-man-pages" "extract" "history-substring-search" "autojump" ];
};
{ enable = true; plugins = [ "git" "colored-man-pages" "extract" "history-substring-search" "autojump" ]; };
};
};
}

View File

@@ -42,36 +42,23 @@ inputs:
secretFile = inputs.config.sops.templates."nextcloud/secret".path;
extraApps =
let
githubRelease = repo: file: "https://github.com/${repo}/releases/download/${file}";
in
{
# nix-prefetch-url --unpack
maps = inputs.pkgs.fetchNextcloudApp
version = inputs.lib.versions.major inputs.config.services.nextcloud.package.version;
info = builtins.fromJSON (builtins.readFile "${inputs.topInputs.nc4nix}/${version}.json");
getInfo = package:
{
url = githubRelease "nextcloud/maps" "v1.4.0/maps-1.4.0.tar.gz";
sha256 = "1gqms3rrdpjmpb1h5d72b4lwbvsl8p10zwnkhgnsmvfcf93h3r1c";
license = "agpl3Only";
inherit (info.${package}) hash url description homepage;
appName = package;
appVersion = info.${package}.version;
license =
let
licenses = { agpl = "agpl3Only"; };
originalLincense = builtins.head info.${package}.licenses;
in licenses.${originalLincense} or originalLincense;
};
phonetrack = inputs.pkgs.fetchNextcloudApp
{
url = githubRelease "julien-nc/phonetrack" "v0.8.1/phonetrack-0.8.1.tar.gz";
sha256 = "1i28xgzp85yb44ay2l2zw18fk00yd6fh6yddj92gdrljb3w9zpap";
license = "agpl3Only";
};
twofactor_webauthn = inputs.pkgs.fetchNextcloudApp
{
url = githubRelease "nextcloud-releases/twofactor_webauthn" "v1.4.0/twofactor_webauthn-v1.4.0.tar.gz";
sha256 = "0llxakzcdcy9hscyzw3na5zp1p57h03w5fmm0gs9g62k1b88k6kw";
license = "agpl3Only";
};
calendar = inputs.pkgs.fetchNextcloudApp
{
url = githubRelease "nextcloud-releases/calendar" "v4.7.6/calendar-v4.7.6.tar.gz";
sha256 = "09rsp5anpaqzwmrixza5qh12vmq9hd3an045064vm3rnynz537qc";
license = "agpl3Only";
};
};
};
in builtins.listToAttrs (builtins.map
(package: { name = package; value = inputs.pkgs.fetchNextcloudApp (getInfo package); })
[ "maps" "phonetrack" "twofactor_webauthn" "calendar" ]);
};
nixos.services =
{
postgresql.instances.nextcloud = {};

View File

@@ -3,7 +3,7 @@ inputs:
options.nixos.services.nixseparatedebuginfo = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule {});
default = if builtins.elem "desktop-extra" inputs.config.nixos.packages._packageSets then {} else null;
default = if inputs.config.nixos.system.gui.enable then {} else null;
};
config =
let inherit (inputs.config.nixos.services) nixseparatedebuginfo; in inputs.lib.mkIf (nixseparatedebuginfo != {})

View File

@@ -11,6 +11,7 @@ inputs:
{ enable = true; package = inputs.pkgs.genericPackages.open-webui; environment.WEBUI_AUTH = "False"; };
nextjs-ollama-llm-ui.enable = true;
};
nixos.packages._packages = [ inputs.pkgs.oterm ];
# TODO: broken in python 3.12
# nixos.packages._packages = [ inputs.pkgs.oterm ];
};
}

View File

@@ -116,7 +116,7 @@ inputs:
};
nixos =
{
packages._packages = [(inputs.pkgs.localPackages.sbatch-tui.override { sbatchConfig =
packages.packages._packages = [(inputs.pkgs.localPackages.sbatch-tui.override { sbatchConfig =
{
cpuMpiThreads = slurm.cpu.mpiThreads;
cpuOpenmpThreads = slurm.cpu.openmpThreads;

View File

@@ -5,33 +5,25 @@ inputs:
enable = mkOption { type = types.bool; default = false; };
configs = mkOption { type = types.attrsOf types.nonEmptyStr; default.persistent = "/nix/persistent"; };
};
config =
let
inherit (inputs.lib) mkMerge mkIf;
inherit (inputs.localLib) stripeTabs attrsToList;
inherit (inputs.config.nixos) services;
inherit (builtins) map listToAttrs toString;
in mkIf services.snapper.enable
{
services.snapper.configs =
let
f = (config:
{
inherit (config) name;
value =
{
SUBVOLUME = config.value;
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
TIMELINE_MIN_AGE = 1800;
TIMELINE_LIMIT_HOURLY = "10";
TIMELINE_LIMIT_DAILY = "7";
TIMELINE_LIMIT_WEEKLY = "1";
TIMELINE_LIMIT_MONTHLY = "0";
TIMELINE_LIMIT_YEARLY = "0";
};
});
in
listToAttrs (map f (attrsToList services.snapper.configs));
};
config = let inherit (inputs.config.nixos.services) snapper; in inputs.lib.mkIf snapper.enable
{
services.snapper.configs = builtins.listToAttrs (builtins.map
(config:
{
inherit (config) name;
value =
{
SUBVOLUME = config.value;
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
TIMELINE_MIN_AGE = 1800;
TIMELINE_LIMIT_HOURLY = 10;
TIMELINE_LIMIT_DAILY = 7;
TIMELINE_LIMIT_WEEKLY = 1;
TIMELINE_LIMIT_MONTHLY = 0;
TIMELINE_LIMIT_YEARLY = 0;
};
})
(inputs.localLib.attrsToList snapper.configs));
};
}

View File

@@ -0,0 +1,38 @@
inputs:
{
options.nixos.services.writefreely = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule (submoduleInputs: { options =
{
hostname = mkOption { type = types.nonEmptyStr; default = "write.chn.moe"; };
};}));
default = null;
};
config = let inherit (inputs.config.nixos.services) writefreely; in inputs.lib.mkIf (writefreely != null)
{
services.writefreely =
{
enable = true;
settings = { server.port = 7264; app = { host = "https://${writefreely.hostname}"; federation = true; }; };
host = writefreely.hostname;
database = { type = "mysql"; passwordFile = inputs.config.sops.secrets."writefreely/mariadb".path; };
admin = { name = "chn"; initialPasswordFile = inputs.config.sops.secrets."writefreely/chn".path; };
};
systemd.services = { writefreely.after = [ "mysql.service" ]; writefreely-mysql-init.after = [ "mysql.service" ]; };
sops.secrets =
{
"writefreely/chn".owner = "writefreely";
"writefreely/mariadb" = { owner = "writefreely"; key = "mariadb/writefreely"; };
};
nixos.services =
{
mariadb.instances.writefreely = {};
nginx =
{
enable = true;
https.${writefreely.hostname}.location."/".proxy.upstream =
"http://127.0.0.1:${builtins.toString inputs.config.services.writefreely.settings.server.port}";
};
};
};
}

View File

@@ -1,10 +1,8 @@
inputs:
{
options.nixos.system.binfmt = let inherit (inputs.lib) mkOption types; in
{
enable = mkOption { type = types.bool; default = inputs.config.nixos.packages.packageSet == "workstation"; };
};
config = inputs.lib.mkIf inputs.config.nixos.system.binfmt.enable
options.nixos.system.binfmt = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = null; };
config = let inherit (inputs.config.nixos.system) binfmt; in inputs.lib.mkIf (binfmt != null)
{
programs.java = { enable = true; binfmt = true; };
boot.binfmt.emulatedSystems = [ "aarch64-linux" "x86_64-windows" ];

View File

@@ -4,7 +4,6 @@ inputs:
{
catppuccin.flavor = "latte";
console.catppuccin.enable = true;
boot.loader.grub.catppuccin.enable = true;
nixos.user.sharedModules =
[{
config =

View File

@@ -8,7 +8,8 @@ inputs:
dbus.implementation = "broker";
fstrim.enable = true;
acpid.enable = true;
kubo = { enable = true; autoMount = true; };
# TODO: set ipfs as separate service
# kubo = { enable = true; autoMount = true; };
};
time.timeZone = "Asia/Shanghai";
boot =
@@ -43,8 +44,7 @@ inputs:
};
# pathsToLink = [ "/include" ];
};
i18n =
{ defaultLocale = "C.UTF-8"; supportedLocales = [ "zh_CN.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" "C.UTF-8/UTF-8" ]; };
i18n = { defaultLocale = "C.UTF-8"; supportedLocales = [ "all" ]; };
users.mutableUsers = false;
virtualisation.oci-containers.backend = "docker";
home-manager.sharedModules = [{ home.stateVersion = "22.11"; }];

View File

@@ -1,10 +1,7 @@
inputs:
{
options.nixos.system.envfs = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule {});
default = if inputs.config.nixos.packages.packageSet == "workstation" then {} else null;
};
{ type = types.nullOr (types.submodule {}); default = null; };
config = let inherit (inputs.config.nixos.system) envfs; in inputs.lib.mkIf (envfs != null) (inputs.lib.mkMerge
[
(builtins.elemAt inputs.topInputs.envfs.nixosModules.envfs.imports 0 inputs)

View File

@@ -214,7 +214,7 @@ inputs:
else
{
resumeDevice = fileSystems.resume.device;
kernelModules = [ "resume_offset=${fileSystems.resume.offset}" ];
kernelModules = [ "resume_offset=${builtins.toString fileSystems.resume.offset}" ];
}
);}
)

View File

@@ -5,7 +5,7 @@ inputs:
timeout = mkOption { type = types.int; default = 5; };
windowsEntries = mkOption { type = types.attrsOf types.nonEmptyStr; default = {}; };
# "efi" using efi, "efiRemovable" using efi with install grub removable, or dev path like "/dev/sda" using bios
installDevice = mkOption { type = types.str; };
installDevice = mkOption { type = types.str; default = "efi"; };
};
config = let inherit (inputs.config.nixos.system) grub; in inputs.lib.mkMerge
[
@@ -23,11 +23,7 @@ inputs:
efiSupport = builtins.elem grub.installDevice [ "efi" "efiRemovable" ];
efiInstallAsRemovable = grub.installDevice == "efiRemovable";
};
efi =
{
canTouchEfiVariables = grub.installDevice == "efi";
efiSysMountPoint = inputs.lib.mkIf (builtins.elem grub.installDevice [ "efi" "efiRemovable" ]) "/boot/efi";
};
efi.canTouchEfiVariables = grub.installDevice == "efi";
};
}
# extra grub entries
@@ -36,7 +32,7 @@ inputs:
{
memtest86.enable = inputs.lib.mkIf (inputs.config.nixos.system.nixpkgs.arch == "x86_64") true;
extraFiles = inputs.lib.mkIf (builtins.elem grub.installDevice [ "efi" "efiRemovable" ])
{ "shell.efi" = "${inputs.pkgs.edk2-uefi-shell}/shell.efi"; };
{ "shell.efi" = "${inputs.pkgs.genericPackages.edk2-uefi-shell}/shell.efi"; };
extraEntries = inputs.lib.mkMerge (builtins.concatLists
[
(builtins.map

View File

@@ -5,24 +5,27 @@ inputs:
enable = mkOption { type = types.bool; default = false; };
preferred = mkOption { type = types.bool; default = inputs.config.nixos.system.gui.enable; };
autoStart = mkOption { type = types.bool; default = inputs.config.nixos.system.gui.preferred; };
touchscreen = mkOption { type = types.bool; default = false; };
};
config = let inherit (inputs.config.nixos.system) gui; in inputs.lib.mkIf gui.enable
{
services =
{
displayManager =
{ sddm = { enable = true; wayland.enable = true; theme = "breeze"; }; defaultSession = "plasma"; };
{
sddm = { enable = inputs.lib.mkDefault true; wayland.enable = true; theme = "breeze"; };
defaultSession = "plasma";
};
desktopManager.plasma6.enable = true;
xserver.enable = true;
};
systemd.services.display-manager.enable = gui.autoStart;
systemd.services.display-manager.enable = inputs.lib.mkDefault gui.autoStart;
environment =
{
sessionVariables =
{
GTK_USE_PORTAL = "1";
NIXOS_OZONE_WL = inputs.lib.mkIf gui.preferred "1";
KWIN_DRM_DISABLE_TRIPLE_BUFFERING = "1";
};
plasma6.excludePackages = inputs.lib.mkIf (!gui.preferred) [ inputs.pkgs.kdePackages.plasma-nm ];
persistence = let inherit (inputs.config.nixos.system) impermanence; in inputs.lib.mkIf impermanence.enable
@@ -34,10 +37,15 @@ inputs:
xdg.portal.extraPortals = builtins.map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "wlr" ];
i18n.inputMethod =
{
enabled = "fcitx5";
fcitx5.addons = builtins.map (p: inputs.pkgs."fcitx5-${p}")
[ "rime" "chinese-addons" "mozc" "nord" "material-color" ];
enable = true;
type = "fcitx5";
fcitx5.addons = (builtins.map (p: inputs.pkgs."fcitx5-${p}")
[ "rime" "chinese-addons" "mozc" "nord" "material-color" ])
++ inputs.lib.mkIf gui.touchscreen (inputs.pkgs.localPackages.fcitx5-virtualkeyboard-ui);
};
programs.dconf.enable = true;
nixpkgs.overlays = inputs.lib.mkIf gui.touchscreen
[(final: prev: { fcitx5 = prev.fcitx5.overrideAttrs (prev:
{ patches = prev.patches or [] ++ [ ./fcitx5.patch ]; });})];
};
}

View File

@@ -0,0 +1,248 @@
From 5662218e904bc245c47ce4b33f04c2e3a74c7d92 Mon Sep 17 00:00:00 2001
From: Daijiro Fukuda <fukuda@clear-code.com>
Date: Mon, 28 Feb 2022 15:08:40 +0900
Subject: [PATCH 1/3] Add simple group enumerating function for addons (#452)
---
src/lib/fcitx/inputmethodmanager.cpp | 22 ++++++++++++++++++++++
src/lib/fcitx/inputmethodmanager.h | 3 +++
2 files changed, 25 insertions(+)
diff --git a/src/lib/fcitx/inputmethodmanager.cpp b/src/lib/fcitx/inputmethodmanager.cpp
index 6e842ee07..e2e0d6184 100644
--- a/src/lib/fcitx/inputmethodmanager.cpp
+++ b/src/lib/fcitx/inputmethodmanager.cpp
@@ -276,6 +276,28 @@ const InputMethodGroup &InputMethodManager::currentGroup() const {
return d->groups_.find(d->groupOrder_.front())->second;
}
+void InputMethodManager::enumerateGroup(bool forward) {
+ FCITX_D();
+ if (groupCount() < 2) {
+ return;
+ }
+ emit<InputMethodManager::CurrentGroupAboutToChange>(d->groupOrder_.front());
+ if (forward) {
+ d->groupOrder_.splice(
+ d->groupOrder_.end(),
+ d->groupOrder_,
+ d->groupOrder_.begin()
+ );
+ } else {
+ d->groupOrder_.splice(
+ d->groupOrder_.begin(),
+ d->groupOrder_,
+ std::prev(d->groupOrder_.end())
+ );
+ }
+ emit<InputMethodManager::CurrentGroupChanged>(d->groupOrder_.front());
+}
+
void InputMethodManager::setDefaultInputMethod(const std::string &name) {
FCITX_D();
auto &currentGroup = d->groups_.find(d->groupOrder_.front())->second;
diff --git a/src/lib/fcitx/inputmethodmanager.h b/src/lib/fcitx/inputmethodmanager.h
index 0069c4108..0be42630d 100644
--- a/src/lib/fcitx/inputmethodmanager.h
+++ b/src/lib/fcitx/inputmethodmanager.h
@@ -84,6 +84,9 @@ class FCITXCORE_EXPORT InputMethodManager : public ConnectableObject {
/// Return the current group.
const InputMethodGroup &currentGroup() const;
+ /// Simply enumerate input method groups.
+ void enumerateGroup(bool forward);
+
/**
* Set default input method for current group.
*
From 3891b04380a5dd36b48af753b85c81472e6c03a4 Mon Sep 17 00:00:00 2001
From: Takuro Ashie <ashie@clear-code.com>
Date: Mon, 7 Mar 2022 12:09:34 +0900
Subject: [PATCH 2/3] Make sure to show UI on activate
---
src/frontend/waylandim/waylandimserver.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/frontend/waylandim/waylandimserver.cpp b/src/frontend/waylandim/waylandimserver.cpp
index 58a4b713f..abbe3d8a4 100644
--- a/src/frontend/waylandim/waylandimserver.cpp
+++ b/src/frontend/waylandim/waylandimserver.cpp
@@ -168,6 +168,7 @@ void WaylandIMInputContextV1::activate(wayland::ZwpInputMethodContextV1 *ic) {
ic_->modifiersMap(&array);
wl_array_release(&array);
focusIn();
+ updateUserInterface(UserInterfaceComponent::InputPanel);
}
void WaylandIMInputContextV1::deactivate(wayland::ZwpInputMethodContextV1 *ic) {
From 861f59bd40916936daeac796fc74844a43f11aaa Mon Sep 17 00:00:00 2001
From: daipom <fukuda@clear-code.com>
Date: Fri, 14 Jan 2022 11:24:42 +0900
Subject: [PATCH 3/3] Add function to handle virtual key events to InputContext
We can use `InputContext::virtualKeyEvent` to handle KeyEvents the same
way as physical key events.
---
src/frontend/waylandim/waylandimserver.cpp | 41 +++++++++++++++++++---
src/frontend/waylandim/waylandimserver.h | 2 ++
src/lib/fcitx/inputcontext.cpp | 18 ++++++++++
src/lib/fcitx/inputcontext.h | 13 +++++++
4 files changed, 70 insertions(+), 4 deletions(-)
diff --git a/src/frontend/waylandim/waylandimserver.cpp b/src/frontend/waylandim/waylandimserver.cpp
index abbe3d8a4..87bd3da33 100644
--- a/src/frontend/waylandim/waylandimserver.cpp
+++ b/src/frontend/waylandim/waylandimserver.cpp
@@ -413,13 +413,44 @@ void WaylandIMInputContextV1::keyCallback(uint32_t serial, uint32_t time,
server_->modifiers_, code),
state == WL_KEYBOARD_KEY_STATE_RELEASED, time);
- if (state == WL_KEYBOARD_KEY_STATE_RELEASED && key == repeatKey_) {
+ processKeyEvent(event, false, serial);
+}
+
+void WaylandIMInputContextV1::virtualKeyEventImpl(KeyEvent &event) {
+ // `mods_locked` value seems to be 16 usually.
+ // It will be 18 with the capslocked state,
+ // but we don't have to consider about it in virtual key process.
+ if (event.rawKey().hasModifier()) {
+ if (event.rawKey().states().test(KeyState::Shift)) {
+ modifiersCallback(serial_, (uint32_t)KeyState::Shift, 0, 16, 0);
+ }
+ } else {
+ modifiersCallback(serial_, 0, 0, 16, 0);
+ }
+
+ processKeyEvent(event, true, serial_);
+}
+
+void WaylandIMInputContextV1::processKeyEvent(KeyEvent &event,
+ bool isVirtualKey,
+ uint32_t serial) {
+ const uint32_t key = event.rawKey().code() > 8 ? event.rawKey().code() - 8
+ : 0;
+ const auto state = event.isRelease() ? WL_KEYBOARD_KEY_STATE_RELEASED
+ : WL_KEYBOARD_KEY_STATE_PRESSED;
+
+ const auto cancelRepeat = isVirtualKey
+ ? (state == WL_KEYBOARD_KEY_STATE_RELEASED)
+ // Strict condition for physical keys.
+ : (state == WL_KEYBOARD_KEY_STATE_RELEASED && key == repeatKey_);
+
+ if (cancelRepeat) {
timeEvent_->setEnabled(false);
} else if (state == WL_KEYBOARD_KEY_STATE_PRESSED &&
- xkb_keymap_key_repeats(server_->keymap_.get(), code)) {
+ xkb_keymap_key_repeats(server_->keymap_.get(), event.rawKey().code())) {
if (repeatRate_) {
repeatKey_ = key;
- repeatTime_ = time;
+ repeatTime_ = event.time();
repeatSym_ = event.rawKey().sym();
// Let's trick the key event system by fake our first.
// Remove 100 from the initial interval.
@@ -430,11 +461,13 @@ void WaylandIMInputContextV1::keyCallback(uint32_t serial, uint32_t time,
WAYLANDIM_DEBUG() << event.key().toString()
<< " IsRelease=" << event.isRelease();
+
if (!keyEvent(event)) {
- ic_->key(serial, time, key, state);
+ ic_->key(serial, event.time(), key, state);
}
server_->display_->flush();
}
+
void WaylandIMInputContextV1::modifiersCallback(uint32_t serial,
uint32_t mods_depressed,
uint32_t mods_latched,
diff --git a/src/frontend/waylandim/waylandimserver.h b/src/frontend/waylandim/waylandimserver.h
index 1ffed14db..3b7871a2f 100644
--- a/src/frontend/waylandim/waylandimserver.h
+++ b/src/frontend/waylandim/waylandimserver.h
@@ -84,6 +84,7 @@ class WaylandIMInputContextV1 : public InputContext {
void deactivate(wayland::ZwpInputMethodContextV1 *id);
protected:
+ void virtualKeyEventImpl(KeyEvent &event) override;
void commitStringImpl(const std::string &text) override {
if (!ic_) {
return;
@@ -120,6 +121,7 @@ class WaylandIMInputContextV1 : public InputContext {
void keymapCallback(uint32_t format, int32_t fd, uint32_t size);
void keyCallback(uint32_t serial, uint32_t time, uint32_t key,
uint32_t state);
+ void processKeyEvent(KeyEvent &event, bool isVirtualKey, uint32_t serial);
void modifiersCallback(uint32_t serial, uint32_t mods_depressed,
uint32_t mods_latched, uint32_t mods_locked,
uint32_t group);
diff --git a/src/lib/fcitx/inputcontext.cpp b/src/lib/fcitx/inputcontext.cpp
index e6138036f..1fdc16358 100644
--- a/src/lib/fcitx/inputcontext.cpp
+++ b/src/lib/fcitx/inputcontext.cpp
@@ -243,6 +243,19 @@ bool InputContext::keyEvent(KeyEvent &event) {
return result;
}
+void InputContext::virtualKeyEvent(KeyEvent &event) {
+ decltype(std::chrono::steady_clock::now()) start;
+ // Don't query time if we don't want log.
+ if (::keyTrace().checkLogLevel(LogLevel::Debug)) {
+ start = std::chrono::steady_clock::now();
+ }
+ virtualKeyEventImpl(event);
+ FCITX_KEYTRACE() << "KeyEvent handling time: "
+ << std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::steady_clock::now() - start)
+ .count();
+}
+
void InputContext::invokeAction(InvokeActionEvent &event) {
FCITX_D();
RETURN_IF_HAS_NO_FOCUS();
@@ -333,6 +346,11 @@ StatusArea &InputContext::statusArea() {
return d->statusArea_;
}
+void InputContext::virtualKeyEventImpl(KeyEvent &event) {
+ FCITX_D();
+ d->postEvent(event);
+}
+
void InputContext::updateClientSideUIImpl() {}
InputContextEventBlocker::InputContextEventBlocker(InputContext *inputContext)
diff --git a/src/lib/fcitx/inputcontext.h b/src/lib/fcitx/inputcontext.h
index 58363b506..8e56f7628 100644
--- a/src/lib/fcitx/inputcontext.h
+++ b/src/lib/fcitx/inputcontext.h
@@ -133,6 +133,10 @@ class FCITXCORE_EXPORT InputContext : public TrackableObject<InputContext> {
/// Send a key event to current input context.
bool keyEvent(KeyEvent &event);
+ /// Send a virtual key event to current input context.
+ /// This handles the event the same way as physical key events.
+ void virtualKeyEvent(KeyEvent &event);
+
/// Returns whether the input context holds the input focus. Input context
/// need to have focus.
bool hasFocus() const;
@@ -253,6 +257,15 @@ class FCITXCORE_EXPORT InputContext : public TrackableObject<InputContext> {
void updateProperty(const InputContextPropertyFactory *factory);
protected:
+ /**
+ * Process the virtual key event.
+ *
+ * @param event KeyEvent
+ *
+ * @see virtualKeyEvent
+ */
+ virtual void virtualKeyEventImpl(KeyEvent &event);
+
/**
* Send the committed string to client
*

View File

@@ -11,6 +11,7 @@ inputs:
default = [ "/nix/persistent/etc/ssh/initrd_ssh_host_ed25519_key" ];
};
};
unl0kr = mkOption { type = types.nullOr (types.submodule {}); default = null; };
};
config = let inherit (inputs.config.nixos.system) initrd; in inputs.lib.mkMerge
[
@@ -36,5 +37,6 @@ inputs:
};
}
)
(inputs.lib.mkIf (initrd.unl0kr != null) { boot.initrd.unl0kr.enable = true; })
];
}

View File

@@ -0,0 +1,47 @@
From 123c4d46272b7e72d7db3fe8b4131a8cc99613fb Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Wed, 14 Aug 2024 10:28:24 -0400
Subject: [PATCH] drm/amdgpu/sdma5.2: limit wptr workaround to sdma 5.2.1
The workaround seems to cause stability issues on other
SDMA 5.2.x IPs.
Fixes: a03ebf116303 ("drm/amdgpu/sdma5.2: Update wptr registers as well as doorbell")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3556
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index d740255edf5a..bc9b240a3488 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -225,14 +225,16 @@ static void sdma_v5_2_ring_set_wptr(struct amdgpu_ring *ring)
DRM_DEBUG("calling WDOORBELL64(0x%08x, 0x%016llx)\n",
ring->doorbell_index, ring->wptr << 2);
WDOORBELL64(ring->doorbell_index, ring->wptr << 2);
- /* SDMA seems to miss doorbells sometimes when powergating kicks in.
- * Updating the wptr directly will wake it. This is only safe because
- * we disallow gfxoff in begin_use() and then allow it again in end_use().
- */
- WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR),
- lower_32_bits(ring->wptr << 2));
- WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI),
- upper_32_bits(ring->wptr << 2));
+ if (amdgpu_ip_version(adev, SDMA0_HWIP, 0) == IP_VERSION(5, 2, 1)) {
+ /* SDMA seems to miss doorbells sometimes when powergating kicks in.
+ * Updating the wptr directly will wake it. This is only safe because
+ * we disallow gfxoff in begin_use() and then allow it again in end_use().
+ */
+ WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR),
+ lower_32_bits(ring->wptr << 2));
+ WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI),
+ upper_32_bits(ring->wptr << 2));
+ }
} else {
DRM_DEBUG("Not using doorbell -- "
"mmSDMA%i_GFX_RB_WPTR == 0x%08x "
--
2.46.0

View File

@@ -0,0 +1,141 @@
From ae1e766f623f7a2a889a0b09eb076dd9a60efbe9 Mon Sep 17 00:00:00 2001
From: Filipe Manana <fdmanana@suse.com>
Date: Sun, 11 Aug 2024 11:53:42 +0100
Subject: btrfs: only run the extent map shrinker from kswapd tasks
Currently the extent map shrinker can be run by any task when attempting
to allocate memory and there's enough memory pressure to trigger it.
To avoid too much latency we stop iterating over extent maps and removing
them once the task needs to reschedule. This logic was introduced in commit
b3ebb9b7e92a ("btrfs: stop extent map shrinker if reschedule is needed").
While that solved high latency problems for some use cases, it's still
not enough because with a too high number of tasks entering the extent map
shrinker code, either due to memory allocations or because they are a
kswapd task, we end up having a very high level of contention on some
spin locks, namely:
1) The fs_info->fs_roots_radix_lock spin lock, which we need to find
roots to iterate over their inodes;
2) The spin lock of the xarray used to track open inodes for a root
(struct btrfs_root::inodes) - on 6.10 kernels and below, it used to
be a red black tree and the spin lock was root->inode_lock;
3) The fs_info->delayed_iput_lock spin lock since the shrinker adds
delayed iputs (calls btrfs_add_delayed_iput()).
Instead of allowing the extent map shrinker to be run by any task, make
it run only by kswapd tasks. This still solves the problem of running
into OOM situations due to an unbounded extent map creation, which is
simple to trigger by direct IO writes, as described in the changelog
of commit 956a17d9d050 ("btrfs: add a shrinker for extent maps"), and
by a similar case when doing buffered IO on files with a very large
number of holes (keeping the file open and creating many holes, whose
extent maps are only released when the file is closed).
Reported-by: kzd <kzd@56709.net>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219121
Reported-by: Octavia Togami <octavia.togami@gmail.com>
Link: https://lore.kernel.org/linux-btrfs/CAHPNGSSt-a4ZZWrtJdVyYnJFscFjP9S7rMcvEMaNSpR556DdLA@mail.gmail.com/
Fixes: 956a17d9d050 ("btrfs: add a shrinker for extent maps")
CC: stable@vger.kernel.org # 6.10+
Tested-by: kzd <kzd@56709.net>
Tested-by: Octavia Togami <octavia.togami@gmail.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/extent_map.c | 22 ++++++----------------
fs/btrfs/super.c | 10 ++++++++++
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 23b65dc73c0048..10ac5f657e3889 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -1147,8 +1147,7 @@ static long btrfs_scan_inode(struct btrfs_inode *inode, struct btrfs_em_shrink_c
return 0;
/*
- * We want to be fast because we can be called from any path trying to
- * allocate memory, so if the lock is busy we don't want to spend time
+ * We want to be fast so if the lock is busy we don't want to spend time
* waiting for it - either some task is about to do IO for the inode or
* we may have another task shrinking extent maps, here in this code, so
* skip this inode.
@@ -1191,9 +1190,7 @@ next:
/*
* Stop if we need to reschedule or there's contention on the
* lock. This is to avoid slowing other tasks trying to take the
- * lock and because the shrinker might be called during a memory
- * allocation path and we want to avoid taking a very long time
- * and slowing down all sorts of tasks.
+ * lock.
*/
if (need_resched() || rwlock_needbreak(&tree->lock))
break;
@@ -1222,12 +1219,7 @@ static long btrfs_scan_root(struct btrfs_root *root, struct btrfs_em_shrink_ctx
if (ctx->scanned >= ctx->nr_to_scan)
break;
- /*
- * We may be called from memory allocation paths, so we don't
- * want to take too much time and slowdown tasks.
- */
- if (need_resched())
- break;
+ cond_resched();
inode = btrfs_find_first_inode(root, min_ino);
}
@@ -1285,14 +1277,12 @@ long btrfs_free_extent_maps(struct btrfs_fs_info *fs_info, long nr_to_scan)
ctx.last_ino);
}
- /*
- * We may be called from memory allocation paths, so we don't want to
- * take too much time and slowdown tasks, so stop if we need reschedule.
- */
- while (ctx.scanned < ctx.nr_to_scan && !need_resched()) {
+ while (ctx.scanned < ctx.nr_to_scan) {
struct btrfs_root *root;
unsigned long count;
+ cond_resched();
+
spin_lock(&fs_info->fs_roots_radix_lock);
count = radix_tree_gang_lookup(&fs_info->fs_roots_radix,
(void **)&root,
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 83478deada3bd2..11044e9e2cb110 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -28,6 +28,7 @@
#include <linux/btrfs.h>
#include <linux/security.h>
#include <linux/fs_parser.h>
+#include <linux/swap.h>
#include "messages.h"
#include "delayed-inode.h"
#include "ctree.h"
@@ -2409,6 +2410,15 @@ static long btrfs_free_cached_objects(struct super_block *sb, struct shrink_cont
const long nr_to_scan = min_t(unsigned long, LONG_MAX, sc->nr_to_scan);
struct btrfs_fs_info *fs_info = btrfs_sb(sb);
+ /*
+ * We may be called from any task trying to allocate memory and we don't
+ * want to slow it down with scanning and dropping extent maps. It would
+ * also cause heavy lock contention if many tasks concurrently enter
+ * here. Therefore only allow kswapd tasks to scan and drop extent maps.
+ */
+ if (!current_is_kswapd())
+ return 0;
+
return btrfs_free_extent_maps(fs_info, nr_to_scan);
}
--
cgit 1.2.3-korg

View File

@@ -4,10 +4,10 @@ inputs:
{
variant = mkOption
{
type = types.enum [ "nixos" "xanmod-lts" "xanmod-latest" "cachyos" "cachyos-lto" "cachyos-server" ];
type = types.enum [ "nixos" "xanmod-lts" "xanmod-latest" "cachyos" "cachyos-lto" "cachyos-server" "zen" ];
default = "xanmod-latest";
};
patches = mkOption { type = types.listOf types.nonEmptyStr; default = [ "cjktty" ]; };
patches = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
modules =
{
install = mkOption { type = types.listOf types.str; default = []; };
@@ -47,6 +47,7 @@ inputs:
cachyos-lto = inputs.pkgs.linuxPackages_cachyos-lto;
cachyos-server = inputs.pkgs.linuxPackages_cachyos-server;
rpi3 = inputs.pkgs.linuxPackages_rpi3;
zen = inputs.pkgs.linuxPackages_zen;
}.${kernel.variant};
kernelPatches =
let
@@ -127,17 +128,26 @@ inputs:
let version = inputs.lib.versions.majorMinor inputs.config.boot.kernelPackages.kernel.version;
in ./hibernate-progress-${version}.patch;
}];
amdgpu =
[{
name = "amdgpu";
patch = ./0001-drm-amdgpu-sdma5.2-limit-wptr-workaround-to-sdma-5.2.patch;
}];
# TODO: remove in 6.11
btrfs =
[{
name = "btrfs";
patch =
let version = inputs.lib.versions.majorMinor inputs.config.boot.kernelPackages.kernel.version;
in if version == "6.10" then ./btrfs.patch else null;
}];
};
in builtins.concatLists (builtins.map (name: patches.${name}) kernel.patches);
in builtins.concatLists (builtins.map (name: patches.${name}) (kernel.patches ++ [ "btrfs" ]));
};
}
(
inputs.lib.mkIf
(
inputs.lib.strings.hasPrefix "cachyos" kernel.variant
&& builtins.elem "server-extra" inputs.config.nixos.packages._packageSets
)
{ environment.systemPackages = [ inputs.pkgs.scx ]; }
inputs.lib.mkIf (inputs.lib.strings.hasPrefix "cachyos" kernel.variant)
{ nixos.packages.packages._packages = [ inputs.pkgs.scx ]; }
)
(
inputs.lib.mkIf (kernel.variant == "rpi3")

View File

@@ -0,0 +1,128 @@
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 5bc04bfe2db1..6e7b17b97de7 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -563,7 +563,7 @@ static int save_image(struct swap_map_handle *handle,
hib_init_batch(&hb);
- pr_info("Saving image data pages (%u pages)...\n",
+ pr_err("Saving image data pages (%u pages)...\n",
nr_to_write);
m = nr_to_write / 10;
if (!m)
@@ -578,7 +578,7 @@ static int save_image(struct swap_map_handle *handle,
if (ret)
break;
if (!(nr_pages % m))
- pr_info("Image saving progress: %3d%%\n",
+ pr_err("Image saving progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -588,7 +588,7 @@ static int save_image(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret)
- pr_info("Image saving done\n");
+ pr_err("Image saving done\n");
swsusp_show_speed(start, stop, nr_to_write, "Wrote");
return ret;
}
@@ -795,8 +795,8 @@ static int save_compressed_image(struct swap_map_handle *handle,
*/
handle->reqd_free_pages = reqd_free_pages();
- pr_info("Using %u thread(s) for %s compression\n", nr_threads, hib_comp_algo);
- pr_info("Compressing and saving image data (%u pages)...\n",
+ pr_err("Using %u thread(s) for %s compression\n", nr_threads, hib_comp_algo);
+ pr_err("Compressing and saving image data (%u pages)...\n",
nr_to_write);
m = nr_to_write / 10;
if (!m)
@@ -817,7 +817,7 @@ static int save_compressed_image(struct swap_map_handle *handle,
data_of(*snapshot), PAGE_SIZE);
if (!(nr_pages % m))
- pr_info("Image saving progress: %3d%%\n",
+ pr_err("Image saving progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -888,9 +888,9 @@ static int save_compressed_image(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret)
- pr_info("Image saving done\n");
+ pr_err("Image saving done\n");
swsusp_show_speed(start, stop, nr_to_write, "Wrote");
- pr_info("Image size after compression: %d kbytes\n",
+ pr_err("Image size after compression: %d kbytes\n",
(atomic_read(&compressed_size) / 1024));
out_clean:
@@ -1105,7 +1105,7 @@ static int load_image(struct swap_map_handle *handle,
hib_init_batch(&hb);
clean_pages_on_read = true;
- pr_info("Loading image data pages (%u pages)...\n", nr_to_read);
+ pr_err("Loading image data pages (%u pages)...\n", nr_to_read);
m = nr_to_read / 10;
if (!m)
m = 1;
@@ -1123,7 +1123,7 @@ static int load_image(struct swap_map_handle *handle,
if (ret)
break;
if (!(nr_pages % m))
- pr_info("Image loading progress: %3d%%\n",
+ pr_err("Image loading progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -1133,7 +1133,7 @@ static int load_image(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret) {
- pr_info("Image loading done\n");
+ pr_err("Image loading done\n");
ret = snapshot_write_finalize(snapshot);
if (!ret && !snapshot_image_loaded(snapshot))
ret = -ENODATA;
@@ -1328,8 +1328,8 @@ static int load_compressed_image(struct swap_map_handle *handle,
}
want = ring_size = i;
- pr_info("Using %u thread(s) for %s decompression\n", nr_threads, hib_comp_algo);
- pr_info("Loading and decompressing image data (%u pages)...\n",
+ pr_err("Using %u thread(s) for %s decompression\n", nr_threads, hib_comp_algo);
+ pr_err("Loading and decompressing image data (%u pages)...\n",
nr_to_read);
m = nr_to_read / 10;
if (!m)
@@ -1459,7 +1459,7 @@ static int load_compressed_image(struct swap_map_handle *handle,
data[thr].unc + off, PAGE_SIZE);
if (!(nr_pages % m))
- pr_info("Image loading progress: %3d%%\n",
+ pr_err("Image loading progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
@@ -1485,7 +1485,7 @@ static int load_compressed_image(struct swap_map_handle *handle,
}
stop = ktime_get();
if (!ret) {
- pr_info("Image loading done\n");
+ pr_err("Image loading done\n");
ret = snapshot_write_finalize(snapshot);
if (!ret && !snapshot_image_loaded(snapshot))
ret = -ENODATA;
@@ -1593,7 +1593,7 @@ int swsusp_check(bool exclusive)
}
if (!error && swsusp_header->flags & SF_HW_SIG &&
swsusp_header->hw_sig != swsusp_hardware_signature) {
- pr_info("Suspend image hardware signature mismatch (%08x now %08x); aborting resume.\n",
+ pr_err("Suspend image hardware signature mismatch (%08x now %08x); aborting resume.\n",
swsusp_header->hw_sig, swsusp_hardware_signature);
error = -EINVAL;
}

View File

@@ -37,7 +37,7 @@ inputs:
"net.core.wmem_max" = 67108864;
"net.ipv4.tcp_rmem" = "4096 87380 67108864";
"net.ipv4.tcp_wmem" = "4096 65536 67108864";
"net.ipv4.tcp_mtu_probing" = true;
"net.ipv4.tcp_mtu_probing" = inputs.lib.mkDefault true;
"net.ipv4.tcp_tw_reuse" = true;
"net.ipv4.tcp_max_syn_backlog" = 8388608;
"net.core.netdev_max_backlog" = 8388608;

View File

@@ -1,10 +1,7 @@
inputs:
{
options.nixos.system.nix-ld = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule {});
default = if inputs.config.nixos.packages.packageSet == "workstation" then {} else null;
};
{ type = types.nullOr (types.submodule {}); default = null; };
config = let inherit (inputs.config.nixos.system) nix-ld; in inputs.lib.mkIf (nix-ld != null)
{
programs.nix-ld = { enable = true; libraries = [ inputs.pkgs.steam-run.fhsenv ]; };

View File

@@ -128,7 +128,7 @@ inputs:
{
hostName = host;
protocol = "ssh-ng";
systems = [ "x86_64-linux" ] ++ hostConfig.nix.settings.extra-platforms;
systems = [ "x86_64-linux" ] ++ hostConfig.nix.settings.extra-platforms or [];
sshUser = "nix-ssh";
sshKey = inputs.config.sops.secrets."nix/remote".path;
maxJobs = 1;

View File

@@ -108,6 +108,13 @@ inputs:
krita = final.genericPackages.krita;
geos = prev.geos.overrideAttrs { doCheck = false; };
c-blosc = prev.c-blosc.overrideAttrs { doCheck = false; };
binaryen = prev.binaryen.overrideAttrs
{ cmakeFlags = (prev.cmakeFlags or []) ++ [ "-DCMAKE_CXX_FLAGS=-Wno-maybe-uninitialized" ]; };
fwupd = prev.fwupd.overrideAttrs { doCheck = false; };
rapidjson = prev.rapidjson.overrideAttrs { doCheck = false; };
scalapack = prev.scalapack.overrideAttrs { doCheck = false; };
xdg-desktop-portal = prev.xdg-desktop-portal.overrideAttrs (prev:
{ doCheck = false; nativeBuildInputs = prev.nativeBuildInputs ++ prev.nativeCheckInputs; });
}
)
// (
@@ -121,7 +128,7 @@ inputs:
};
programs.ccache = { enable = true; cacheDir = "/var/lib/ccache"; };
nix.settings.extra-sandbox-paths = [ inputs.config.programs.ccache.cacheDir ];
boot.kernelPatches = mkIf (nixpkgs.march != null)
boot.kernelPatches = mkIf (nixpkgs.march != null && inputs.config.nixos.system.kernel.variant != "steamos")
[{
name = "native kernel";
patch = null;

View File

@@ -11,24 +11,27 @@ inputs:
u2f =
{
enable = true;
cue = true;
appId = "pam://chn.moe";
origin = "pam://chn.moe";
# generate using: `pamu2fcfg -u chn -o pam://chn.moe -i pam://chn.moe`
authFile = builtins.toString (inputs.pkgs.writeText "yubikey_mappings" (builtins.concatStringsSep "\n"
[
(builtins.concatStringsSep ":"
settings =
{
cue = true;
appid = "pam://chn.moe";
origin = "pam://chn.moe";
# generate using: `pamu2fcfg -u chn -o pam://chn.moe -i pam://chn.moe`
authfile = builtins.toString (inputs.pkgs.writeText "yubikey_mappings" (builtins.concatStringsSep "\n"
[
"chn"
(builtins.concatStringsSep ","
(builtins.concatStringsSep ":"
[
"83Y3cLxhcmwbDOH1h67SQ1xy0dFBcoKYM0VO/YVq+9lpOpdPdmFaB7BNngO3xCmAxJeO/Fg9jNmEF9vMJEmAaw=="
"9bSjr+12JVwtHlyoa70J7w3bEQff+MwLxg5elzdP1OGHcfWGkolRvS+luAgcWjKn1g0swaYdnklCYWYOoCAJbA=="
"es256"
"+presence"
"chn"
(builtins.concatStringsSep ","
[
"83Y3cLxhcmwbDOH1h67SQ1xy0dFBcoKYM0VO/YVq+9lpOpdPdmFaB7BNngO3xCmAxJeO/Fg9jNmEF9vMJEmAaw=="
"9bSjr+12JVwtHlyoa70J7w3bEQff+MwLxg5elzdP1OGHcfWGkolRvS+luAgcWjKn1g0swaYdnklCYWYOoCAJbA=="
"es256"
"+presence"
])
])
])
]));
]));
};
};
yubico = { enable = true; id = "91291"; };
loginLimits =

View File

@@ -1,6 +1,6 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop-extra" inputs.config.nixos.packages._packageSets)
config = inputs.lib.mkIf (inputs.config.nixos.packages.chromium != null)
{
home-manager.users.chn.config.programs.chromium =
{

View File

@@ -1,6 +1,6 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
config = inputs.lib.mkIf (inputs.config.nixos.packages.firefox != null)
{
home-manager.users.chn.config =
{

View File

@@ -1,6 +1,6 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
config = inputs.lib.mkIf (inputs.config.nixos.packages.git != null)
{
home-manager.users.chn.config.programs.git =
{

View File

@@ -1,7 +1,7 @@
inputs:
{
imports = inputs.localLib.findModules ./.;
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
config = inputs.lib.mkIf (inputs.config.nixos.packages.desktop != null)
{
home-manager.users.chn.config.programs.plasma = inputs.lib.mkMerge
[

View File

@@ -1,6 +1,6 @@
inputs:
{
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
config = inputs.lib.mkIf (inputs.config.nixos.packages.desktop != null)
{
home-manager.users.chn.config =
{

View File

@@ -18,6 +18,7 @@ inputs:
zem = 1004;
gb = 1005;
test = 1006;
zqq = 1007;
misskey-misskey = 2000;
misskey-misskey-old = 2001;
frp = 2002;

View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPM+Hi3Jo/xb7vDm5L75jybjjrE6z7quveuKd0mTeXDP zqq@xmupc1

View File

@@ -40,8 +40,11 @@ add_executable(test-serialize test/serialize.cpp)
target_link_libraries(test-serialize PRIVATE biu)
set_property(TARGET test-serialize PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
add_test(NAME test-serialize COMMAND test-serialize)
add_executable(test-process test/process.cpp)
target_link_libraries(test-process PRIVATE biu)
set_property(TARGET test-process PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
add_test(NAME test-process COMMAND test-process)
add_executable(test-eigen test/eigen.cpp)
target_link_libraries(test-eigen PRIVATE biu)
set_property(TARGET test-eigen PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
add_test(NAME test-eigen COMMAND test-eigen)

View File

@@ -5,7 +5,8 @@
# include <biu/concepts.tpp>
# include <biu/string.tpp>
# include <biu/format.tpp>
# include <biu/eigen.tpp>
// # include <biu/logger.tpp>
// # include <biu/smartref.tpp>
// # include <biu/eigen.hpp>

View File

@@ -26,12 +26,14 @@ namespace biu
using int128_t = __int128_t;
using uint128_t = __uint128_t;
struct Empty {};
struct Empty
{
template <typename T> consteval bool operator==(const T&) const
{ return std::same_as<std::remove_cvref_t<T>, Empty>; }
};
struct CaseInsensitiveStringLessComparator
{
template <typename String> constexpr bool operator()(const String& s1, const String& s2) const;
};
{ template <typename String> constexpr bool operator()(const String& s1, const String& s2) const; };
namespace detail_
{
template <typename T> struct RemoveMemberPointerHelper { using Type = T; };

View File

@@ -0,0 +1,77 @@
# pragma once
# include <vector>
# include <span>
# include <Eigen/Dense>
# include <biu/concepts.hpp>
namespace biu
{
namespace eigen
{
namespace detail_
{
// user-specified size of destination container: dynamic, unspecified(use default), or fixed
constexpr std::size_t dynamicSize = std::dynamic_extent, unspecifiedSize = std::dynamic_extent - 1;
static_assert(std::dynamic_extent == std::numeric_limits<std::size_t>::max());
// supported types of standard containers
template <typename T, typename Scalar> struct SpecializationOfArrayHelper : std::false_type {};
template <typename Scalar, std::size_t N>
struct SpecializationOfArrayHelper<std::array<Scalar, N>, Scalar> : std::true_type {};
template <typename Scalar, std::size_t N>
struct SpecializationOfArrayHelper<std::array<Scalar, N>, void> : std::true_type {};
template <typename T, typename Scalar = void> concept SpecializationOfArray =
SpecializationOfArrayHelper<T, Scalar>::value;
template <typename T, typename Scalar> concept StandardContainer =
SpecializationOf<T, std::vector, Scalar> || SpecializationOfArray<T, Scalar>;
// deduce the size of the destination Eigen container
// if no size is specified, convert std::vector to dynamic-size Eigen::Vector,
// std::array to fixed-size Eigen::Vector;
// if size is std::dynamic_extent, always convert to dynamic-size Eigen::Vector
// if size is specified as a number, convert to fixed-size Eigen::Vector if specified size equals the size of the
// input, otherwise throw an error
// return deduced size if the size is deducible in compile time, otherwise return Empty
template <std::size_t ToSize, typename Container> constexpr auto deduce_eigen_size();
// helper operator| to specify the size of the destination container
template <std::size_t Row, std::size_t Col> struct ToEigenHelper {};
// convert 1D standard container to Eigen::Matrix, the second argument should always be unspecified
template <typename From, std::size_t ToSize> auto operator|
(const From&, const detail_::ToEigenHelper<ToSize, detail_::unspecifiedSize>&)
requires (detail_::StandardContainer<From, typename From::value_type> && Arithmetic<typename From::value_type>);
// convert 2D standard container to Eigen::Matrix
template <typename From, std::size_t ToRow, std::size_t ToCol> auto operator|
(const From&, const detail_::ToEigenHelper<ToRow, ToCol>&)
requires
(
detail_::StandardContainer<From, typename From::value_type>
&& detail_::StandardContainer<typename From::value_type, typename From::value_type::value_type>
&& Arithmetic<typename From::value_type::value_type>
);
}
// usage: some_value | toEigen<Row, Col>
template <std::size_t Row = detail_::unspecifiedSize, std::size_t Col = detail_::unspecifiedSize>
inline constexpr detail_::ToEigenHelper<Row, Col> toEigen;
// test if a class is an eigen matrix
namespace detail_
{
template <typename Matrix> class EigenMatrix : public std::false_type {};
template <typename Scalar, int Rows, int Cols, int Options>
class EigenMatrix<Eigen::Matrix<Scalar, Rows, Cols, Options>> : public std::true_type {};
}
template <typename Matrix> concept EigenMatrix = detail_::EigenMatrix<Matrix>::value;
}
using eigen::toEigen, eigen::EigenMatrix;
}
// archive a matrix
namespace Eigen
{
template <typename Matrix> constexpr auto serialize(auto & archive, Matrix& matrix)
requires biu::EigenMatrix<std::remove_cvref_t<Matrix>>;
}

View File

@@ -0,0 +1,137 @@
# pragma once
# include <biu/eigen.hpp>
# include <biu/common.hpp>
# include <range/v3/view.hpp>
# include <zpp_bits.h>
namespace biu::eigen
{
template <std::size_t ToSize, typename Container> constexpr auto detail_::deduce_eigen_size()
{
if constexpr (ToSize == detail_::dynamicSize) return Empty{};
else if constexpr (ToSize == detail_::unspecifiedSize)
if constexpr (SpecializationOfArray<Container>) return Container{}.size();
else return Empty{};
else
if constexpr (SpecializationOfArray<Container>)
if (Container{}.size() == ToSize) return ToSize;
else throw std::invalid_argument("The size of the destination Eigen container mismatches the input container");
else return ToSize;
}
template <typename From, std::size_t ToSize> auto detail_::operator|
(const From& from, const detail_::ToEigenHelper<ToSize, detail_::unspecifiedSize>&)
requires (detail_::StandardContainer<From, typename From::value_type> && Arithmetic<typename From::value_type>)
{
using Scalar = typename From::value_type;
// dynamic size
if constexpr (detail_::deduce_eigen_size<ToSize, From>() == Empty{})
{
using Vector = Eigen::Vector<Scalar, Eigen::Dynamic>;
return Vector(Eigen::Map<const Vector>(from.data(), from.size()));
}
// fixed size
else
// from std::array, or from std::vector and vector.size() == ToSize
if (!SpecializationOf<From, std::vector, Scalar> || from.size() == ToSize)
{
using Vector = Eigen::Vector<Scalar, static_cast<int>(detail_::deduce_eigen_size<ToSize, From>())>;
return Vector(Eigen::Map<const Vector>(from.data()));
}
else
throw std::invalid_argument("The size of the destination Eigen container mismatches the input container");
}
template <typename From, std::size_t ToRow, std::size_t ToCol> auto detail_::operator|
(const From& from, const detail_::ToEigenHelper<ToRow, ToCol>&)
requires
(
detail_::StandardContainer<From, typename From::value_type>
&& detail_::StandardContainer<typename From::value_type, typename From::value_type::value_type>
&& Arithmetic<typename From::value_type::value_type>
)
{
constexpr auto nRow = detail_::deduce_eigen_size<ToRow, From>();
constexpr auto nCol = detail_::deduce_eigen_size<ToCol, typename From::value_type>();
using FromPerRow = typename From::value_type;
using Scalar = typename FromPerRow::value_type;
// ensure all rows have the same size
std::vector<std::size_t> size_in_each_row;
// each row is a std::array, they must have the same size
if constexpr (!SpecializationOf<FromPerRow, std::vector, Scalar>)
size_in_each_row.push_back(FromPerRow{}.size());
else
size_in_each_row = from
| ranges::views::transform([](const auto& row) { return row.size(); })
| ranges::views::unique
| ranges::to<std::vector<std::size_t>>;
if (size_in_each_row.size() > 1)
throw std::invalid_argument("The sizes of the rows of the input container are not the same");
else if (size_in_each_row.empty()) size_in_each_row.push_back(0);
// ensure specified size is consistent with the input
if constexpr (nRow != Empty{})
if (SpecializationOf<From, std::vector> && from.size() != nRow)
throw std::invalid_argument("The size of the destination Eigen container mismatches the input container");
if constexpr (nCol != Empty{})
if (size_in_each_row[0] != nCol)
throw std::invalid_argument("The size of the destination Eigen container mismatches the input container");
// copy all data into a single vector
auto data = from | ranges::views::join | ranges::to<std::vector<Scalar>>;
// dynamic row and dynamic col
if constexpr (nRow == Empty{} && nCol == Empty{})
{
using Matrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Eigen::AutoAlign>;
return Matrix(Eigen::Map<const Matrix>(data.data(), from.size(), size_in_each_row[0]));
}
// fixed row and dynamic col
else if constexpr (nRow != Empty{} && nCol == Empty{})
{
using Matrix = Eigen::Matrix<Scalar, nRow, Eigen::Dynamic, Eigen::RowMajor | Eigen::AutoAlign>;
return Matrix(Eigen::Map<const Matrix>(data.data(), nRow, size_in_each_row[0]));
}
// dynamic row and fixed col
else if constexpr (nRow == Empty{} && nCol != Empty{})
{
using Matrix = Eigen::Matrix<Scalar, Eigen::Dynamic, nCol, Eigen::RowMajor | Eigen::AutoAlign>;
return Matrix(Eigen::Map<const Matrix>(data.data(), from.size(), nCol));
}
// fixed row and fixed col
else
{
using Matrix = Eigen::Matrix<Scalar, nRow, nCol, Eigen::RowMajor | Eigen::AutoAlign>;
return Matrix(Eigen::Map<const Matrix>(data.data()));
}
}
}
template <typename Matrix> constexpr auto Eigen::serialize(auto & archive, Matrix& matrix)
requires biu::EigenMatrix<std::remove_cvref_t<Matrix>>
{
// this function will be called twice, first to get how many members to archive, then to archive the members
// first call
if constexpr (std::integral<decltype(archive())>)
return 1 + (Matrix::CompileTimeTraits::RowsAtCompileTime == Eigen::Dynamic)
+ (Matrix::CompileTimeTraits::ColsAtCompileTime == Eigen::Dynamic);
// second call
else
{
typename Matrix::Index nRow, nCol;
std::vector<typename Matrix::Scalar> data;
if constexpr (archive.kind() == zpp::bits::kind::out)
{ nRow = matrix.rows(); nCol = matrix.cols(); data = std::vector(matrix.data(), matrix.data() + matrix.size()); }
zpp::bits::errc result;
if constexpr (Matrix::CompileTimeTraits::RowsAtCompileTime == Eigen::Dynamic)
{ if (result = archive(nRow); result.code != std::errc{}) [[unlikely]] return result; }
else nRow = Matrix::CompileTimeTraits::RowsAtCompileTime;
if constexpr (Matrix::CompileTimeTraits::ColsAtCompileTime == Eigen::Dynamic)
{ if (result = archive(nCol); result.code != std::errc{}) [[unlikely]] return result; }
else nCol = Matrix::CompileTimeTraits::ColsAtCompileTime;
result = archive(data);
if (result.code != std::errc{}) [[unlikely]] return result;
if constexpr (archive.kind() == zpp::bits::kind::in)
matrix = Eigen::Map<const Matrix>(data.data(), nRow, nCol);
return result;
}
}

Some files were not shown because too many files have changed in this diff Show More