This repository has no description
0

Configure Feed

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

superconfig / 2configs / default.nix
9.7 kB 382 lines
1{ 2 self, 3 config, 4 lib, 5 pkgs, 6 ... 7}: 8{ 9 imports = [ 10 ./security-workarounds.nix 11 # ./binary-cache/client.nix 12 ./gc.nix 13 ./mc.nix 14 ./zsh.nix 15 ./htop.nix 16 ./wiregrill.nix 17 ./tmux.nix 18 ./tor-ssh.nix 19 ./networkd.nix 20 ./pinned-registry.nix 21 ./zerotier.nix 22 ./nether.nix 23 ./spora.nix 24 ./nix.nix 25 self.inputs.stockholm.nixosModules.users 26 self.inputs.stockholm.nixosModules.hosts 27 self.inputs.stockholm.nixosModules.kartei 28 self.inputs.stockholm.nixosModules.build 29 self.inputs.stockholm.nixosModules.dns 30 self.inputs.stockholm.nixosModules.exim 31 self.inputs.stockholm.nixosModules.exim-retiolum 32 self.inputs.stockholm.nixosModules.tinc 33 self.inputs.stockholm.nixosModules.iptables 34 self.inputs.stockholm.nixosModules.power-action 35 self.inputs.stockholm.nixosModules.setuid 36 self.inputs.stockholm.nixosModules.secret 37 self.inputs.stockholm.nixosModules.sitemap 38 self.inputs.stockholm.nixosModules.ssl 39 self.inputs.stockholm.nixosModules.systemd 40 self.inputs.stockholm.nixosModules.xresources 41 self.inputs.stockholm.nixosModules.ssh 42 self.inputs.stockholm.nixosModules.sync-containers3 43 { 44 # We need to mount these vars before the users phase, since that is the moment where the hashsed password are put into /etc/shadown 45 users.extraUsers.mainUser.hashedPasswordFile = 46 config.clan.core.vars.generators.password.files.passwordHash.path; 47 users.extraUsers.root.hashedPasswordFile = 48 config.clan.core.vars.generators.password.files.passwordHash.path; 49 boot.initrd.systemd.emergencyAccess = true; 50 clan.core.vars.generators.password = { 51 prompts.password = { 52 description = "Password for the main user"; 53 type = "hidden"; 54 }; 55 files.password.deploy = false; 56 files.passwordHash.neededFor = "users"; 57 migrateFact = "password"; 58 runtimeInputs = with pkgs; [ 59 coreutils 60 mkpasswd 61 ]; 62 script = '' 63 cp $prompts/password $out/password 64 cat $out/password | mkpasswd -s -m sha-512 > $out/passwordHash 65 ''; 66 }; 67 } 68 { 69 # deployment information 70 options.clan.flake-inputs = lib.mkOption { 71 description = '' 72 information about the flake inputs. 73 Used for update tracking. 74 ''; 75 type = lib.types.attrsOf ( 76 lib.types.attrsOf ( 77 lib.types.nullOr ( 78 lib.types.oneOf [ 79 lib.types.str 80 lib.types.int 81 ] 82 ) 83 ) 84 ); 85 default = 86 let 87 inputs = config.clan.core.clanDir.inputs; 88 cleanSourceInfo = input: { 89 rev = input.rev or null; 90 dirtyRev = input.dirtyRev or null; 91 lastModified = input.lastModified or null; 92 narHash = input.narHash or null; 93 }; 94 sourceInfo = lib.mapAttrs (_: input: cleanSourceInfo input) inputs; 95 in 96 sourceInfo 97 // { 98 self = cleanSourceInfo config.clan.core.clanDir.sourceInfo; 99 }; 100 }; 101 config.environment.etc."flake-inputs.json".text = 102 let 103 text = builtins.unsafeDiscardStringContext (builtins.toJSON config.clan.flake-inputs); 104 in 105 text; 106 } 107 { 108 services.openssh.enable = true; 109 services.openssh.hostKeys = [ 110 { 111 path = config.clanCore.vars.generators.ssh.files."ssh.id_ed25519".path; 112 type = "ed25519"; 113 } 114 ]; 115 clan.core.vars.generators.ssh = { 116 files."ssh.id_ed25519".secret = true; 117 files."ssh.id_ed25519.pub".secret = false; 118 migrateFact = "ssh"; 119 runtimeInputs = with pkgs; [ 120 coreutils 121 openssh 122 ]; 123 script = '' 124 ssh-keygen -t ed25519 -N "" -f $out/ssh.id_ed25519 125 ''; 126 }; 127 } 128 { 129 users.extraUsers = { 130 root = { 131 openssh.authorizedKeys.keys = [ 132 config.krebs.users.lass.pubkey 133 ]; 134 }; 135 mainUser = { 136 name = "lass"; 137 uid = 1337; 138 home = "/home/lass"; 139 group = "users"; 140 createHome = true; 141 useDefaultShell = true; 142 isNormalUser = true; 143 extraGroups = [ 144 "audio" 145 "video" 146 "fuse" 147 "wheel" 148 "tor" 149 "dialout" 150 ]; 151 openssh.authorizedKeys.keys = [ 152 config.krebs.users.lass.pubkey 153 ]; 154 }; 155 }; 156 } 157 ( 158 let 159 ca-bundle = "/etc/ssl/certs/ca-bundle.crt"; 160 in 161 { 162 environment.variables = { 163 CURL_CA_BUNDLE = ca-bundle; 164 GIT_SSL_CAINFO = ca-bundle; 165 SSL_CERT_FILE = ca-bundle; 166 }; 167 } 168 ) 169 { 170 #for sshuttle 171 environment.systemPackages = [ 172 pkgs.python3Packages.python 173 ]; 174 } 175 ]; 176 177 networking.hostName = config.krebs.build.host.name; 178 179 krebs = { 180 enable = true; 181 build.user = config.krebs.users.lass; 182 ssl.trustIntermediate = true; 183 }; 184 185 users.mutableUsers = false; 186 187 # multiple-definition-problem when defining environment.variables.EDITOR 188 environment.extraInit = '' 189 EDITOR=vim 190 ''; 191 192 nixpkgs.config.allowUnfree = true; 193 194 environment.systemPackages = with pkgs; [ 195 self.packages.${pkgs.system}.nvim 196 197 git 198 git-absorb 199 git-preview 200 gnumake 201 jq 202 nix-output-monitor 203 comma 204 205 #style 206 rxvt-unicode-unwrapped.terminfo 207 alacritty.terminfo 208 209 #monitoring tools 210 htop 211 iotop 212 213 #network 214 iptables 215 iftop 216 tcpdump 217 mosh 218 eternal-terminal 219 self.packages.${pkgs.system}.sshify 220 221 #stuff for dl 222 aria2 223 224 #neat utils 225 file 226 hashPassword 227 xkcdpass 228 kpaste 229 cyberlocker-tools 230 pciutils 231 pop 232 q 233 untilport 234 (pkgs.writeDashBin "urgent" '' 235 printf '\a' 236 '') 237 usbutils 238 self.packages.${pkgs.system}.logify 239 goify 240 241 #unpack stuff 242 libarchive 243 244 (pkgs.writeDashBin "sshn" '' 245 ${pkgs.openssh}/bin/ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@" 246 '') 247 ]; 248 249 environment.shellAliases = { 250 ll = "ls -l"; 251 la = "ls -la"; 252 ls = "ls --color"; 253 ip = "ip -color=auto"; 254 grep = "grep --color=auto"; 255 nosleep = "systemd-inhibit --what=handle-lid-switch sleep infinity"; 256 }; 257 258 programs.bash = { 259 enableCompletion = true; 260 interactiveShellInit = '' 261 HISTCONTROL='erasedups:ignorespace' 262 HISTSIZE=65536 263 HISTFILESIZE=$HISTSIZE 264 265 shopt -s checkhash 266 shopt -s histappend histreedit histverify 267 shopt -s no_empty_cmd_completion 268 complete -d cd 269 LS_COLORS=$LS_COLORS:'di=1;31:' ; export LS_COLORS 270 ''; 271 promptInit = '' 272 if test $UID = 0; then 273 PS1='\[\033[1;31m\]\w\[\033[0m\] ' 274 PROMPT_COMMAND='echo -ne "\033]0;$$ $USER@$PWD\007"' 275 elif test $UID = 1337; then 276 PS1='\[\033[1;32m\]\w\[\033[0m\] ' 277 PROMPT_COMMAND='echo -ne "\033]0;$$ $PWD\007"' 278 else 279 PS1='\[\033[1;33m\]\u@\w\[\033[0m\] ' 280 PROMPT_COMMAND='echo -ne "\033]0;$$ $USER@$PWD\007"' 281 fi 282 if test -n "$SSH_CLIENT"; then 283 PS1='\[\033[35m\]\h'" $PS1" 284 PROMPT_COMMAND='echo -ne "\033]0;$$ $HOSTNAME $USER@$PWD\007"' 285 fi 286 ''; 287 }; 288 289 services.journald.extraConfig = '' 290 SystemMaxUse=1G 291 RuntimeMaxUse=128M 292 Storage=persistent 293 ''; 294 295 krebs.iptables = { 296 enable = true; 297 tables = { 298 filter.INPUT.policy = "DROP"; 299 filter.FORWARD.policy = lib.mkDefault "DROP"; 300 filter.INPUT.rules = lib.mkMerge [ 301 (lib.mkBefore [ 302 { 303 predicate = "-m conntrack --ctstate RELATED,ESTABLISHED"; 304 target = "ACCEPT"; 305 } 306 { 307 predicate = "-p icmp"; 308 target = "ACCEPT"; 309 } 310 { 311 predicate = "-p ipv6-icmp"; 312 target = "ACCEPT"; 313 v4 = false; 314 } 315 { 316 predicate = "-i lo"; 317 target = "ACCEPT"; 318 } 319 { 320 predicate = "-p tcp --dport 22"; 321 target = "ACCEPT"; 322 } 323 ]) 324 (lib.mkOrder 1000 [ 325 { 326 predicate = "-p udp --dport 60000:61000"; 327 target = "ACCEPT"; 328 } # mosh 329 { 330 predicate = "-i retiolum -p udp -m udp --dport 53"; 331 target = "ACCEPT"; 332 } 333 { 334 predicate = "-i retiolum -p tcp --dport 19999"; 335 target = "ACCEPT"; 336 } 337 ]) 338 (lib.mkAfter [ 339 { 340 predicate = "-p tcp -i retiolum"; 341 target = "REJECT --reject-with tcp-reset"; 342 } 343 { 344 predicate = "-p udp -i retiolum"; 345 target = "REJECT --reject-with icmp-port-unreachable"; 346 v6 = false; 347 } 348 { 349 predicate = "-i retiolum"; 350 target = "REJECT --reject-with icmp-proto-unreachable"; 351 v6 = false; 352 } 353 ]) 354 ]; 355 }; 356 }; 357 358 networking.dhcpcd.extraConfig = '' 359 noipv4ll 360 ''; 361 362 networking.extraHosts = '' 363 10.42.0.1 styx.gg23 364 ''; 365 366 # use 24:00 time format, the default got sneakily changed around 20.03 367 i18n.defaultLocale = lib.mkDefault "C.UTF-8"; 368 time.timeZone = lib.mkDefault "Europe/Berlin"; 369 370 # disable doc usually 371 documentation.nixos.enable = lib.mkDefault false; 372 373 # use new rebuild switch 374 system.switch = { 375 enable = false; 376 enableNg = true; 377 }; 378 379 # use latest nix to hunt all the bugs 380 nix.package = pkgs.nixVersions.latest; 381 382}