diff --git a/main.nix b/main.nix index de3c650..e91de43 100644 --- a/main.nix +++ b/main.nix @@ -2,6 +2,7 @@ systemStateVersion ? "23.11", hostName, user, + enableSSHServer ? false, }: { ... }: let @@ -17,6 +18,10 @@ in (import ./modules/os/core.nix { hostName = hostName; }) + (import ./modules/os/ssh.nix { + user = user; + enableSSHServer = enableSSHServer; + }) (import "${home-manager}/nixos") ./modules/os/services.nix ./modules/docker/core.nix diff --git a/modules/os/core.nix b/modules/os/core.nix index 3416720..43e72fc 100644 --- a/modules/os/core.nix +++ b/modules/os/core.nix @@ -5,10 +5,11 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = "nixos"; # Define your hostname. + networking.hostName = hostName; # Define your hostname. # Enable networking networking.networkmanager.enable = true; + networking.firewall.enable = false; # Set your time zone. time.timeZone = "America/Toronto"; @@ -16,19 +17,27 @@ # Select internationalisation properties. i18n.defaultLocale = "en_CA.UTF-8"; - # Fonts - # fonts = { - # packages = with pkgs; [ - # (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; }) - # ]; + # System Packages + environment.systemPackages = with pkgs; [ + git + vscode + nil + docker-compose + ]; - # fontconfig = { - # enable = true; - # defaultFonts = { - # serif = [ "FiraCode" "DroidSansMono" ]; - # sansSerif = [ "FiraCode" "DroidSansMono" ]; - # monospace = [ "FiraCode" ]; - # }; - # }; - # }; + # Fonts + fonts = { + packages = with pkgs; [ + (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; }) + ]; + + fontconfig = { + enable = true; + defaultFonts = { + serif = [ "FiraCode" "DroidSansMono" ]; + sansSerif = [ "FiraCode" "DroidSansMono" ]; + monospace = [ "FiraCode" ]; + }; + }; + }; } \ No newline at end of file diff --git a/modules/os/nix.nix b/modules/os/nix.nix index 8b66cef..e235e8e 100644 --- a/modules/os/nix.nix +++ b/modules/os/nix.nix @@ -2,10 +2,5 @@ { pkgs, ... }: { nixpkgs.config.allowUnfree = true; - environment.systemPackages = with pkgs; [ - git - vscode - nil - ]; system.stateVersion = systemStateVersion; } \ No newline at end of file diff --git a/modules/os/ssh.nix b/modules/os/ssh.nix new file mode 100644 index 0000000..7cd029e --- /dev/null +++ b/modules/os/ssh.nix @@ -0,0 +1,18 @@ +{ enableSSHServer, user }: +{ ... }: +{ + services.openssh = if enableSSHServer then { + enable = true; + settings.PasswordAuthentication = false; + settings.KbdInteractiveAuthentication = false; + settings.PermitRootLogin = "yes"; + } else { + enable = false; + }; + users.users.${user.name}.openssh.authorizedKeys.keys = if enableSSHServer then [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCuatskL9qXvgvS3E8zRwosFnpcN0f8PkKl8syAvpn297V2iPk6mi8yK3EE7xPpxaKKlwUuBHDj3BNUCoLgdRFKUgroRDzr3BMm+gZTHy6CuEZBY9zBRTmH+aOV6FZ96QPW4zba0BW5YPkPNy/FhYibjpXyZ3nX4/LWSbPKQJ7wTnUJZgq4VFmevBOttvhzUJUgTziMFsGXn6I38fAi6LI8qwI+zOOdsNjtKgr/TIlO/7VqcH7GYnQEwlthl577sDd1V6+XWz649qoiBYyq0Ahm09dwYx2iGQwLo8IYFbSy4aJRK/PI0+ytnPBoF5QCl+ILb5E8uV3e6Wb9WpXl9Hv2iLx91/9iq5hykHPnfVtkq3MK0C2vqkvX1qFOIkKM7vmxvXGbaDZDGK3G+/zkQ7GUw8ydbl9wGwE9cKbm9miqs4w2Ry/+3IZasE6G2TI97bSzSYInQd2RwoglqBOaJojbUqgI9wvNdKxGhADNFbZah2+s6SSe1ByQRN3b9wtmqu0= ari@shared" + ] else []; + users.users.root.openssh.authorizedKeys.keys = if enableSSHServer then [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCuatskL9qXvgvS3E8zRwosFnpcN0f8PkKl8syAvpn297V2iPk6mi8yK3EE7xPpxaKKlwUuBHDj3BNUCoLgdRFKUgroRDzr3BMm+gZTHy6CuEZBY9zBRTmH+aOV6FZ96QPW4zba0BW5YPkPNy/FhYibjpXyZ3nX4/LWSbPKQJ7wTnUJZgq4VFmevBOttvhzUJUgTziMFsGXn6I38fAi6LI8qwI+zOOdsNjtKgr/TIlO/7VqcH7GYnQEwlthl577sDd1V6+XWz649qoiBYyq0Ahm09dwYx2iGQwLo8IYFbSy4aJRK/PI0+ytnPBoF5QCl+ILb5E8uV3e6Wb9WpXl9Hv2iLx91/9iq5hykHPnfVtkq3MK0C2vqkvX1qFOIkKM7vmxvXGbaDZDGK3G+/zkQ7GUw8ydbl9wGwE9cKbm9miqs4w2Ry/+3IZasE6G2TI97bSzSYInQd2RwoglqBOaJojbUqgI9wvNdKxGhADNFbZah2+s6SSe1ByQRN3b9wtmqu0= ari@shared" + ] else []; +} \ No newline at end of file