This commit is contained in:
Sense T
2023-07-18 13:52:59 +00:00
commit 52902348c8
11 changed files with 354 additions and 0 deletions

46
global/containers.nix Normal file
View File

@@ -0,0 +1,46 @@
{
virtualisation = {
podman.enable = true;
oci-containers.backend = "podman";
oci-containers.containers = {
wsproxy = {
login.username = "senseab";
login.registry = "ghcr.io";
login.passwordFile = "/var/lib/secrets/podman/ghcr.io"; # should create it manually.
image = "ghcr.io/senseab/wsproxy:master";
autoStart = true;
environment = {
CONFIG_NO_TLS_VERIFY = "true";
CONFIG_ADDR = "wss://dev.wetofu.me/path";
WSPROXY_MODE = "client";
};
ports = [
"1089:1089"
];
};
zeronet = {
autoStart = true;
dependsOn = [ "wsproxy" ];
image = "supersandro2000/zeronet";
ports = [
"26552:26552"
"43110:43110"
];
environment = {
ENABLE_TOR = "false";
UI_PASSWORD = "12345678";
};
volumes = [
"/var/lib/zeronet:/root/data"
];
};
};
};
}

8
global/default.nix Normal file
View File

@@ -0,0 +1,8 @@
{
imports = [
./system-configuration.nix
./software-configuration.nix
./user-configuration.nix
./containers.nix
];
}

View File

@@ -0,0 +1,96 @@
{ pkgs, ... }:
let
downloadDir = "/mnt/Downloads";
in
{
# Enable automatic login for the user.
services = {
# sudo tailscale up --operator=$USER
# use https://hs.wetofu.me
tailscale.enable = true;
logrotate.checkConfig = false;
openssh = {
enable = true;
banner = "Must back to QingDao! Must back HOME!";
settings = {
PermitRootLogin = false;
PasswordAuthentication = false;
};
};
ntp = {
enable = true;
servers = [
"ntp.ntsc.ac.cn" # China
];
};
transmission = {
enable = false;
openPeerPorts = true;
downloadDirPermissions = "777";
settings = {
download-dir = downloadDir;
peer-port-random-low = "42333";
peer-port-random-on-start = true;
};
};
resilio = {
enable = true;
deviceName = "Gangly4670";
enableWebUI = true;
directoryRoot = downloadDir;
};
nginx = {
enable = true;
virtualHosts = {
default = {
default = true;
locations = {
"/" = {
root = "/var/lib/nginx/html";
};
"/files" = {
alias = downloadDir;
extraConfig = "autoindex on;";
};
"/transmission" = {
proxyPass = "http://localhost:9091";
};
"/sync" = {
proxyPass = "http://localhost:9000";
};
};
};
};
};
samba = {
enable = true;
shares = {
share = {
path = downloadDir;
browseable = "yes";
"read only" = true;
};
};
};
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
libraspberrypi
];
programs = {
};
}

View File

@@ -0,0 +1,49 @@
{
time.timeZone = "Asia/Shanghai";
security.sudo.wheelNeedsPassword = false;
networking.firewall.enable = false;
# Select internationalisation properties.
i18n = {
defaultLocale = "zh_CN.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "zh_CN.UTF-8";
LC_IDENTIFICATION = "zh_CN.UTF-8";
LC_MEASUREMENT = "zh_CN.UTF-8";
LC_MONETARY = "zh_CN.UTF-8";
LC_NAME = "zh_CN.UTF-8";
LC_NUMERIC = "zh_CN.UTF-8";
LC_PAPER = "zh_CN.UTF-8";
LC_TELEPHONE = "zh_CN.UTF-8";
LC_TIME = "zh_CN.UTF-8";
};
};
nix.settings = {
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
substituters = [
"https://mirrors.ustc.edu.cn/nix-channels/store" # 中科大
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # 清华
"https://mirrors.bfsu.edu.cn/nix-channels/store" # 北外
"https://mirror.sjtu.edu.cn/nix-channels/store" # 交大
"https://nixos-cn.cachix.org"
"https://cache.nixos.org/"
];
trusted-users = [
"root"
"@wheel"
];
};
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 1w";
};
}

View File

@@ -0,0 +1,24 @@
{ pkgs, ... }: {
users = {
mutableUsers = false;
users = {
pi = {
isNormalUser = true;
description = "Default user";
packages = with pkgs; [
gnumake42
];
extraGroups = [
"wheel"
];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG4D8YhuKaVoVu5f51SwO8FHmIMxytQ1VXzLr4qe1GnQ tonychyi@TonyChyideMacBook-Pro.local"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFpWqnXVD/wC1IyWMNUtvPCnj7NtTfT1GaeKiDYILHIa coder@code-server-7dd77f88fb-5vlbj"
];
};
};
};
}