-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
147 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ pkgs, lib, config, ... }: | ||
with lib; | ||
let cfg = config.deployment.keyys; in | ||
{ | ||
options.deployment.keyys = mkOption { type = types.listOf types.path; default = []; }; | ||
options.deployment.keys-copy = mkOption { type = types.package; }; | ||
config = { | ||
deployment.keys-copy = pkgs.writeShellScriptBin "copy-keys" (if cfg != [] then '' | ||
set -e | ||
ssh root@$1 "mkdir -p /root/keys" | ||
scp ${concatMapStringsSep " " toString cfg} root@$1:/root/keys | ||
echo "uploaded keys" | ||
'' else '' | ||
echo "no keys to upload" | ||
''); | ||
|
||
}; | ||
|
||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
let secrets = import <secrets>; | ||
in | ||
{ config, pkgs, lib, ...}: | ||
let | ||
machine = with lib; head (splitString "." config.networking.hostName); | ||
in | ||
{ | ||
imports = [ | ||
../modules/tor-hidden-service.nix | ||
../modules/nginx.nix | ||
../roles/pub.nix | ||
../roles/quassel.nix | ||
../roles/gogs.nix | ||
../roles/mail.nix | ||
../roles/website.nix | ||
../roles/xmpp.nix | ||
]; | ||
time.timeZone = "Europe/Amsterdam"; | ||
users.mutableUsers = false; | ||
users.extraUsers.root = { | ||
openssh.authorizedKeys.keys = config.users.extraUsers.yorick.openssh.authorizedKeys.keys; | ||
# root password is useful from console, ssh has password logins disabled | ||
hashedPassword = secrets.pennyworth_hashedPassword; # TODO: generate own | ||
|
||
}; | ||
services.timesyncd.enable = true; | ||
services.fail2ban.enable = true; | ||
users.extraUsers.yorick = { | ||
isNormalUser = true; | ||
uid = 1000; | ||
extraGroups = ["wheel"]; | ||
group = "users"; | ||
openssh.authorizedKeys.keys = with (import ../sshkeys.nix); [yorick]; | ||
}; | ||
|
||
# Nix | ||
nixpkgs.config.allowUnfree = true; | ||
nix.package = pkgs.nixUnstable; | ||
|
||
nix.buildCores = config.nix.maxJobs; | ||
|
||
nix.extraOptions = '' | ||
allow-unsafe-native-code-during-evaluation = true | ||
''; | ||
|
||
# Networking | ||
networking.enableIPv6 = false; | ||
|
||
services.openssh = { | ||
enable = true; | ||
passwordAuthentication = false; | ||
challengeResponseAuthentication = false; | ||
}; | ||
|
||
services.tor = { | ||
enable = true; | ||
client.enable = true; | ||
# ssh hidden service | ||
hiddenServices.ssh.map = [{ port = 22; }]; | ||
service-keys.ssh = "/root/keys/ssh.${machine}.key"; | ||
}; | ||
|
||
programs.ssh.extraConfig = '' | ||
Host *.onion | ||
ProxyCommand nc -xlocalhost:9050 -X5 %h %p | ||
'' + | ||
(with lib; (flip concatMapStrings) (filter (hasPrefix "ssh.") (attrNames secrets.tor_hostnames)) (name: '' | ||
Host ${removePrefix "ssh." name}.onion | ||
hostname ${secrets.tor_hostnames.${name}} | ||
'' | ||
)); | ||
|
||
environment.systemPackages = with pkgs; [ | ||
# v important. | ||
cowsay ponysay | ||
ed # ed, man! | ||
sl | ||
rlwrap | ||
|
||
vim | ||
|
||
# system stuff | ||
ethtool inetutils | ||
pciutils usbutils | ||
iotop powertop htop | ||
psmisc lsof | ||
smartmontools hdparm | ||
lm_sensors | ||
ncdu | ||
|
||
# utils | ||
file which | ||
reptyr | ||
tmux | ||
bc | ||
mkpasswd | ||
shadow | ||
|
||
# archiving | ||
xdelta | ||
atool | ||
unrar p7zip | ||
unzip zip | ||
|
||
# network | ||
nmap mtr bind | ||
socat netcat-openbsd | ||
lftp wget rsync | ||
|
||
git | ||
nix-repl | ||
rxvt_unicode.terminfo | ||
]; | ||
nix.gc.automatic = true; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
./quassel.nix | ||
./website.nix | ||
./xmpp.nix | ||
] | ||
]; | ||
} |