about summary refs log tree commit diff
path: root/hosts/configuration.nix
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2022-06-19 15:58:52 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2022-06-19 15:58:52 +0200
commit763b2a81231348187a51bf6cc9cdc0fa7705404a (patch)
tree2ec0a31f0c204681c4d8ca6b4d353ac193c68da1 /hosts/configuration.nix
parentRefactor custom packages (diff)
downloadnixos-config-763b2a81231348187a51bf6cc9cdc0fa7705404a.tar.gz
nixos-config-763b2a81231348187a51bf6cc9cdc0fa7705404a.tar.bz2
nixos-config-763b2a81231348187a51bf6cc9cdc0fa7705404a.zip
Refractor codebase
Diffstat (limited to 'hosts/configuration.nix')
-rw-r--r--hosts/configuration.nix104
1 files changed, 55 insertions, 49 deletions
diff --git a/hosts/configuration.nix b/hosts/configuration.nix
index 8bb625b..6f60e49 100644
--- a/hosts/configuration.nix
+++ b/hosts/configuration.nix
@@ -9,27 +9,38 @@
   ];
 
   # Use the GRUB 2 boot loader.
-  boot.loader.grub.enable = true;
-  boot.loader.grub.version = 2;
-  boot.loader.grub.splashImage = null;
-  # boot.loader.grub.efiSupport = true;
-  # boot.loader.grub.efiInstallAsRemovable = true;
-  # boot.loader.efi.efiSysMountPoint = "/boot/efi";
-  boot.loader.timeout = 0;
+  boot.loader = {
+    grub = {
+      enable = true;
+      version = 2;
+      splashImage = null;
+      # efiSupport = true;
+      # efiInstallAsRemovable = true;
+    };
+    # efi.efiSysMountPoint = "/boot/efi";
+    timeout = 0;
+  };
 
   # Set your time zone.
   time.timeZone = "Europe/Madrid";
 
-  networking.hostName = hostname; # Define your hostname.
-  networking.extraHosts = builtins.readFile ../dotfiles/hosts;
-  networking.nameservers = [ "9.9.9.9" ];
-
-  # 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.enp0s3.useDHCP = lib.mkDefault true;
+  networking = {
+    hostName = hostname; # Define your hostname.
+    extraHosts = builtins.readFile ../dotfiles/hosts;
+    nameservers = [ "9.9.9.9" ];
+    firewall = {
+      enable = true;
+      allowedTCPPorts = [ 2222 ];
+      # networking.firewall.allowedUDPPorts = [ ... ];
+      # Or disable the firewall altogether.
+    };
+    # 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`.
+    useDHCP = lib.mkDefault true;
+    # interfaces.enp0s3.useDHCP = lib.mkDefault true;
+  };
 
   # Select internationalisation properties.
   i18n.defaultLocale = "en_US.UTF-8";
@@ -81,25 +92,27 @@
   # programs.mtr.enable = true;
 
   # List services that you want to enable:
+  services = {
+    openssh = {
+      enable = true;
+      listenAddresses = [{
+        addr = "0.0.0.0";
+        port = 2222;
+      }];
+    };
+  };
 
-  # Enable the OpenSSH daemon.
-  services.openssh.enable = true;
-  services.openssh.listenAddresses = [{
-    addr = "0.0.0.0";
-    port = 2222;
-  }];
-  programs.ssh.askPassword = "";
-
-  /*programs.ssh.startAgent = true;
-    programs.ssh.extraConfig = ''
-    AddKeysToAgent yes
-    '';*/
-
-  programs.firejail.enable = true;
-  programs.firejail.wrappedBinaries = {
-    discord-wrapped = {
-      executable = "${lib.getBin pkgs.discord}/bin/discord";
-      profile = "${pkgs.firejail}/etc/firejail/discord.profile";
+  programs = {
+    ssh.askPassword = "";
+
+    firejail = {
+      enable = true;
+      wrappedBinaries = {
+        discord-wrapped = {
+          executable = "${lib.getBin pkgs.discord}/bin/discord";
+          profile = "${pkgs.firejail}/etc/firejail/discord.profile";
+        };
+      };
     };
   };
 
@@ -110,31 +123,24 @@
       dates = "daily";
       options = "-d";
     };
+    package = pkgs.nixFlakes;
+    extraOptions = "experimental-features = nix-command flakes";
+    maxJobs = "auto";
+    buildCores = 0;
   };
 
-  # Open ports in the firewall.
-  networking.firewall.allowedTCPPorts = [ 2222 ];
-  # networking.firewall.allowedUDPPorts = [ ... ];
-  # Or disable the firewall altogether.
-  networking.firewall.enable = true;
-
   # Copy the NixOS configuration file and link it from the resulting system
   # (/run/current-system/configuration.nix). This is useful in case you
   # accidentally delete configuration.nix.
   #system.copySystemConfiguration = true;
 
-  nix = {
-    package = pkgs.nixFlakes;
-    extraOptions = "experimental-features = nix-command flakes";
-    maxJobs = "auto";
-    buildCores = 0;
+  hardware = {
+    enableRedistributableFirmware = true;
+    cpu.intel.updateMicrocode = true;
   };
 
   lib.formatter.x86_64-linux = pkgs.nixpkgs-fmt;
 
-  hardware.enableRedistributableFirmware = true;
-  hardware.cpu.intel.updateMicrocode = true;
-
   # This value determines the NixOS release from which the default
   # settings for stateful data, like file locations and database versions
   # on your system were taken. It‘s perfectly fine and recommended to leave