mirror of
https://github.com/Dichgrem/DCGOS.git
synced 2025-12-16 19:22:00 -05:00
feat:add_aria2&syncthing_daemon
This commit is contained in:
1
dotfiles/.config/aria2/aria2.conf
vendored
1
dotfiles/.config/aria2/aria2.conf
vendored
@@ -2,6 +2,7 @@ enable-rpc=true
|
|||||||
rpc-listen-all=true
|
rpc-listen-all=true
|
||||||
rpc-allow-origin-all=true
|
rpc-allow-origin-all=true
|
||||||
rpc-listen-port=6800
|
rpc-listen-port=6800
|
||||||
|
rpc-secret=adminadmin
|
||||||
continue=true
|
continue=true
|
||||||
dir=/home/dich/Downloads
|
dir=/home/dich/Downloads
|
||||||
input-file=/home/dich/.config/aria2/aria2.session
|
input-file=/home/dich/.config/aria2/aria2.session
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
syncthing
|
syncthing
|
||||||
syncthingtray
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -1,32 +1,55 @@
|
|||||||
|
{ lib, pkgs, username, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
lib,
|
imports = [ ./hardware.nix ]
|
||||||
pkgs,
|
|
||||||
username,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
./hardware.nix
|
|
||||||
]
|
|
||||||
++ lib.filesystem.listFilesRecursive ../../modules;
|
++ lib.filesystem.listFilesRecursive ../../modules;
|
||||||
|
|
||||||
# Define users
|
users.users."${username}" = {
|
||||||
# If use nixos-anywhere to install, hashedPassword should be declared before installation
|
extraGroups = [ "libvirtd" "networkmanager" "wheel" ];
|
||||||
users = {
|
homeMode = "755";
|
||||||
# users.root = {
|
ignoreShellProgramCheck = true;
|
||||||
# hashedPassword = "xxxxxx"; could be generated by mkpasswd
|
isNormalUser = true;
|
||||||
# };
|
shell = pkgs.nushell;
|
||||||
users."${username}" = {
|
};
|
||||||
extraGroups = [
|
|
||||||
"libvirtd"
|
# 不加载官方 aria2 模块
|
||||||
"networkmanager"
|
services.aria2.enable = false;
|
||||||
"wheel"
|
|
||||||
|
# 自定义 systemd 单元:aria2
|
||||||
|
systemd.services.aria2 = {
|
||||||
|
description = "Aria2 Download Manager (dich)";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wants = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
User = username;
|
||||||
|
|
||||||
|
ExecStartPre = [
|
||||||
|
"${pkgs.coreutils}/bin/mkdir -p /home/${username}/.config/aria2"
|
||||||
|
"${pkgs.coreutils}/bin/touch /home/${username}/.config/aria2/aria2.session"
|
||||||
];
|
];
|
||||||
# hashedPassword = "";
|
|
||||||
homeMode = "755";
|
ExecStart = "${pkgs.aria2}/bin/aria2c --conf-path=/home/${username}/.config/aria2/aria2.conf";
|
||||||
ignoreShellProgramCheck = true;
|
|
||||||
isNormalUser = true;
|
Restart = "always";
|
||||||
shell = pkgs.nushell;
|
RestartSec = "5s";
|
||||||
|
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
PrivateTmp = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# 启用 Syncthing,为用户运行
|
||||||
|
services.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
user = username;
|
||||||
|
dataDir = "/home/${username}/Sync"; # Syncthing 默认同步文件夹
|
||||||
|
configDir = "/home/${username}/.config/syncthing";
|
||||||
|
guiAddress = "127.0.0.1:8384"; # Web UI 地址
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ in {
|
|||||||
curl
|
curl
|
||||||
nexttrace
|
nexttrace
|
||||||
aria2
|
aria2
|
||||||
syncthing
|
|
||||||
|
|
||||||
#Blog
|
#Blog
|
||||||
zola
|
zola
|
||||||
|
|||||||
Reference in New Issue
Block a user