From 132904fa828d9c9db295e3f3d707912221841552 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Duje=20Mihanovi=C4=87?= Date: Fri, 15 Sep 2023 16:33:19 +0200 Subject: [PATCH] Separate config into server and laptop --- .gitignore | 1 + configs/laptop.nix | 111 ++++++++++++++++++++++++ configuration.nix => configs/server.nix | 18 +--- configuration.sample.nix | 17 ++++ 4 files changed, 130 insertions(+), 17 deletions(-) create mode 100644 configs/laptop.nix rename configuration.nix => configs/server.nix (85%) create mode 100644 configuration.sample.nix diff --git a/.gitignore b/.gitignore index 577b0a0..2ee4098 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +configuration.nix hardware-configuration.nix diff --git a/configs/laptop.nix b/configs/laptop.nix new file mode 100644 index 0000000..4af9965 --- /dev/null +++ b/configs/laptop.nix @@ -0,0 +1,111 @@ +{ config, pkgs, ... }: + +{ + networking.networkmanager.enable = true; + networking.wireless.enable = true; + + time.timeZone = "Europe/Zagreb"; + + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "hr_HR.UTF-8"; + LC_IDENTIFICATION = "hr_HR.UTF-8"; + LC_MEASUREMENT = "hr_HR.UTF-8"; + LC_MONETARY = "hr_HR.UTF-8"; + LC_NAME = "hr_HR.UTF-8"; + LC_NUMERIC = "hr_HR.UTF-8"; + LC_PAPER = "hr_HR.UTF-8"; + LC_TELEPHONE = "hr_HR.UTF-8"; + LC_TIME = "hr_HR.UTF-8"; + }; + + console = { + keyMap = "dvorak"; + packages = with pkgs; [ terminus_font ]; + font = "ter-124b"; + }; + + services.xserver = { + enable = true; + desktopManager.gnome.enable = true; + displayManager.gdm.enable = true; + }; + + sound.enable = true; + hardware.pulseaudio.enable = false; + services.pipewire = { + enable = true; + audio.enable = true; + alsa.enable = true; + alsa.enable32Bit = true; + pulse.enable = true; + }; + + programs.zsh = { + enable = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + }; + + users.users.duje = { + isNormalUser = true; + description = "Duje"; + extraGroups = [ "networkmanager" "wheel" ]; + shell = pkgs.zsh; + }; + + nixpkgs.config.allowUnfree = true; + + environment.systemPackages = with pkgs; [ + neovim + lm_sensors + htop + nvimpager + tree + neofetch + ]; + + hardware.sensor.hddtemp = { + enable = true; + drives = [ "/dev/disk/by-path/*" ]; + }; + + services.smartd.enable = true; + programs.msmtp = { + enable = true; + defaults = { + auth = true; + tls = true; + tls_starttls = true; + aliases = "/etc/aliases"; + }; + accounts = { + default = { + from = "duje.mihanovic@skole.hr"; + host = "smtp.skole.hr"; + port = 587; + user = "duje.mihanovic"; + passwordeval = "/run/current-system/sw/bin/cat /secrets/email.txt"; + }; + }; + }; + + environment.etc."aliases" = { + text = '' + root: duje.mihanovic@skole.hr + duje: duje.mihanovic@skole.hr + mailer-daemon: duje.mihanovic@skole.hr + ''; + mode = "0644"; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + system.stateVersion = "23.05"; + +} diff --git a/configuration.nix b/configs/server.nix similarity index 85% rename from configuration.nix rename to configs/server.nix index b679930..6727148 100644 --- a/configuration.nix +++ b/configs/server.nix @@ -1,26 +1,10 @@ { config, pkgs, ... }: { - imports = - [ - ./hardware-configuration.nix - ]; - - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - boot.extraModprobeConfig = - '' - options radeon si_support=0 cik_support=0 - options amdgpu si_support=1 cik_support=1 - ''; - - networking.hostName = "elitedesk"; # Define your hostname. - networking.interfaces.eno1.wakeOnLan.enable = true; systemd.network = { enable = true; networks."10-lan" = { - matchConfig.Name = "eno1"; + matchConfig.Name = "*"; DHCP = "yes"; linkConfig.RequiredForOnline = "routable"; }; diff --git a/configuration.sample.nix b/configuration.sample.nix new file mode 100644 index 0000000..06832db --- /dev/null +++ b/configuration.sample.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: + +{ + # Uncomment the respective config here. + imports = + [ + ./hardware-configuration.nix + #./configs/server.nix + #./configs/laptop.nix + ]; + + # Enable EFI bootloader. + #boot.loader.systemd-boot.enable = true; + #boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "nixos"; # Define your hostname. +} -- 2.39.5