146 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			146 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{ config, lib, inputs, outputs, pkgs, timeZone, system, ... }:
 | 
						|
let
 | 
						|
  supportedDesktops = [ "niri" ];
 | 
						|
  supportedDesktopsStr = lib.strings.concatStringsSep ", " supportedDesktops;
 | 
						|
  deskCfg = config.deskCfg;
 | 
						|
in
 | 
						|
{
 | 
						|
  options.deskCfg = {
 | 
						|
      de = lib.mkOption {
 | 
						|
          default = "";
 | 
						|
          type = lib.types.str;
 | 
						|
          description = "Desktop Environment";
 | 
						|
      };
 | 
						|
      userName = lib.mkOption {
 | 
						|
          type = lib.types.str;
 | 
						|
          description = "Main username for system";
 | 
						|
      };
 | 
						|
      hostName = lib.mkOption {
 | 
						|
          type = lib.types.str;
 | 
						|
          description = "Hostname for system";
 | 
						|
      };
 | 
						|
      installGaming = lib.mkOption {
 | 
						|
          type = lib.types.bool;
 | 
						|
          default = true;
 | 
						|
          description = "Whether to install gaming software or not";
 | 
						|
      };
 | 
						|
  };
 | 
						|
 | 
						|
    imports = [
 | 
						|
      modules/user/main_user.nix
 | 
						|
      modules/niri/niri_conf.nix
 | 
						|
      modules/niri/auto-rotation.nix
 | 
						|
      ../shared/modules/system/power_manager.nix
 | 
						|
    ];
 | 
						|
 | 
						|
   config = {
 | 
						|
    assertions = [
 | 
						|
      {
 | 
						|
        assertion = builtins.elem deskCfg.de supportedDesktops;
 | 
						|
        message = "Unsupported desktop environment: ${deskCfg.de}\nSupported DE's: ${supportedDesktopsStr}";
 | 
						|
      }
 | 
						|
    ];
 | 
						|
  
 | 
						|
    nixpkgs.overlays = [
 | 
						|
      inputs.nur.overlays.default
 | 
						|
    ];
 | 
						|
  
 | 
						|
 
 | 
						|
    # Enable flakes feature
 | 
						|
    nix.settings.experimental-features = [
 | 
						|
      "nix-command" "flakes"
 | 
						|
    ];
 | 
						|
    nixpkgs.config.allowUnfree = true;
 | 
						|
  
 | 
						|
    boot = {
 | 
						|
      plymouth = {
 | 
						|
        enable = true;
 | 
						|
        theme = "circuit";
 | 
						|
        themePackages = with pkgs; [
 | 
						|
          # By default we would install all themes
 | 
						|
          (adi1090x-plymouth-themes.override {
 | 
						|
            selected_themes = [ "circuit" "circle_flow" ];
 | 
						|
          })
 | 
						|
        ];
 | 
						|
      };
 | 
						|
 | 
						|
      # Enable "Silent Boot"
 | 
						|
      consoleLogLevel = 0;
 | 
						|
      initrd.verbose = false;
 | 
						|
      kernelParams = [
 | 
						|
        "quiet"
 | 
						|
        "splash"
 | 
						|
        "boot.shell_on_fail"
 | 
						|
        "loglevel=3"
 | 
						|
        "rd.systemd.show_status=false"
 | 
						|
        "rd.udev.log_level=3"
 | 
						|
        "udev.log_priority=3"
 | 
						|
      ];
 | 
						|
      # Hide the OS choice for bootloaders.
 | 
						|
      # It's still possible to open the bootloader list by pressing any key
 | 
						|
      # It will just not appear on screen unless a key is pressed
 | 
						|
      loader.timeout = 0;
 | 
						|
      # Use the systemd-boot EFI boot loader.
 | 
						|
      loader.systemd-boot.enable = true;
 | 
						|
      loader.efi.canTouchEfiVariables = true;
 | 
						|
      # Use latest kernel packages
 | 
						|
      kernelPackages = pkgs.linuxPackages_latest;
 | 
						|
    };
 | 
						|
    networking.hostName = deskCfg.hostName; # Define your hostname.
 | 
						|
    networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.
 | 
						|
    networking.wireless.iwd.enable = true;  
 | 
						|
 | 
						|
    time.timeZone = timeZone;
 | 
						|
   
 | 
						|
    main_user = {
 | 
						|
      enable = true;
 | 
						|
      userName = deskCfg.userName;
 | 
						|
      isDesktopUser = true;
 | 
						|
    };
 | 
						|
    
 | 
						|
    power_manager = {
 | 
						|
      enable = true;
 | 
						|
    };
 | 
						|
 | 
						|
    niriwm = {
 | 
						|
      enable = true;
 | 
						|
      useNonFree = true;
 | 
						|
      user = deskCfg.userName;
 | 
						|
      systemPackages = with pkgs; [
 | 
						|
        libreoffice
 | 
						|
        rpi-imager
 | 
						|
      ];
 | 
						|
    };
 | 
						|
 | 
						|
    niri-auto-rotation = {
 | 
						|
      enable = true;
 | 
						|
      user = deskCfg.userName;
 | 
						|
      monitor = "eDP-1";
 | 
						|
    };
 | 
						|
 | 
						|
    environment.systemPackages = with pkgs; [
 | 
						|
      cryptsetup
 | 
						|
      cage
 | 
						|
    ];
 | 
						|
 | 
						|
    programs.niri.enable = true;
 | 
						|
    # For electron apps in wayland
 | 
						|
    environment.sessionVariables.NIXOS_OZONE_WL = "1";
 | 
						|
 | 
						|
    services.greetd = {
 | 
						|
      enable = true;
 | 
						|
      settings = rec {
 | 
						|
        initial_session = {
 | 
						|
          command = "${pkgs.niri}/bin/niri-session";
 | 
						|
          user = "nate";
 | 
						|
        };
 | 
						|
        default_session = initial_session;
 | 
						|
      };
 | 
						|
    };
 | 
						|
    
 | 
						|
    # For yubioath desktop
 | 
						|
    services.pcscd.enable = true;
 | 
						|
    system.stateVersion = "25.05"; # Did you read the comment?
 | 
						|
  };
 | 
						|
}
 |