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