~glorifiedgluer/dotfiles

d3971701cca176cfa57ab82dc3a60a25c7559f87 — Victor Freire 2 years ago 13a6b15
feat(hosts): add desktop
M flake.nix => flake.nix +54 -0
@@ 49,6 49,11 @@
            ./nixos/user.nix
            ./nixos/secrets/t495.nix

            ./hosts/common/boot.nix
            ./hosts/common/graphical.nix
            ./hosts/common/virtualisation.nix

            ./hosts/t495/default.nix
            ./hosts/t495/hardware-configuration.nix

            inputs.hardware.nixosModules.lenovo-thinkpad-t495


@@ 82,6 87,55 @@
          ];
        };

        desktop = prelude.mkHost {
          host = "desktop";
          system = "x86_64-linux";
          username = "victor";
          nixosModules = [
            ./modules/meta.nix
            ./nixos/cli.nix
            ./nixos/nix.nix
            ./nixos/user.nix
            ./nixos/secrets/t495.nix

            ./hosts/common/boot.nix
            ./hosts/common/graphical.nix
            ./hosts/common/virtualisation.nix

            ./hosts/desktop/hardware-configuration.nix
            ./hosts/desktop/default.nix

            inputs.agenix.nixosModule
          ];

          homeModules = [
            ./home/aerc.nix
            ./home/bash.nix
            ./home/chromium.nix
            ./home/cli.nix
            ./home/dconf.nix
            ./home/doom
            ./home/email.nix
            ./home/firefox.nix
            ./home/git.nix
            ./home/gui.nix
            ./home/home.nix
            ./home/jetbrains.nix
            ./home/kitty.nix
            ./home/neovim
            ./home/newsboat.nix
            ./home/rbw.nix
            ./home/vscodium.nix

            ./modules/aerc.nix
            ./modules/meta.nix

            inputs.nixColors.homeManagerModule
            inputs.nixDoomEmacs.hmModule
          ];
        };


        rpi4 = prelude.mkHost {
          host = "rpi4";
          system = "aarch64-linux";

A hosts/common/boot.nix => hosts/common/boot.nix +12 -0
@@ 0,0 1,12 @@
{
  boot = {
    extraModprobeConfig = ''
      options hid_apple fnmode=0
    '';

    binfmt.emulatedSystems = [ "aarch64-linux" ];

    cleanTmpDir = true;
    consoleLogLevel = 7;
  };
}

A hosts/common/graphical.nix => hosts/common/graphical.nix +45 -0
@@ 0,0 1,45 @@
{ pkgs, ... }:

{
  services = {
    xserver = {
      enable = true;
      libinput.enable = true;

      desktopManager = {
        gnome.enable = true;
        xterm.enable = false;
      };

      displayManager.gdm = {
        enable = true;
        wayland = true;
      };
    };

    pipewire = {
      enable = true;
      alsa = {
        enable = true;
        support32Bit = true;
      };
      pulse.enable = true;
    };
  };

  # Enable sound.
  sound.enable = true;
  hardware = {
    bluetooth.enable = true;
    ledger.enable = true;
    pulseaudio.enable = false;
  };

  programs = {
    dconf.enable = true;
    kdeconnect = {
      enable = true;
      package = pkgs.gnomeExtensions.gsconnect;
    };
  };
}

A hosts/common/virtualisation.nix => hosts/common/virtualisation.nix +12 -0
@@ 0,0 1,12 @@
{ config, lib, pkgs, ... }:

{
  virtualisation = {
    podman = {
      enable = true;
      dockerCompat = true;
    };

    libvirtd.enable = true;
  };
}

A hosts/desktop/default.nix => hosts/desktop/default.nix +26 -0
@@ 0,0 1,26 @@
{ config, ... }:

{
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";
  boot.loader.grub.useOSProber = true;

  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.opengl.enable = true;

  hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;

  # Set your time zone.
  time = {
    timeZone = "America/Sao_Paulo";
    hardwareClockInLocalTime = true;
  };

  networking = {
    hostName = "desktop";
    networkmanager.enable = true;
  };

  system.stateVersion = "22.11";
}

A hosts/desktop/hardware-configuration.nix => hosts/desktop/hardware-configuration.nix +41 -0
@@ 0,0 1,41 @@
# 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 = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/76267ac1-8983-4bc9-abb7-cd0784d2b5b1";
      fsType = "ext4";
    };

  fileSystems."/boot/efi" =
    { device = "/dev/disk/by-uuid/4065-3ACE";
      fsType = "vfat";
    };

  swapDevices =
    [ { device = "/dev/disk/by-uuid/a400afbf-ca46-40b0-93c7-8204948ec5e7"; }
    ];

  # 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.enp5s0.useDHCP = lib.mkDefault true;
  # networking.interfaces.enp6s0f3u1.useDHCP = lib.mkDefault true;

  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
  # high-resolution display
  hardware.video.hidpi.enable = lib.mkDefault true;
}

M hosts/t495/default.nix => hosts/t495/default.nix +2 -57
@@ 1,4 1,4 @@
{ config, lib, hardware, homeManager, nixpkgs, pkgs, ... }:
{ config, lib, hardware, nixpkgs, pkgs, ... }:

{
  boot = {


@@ 6,15 6,6 @@
      systemd-boot.enable = true;
      efi.canTouchEfiVariables = true;
    };

    extraModprobeConfig = ''
      options hid_apple fnmode=0
    '';

    binfmt.emulatedSystems = [ "aarch64-linux" ];

    cleanTmpDir = true;
    consoleLogLevel = 7;
  };

  # Set your time zone.


@@ 28,58 19,12 @@
    networkmanager.enable = true;
  };

  # Enable sound.
  sound.enable = true;
  hardware = {
    bluetooth.enable = true;
    ledger.enable = true;
    pulseaudio.enable = false;
  };

  programs = {
    dconf.enable = true;
    kdeconnect = {
      enable = true;
      package = pkgs.gnomeExtensions.gsconnect;
    };
  };

  services = {
    xserver = {
      enable = true;
      videoDrivers = [ "amdgpu" ];
      libinput.enable = true;
  services.xserver.videoDrivers = [ "amdgpu" ];

      desktopManager = {
        gnome.enable = true;
        xterm.enable = false;
      };

      displayManager.gdm = {
        enable = true;
        wayland = true;
      };
    };

    pipewire = {
      enable = true;
      alsa = {
        enable = true;
        support32Bit = true;
      };
      pulse.enable = true;
    };
  };

  virtualisation = {
    docker.enable = true;
    libvirtd.enable = true;
  };

  environment = {
    etc = {
      "nix/channels/nixpkgs".source = nixpkgs;
      "nix/channels/home-manager".source = homeManager;
    };

    systemPackages = with pkgs; [

M nixos/nix.nix => nixos/nix.nix +6 -0
@@ 6,6 6,12 @@
}:

{
  environment = {
    etc = {
      "nix/channels/nixpkgs".source = nixpkgs;
    };
  };

  nix = {
    package = pkgs.nix;


M prelude/default.nix => prelude/default.nix +0 -3
@@ 38,9 38,6 @@ rec {
      modules =
        nixosModules
        ++ [
          # host configuration
          (../hosts + "/${host}")

          # home manager
          inputs.homeManager.nixosModules.home-manager
          {