forked from Fachschaft/nixConfig
Compare commits
16 commits
96611e47c2
...
44036f804a
Author | SHA1 | Date | |
---|---|---|---|
44036f804a | |||
191083f526 | |||
8a87066837 | |||
b91c5b0a2a | |||
c0d03be602 | |||
|
33519a678a | ||
4f414fa1d7 | |||
3dc8c90a27 | |||
4ccc9c83e6 | |||
d0d7237fa6 | |||
c7825cbd01 | |||
16fee6f1f9 | |||
44a0ef0ecd | |||
cba8cb1ce8 | |||
4d7d32f7b6 | |||
d7b8d63f83 |
3 changed files with 89 additions and 1 deletions
30
nixos/roles/admins.nix
Normal file
30
nixos/roles/admins.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{lib, ...} :
|
||||
with lib;
|
||||
|
||||
let
|
||||
admins = {
|
||||
nerf = {
|
||||
hashedPassword =
|
||||
"$y$j9T$SJcjUIcs3JYuM5oyxfEQa/$tUBQT07FK4cb9xm.A6ZKVnFIPNOYMOKC6Dt6hadCuJ7";
|
||||
keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEdA4LpEGUUmN8esFyrNZXFb2GiBID9/S6zzhcnofQuP nerf@nerflap2"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
mkAdmin = name :
|
||||
{hashedPassword, keys}: {
|
||||
"${name}" = {
|
||||
isNormalUser = true;
|
||||
createHome = true;
|
||||
extraGroups = [ "wheel" ];
|
||||
group = "users";
|
||||
home = "/home/${name}";
|
||||
openssh.authorizedKeys = { inherit keys; };
|
||||
inherit hashedPassword;
|
||||
};
|
||||
};
|
||||
|
||||
in {
|
||||
users.users = mkMerge (mapAttrsToList mkAdmin admins);
|
||||
}
|
|
@ -1,4 +1,56 @@
|
|||
{ ... } : {
|
||||
{pkgs, config, lib, modulesPath, ...} : {
|
||||
|
||||
imports = [
|
||||
./admins.nix
|
||||
./nix_keys.nix
|
||||
(modulesPath + "/virtualisation/xen-domU.nix")
|
||||
];
|
||||
nix = {
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
builders-use-substitutes = true
|
||||
'';
|
||||
};
|
||||
|
||||
networking = {
|
||||
firewall = { # these shoud be default, but better make sure!
|
||||
enable = true;
|
||||
allowPing = true;
|
||||
};
|
||||
nftables.enable = true;
|
||||
useDHCP = false; # We don't speak DHCP and even if we would, we should enable it per interface
|
||||
# hosts = # TODO write something to autogenerate ip adresses!
|
||||
};
|
||||
|
||||
users = {
|
||||
mutableUsers = false;
|
||||
users.root.hashedPassword = "!";
|
||||
};
|
||||
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
|
||||
environment = {
|
||||
systemPackages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
htop lsof tmux btop;
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
journald.extraConfig = "SystemMaxUse=5G";
|
||||
|
||||
nginx = {
|
||||
recommendedOptimisation = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedTlsSettings = true;
|
||||
};
|
||||
|
||||
openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PermitRootLogin = "no";
|
||||
PasswordAuthentication = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
6
nixos/roles/nix_keys.nix
Normal file
6
nixos/roles/nix_keys.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [ ];
|
||||
nix.settings.trusted-public-keys = [
|
||||
"nerflap2-1:pDZCg0oo9PxNQxwVSQSvycw7WXTl53PGvVeZWvxuqJc="
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue