Last active
December 14, 2023 08:01
-
-
Save kaznak/734c6a3c56703c8690bab43d59e36016 to your computer and use it in GitHub Desktop.
NixOS configuration for AWS EC2 instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ modulesPath, pkgs, lib, ... }: { | |
imports = [ | |
"${modulesPath}/virtualisation/amazon-image.nix" | |
]; | |
ec2.hvm = true; | |
################################################ | |
system.autoUpgrade = { | |
enable = true; | |
allowReboot = true; | |
}; | |
nix.gc = { | |
automatic = true; | |
dates = "19:30"; | |
}; | |
################################################ | |
security.sudo.wheelNeedsPassword = false; | |
environment.systemPackages = with pkgs; [ | |
git vim file screen | |
docker-compose | |
]; | |
################################################ | |
# networking.hostName = "aws"; | |
services.fail2ban.enable = true; | |
services.openssh = lib.mkForce { | |
enable = true; | |
permitRootLogin = "no"; | |
passwordAuthentication = false; | |
forwardX11 = true; | |
}; | |
virtualisation.docker = { | |
enable = true; | |
autoPrune.enable = true; | |
}; | |
################################################ | |
users.users = import ./users.nix; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ # options of users.users | |
USER_NAME = { | |
isNormalUser = true; | |
extraGroups = [ "wheel" "docker" ]; | |
openssh.authorizedKeys.keys = [ | |
"<SSH_PUBKEY>" ]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment