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