diff options
| Commit | 8f77ce7a5ceb8dec7cfea38d2031624027fd0d3e (patch) | |
|---|---|---|
| Author | 2025-07-01 12:16:40 +0300 | |
| Committer | 2025-07-01 12:16:40 +0300 | |
| Files | a7f973829fa92f8d9e3ab7026d81e0587bf628d3 | |
| nix-8f77ce7a5ceb8dec7cfea38d2031624027fd0d3e.tar nix-8f77ce7a5ceb8dec7cfea38d2031624027fd0d3e.tar.gz nix-8f77ce7a5ceb8dec7cfea38d2031624027fd0d3e.zip | ||
| Parent | af422eab2e6917383cc321cc0393210f1585e631 (diff) | |
feat(machines): Add configuration for marduk server
This is a small home server
8 files changed, 143 insertions, 0 deletions
| -rw-r--r-- | machines/marduk/configuration.nix | 2 | ||||
| -rw-r--r-- | machines/marduk/hardware-configuration.nix | 38 | ||||
| -rw-r--r-- | machines/marduk/sysidentity.nix | 7 | ||||
| -rw-r--r-- | module-groups.nix | 2 | ||||
| -rw-r--r-- | modules/server/cli-essential.nix | 21 | ||||
| -rw-r--r-- | modules/server/default.nix | 64 | ||||
| l--------- | modules/server/fonts.nix | 1 | ||||
| -rw-r--r-- | modules/server/users-standard.nix | 8 |
diff --git a/machines/marduk/configuration.nix b/machines/marduk/configuration.nix new file mode 100644 index 0000000..0222734 --- /dev/null +++ b/machines/marduk/configuration.nix @@ -0,0 +1,2 @@ +{ pkgs, ... }: { +} diff --git a/machines/marduk/hardware-configuration.nix b/machines/marduk/hardware-configuration.nix new file mode 100644 index 0000000..0133201 --- /dev/null +++ b/machines/marduk/hardware-configuration.nix @@ -0,0 +1,38 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "ohci_pci" "ehci_pci" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/9e9c092c-1fd7-4e10-a218-726c4c427be1"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/A18A-E092"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/marduk/sysidentity.nix b/machines/marduk/sysidentity.nix new file mode 100644 index 0000000..23047c0 --- /dev/null +++ b/machines/marduk/sysidentity.nix @@ -0,0 +1,7 @@ +groups: { + name = "marduk"; + arch = "x86_64-linux"; + kind = "server"; + + include = groups.barebones; +} diff --git a/module-groups.nix b/module-groups.nix index a2e777f..3f5835d 100644 --- a/module-groups.nix +++ b/module-groups.nix @@ -3,6 +3,8 @@ rec { barebones = [ "cli-essential" "fonts" "users-standard" ]; }; + server = rec { + }; personal = rec { personal = all.barebones ++ [ # default.nix is always included by autoconfig diff --git a/modules/server/cli-essential.nix b/modules/server/cli-essential.nix new file mode 100644 index 0000000..3f5c6e7 --- /dev/null +++ b/modules/server/cli-essential.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + dash htop rlwrap bc + # Hardware + lm_sensors lshw + # Network + curl wget git rsync inetutils netcat + # Files + vim-full nnn + # Archive formats + gnutar p7zip zip unzip rar unrar + ]; + + programs = { + gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryPackage = pkgs.pinentry-tty; + }; + }; +} diff --git a/modules/server/default.nix b/modules/server/default.nix new file mode 100644 index 0000000..058276c --- /dev/null +++ b/modules/server/default.nix @@ -0,0 +1,64 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + networkmanager + ]; + + # + # Kernel + # + + boot.kernelModules = [ "kvm-intel" ]; + + # + # Bootloader + # + + boot.loader = { + grub = { + enable = true; + copyKernels = true; + efiSupport = true; + efiInstallAsRemovable = true; + # Define on which hard drive you want to install Grub + device = "nodev"; # or "nodev" for efi only + }; + timeout = 1; + }; + + # + # Timezone and locale + # + + # Set your time zone. + time.timeZone = "Europe/Sofia"; + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + # + # Networking + # + + networking = { + networkmanager.enable = true; + firewall.allowedTCPPorts = [ 2200 ]; + }; + + # zeroconf networking + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + services.openssh = { + enable = true; + ports = [ 2200 ]; + settings = { + PasswordAuthentication = true; + AllowUsers = [ "admin" ]; + UseDns = true; + X11Forwarding = true; + PermitRootLogin = "no"; + }; + }; +} diff --git a/modules/server/fonts.nix b/modules/server/fonts.nix new file mode 120000 index 0000000..9bd6055 --- /dev/null +++ b/modules/server/fonts.nix @@ -0,0 +1 @@ +../personal/fonts.nix
\ No newline at end of file diff --git a/modules/server/users-standard.nix b/modules/server/users-standard.nix new file mode 100644 index 0000000..ae9b30b --- /dev/null +++ b/modules/server/users-standard.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: { + users.users.admin = { + isNormalUser = true; + extraGroups = [ "wheel" "audio" "video" "input" "plugdev" ]; + packages = [ ]; + shell = pkgs.bash; + }; +} |
