about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--hosts/configuration.nix104
-rw-r--r--hosts/home.nix82
-rw-r--r--hosts/phobos/default.nix17
-rw-r--r--hosts/phobos/hardware.nix49
-rw-r--r--modules/virtualisation/default.nix10
-rw-r--r--modules/xorg/default.nix22
-rw-r--r--overlays/base.nix2
-rw-r--r--secrets/default.nixbin345 -> 348 bytes
8 files changed, 158 insertions, 128 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
diff --git a/hosts/home.nix b/hosts/home.nix
index ef9bb98..f47e625 100644
--- a/hosts/home.nix
+++ b/hosts/home.nix
@@ -3,42 +3,44 @@ let
   dotfiles = ../dotfiles;
 in
 {
-  home.username = "${user}";
-  home.homeDirectory = "/home/${user}";
+  home = {
+    username = "${user}";
+    homeDirectory = "/home/${user}";
 
-  home.packages = with pkgs; [
-    scrot
-    qemu
-    redshift
-    custom.xwinwrap
-    discord
-    mpv
-    sxiv
-    dwm
-    st
-    dmenu
-    unclutter
-    clipmenu
-    dunst
-    sxhkd
-    feh
-    custom.smart-wallpaper
-    custom.dwmbar
-    numlockx
-    surf
-    pavucontrol
-    light
-    polkit_gnome
-    progress
-    qbittorrent
-    xorg.xev
-    statix
-    custom.anime-downloader
-    custom.adl
-    custom.trackma
-    kcc
-    custom.kindlegen
-  ];
+    packages = with pkgs; [
+      scrot
+      qemu
+      redshift
+      custom.xwinwrap
+      discord
+      mpv
+      sxiv
+      dwm
+      st
+      dmenu
+      unclutter
+      clipmenu
+      dunst
+      sxhkd
+      feh
+      custom.smart-wallpaper
+      custom.dwmbar
+      numlockx
+      surf
+      pavucontrol
+      light
+      polkit_gnome
+      progress
+      qbittorrent
+      xorg.xev
+      statix
+      custom.anime-downloader
+      custom.adl
+      custom.trackma
+      kcc
+      custom.kindlegen
+    ];
+  };
 
   services.gpg-agent = {
     enable = true;
@@ -151,10 +153,12 @@ in
     };
   };
 
-  xdg.configFile."zathura/zathurarc".source = dotfiles + "/zathurarc";
-  xdg.configFile."sxhkd/".source = dotfiles + "/sxhkd/";
-  xdg.configFile."dunst/dunstrc".source = dotfiles + "/dunstrc";
-  xdg.configFile."dwmbar".source = dotfiles + "/dwmbar/";
+  xdg = {
+    configFile."zathura/zathurarc".source = dotfiles + "/zathurarc";
+    configFile."sxhkd/".source = dotfiles + "/sxhkd/";
+    configFile."dunst/dunstrc".source = dotfiles + "/dunstrc";
+    configFile."dwmbar".source = dotfiles + "/dwmbar/";
+  };
 
   home.file = {
     ".bash_profile".source = dotfiles + "/.bash_profile";
diff --git a/hosts/phobos/default.nix b/hosts/phobos/default.nix
index cbefcba..9871b91 100644
--- a/hosts/phobos/default.nix
+++ b/hosts/phobos/default.nix
@@ -13,13 +13,16 @@
   boot.loader.grub.device = "/dev/sdb"; # or "nodev" for efi only
 
   # Pick only one of the below networking options.
-  networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
-  networking.wireless.networks = secrets.wifi;
-  # networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.
-
-  # Configure network proxy if necessary
-  # networking.proxy.default = "http://user:password@proxy:port/";
-  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
+  networking = {
+    wireless = {
+      enable = true; # Enables wireless support via wpa_supplicant.
+      networks = secrets.wifi;
+    };
+    # networkmanager.enable = true;  # Easiest to use and most distros use this by default.
+    # Configure network proxy if necessary
+    # proxy.default = "http://user:password@proxy:port/";
+    # proxy.noProxy = "127.0.0.1,localhost,internal.domain";
+  };
 
   environment.systemPackages = with pkgs;
     [
diff --git a/hosts/phobos/hardware.nix b/hosts/phobos/hardware.nix
index 6194c2d..84e9b8b 100644
--- a/hosts/phobos/hardware.nix
+++ b/hosts/phobos/hardware.nix
@@ -5,12 +5,16 @@ in
 {
   imports = [ ];
 
-  boot.initrd.availableKernelModules =
-    [ "xhci_pci" "ahci" "usbhid" "sd_mod" "sdhci_pci" ];
-  boot.initrd.kernelModules = [ ];
-  boot.kernelModules = [ "kvm_intel" ];
-  boot.extraModulePackages = [ ];
-  boot.kernelParams = [ "net.ifnames=0" "biosdevname=0" "iomem=relaxed" ];
+  boot = {
+    initrd = {
+      availableKernelModules =
+        [ "xhci_pci" "ahci" "usbhid" "sd_mod" "sdhci_pci" ];
+      kernelModules = [ ];
+    };
+    kernelModules = [ "kvm_intel" ];
+    extraModulePackages = [ ];
+    kernelParams = [ "net.ifnames=0" "biosdevname=0" "iomem=relaxed" ];
+  };
 
   fileSystems."/" = {
     device = "/dev/disk/by-uuid/2a0ba6f5-a4ec-4614-9bd2-11b4a66d5d82";
@@ -21,20 +25,29 @@ in
 
   powerManagement.cpuFreqGovernor = powerMode;
 
-  services.xserver.videoDrivers = [ "intel" ];
-  #  hardware.nvidia.modesetting.enable = true;
-  hardware.opengl.enable = true;
-  hardware.opengl.driSupport = true;
   #services.xserver.videoDrivers = [ "nvidia" ];
+  services.xserver = {
+    videoDrivers = [ "intel" ];
+    # Enable touchpad support (enabled default in most desktopManager).
+    libinput.enable = true;
+  };
+
+  hardware = {
+    opengl = {
+      enable = true;
+      driSupport = true;
+    };
 
-  /* hardware.nvidia.prime = {
-    sync.enable = true;
+    # nvidia.modesetting.enable = true;
+    /*nvidia.prime = {
+      sync.enable = true;
 
-    # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
-    nvidiaBusId = "PCI:1:0:0";
+      # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
+      nvidiaBusId = "PCI:1:0:0";
+
+      # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
+      intelBusId = "PCI:0:2:0";
+      };*/
+  };
 
-    # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
-    intelBusId = "PCI:0:2:0";
-    };
-  */
 }
diff --git a/modules/virtualisation/default.nix b/modules/virtualisation/default.nix
index c81b3d4..82df906 100644
--- a/modules/virtualisation/default.nix
+++ b/modules/virtualisation/default.nix
@@ -1,8 +1,10 @@
-{ config, pkgs, ... }:
+{ config, pkgs, user, ... }:
 
 {
-  virtualisation.docker.enable = true;
-  users.users.baitinq.extraGroups = [ "docker" ];
+  virtualisation = {
+    docker.enable = true;
+    libvirtd.enable = true;
+  };
 
-  virtualisation.libvirtd.enable = true;
+  users.users.${user}.extraGroups = [ "docker" ];
 }
diff --git a/modules/xorg/default.nix b/modules/xorg/default.nix
index aeb4301..f75716a 100644
--- a/modules/xorg/default.nix
+++ b/modules/xorg/default.nix
@@ -1,19 +1,20 @@
-{ config, pkgs, ... }: {
-  services.xserver.enable = true;
+{ config, pkgs, ... }:
+{
+  services.xserver = {
+    enable = true;
 
-  # Configure keymap in X11
-  services.xserver.layout = "gb";
+    # Configure keymap in X11
+    layout = "gb";
 
-  services.xserver.displayManager.startx.enable = true;
-  services.xserver.windowManager.dwm.enable = true;
+    displayManager.startx.enable = true;
+    windowManager.dwm.enable = true;
 
-  # Enable touchpad support (enabled default in most desktopManager).
-  services.xserver.libinput.enable = true;
-  services.xserver.dpi = 96;
+    dpi = 96;
+  };
 
   systemd.user.services.polkit-gnome-authentication-agent-1 = {
     description = "polkit-gnome-authentication-agent-1";
-    #wants = [ "graphical-session.target" ];
+    wants = [ "graphical-session.target" ];
     wantedBy = [ "graphical-session.target" ];
     after = [ "graphical-session.target" ];
     serviceConfig = {
@@ -27,5 +28,4 @@
   };
   systemd.user.services.polkit-gnome-authentication-agent-1.enable = true;
 
-  #xsession.enable = true; NOT NEEDED RIGHT
 }
diff --git a/overlays/base.nix b/overlays/base.nix
index 681fa64..4429243 100644
--- a/overlays/base.nix
+++ b/overlays/base.nix
@@ -8,6 +8,7 @@ final: prev:
       sha256 = "sha256-jcfcOEQTdAw/4yFmHO3MtXjhcxNnNpqJgjuxy0T8zIs=";
     };
   });
+  
   dmenu = prev.dmenu.overrideAttrs (old: {
     src = prev.fetchFromGitHub {
       owner = "Baitinq";
@@ -16,6 +17,7 @@ final: prev:
       sha256 = "sha256-MyNMxdaWtgjClZGIHUtYwwx51u5NII5Ce4BnOnUojo8=";
     };
   });
+
   st = prev.st.overrideAttrs (old: {
     buildInputs = old.buildInputs ++ [ prev.harfbuzz ];
     src = prev.fetchFromGitHub {
diff --git a/secrets/default.nix b/secrets/default.nix
index f814874..9607c36 100644
--- a/secrets/default.nix
+++ b/secrets/default.nix
Binary files differ