test
This commit is contained in:
parent
03c20a3bd8
commit
562180961e
5 changed files with 48 additions and 4 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,5 +1,7 @@
|
||||||
backup/
|
backup/
|
||||||
|
|
||||||
|
.secrets
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|
||||||
*.nix.bak
|
*.nix.bak
|
||||||
|
|
|
||||||
|
|
@ -8,19 +8,16 @@
|
||||||
imports = [
|
imports = [
|
||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
|
||||||
./local-packages.nix
|
./local-packages.nix
|
||||||
../modules
|
../modules/default.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
networking.hostName = "nixos";
|
networking.hostName = "nixos";
|
||||||
# Setup garbage collection for old generations
|
|
||||||
nix.gc = {
|
nix.gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
dates = "weekly";
|
dates = "weekly";
|
||||||
options = "--delete-older-than 30d";
|
options = "--delete-older-than 30d";
|
||||||
};
|
};
|
||||||
# Limit the number of generations
|
|
||||||
boot.loader.systemd-boot.configurationLimit = 5;
|
boot.loader.systemd-boot.configurationLimit = 5;
|
||||||
# This value determines the NixOS release from which the default
|
# This value determines the NixOS release from which the default
|
||||||
# settings for stateful data, like file locations and database versions
|
# settings for stateful data, like file locations and database versions
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,12 @@ in
|
||||||
libtool
|
libtool
|
||||||
gawk
|
gawk
|
||||||
lazygit
|
lazygit
|
||||||
|
# Java ecosystem
|
||||||
|
jdk17
|
||||||
|
maven
|
||||||
|
gradle
|
||||||
|
visualvm
|
||||||
|
jdt-language-server
|
||||||
(python310.withPackages (ps: with ps; [
|
(python310.withPackages (ps: with ps; [
|
||||||
virtualenv
|
virtualenv
|
||||||
ipython
|
ipython
|
||||||
|
|
@ -117,6 +123,8 @@ in
|
||||||
go
|
go
|
||||||
sqls
|
sqls
|
||||||
deno
|
deno
|
||||||
|
redis
|
||||||
|
cloudflared
|
||||||
# Rust ecosystem
|
# Rust ecosystem
|
||||||
rustup
|
rustup
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
./steam.nix
|
./steam.nix
|
||||||
./timezone.nix
|
./timezone.nix
|
||||||
./user.nix
|
./user.nix
|
||||||
|
./systemd.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Enable CUPS to print documents.
|
# Enable CUPS to print documents.
|
||||||
|
|
|
||||||
36
modules/systemd.nix
Normal file
36
modules/systemd.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
autossh
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.services.autossh-redbot = {
|
||||||
|
description = "Persistent SSH Tunnel to Cloud Server";
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
User = "cobray";
|
||||||
|
Group = "cobray";
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = 30;
|
||||||
|
EnvironmentFile = "/home/cobray/.secrets/autossh-redbot.conf";
|
||||||
|
Environment = [
|
||||||
|
"AUTOSSH_GATETIME=0"
|
||||||
|
"AUTOSSH_POLL=60"
|
||||||
|
"AUTOSSH_FIRST_POLL=30"
|
||||||
|
"AUTOSSH_PORT=0"
|
||||||
|
];
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.autossh}/bin/autossh -M 0 -N \
|
||||||
|
-o "ServerAliveInterval 60" \
|
||||||
|
-o "ServerAliveCountMax 3" \
|
||||||
|
-o "ExitOnForwardFailure=yes" \
|
||||||
|
-o "ConnectTimeout=10" \
|
||||||
|
-R "0.0.0.0:$REMOTE_PORT:localhost:$LOCAL_PORT" \
|
||||||
|
root@$REMOTE_HOST
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue