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