From 8aacb14fcab1ef1efd0458fb4a97e81ec852f472 Mon Sep 17 00:00:00 2001 From: Devin Finlinson Date: Tue, 3 Oct 2023 03:29:21 -0600 Subject: i've gone mad with power / attempted config from misterio77 to fix inputs errors // this created the default.nix files and commented out block in flake.nix // didn't work, misterio is insane / but misterio's nix-colors github tells you to pass it as a special arg into home-manager // was confused for a bit but got it as an extraSpecialArg cause of module bullshit /// good thing i had that old note or i'd have been stuck / now the inputs pass into home-manager // hoping to find a more elegant passthrough format / oh also moved home-manager's modules to modules folder because misterio does // probably because they're crazy but also because they've gone so deep it's somehow necessary for anything to work /// idk how or why, should have something to do with replacing/following default nix format? //// thus the default.nix files to add/override defaults? this is my longest commit message ever --- modules/bluetooth.nix | 12 ------ modules/environment.nix | 18 --------- modules/home-manager/btop.nix | 12 ++++++ modules/home-manager/default.nix | 6 +++ modules/home-manager/helix.nix | 25 +++++++++++++ modules/home-manager/shell.nix | 12 ++++++ modules/home-manager/starship.nix | 11 ++++++ modules/hyprland.nix | 3 -- modules/kde-connect.nix | 7 ---- modules/nix-common.nix | 19 ---------- modules/nixos/bluetooth.nix | 12 ++++++ modules/nixos/default.nix | 11 ++++++ modules/nixos/environment.nix | 18 +++++++++ modules/nixos/hyprland.nix | 3 ++ modules/nixos/kde-connect.nix | 7 ++++ modules/nixos/nix-common.nix | 19 ++++++++++ modules/nixos/services.nix | 50 +++++++++++++++++++++++++ modules/nixos/steam.nix | 7 ++++ modules/nixos/sway.nix | 40 ++++++++++++++++++++ modules/nixos/system-packages.nix | 78 +++++++++++++++++++++++++++++++++++++++ modules/services.nix | 50 ------------------------- modules/steam.nix | 7 ---- modules/sway.nix | 40 -------------------- modules/system-packages.nix | 78 --------------------------------------- 24 files changed, 311 insertions(+), 234 deletions(-) delete mode 100644 modules/bluetooth.nix delete mode 100644 modules/environment.nix create mode 100644 modules/home-manager/btop.nix create mode 100644 modules/home-manager/default.nix create mode 100644 modules/home-manager/helix.nix create mode 100644 modules/home-manager/shell.nix create mode 100644 modules/home-manager/starship.nix delete mode 100644 modules/hyprland.nix delete mode 100644 modules/kde-connect.nix delete mode 100644 modules/nix-common.nix create mode 100644 modules/nixos/bluetooth.nix create mode 100644 modules/nixos/default.nix create mode 100644 modules/nixos/environment.nix create mode 100644 modules/nixos/hyprland.nix create mode 100644 modules/nixos/kde-connect.nix create mode 100644 modules/nixos/nix-common.nix create mode 100644 modules/nixos/services.nix create mode 100644 modules/nixos/steam.nix create mode 100644 modules/nixos/sway.nix create mode 100644 modules/nixos/system-packages.nix delete mode 100644 modules/services.nix delete mode 100644 modules/steam.nix delete mode 100644 modules/sway.nix delete mode 100644 modules/system-packages.nix (limited to 'modules') diff --git a/modules/bluetooth.nix b/modules/bluetooth.nix deleted file mode 100644 index 36e8f8f..0000000 --- a/modules/bluetooth.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, pkgs, lib, ... }: { - - hardware.bluetooth = { - enable = true; - # config = " - # [General] - # Enable=Source,Sink,Media,Socket - # "; - }; - - services.blueman.enable = true; -} diff --git a/modules/environment.nix b/modules/environment.nix deleted file mode 100644 index 225ddda..0000000 --- a/modules/environment.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, lib, ... }: { - environment = { - # include user channels in NIX_PATH - # shellInit = ''export NIXPATH="/nix/var/nix/profiles/per-user/$USER/channels:nixos-config=/etc/nixos/machines/zenbook/configuration.nix"''; - # List packages installed in system profile. To search, run: - # $ nix search wget - sessionVariables = { - NIXOS_OZONE_WL = "1"; - }; - variables = { - # PATH = "/home/defin/.local/share/gem/ruby/3.0.0/bin:"; - # PAGER = "sh -c 'col -bx | bat -f'"; - MANPAGER = "sh -c 'col -bx | bat -l man -p'"; - EDITOR = "hx"; - ZEIT_DB = "/home/defin/Documents/zeit"; - }; - }; -} diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix new file mode 100644 index 0000000..2c4e6cc --- /dev/null +++ b/modules/home-manager/btop.nix @@ -0,0 +1,12 @@ +{ catppuccin-btop, ... }: { + home.file.".config/btop/themes".source = "${catppuccin-btop}/themes"; + + #replace htop/nmon + programs.btop = { + enable = true; + settings = { + color_theme = "catppuccin_mocha"; + theme_background = false; # make btop transparent + }; + }; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..132d201 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,6 @@ +{ + btop = import ./btop.nix; + helix = import ./helix.nix; + shell = import ./shell.nix; + starship = import ./starship.nix; +} diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix new file mode 100644 index 0000000..a8891a5 --- /dev/null +++ b/modules/home-manager/helix.nix @@ -0,0 +1,25 @@ +{ pkgs, catppuccin-helix, ... }: { + # https://github.com/catppuccin/helix + xdg.configFile."helix/themes".source = "${catppuccin-helix}/themes/default"; + + programs.helix = { + enable = true; + package = pkgs.helix; + # defaultEditor = true; + settings = { + theme = "catppuccin_mocha"; + editor = { + line-number = "relative"; + cursorline = true; + color-modes = true; + lsp.display-messages = true; + cursor.shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + indent-guides.render = true; + }; + }; + }; +} diff --git a/modules/home-manager/shell.nix b/modules/home-manager/shell.nix new file mode 100644 index 0000000..c86190e --- /dev/null +++ b/modules/home-manager/shell.nix @@ -0,0 +1,12 @@ +{nushell-scripts, ... }: { + programs.nushell = { + extraConfig = '' + use ${nushell-scripts}/custom-completions/pass/pass-completions.nu * + use ${nushell-scripts}/custom-completions/nix/nix-completions.nu * + use ${nushell-scripts}/custom-completions/man/man-completions.nu * + use ${nushell-scripts}/custom-completions/cargo/cargo-completions.nu * + use ${nushell-scripts}/custom-completions/make/make-completions.nu * + use ${nushell-scripts}/custom-completions/git/git-completions.nu * + ''; + }; +} diff --git a/modules/home-manager/starship.nix b/modules/home-manager/starship.nix new file mode 100644 index 0000000..7869b4c --- /dev/null +++ b/modules/home-manager/starship.nix @@ -0,0 +1,11 @@ +{ catppuccin-starship, ... }: { + programs.starship = { + enable = true; + + settings = { + command_timeout = 1000; + + palette = "catppuccin_mocha"; + } ; #// builtins.fromTOML (builtins.readFile "${catppuccin-starship}/palettes/mocha.toml"); + }; +} \ No newline at end of file diff --git a/modules/hyprland.nix b/modules/hyprland.nix deleted file mode 100644 index c754eae..0000000 --- a/modules/hyprland.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ config, lib, ...}: { - programs.hyprland.enable = true; -} \ No newline at end of file diff --git a/modules/kde-connect.nix b/modules/kde-connect.nix deleted file mode 100644 index 3705c44..0000000 --- a/modules/kde-connect.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, lib, ... }: { - networking.firewall = { - allowedTCPPortRanges = [ { from = 1714; to = 1764; } ]; - allowedUDPPortRanges = [ { from = 1714; to = 1764; } ]; - }; - programs.kdeconnect.enable = true; -} diff --git a/modules/nix-common.nix b/modules/nix-common.nix deleted file mode 100644 index 6e4d373..0000000 --- a/modules/nix-common.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, pkgs, ... }: { - - nix = { - settings = { - allowed-users = [ "@wheel" "@builders" "@video" ]; - experimental-features = [ "nix-command" "flakes" ]; - }; - - # Clean up old generations after 30 days - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - - # Users allowed to run nix - # allowedUsers = [ "root" ]; - }; -} diff --git a/modules/nixos/bluetooth.nix b/modules/nixos/bluetooth.nix new file mode 100644 index 0000000..36e8f8f --- /dev/null +++ b/modules/nixos/bluetooth.nix @@ -0,0 +1,12 @@ +{ config, pkgs, lib, ... }: { + + hardware.bluetooth = { + enable = true; + # config = " + # [General] + # Enable=Source,Sink,Media,Socket + # "; + }; + + services.blueman.enable = true; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..a6d62e3 --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,11 @@ +{ + bluetooth = import ./bluetooth.nix; + environment = import ./environment.nix; + hyprland = import ./hyprland.nix; + kde-connect = import ./kde-connect.nix; + nix-common = import ./nix-common.nix; + services = import ./services.nix; + steam = import ./steam.nix; + sway = import ./sway.nix; + system-packages = import ./system-packages.nix; +} diff --git a/modules/nixos/environment.nix b/modules/nixos/environment.nix new file mode 100644 index 0000000..225ddda --- /dev/null +++ b/modules/nixos/environment.nix @@ -0,0 +1,18 @@ +{ config, lib, ... }: { + environment = { + # include user channels in NIX_PATH + # shellInit = ''export NIXPATH="/nix/var/nix/profiles/per-user/$USER/channels:nixos-config=/etc/nixos/machines/zenbook/configuration.nix"''; + # List packages installed in system profile. To search, run: + # $ nix search wget + sessionVariables = { + NIXOS_OZONE_WL = "1"; + }; + variables = { + # PATH = "/home/defin/.local/share/gem/ruby/3.0.0/bin:"; + # PAGER = "sh -c 'col -bx | bat -f'"; + MANPAGER = "sh -c 'col -bx | bat -l man -p'"; + EDITOR = "hx"; + ZEIT_DB = "/home/defin/Documents/zeit"; + }; + }; +} diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix new file mode 100644 index 0000000..c754eae --- /dev/null +++ b/modules/nixos/hyprland.nix @@ -0,0 +1,3 @@ +{ config, lib, ...}: { + programs.hyprland.enable = true; +} \ No newline at end of file diff --git a/modules/nixos/kde-connect.nix b/modules/nixos/kde-connect.nix new file mode 100644 index 0000000..3705c44 --- /dev/null +++ b/modules/nixos/kde-connect.nix @@ -0,0 +1,7 @@ +{ config, lib, ... }: { + networking.firewall = { + allowedTCPPortRanges = [ { from = 1714; to = 1764; } ]; + allowedUDPPortRanges = [ { from = 1714; to = 1764; } ]; + }; + programs.kdeconnect.enable = true; +} diff --git a/modules/nixos/nix-common.nix b/modules/nixos/nix-common.nix new file mode 100644 index 0000000..6e4d373 --- /dev/null +++ b/modules/nixos/nix-common.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: { + + nix = { + settings = { + allowed-users = [ "@wheel" "@builders" "@video" ]; + experimental-features = [ "nix-command" "flakes" ]; + }; + + # Clean up old generations after 30 days + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + + # Users allowed to run nix + # allowedUsers = [ "root" ]; + }; +} diff --git a/modules/nixos/services.nix b/modules/nixos/services.nix new file mode 100644 index 0000000..336d132 --- /dev/null +++ b/modules/nixos/services.nix @@ -0,0 +1,50 @@ +{ config, pkgs, ... }: +{ + services = { + pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; + spotifyd.enable = true; + + #FOR: sway + dbus.enable = true; + + #FROM: configuration.nix + # localtimed.enable = true; + xserver = { + # Enable the X11 windowing system. + enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + libinput.enable = true; + + # Configure keymap in X11 + # layout = "us"; + # xkbOptions = "eurosign:e,caps:escape"; + + # Enable the Plasma 5 Desktop Environment. + desktopManager.plasma5.enable = true; + displayManager = { + sddm.enable = true; + defaultSession = "plasmawayland"; + }; + }; + + # Enable CUPS to print documents. + printing = { + enable = true; + drivers = with pkgs; [ epson-escpr gutenprint ]; + }; + avahi = { + enable = true; + nssmdns = true; + # for a WiFi printer + openFirewall = true; + }; + + # Enable the OpenSSH daemon. + # openssh.enable = true; + }; +} diff --git a/modules/nixos/steam.nix b/modules/nixos/steam.nix new file mode 100644 index 0000000..91c5b67 --- /dev/null +++ b/modules/nixos/steam.nix @@ -0,0 +1,7 @@ +{ config, ... }: { + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + # dedicatedServer.openfirewall = true; + }; +} diff --git a/modules/nixos/sway.nix b/modules/nixos/sway.nix new file mode 100644 index 0000000..8d4d664 --- /dev/null +++ b/modules/nixos/sway.nix @@ -0,0 +1,40 @@ +{ config, pkgs, lib, ... }: +{ + environment.systemPackages = with pkgs; [ + ]; + + # xdg-desktop-portal works by exposing a series of D-Bus interfaces + # known as portals under a well-known name + # (org.freedesktop.portal.Desktop) and object path + # (/org/freedesktop/portal/desktop). + # The portal interfaces include APIs for file access, opening URIs, + # printing and others. + xdg.portal = { + enable = true; + wlr.enable = true; + # gtk portal needed to make gtk apps happy + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; + + # enable sway window manager + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; + + # kanshi systemd service + systemd.user.services.kanshi = { + description = "kanshi daemon"; + serviceConfig = { + Type = "simple"; + ExecStart = ''${pkgs.kanshi}/bin/kanshi -c kanshi_config_file''; + }; + }; + + security.pam.services.swaylock.text = '' + # PAM configuration file for the swaylock screen locker. By default, it includes + # the 'login' configuration file (see /etc/pam.d/login) + auth include login + ''; +} + diff --git a/modules/nixos/system-packages.nix b/modules/nixos/system-packages.nix new file mode 100644 index 0000000..1ffa540 --- /dev/null +++ b/modules/nixos/system-packages.nix @@ -0,0 +1,78 @@ +{ pkgs, ...}: +let + + # bash script to let dbus know about important env variables and + # propagate them to relevent services run at the end of sway config + # see + # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist + # note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts + # some user services to make sure they have the correct environment variables + dbus-sway-environment = pkgs.writeTextFile { + name = "dbus-sway-environment"; + destination = "/bin/dbus-sway-environment"; + executable = true; + + text = '' + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr + systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr + ''; + }; + + # currently, there is some friction between sway and gtk: + # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland + # the suggested way to set gtk settings is with gsettings + # for gsettings to work, we need to tell it where the schemas are + # using the XDG_DATA_DIR environment variable + # run at the end of sway config + configure-gtk = pkgs.writeTextFile { + name = "configure-gtk"; + destination = "/bin/configure-gtk"; + executable = true; + text = let + schema = pkgs.gsettings-desktop-schemas; + datadir = "${schema}/share/gsettings-schemas/${schema.name}"; + in '' + export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS + gnome_schema=org.gnome.desktop.interface + gsettings set $gnome_schema gtk-theme 'Dracula' + ''; + }; + +in + +{ + programs.partition-manager.enable = true; + environment.systemPackages = with pkgs; [ + #For root + nushell + bat + helix + wget + unzip + git + wl-clipboard + pciutils + #For hyprland + waybar + #For sway + alacritty # gpu accelerated terminal + dbus-sway-environment + configure-gtk + wayland + waybar + xdg-utils # for opening default programs when clicking links + glib # gsettings + dracula-theme # gtk theme + gnome3.adwaita-icon-theme # default gnome cursors + swaylock + swayidle + grim # screenshot functionality + slurp # screenshot functionality + bemenu # wayland clone of dmenu + mako # notification system developed by swaywm maintainer + wdisplays # tool to configure displays + wofi + (writeShellScriptBin "rofi" "exec -a $0 ${wofi}/bin/wofi $@") #Lets qutebrowser select passwords + ]; +} diff --git a/modules/services.nix b/modules/services.nix deleted file mode 100644 index 336d132..0000000 --- a/modules/services.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ config, pkgs, ... }: -{ - services = { - pipewire = { - enable = true; - alsa.enable = true; - pulse.enable = true; - }; - spotifyd.enable = true; - - #FOR: sway - dbus.enable = true; - - #FROM: configuration.nix - # localtimed.enable = true; - xserver = { - # Enable the X11 windowing system. - enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - libinput.enable = true; - - # Configure keymap in X11 - # layout = "us"; - # xkbOptions = "eurosign:e,caps:escape"; - - # Enable the Plasma 5 Desktop Environment. - desktopManager.plasma5.enable = true; - displayManager = { - sddm.enable = true; - defaultSession = "plasmawayland"; - }; - }; - - # Enable CUPS to print documents. - printing = { - enable = true; - drivers = with pkgs; [ epson-escpr gutenprint ]; - }; - avahi = { - enable = true; - nssmdns = true; - # for a WiFi printer - openFirewall = true; - }; - - # Enable the OpenSSH daemon. - # openssh.enable = true; - }; -} diff --git a/modules/steam.nix b/modules/steam.nix deleted file mode 100644 index 91c5b67..0000000 --- a/modules/steam.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, ... }: { - programs.steam = { - enable = true; - remotePlay.openFirewall = true; - # dedicatedServer.openfirewall = true; - }; -} diff --git a/modules/sway.nix b/modules/sway.nix deleted file mode 100644 index 8d4d664..0000000 --- a/modules/sway.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ config, pkgs, lib, ... }: -{ - environment.systemPackages = with pkgs; [ - ]; - - # xdg-desktop-portal works by exposing a series of D-Bus interfaces - # known as portals under a well-known name - # (org.freedesktop.portal.Desktop) and object path - # (/org/freedesktop/portal/desktop). - # The portal interfaces include APIs for file access, opening URIs, - # printing and others. - xdg.portal = { - enable = true; - wlr.enable = true; - # gtk portal needed to make gtk apps happy - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - }; - - # enable sway window manager - programs.sway = { - enable = true; - wrapperFeatures.gtk = true; - }; - - # kanshi systemd service - systemd.user.services.kanshi = { - description = "kanshi daemon"; - serviceConfig = { - Type = "simple"; - ExecStart = ''${pkgs.kanshi}/bin/kanshi -c kanshi_config_file''; - }; - }; - - security.pam.services.swaylock.text = '' - # PAM configuration file for the swaylock screen locker. By default, it includes - # the 'login' configuration file (see /etc/pam.d/login) - auth include login - ''; -} - diff --git a/modules/system-packages.nix b/modules/system-packages.nix deleted file mode 100644 index 1ffa540..0000000 --- a/modules/system-packages.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ pkgs, ...}: -let - - # bash script to let dbus know about important env variables and - # propagate them to relevent services run at the end of sway config - # see - # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist - # note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts - # some user services to make sure they have the correct environment variables - dbus-sway-environment = pkgs.writeTextFile { - name = "dbus-sway-environment"; - destination = "/bin/dbus-sway-environment"; - executable = true; - - text = '' - dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway - systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr - systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr - ''; - }; - - # currently, there is some friction between sway and gtk: - # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland - # the suggested way to set gtk settings is with gsettings - # for gsettings to work, we need to tell it where the schemas are - # using the XDG_DATA_DIR environment variable - # run at the end of sway config - configure-gtk = pkgs.writeTextFile { - name = "configure-gtk"; - destination = "/bin/configure-gtk"; - executable = true; - text = let - schema = pkgs.gsettings-desktop-schemas; - datadir = "${schema}/share/gsettings-schemas/${schema.name}"; - in '' - export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS - gnome_schema=org.gnome.desktop.interface - gsettings set $gnome_schema gtk-theme 'Dracula' - ''; - }; - -in - -{ - programs.partition-manager.enable = true; - environment.systemPackages = with pkgs; [ - #For root - nushell - bat - helix - wget - unzip - git - wl-clipboard - pciutils - #For hyprland - waybar - #For sway - alacritty # gpu accelerated terminal - dbus-sway-environment - configure-gtk - wayland - waybar - xdg-utils # for opening default programs when clicking links - glib # gsettings - dracula-theme # gtk theme - gnome3.adwaita-icon-theme # default gnome cursors - swaylock - swayidle - grim # screenshot functionality - slurp # screenshot functionality - bemenu # wayland clone of dmenu - mako # notification system developed by swaywm maintainer - wdisplays # tool to configure displays - wofi - (writeShellScriptBin "rofi" "exec -a $0 ${wofi}/bin/wofi $@") #Lets qutebrowser select passwords - ]; -} -- cgit v1.2.3