From b914dc5b2b13419ced8640feaf0b3fc82c1dc2ca Mon Sep 17 00:00:00 2001 From: twoneis Date: Sun, 11 Feb 2024 02:15:47 +0100 Subject: [PATCH] basic configuration for home-server --- modules/server/default.nix | 68 ++++++++++++++++++++++++++++++++++++++ outputs.nix | 16 +++++++-- 2 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 modules/server/default.nix diff --git a/modules/server/default.nix b/modules/server/default.nix new file mode 100644 index 0000000..d2cd7cb --- /dev/null +++ b/modules/server/default.nix @@ -0,0 +1,68 @@ +{ pkgs, ... }: { + # Allow ssh access + services.openssh = { + enable = true; + settings = { + PasswordAuthentication = true; + KbdInteractiveAuthentication = true; + }; + }; + + # Allow packages from nixpkgs + nixpkgs.config = { + allowUnfree = true; + }; + + #Optimise nix store + nix = { + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + settings.auto-optimise-store = true; + }; + + # Enable nix flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Disable documentation + documentation.nixos.enable = false; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Amsterdam"; + + # Select internationalisation properties. + i18n = { + defaultLocale = "en_US.UTF-8"; + + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; + + # Security + security.rtkit.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.twoneis = { + isNormalUser = true; + description = "twoneis"; + extraGroups = [ "networkmanager" "wheel" ]; + }; + + # Use zsh + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; +} diff --git a/outputs.nix b/outputs.nix index c40b29f..4f328d5 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,6 +1,6 @@ { nixpkgs, home-manager, nixos-hardware, nur, niri, ... }@inputs: { nixosConfigurations = let - commonModules = [ + clientModules = [ ./modules/system niri.nixosModules.default home-manager.nixosModules.home-manager { @@ -14,19 +14,29 @@ }; } ]; + serverModules = [ + ./modules/server + ]; in { desktop = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./devices/desktop - ] ++ commonModules; + ] ++ clientModules; }; surface = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./devices/surface - ] ++ commonModules; + ] ++ clientModules; + }; + + zotac-mini = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./devices/zotac-mini + ] ++ serverModules; }; }; }