diff --git a/.ignore b/.ignore index f3d5883..dbf5c87 100644 --- a/.ignore +++ b/.ignore @@ -1,3 +1,3 @@ -dotfiles/ +# dotfiles/ .git/ flake.lock diff --git a/flake.nix b/flake.nix index 1094877..ef896b4 100644 --- a/flake.nix +++ b/flake.nix @@ -22,61 +22,39 @@ inherit (self) outputs; system = "x86_64-linux"; userName = "nate"; + fullName = "Nate Anderson"; + email = "n8r@tuta.io"; hostName = "winmax"; desktop = "sway"; + gaming = true; + timeZone = "America/Denver"; pkgs = nixpkgs.legacyPackages.${system}; - stablePkgs = import nixpkgs-stable { - legacyPackages = system; - config.allowUnfree = true; - }; + stablePkgs = nixpkgs-stable.legacyPackages.${system}; in { - nixosConfigurations = { - default = nixpkgs.lib.nixosSystem { - # Pass args to sway_configuration - specialArgs = { - inherit inputs; - inherit userName; - inherit hostName; - }; - modules = [ - ./modules/sway/sway_conf.nix - # Setup home manager - home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.${userName} = import ./modules/home-manager/home.nix; - home-manager.extraSpecialArgs = { - inherit inputs outputs userName hostName; - }; - } - ]; - } + nixosConfigurations = { nixServer = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; modules = [ - ./nixos/configuration.nix + ./nixos/server_configuration.nix inputs.home-manager.nixosModules.default ]; }; - - nixSway = nixpkgs.lib.nixosSystem { - # Pass args to sway_configuration + nixDesktop = nixpkgs.lib.nixosSystem { + # Pass args to desktop configuration specialArgs = { - inherit inputs; - inherit userName; - inherit hostName; + inherit inputs outputs userName hostName desktop timeZone gaming; }; modules = [ - ./nixos/sway_configuration.nix + ./nixos/desktop_configuration.nix # Setup home manager home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.${userName} = import ./modules/home-manager/home.nix; home-manager.extraSpecialArgs = { - inherit inputs outputs userName hostName; + inherit inputs outputs userName fullName email hostName desktop gaming; }; } ]; diff --git a/modules/home-manager/home.nix b/modules/home-manager/home.nix index 03e66a5..fda6f86 100644 --- a/modules/home-manager/home.nix +++ b/modules/home-manager/home.nix @@ -1,4 +1,4 @@ -{ inputs, outputs, lib, config, pkgs, userName, hostName, ... }: +{ inputs, outputs, lib, config, pkgs, userName, fullName, email, hostName, desktop, gaming, ... }: { # Home Manager needs a bit of information about you and the paths it should # manage. @@ -37,7 +37,7 @@ wofi xfce.thunar # Install fonts - (nerdfonts.override { fonts = [ "Hermit" ]; }) + (nerdfonts.override { fonts = [ "Hermit" "Overpass" ]; }) overpass # # You can also create simple shell scripts directly inside your @@ -87,27 +87,27 @@ wayland.windowManager.sway = { enable = true; - config = rec { - modifier = "Mod4"; - terminal = "foot"; - # startup = [ - # {command = "firefox";} - # ]; - }; + # config = rec { + # modifier = "Mod4"; + # terminal = "foot"; + # # startup = [ + # # {command = "firefox";} + # # ]; + # }; }; # kdeconnect setup - services.kdeconnect = { - enable = true; - indicator = true; - }; + # services.kdeconnect = { + # enable = true; + # indicator = true; + # }; # Git setup programs.git = { enable = true; - userEmail = "n8r@tuta.io"; - userName = "Nate Anderson"; + userEmail = email; + userName = fullName; }; # Zsh setup diff --git a/modules/sway/sway_conf.nix b/modules/sway/sway_conf.nix index 306020d..8845c5c 100644 --- a/modules/sway/sway_conf.nix +++ b/modules/sway/sway_conf.nix @@ -7,6 +7,11 @@ example = true; description = "Whether to enable non-free software in the sway config"; }; + installGaming = lib.mkOption { + default = false; + example = true; + description = "Whether to install gaming software on the system."; + }; systemPackages = lib.mkOption { default = []; description = "Add any additional packages desired. Merged with sway defaults."; @@ -41,8 +46,8 @@ ### ## System Packages ### - environment.systemPackages = with pkgs; lib.mkMerge [ - [ + environment.systemPackages = with pkgs; lib.lists.flatten [ + [ git glib # gsettings grim @@ -50,16 +55,26 @@ slurp swaylock swayidle - wget wl-clipboard xdg-utils zsh - ] + # Add to gaming only installs + lutris + wine-wayland + # Video utils + davinci-resolve-studio + imv + mpv + gimp + ] config.swaywm.systemPackages + # (lib.mkIf config.swaywm.installGaming [ + # pkgs.lutris + # ]) ]; programs.zsh.enable = true; - programs.steam.enable = true; + programs.steam.enable = config.swaywm.installGaming; ### ## Services @@ -72,16 +87,19 @@ pulse.enable = true; }; + # kdeconnect setup + programs.kdeconnect.enable = true; + # Firewall - networking.firewall = { - enable = true; - allowedTCPPortRanges = [ - {from = 1714; to = 1764;} # KDE Connnect - ]; - allowedUDPPortRanges = [ - {from = 1714; to = 1764;} # KDE Connnect - ]; - }; + # networking.firewall = { + # enable = true; + # allowedTCPPortRanges = [ + # {from = 1714; to = 1764;} # KDE Connnect + # ]; + # allowedUDPPortRanges = [ + # {from = 1714; to = 1764;} # KDE Connnect + # ]; + # }; ### ## Misc diff --git a/nixos/desktop_configuration.nix b/nixos/desktop_configuration.nix new file mode 100644 index 0000000..f96533d --- /dev/null +++ b/nixos/desktop_configuration.nix @@ -0,0 +1,54 @@ +{ config, lib, inputs, outputs, pkgs, userName, hostName, desktop, timeZone, gaming, ... }: + +let + supportedDesktops = [ "sway" ]; + supportedDesktopsStr = lib.strings.concatStringsSep ", " supportedDesktops; +in +{ + assertions = [ + { + assertion = builtins.elem desktop supportedDesktops; + message = "Unsupported desktop environment: ${desktop}\nSupported DE's: ${supportedDesktopsStr}"; + } + ]; + + imports = [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ../modules/user/main_user.nix + ../modules/sway/sway_conf.nix + ]; + + # Enable flakes feature + nix.settings.experimental-features = [ + "nix-command" "flakes" + ]; + + # nixpkgs.config.allowUnfree = true; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = hostName; # Define your hostname. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + time.timeZone = timeZone; + + main_user = { + enable = true; + userName = userName; + isDesktopUser = true; + }; + + swaywm = { + enable = desktop == "sway"; + useNonFree = true; + installGaming = gaming; + systemPackages = [ + pkgs.libreoffice + ]; + }; + + system.stateVersion = "23.11"; # Did you read the comment? +} + diff --git a/nixos/configuration.nix b/nixos/server_configuration.nix similarity index 100% rename from nixos/configuration.nix rename to nixos/server_configuration.nix diff --git a/nixos/sway_configuration.nix b/nixos/sway_configuration.nix deleted file mode 100644 index fa3811d..0000000 --- a/nixos/sway_configuration.nix +++ /dev/null @@ -1,169 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page, on -# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - -{ config, lib, pkgs, userName, hostName, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ../modules/user/main_user.nix - ../modules/sway/sway_conf.nix - ]; - - # Enable flakes feature - nix.settings.experimental-features = [ - "nix-command" "flakes" - ]; - - # nixpkgs.config.allowUnfree = true; - - # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.hostName = hostName; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - - # Set your time zone. - time.timeZone = "America/Denver"; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - # i18n.defaultLocale = "en_US.UTF-8"; - # console = { - # font = "Lat2-Terminus16"; - # keyMap = "us"; - # useXkbConfig = true; # use xkb.options in tty. - # }; - - # Enable the X11 windowing system. - # services.xserver.enable = true; - - - - - # Configure keymap in X11 - # services.xserver.xkb.layout = "us"; - # services.xserver.xkb.options = "eurosign:e,caps:escape"; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # sound.enable = true; - # hardware.pulseaudio.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # enable polkit for sway in home-manager - # security.polkit.enable = true; - - # hardware.opengl = { - # enable = true; - # driSupport = true; - # }; - - # Setup xdg portal for screen share - # xdg.portal = { - # config = { - # common = { - # default = [ - # "wlr" - # ]; - # }; - # }; - # extraPortals = with pkgs; [ - # # xdg-desktop-portal-kde - # xdg-desktop-portal-gtk - # ]; - # wlr.enable = true; - # enable = true; - # }; - # xdg.sounds.enable = true; - - main_user = { - enable = true; - userName = userName; - isDesktopUser = true; - }; - - swaywm = { - enable = true; - useNonFree = true; - systemPackages = with pkgs; [ - # corectrl - ]; - }; - - # programs.zsh.enable = true; - # programs.steam.enable = true; - - # Corectrl from stable branch - # inputs.nixpkgs-stable.lib.nixosSystem.programs.corectrl.enable = true; - # programs.corectrl.enable = true; - - # environment.systemPackages = with pkgs; [ - # git - # glib # gsettings - # grim - # pavucontrol - # slurp - # swaylock - # swayidle - # wget - # wl-clipboard - # xdg-utils - # zsh - # ]; - - # Services - # services.flatpak.enable = true; - # services.openssh.enable = true; - # services.dbus.enable = true; - # services.pipewire = { - # enable = true; - # alsa.enable = true; - # pulse.enable = true; - # }; - - # Firewall - # networking.firewall = { - # enable = true; - # allowedTCPPortRanges = [ - # {from = 1714; to = 1764;} # KDE Connnect - # ]; - # allowedUDPPortRanges = [ - # {from = 1714; to = 1764;} # KDE Connnect - # ]; - # }; - - # 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; - - # This option defines the first version of NixOS you have installed on this particular machine, - # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. - # - # Most users should NEVER change this value after the initial install, for any reason, - # even if you've upgraded your system to a new NixOS release. - # - # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, - # so changing it will NOT upgrade your system. - # - # This value being lower than the current NixOS release does NOT mean your system is - # out of date, out of support, or vulnerable. - # - # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, - # and migrated your data accordingly. - # - # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . - system.stateVersion = "23.11"; # Did you read the comment? -} -