feat: 0801 update
This commit is contained in:
@@ -5,8 +5,13 @@
|
||||
...
|
||||
}:
|
||||
{
|
||||
hardware.nvidia.open = true;
|
||||
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||
hardware.nvidia = {
|
||||
package = config.boot.kernelPackages.nvidiaPackages.latest;
|
||||
modesetting.enable = true;
|
||||
nvidiaSettings = true;
|
||||
open = true;
|
||||
};
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
home.packages = with pkgs; [
|
||||
localsend
|
||||
|
||||
rclone
|
||||
|
||||
wpsoffice-cn
|
||||
wps-office-fonts
|
||||
ttf-wps-fonts
|
||||
@@ -26,6 +24,16 @@
|
||||
pavucontrol
|
||||
pamixer
|
||||
qqmusic
|
||||
|
||||
lumafly
|
||||
|
||||
scanmem
|
||||
|
||||
xmind
|
||||
|
||||
netease-cloud-music-gtk
|
||||
|
||||
maven
|
||||
];
|
||||
programs.zsh = {
|
||||
sessionVariables = {
|
||||
|
||||
@@ -65,7 +65,11 @@
|
||||
sopsFile = secrets.easytier;
|
||||
format = "binary";
|
||||
};
|
||||
environment.systemPackages = [ pkgs.easytier ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
inetutils
|
||||
|
||||
easytier
|
||||
];
|
||||
systemd.services."easytier" = {
|
||||
enable = true;
|
||||
script = "${pkgs.easytier}/bin/easytier-core -c ${config.sops.secrets.easytier.path}";
|
||||
|
||||
@@ -6,75 +6,6 @@
|
||||
secrets,
|
||||
...
|
||||
}:
|
||||
let
|
||||
btreset = pkgs.writeScriptBin "btreset" ''
|
||||
#!${lib.getExe pkgs.python3}
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
|
||||
SYM = "BT"
|
||||
|
||||
def action(line: str) -> bool:
|
||||
if line.find(SYM) == -1:
|
||||
return False
|
||||
temp = line.split(" ")
|
||||
bus = temp[1]
|
||||
device = temp[3][:-1]
|
||||
subprocess.run(["${lib.getExe usbreset}", f"/dev/bus/usb/{bus}/{device}"])
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
if os.path.exists("/tmp/.btreseted") and len(sys.argv) == 1 and "-f" not in sys.argv[1:]:
|
||||
exit(0)
|
||||
res_byte = subprocess.check_output("/run/current-system/sw/bin/lsusb")
|
||||
res = res_byte.decode()
|
||||
lst = res.split("\n")
|
||||
|
||||
if any(tuple(map(action, lst))):
|
||||
with open("/tmp/.btreseted", "w"):
|
||||
...
|
||||
'';
|
||||
usbreset = pkgs.writeCBin "usbreset" ''
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <linux/usbdevice_fs.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *filename;
|
||||
int fd;
|
||||
int rc;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: usbreset device-filename\n");
|
||||
return 1;
|
||||
}
|
||||
filename = argv[1];
|
||||
|
||||
fd = open(filename, O_WRONLY);
|
||||
if (fd < 0) {
|
||||
perror("Error opening output file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Resetting USB device %s\n", filename);
|
||||
rc = ioctl(fd, USBDEVFS_RESET, 0);
|
||||
if (rc < 0) {
|
||||
perror("Error in ioctl");
|
||||
return 1;
|
||||
}
|
||||
printf("Reset successful\n");
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
'';
|
||||
in
|
||||
{
|
||||
security.pam.loginLimits = [
|
||||
{
|
||||
@@ -85,11 +16,6 @@ in
|
||||
}
|
||||
];
|
||||
|
||||
systemd.services.btreset = {
|
||||
script = lib.getExe btreset;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.Type = "oneshot";
|
||||
};
|
||||
boot.kernelParams = [
|
||||
"usbcore.autosuspend=-1" # Avoid usb autosuspend (for usb bluetooth adapter)
|
||||
"fsck.mode=skip"
|
||||
@@ -141,6 +67,8 @@ in
|
||||
};
|
||||
users.extraUsers.${username}.extraGroups = [ "audio" ];
|
||||
|
||||
programs.nix-ld.enable = true;
|
||||
|
||||
fonts = {
|
||||
enableDefaultPackages = false;
|
||||
fontDir.enable = true;
|
||||
@@ -177,28 +105,8 @@ in
|
||||
|
||||
services.printing.enable = true;
|
||||
|
||||
services.keyd = {
|
||||
enable = true;
|
||||
keyboards.default.settings = {
|
||||
main = {
|
||||
capslock = "overload(control, esc)";
|
||||
home = "end";
|
||||
};
|
||||
shift = {
|
||||
home = "home";
|
||||
};
|
||||
control = {
|
||||
delete = "print";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.gvfs.enable = true;
|
||||
|
||||
programs.wireshark.enable = true;
|
||||
programs.wireshark.package = pkgs.wireshark;
|
||||
users.users.${username}.extraGroups = [ "wireshark" ];
|
||||
|
||||
services.sunshine = {
|
||||
enable = true;
|
||||
autoStart = true;
|
||||
@@ -218,9 +126,4 @@ in
|
||||
PasswordAuthentication = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.rclone
|
||||
btreset
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user