nixos/hosts/bootstrap/default.nix

105 lines
2.3 KiB
Nix
Raw Normal View History

2024-05-22 21:10:41 +01:00
{ inputs, config, lib, pkgs, outputs,... }:
2024-05-22 21:14:20 +01:00
let
pubKeys = lib.filesystem.listFilesRecursive (../common/users/keys);
in
2024-05-14 14:51:09 +01:00
{
2024-05-22 21:10:41 +01:00
imports =
[
# Disk configuration
inputs.disko.nixosModules.disko
2024-05-22 21:10:41 +01:00
(import ../common/disks/std-disk-config.nix { device = "/dev/vda"; })
../common/optional/btrfs-impermanence.nix
inputs.impermanence.nixosModules.impermanence
2024-05-14 14:51:09 +01:00
# Import core options
./hardware-configuration.nix
../common/core
2024-05-22 21:10:41 +01:00
];
2024-05-14 14:51:09 +01:00
2024-05-22 21:10:41 +01:00
nixpkgs = {
overlays = [
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
];
config = {
allowUnfree = true;
};
};
2024-05-14 14:51:09 +01:00
2024-05-22 21:10:41 +01:00
fileSystems."/persist".neededForBoot = true;
environment.persistence."/persist" = {
hideMounts = true;
directories = [
"/etc/nixos"
];
files = [
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/deploy_key-ssh-ed25519"
];
};
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = 3;
2024-05-14 14:51:09 +01:00
};
};
2024-05-22 21:10:41 +01:00
users = {
mutableUsers = true;
extraUsers = {
root = {
initialPassword = "1234";
2024-05-22 21:15:22 +01:00
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
2024-05-22 21:10:41 +01:00
};
};
2024-05-14 14:51:09 +01:00
};
networking = {
hostName = "bootstrap";
2024-05-14 14:51:09 +01:00
networkmanager.enable = true;
enableIPv6 = false;
2024-05-14 14:51:09 +01:00
};
2024-05-22 21:10:41 +01:00
services.openssh = {
enable = true;
2024-05-22 21:15:58 +01:00
ports = [22];
2024-05-22 21:10:41 +01:00
authorizedKeysFiles = lib.mkForce ["/etc/ssh/authorized_keys.d/%u"];
hostKeys = [{
path = "/persist/etc/ssh/ssh_host_ed25519_key";
type = "ed25519";
}];
settings = {
PasswordAuthentication = false;
PermitRootLogin = "yes";
PubKeyAuthentication = "yes";
StreamLocalBindUnlink = "yes";
UsePAM = true;
2024-05-14 14:51:09 +01:00
};
};
2024-05-22 21:10:41 +01:00
programs.ssh.extraConfig = ''
Host git.bitlab21.com
IdentitiesOnly yes
StrictHostKeyChecking no
IdentityFile /etc/ssh/deploy_key-ssh-ed25519
2024-05-22 21:14:20 +01:00
'';
2024-05-22 21:10:41 +01:00
2024-05-14 14:51:09 +01:00
security.pam = {
sshAgentAuth.enable = true;
};
2024-05-22 21:10:41 +01:00
2024-05-22 21:14:47 +01:00
networking.firewall.allowedTCPPorts = [ 22 ];
2024-05-14 14:51:09 +01:00
2024-05-22 21:10:41 +01:00
services = {
qemuGuest.enable = true;
2024-05-14 14:51:09 +01:00
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
system.stateVersion = "23.11";
}