This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / 2configs / default.nix
8.3 kB 330 lines
1{ 2 self, 3 config, 4 lib, 5 pkgs, 6 ... 7}: 8{ 9 # Stockholm configuration 10 krebs.secret.directory = config.clan.core.vars.password-store.secretLocation; 11 12 # Nixpkgs overlays 13 nixpkgs.overlays = [ 14 self.inputs.stockholm.overlays.default 15 (import (self.inputs.stockholm.inputs.nix-writers + "/pkgs")) # TODO get rid of that overlay 16 ]; 17 18 imports = [ 19 # Import 3modules 20 ../3modules 21 22 # Import stockholm krebs module 23 self.inputs.stockholm.nixosModules.krebs 24 25 # Import individual configurations 26 ./security-workarounds.nix 27 # ./binary-cache/client.nix 28 ./gc.nix 29 ./mc.nix 30 ./zsh.nix 31 ./htop.nix 32 ./tor-ssh.nix 33 ./networkd.nix 34 ./pinned-registry.nix 35 ./nix.nix 36 37 # Import stockholm modules 38 self.inputs.stockholm.nixosModules.users 39 self.inputs.stockholm.nixosModules.hosts 40 self.inputs.stockholm.nixosModules.kartei 41 self.inputs.stockholm.nixosModules.build 42 self.inputs.stockholm.nixosModules.dns 43 self.inputs.stockholm.nixosModules.iptables 44 self.inputs.stockholm.nixosModules.secret 45 self.inputs.stockholm.nixosModules.setuid 46 self.inputs.stockholm.nixosModules.sitemap 47 self.inputs.stockholm.nixosModules.ssl 48 self.inputs.stockholm.nixosModules.systemd 49 self.inputs.stockholm.nixosModules.ssh 50 { 51 # nix-index 52 imports = [ 53 self.inputs.nix-index-database.nixosModules.nix-index 54 ]; 55 programs.nix-index-database.comma.enable = true; 56 } 57 { 58 # We need to mount these vars before the users phase, since that is the moment where the hashsed password are put into /etc/shadown 59 users.extraUsers.mainUser.hashedPasswordFile = 60 config.clan.core.vars.generators.password.files.passwordHash.path; 61 users.extraUsers.root.hashedPasswordFile = 62 config.clan.core.vars.generators.password.files.passwordHash.path; 63 boot.initrd.systemd.emergencyAccess = true; 64 clan.core.vars.generators.password = { 65 prompts.password = { 66 description = "Password for the main user"; 67 type = "hidden"; 68 }; 69 files.password.deploy = false; 70 files.passwordHash.neededFor = "users"; 71 runtimeInputs = with pkgs; [ 72 coreutils 73 mkpasswd 74 ]; 75 script = '' 76 cp $prompts/password $out/password 77 cat $out/password | mkpasswd -s -m sha-512 > $out/passwordHash 78 ''; 79 }; 80 } 81 { 82 services.openssh.enable = true; 83 services.openssh.settings.PasswordAuthentication = false; 84 services.openssh.hostKeys = [ 85 { 86 path = config.clan.core.vars.generators.ssh.files."ssh.id_ed25519".path; 87 type = "ed25519"; 88 } 89 ]; 90 clan.core.vars.generators.ssh = { 91 files."ssh.id_ed25519" = { }; 92 files."ssh.id_ed25519.pub".secret = false; 93 runtimeInputs = with pkgs; [ 94 coreutils 95 openssh 96 ]; 97 script = '' 98 ssh-keygen -t ed25519 -N "" -f $out/ssh.id_ed25519 99 ''; 100 }; 101 } 102 { 103 users.extraUsers = { 104 root = { 105 openssh.authorizedKeys.keys = [ 106 self.keys.ssh.barnacle.public 107 self.keys.ssh.yubi_pgp.public 108 self.keys.ssh.yubi1.public 109 self.keys.ssh.yubi2.public 110 self.keys.ssh.solo2.public 111 self.keys.ssh.xerxes.public 112 self.keys.ssh.massulus.public 113 ]; 114 }; 115 mainUser = { 116 name = "lass"; 117 uid = 1337; 118 home = "/home/lass"; 119 group = "users"; 120 createHome = true; 121 useDefaultShell = true; 122 isNormalUser = true; 123 linger = true; 124 extraGroups = [ 125 "audio" 126 "video" 127 "fuse" 128 "wheel" 129 "tor" 130 "dialout" 131 ]; 132 openssh.authorizedKeys.keys = [ 133 self.keys.ssh.barnacle.public 134 self.keys.ssh.yubi_pgp.public 135 self.keys.ssh.yubi1.public 136 self.keys.ssh.yubi2.public 137 self.keys.ssh.solo2.public 138 self.keys.ssh.xerxes.public 139 self.keys.ssh.massulus.public 140 ]; 141 }; 142 }; 143 } 144 ( 145 let 146 ca-bundle = "/etc/ssl/certs/ca-bundle.crt"; 147 in 148 { 149 environment.variables = { 150 CURL_CA_BUNDLE = ca-bundle; 151 GIT_SSL_CAINFO = ca-bundle; 152 SSL_CERT_FILE = ca-bundle; 153 }; 154 } 155 ) 156 { 157 #for sshuttle 158 environment.systemPackages = [ 159 pkgs.python3Packages.python 160 ]; 161 } 162 ]; 163 164 networking.hostName = config.krebs.build.host.name; 165 166 krebs = { 167 enable = true; 168 build.user = config.krebs.users.lass; 169 ssl.trustIntermediate = true; 170 }; 171 172 users.mutableUsers = false; 173 174 # multiple-definition-problem when defining environment.variables.EDITOR 175 environment.extraInit = '' 176 EDITOR=vim 177 ''; 178 179 nixpkgs.config.allowUnfree = true; 180 181 environment.systemPackages = with pkgs; [ 182 self.packages.${pkgs.system}.nvim 183 self.packages.${pkgs.system}.tmux 184 self.packages.${pkgs.system}.s 185 186 git 187 git-absorb 188 gnumake 189 jq 190 nix-output-monitor 191 comma 192 193 #style 194 rxvt-unicode-unwrapped.terminfo 195 alacritty.terminfo 196 197 #monitoring tools 198 htop 199 iotop 200 201 #network 202 iptables 203 iftop 204 tcpdump 205 mosh 206 eternal-terminal 207 self.packages.${pkgs.system}.sshify 208 209 #stuff for dl 210 aria2 211 212 # decentralized git hosting 213 radicle-node 214 215 #neat utils 216 file 217 xkcdpass 218 kpaste 219 cyberlocker-tools 220 pciutils 221 pop 222 q 223 untilport 224 (pkgs.writeDashBin "urgent" '' 225 printf '\a' 226 '') 227 usbutils 228 goify 229 230 #unpack stuff 231 libarchive 232 233 (pkgs.writeDashBin "sshn" '' 234 ${pkgs.openssh}/bin/ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@" 235 '') 236 ]; 237 238 environment.shellAliases = { 239 ll = "ls -l"; 240 la = "ls -la"; 241 ls = "ls --color"; 242 ip = "ip -color=auto"; 243 grep = "grep --color=auto"; 244 nosleep = "systemd-inhibit --what=handle-lid-switch sleep infinity"; 245 }; 246 247 programs.bash = { 248 completion.enable = true; 249 interactiveShellInit = '' 250 HISTCONTROL='erasedups:ignorespace' 251 HISTSIZE=65536 252 HISTFILESIZE=$HISTSIZE 253 254 shopt -s checkhash 255 shopt -s histappend histreedit histverify 256 shopt -s no_empty_cmd_completion 257 complete -d cd 258 LS_COLORS=$LS_COLORS:'di=1;31:' ; export LS_COLORS 259 ''; 260 promptInit = '' 261 if test $UID = 0; then 262 PS1='\[\033[1;31m\]\w\[\033[0m\] ' 263 PROMPT_COMMAND='echo -ne "\033]0;$$ $USER@$PWD\007"' 264 elif test $UID = 1337; then 265 PS1='\[\033[1;32m\]\w\[\033[0m\] ' 266 PROMPT_COMMAND='echo -ne "\033]0;$$ $PWD\007"' 267 else 268 PS1='\[\033[1;33m\]\u@\w\[\033[0m\] ' 269 PROMPT_COMMAND='echo -ne "\033]0;$$ $USER@$PWD\007"' 270 fi 271 if test -n "$SSH_CLIENT"; then 272 PS1='\[\033[35m\]\h'" $PS1" 273 PROMPT_COMMAND='echo -ne "\033]0;$$ $HOSTNAME $USER@$PWD\007"' 274 fi 275 ''; 276 }; 277 278 services.journald.extraConfig = '' 279 SystemMaxUse=1G 280 RuntimeMaxUse=128M 281 Storage=persistent 282 ''; 283 284 krebs.iptables = { 285 enable = true; 286 tables = { 287 filter.INPUT.policy = "DROP"; 288 filter.FORWARD.policy = lib.mkDefault "DROP"; 289 filter.INPUT.rules = lib.mkMerge [ 290 (lib.mkBefore [ 291 { 292 predicate = "-m conntrack --ctstate RELATED,ESTABLISHED"; 293 target = "ACCEPT"; 294 } 295 { 296 predicate = "-p icmp"; 297 target = "ACCEPT"; 298 } 299 { 300 predicate = "-p ipv6-icmp"; 301 target = "ACCEPT"; 302 v4 = false; 303 } 304 { 305 predicate = "-i lo"; 306 target = "ACCEPT"; 307 } 308 ]) 309 ]; 310 }; 311 }; 312 313 networking.firewall.allowedTCPPorts = [ 22 ]; # ssh 314 networking.firewall.allowedUDPPortRanges = [ 315 { 316 from = 60000; 317 to = 61000; 318 } 319 ]; # mosh 320 networking.extraHosts = '' 321 10.42.0.1 styx.gg23 322 ''; 323 324 # use 24:00 time format, the default got sneakily changed around 20.03 325 i18n.defaultLocale = lib.mkDefault "C.UTF-8"; 326 time.timeZone = lib.mkDefault "Europe/Berlin"; 327 328 # disable doc usually 329 documentation.nixos.enable = lib.mkDefault false; 330}