Compare commits

..

2 Commits

Author SHA1 Message Date
0b4b950ad1 Complete 2023-12-16 16:36:03 -07:00
Nathan Anderson
c0cde19714 Migrating to module usage 2023-12-15 15:50:45 -07:00
8 changed files with 225 additions and 190 deletions

View File

@ -1,3 +1,3 @@
dotfiles/
# dotfiles/
.git/
flake.lock

View File

@ -22,39 +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 = {
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;
};
}
];

View File

@ -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

View File

@ -0,0 +1,117 @@
{ lib, config, pkgs, ... }:
{
options.swaywm = {
enable = lib.mkEnableOption "Enable sway window manager.";
useNonFree = lib.mkOption {
default = false;
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.";
};
};
config = lib.mkIf config.swaywm.enable {
nixpkgs.config.allowUnfree = config.swaywm.useNonFree;
###
## XDG portal setup
###
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;
###
## System Packages
###
environment.systemPackages = with pkgs; lib.lists.flatten [
[
git
glib # gsettings
grim
pavucontrol
slurp
swaylock
swayidle
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 = config.swaywm.installGaming;
###
## Services
###
services.openssh.enable = true;
services.dbus.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
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
# ];
# };
###
## Misc
###
sound.enable = true;
# Necessary for home-manager sway setup
security.polkit.enable = true;
hardware.opengl = {
enable = true;
driSupport = true;
};
};
}

24
nixos/default.nix Normal file
View File

@ -0,0 +1,24 @@
# 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
./sway_configuration.nix
# ../modules/user/main_user.nix
# ../modules/sway/sway_conf.nix
];
# Enable flakes feature
nix.settings.experimental-features = [
"nix-command" "flakes"
];
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@ -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?
}

View File

@ -1,160 +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
];
# 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;
};
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?
}