chore: initial commit

This commit is contained in:
Glen Goodwin 2023-06-06 23:58:36 -04:00
commit cc4f3398ff
37 changed files with 2210 additions and 0 deletions

17
cog.toml Normal file
View file

@ -0,0 +1,17 @@
from_latest_tag = false
ignore_merge_commits = false
branch_whitelist = []
pre_bump_hooks = []
post_bump_hooks = []
pre_package_bump_hooks = []
post_package_bump_hooks = []
[commit_types]
[changelog]
path = "CHANGELOG.md"
authors = []
[bump_profiles]
[packages]

176
configs/hypr/hyprland.conf Normal file
View file

@ -0,0 +1,176 @@
########################################################################################
AUTOGENERATED HYPR CONFIG.
PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT,
OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS.
########################################################################################
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki
#
autogenerated = 1 # remove this line to remove the warning
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,auto
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
# Some default env vars.
env = XCURSOR_SIZE,24
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_rules =
follow_mouse = 1
touchpad {
natural_scroll = no
}
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}
general {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in = 5
gaps_out = 20
border_size = 2
col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
col.inactive_border = rgba(595959aa)
layout = dwindle
}
decoration {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10
blur = yes
blur_size = 3
blur_passes = 1
blur_new_optimizations = on
drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
}
animations {
enabled = yes
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = border, 1, 10, default
animation = borderangle, 1, 8, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
}
dwindle {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = yes # you probably want this
}
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_is_master = true
}
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = off
}
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
device:epic-mouse-v1 {
sensitivity = -0.5
}
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, Return, exec, kitty
bind = $mainMod, Q, killactive,
bind = $mainMod, Space, exec, wofi --show drun
bind = $mainMod, F, fullscreen,
bind = $mainMod SHIFT, R, exec, hyprctl reload
bind = $mainMod, J, togglesplit, # dwindle
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
#bind = $mainMod, C, killactive,
#bind = $mainMod, M, exit,
#bind = $mainMod, E, exec, dolphin
#bind = $mainMod, V, togglefloating,
#bind = $mainMod, R, exec, wofi --show drun
#bind = $mainMod, P, pseudo, # dwindle
#bind = $mainMod, J, togglesplit, # dwindle
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow

153
flake.lock generated Normal file
View file

@ -0,0 +1,153 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1685395684,
"narHash": "sha256-XUUWE5XJiGZ2Wi+Mxv/mIwKYDPEC8gYHkHyT3+/sciY=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "43ed7048f670661d1ae2ea0d2f7655e87e7b0461",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"hyprland": {
"inputs": {
"hyprland-protocols": "hyprland-protocols",
"nixpkgs": [
"nixpkgs"
],
"wlroots": "wlroots",
"xdph": "xdph"
},
"locked": {
"lastModified": 1685380658,
"narHash": "sha256-LPih0Q//p8IurXG9kGRVGAqV4AUKVYj9xkk3sYYAj6I=",
"owner": "vaxerski",
"repo": "Hyprland",
"rev": "51a930f802c71a0e67f05e7b176ded74e8e95f87",
"type": "github"
},
"original": {
"owner": "vaxerski",
"repo": "Hyprland",
"type": "github"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1681065697,
"narHash": "sha256-QPzwwlGKX95tl6ZEshboZbEwwAXww6lNLdVYd6T9Mrc=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "4d29e48433270a2af06b8bc711ca1fe5109746cd",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1685290091,
"narHash": "sha256-GGQYNZ7POoqPTtXgPOLUuSiHkOKFRWYpCoWUOSeSRoU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "4e37b4e55b60fb7d43d2b62deb51032a489bcbe8",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1685347552,
"narHash": "sha256-9woSppRyUFo26yUffORTzttJ+apOt8MmCv6RxpPNTU4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f2f1ec390714d303cf84ba086e34e45b450dd8c4",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"hyprland": "hyprland",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
}
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1682436395,
"narHash": "sha256-GGEjkQO9m7YLYIXIXM76HWdhjg4Ye+oafOtyaFAYKI4=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "6830bfc17fd94709e2cdd4da0af989f102a26e59",
"type": "gitlab"
},
"original": {
"host": "gitlab.freedesktop.org",
"owner": "wlroots",
"repo": "wlroots",
"type": "gitlab"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": [
"hyprland",
"hyprland-protocols"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1682439384,
"narHash": "sha256-zHDa8LCZs05TZHQSIZ3ucwyMPglBGHcqTBzfkLjYXTM=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "c0e233955568fbea4e859336f6d3d14d51294d7c",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

43
flake.nix Normal file
View file

@ -0,0 +1,43 @@
{
description = "My Nix Config";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
# Official Hyprland flake
url = "github:vaxerski/Hyprland"; # Add "hyprland.nixosModules.default" to the host modules
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, nixpkgs, home-manager, hyprland, ... }:
let
system = "x86_64-linux";
user = "glen";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
lib = nixpkgs.lib;
in
{
nixosConfigurations = (
import ./hosts {
inherit (nixpkgs) lib;
inherit inputs user system home-manager hyprland;
}
);
};
}

119
hosts/configuration.nix Normal file
View file

@ -0,0 +1,119 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports = (import ../modules/editors) ++
(import ../modules/shell);
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Toronto";
# Select internationalisation properties.
i18n.defaultLocale = "en_CA.UTF-8";
# Configure keymap in X11
services.xserver = {
layout = "us";
xkbVariant = "";
};
# Define a user account. Don't forget to set a password with passwd.
users.users.glen = {
isNormalUser = true;
description = "Glen";
extraGroups = [ "networkmanager" "wheel" "video" "docker" ];
shell = pkgs.zsh; # Default shell
packages = with pkgs; [ ];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
# environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
# neovim
# kitty
# ];
environment = {
variables = {
TERMINAL = "kitty";
EDITOR = "nvim";
VISUAL = "nvim";
};
systemPackages = with pkgs; [
# Default packages installed system-wide
vim
git
killall
nano
pciutils
usbutils
wget
];
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
programs.hyprland.enable = true;
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.pipewire = {
# Sound
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
};
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
nix = {
package = pkgs.nixFlakes;
extraOptions = "experimental-features = nix-command flakes";
};
}

37
hosts/default.nix Normal file
View file

@ -0,0 +1,37 @@
{ lib, inputs, system, home-manager, user, hyprland, ... }:
{
thinkpad = lib.nixosSystem {
inherit system;
specialArgs = {
inherit user inputs hyprland system;
host = {
hostName = "thinkpad";
mainMonitor = "eDP-1";
# secondMonitor = "DP-1";
};
};
modules = [
./thinkpad
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit user; };
home-manager.users.${user} = {
imports = [ (import ./home.nix) ] ++ [ (import ./thinkpad/home.nix) ];
};
}
];
};
}

153
hosts/home.nix Normal file
View file

@ -0,0 +1,153 @@
{ config, lib, pkgs, stable, user, ... }:
{
imports = # Home Manager Modules
[ (import ../modules/shell/git/home.nix) ] ++
[ (import ../modules/programs/wofi.nix) ] ++
[ (import ../modules/editors/nvim/home.nix) ] ++
[ (import ../modules/shell/zsh/home.nix) ];
home = {
username = "${user}";
homeDirectory = "/home/${user}";
packages = with pkgs; [
# Terminal
btop # Resource Manager
nitch # Minimal fetch
tldr # Helper
zellij # multiplexer
dog # dns tool
exa # better ls
bat # better cap
sd # simpler sed
fd # simpler find
xh
ncdu
duf
atuin
xplr
thefuck
hyperfine
procs
ripgrep
nerdfonts
pfetch
dbeaver
ansible
nixpkgs-fmt
# Video/Audio
feh # Image Viewer
#mpv # Media Player
pavucontrol # Audio Control
#plex-media-player # Media Player
vlc # Media Player
stremio # Media Streamer
# Apps
appimage-run # Runs AppImages on NixOS
firefox # Browser
google-chrome # Browser
remmina # XRDP & VNC Client
# File Management
gnome.file-roller # Archive Manager
okular # PDF Viewer
#pcmanfm # File Manager
xfce.thunar # File Manager
p7zip # Zip Encryption
rsync # Syncer - $ rsync -r dir1/ dir2/
unzip # Zip Files
unrar # Rar Files
zip # Zip
# General configuration
#git # Repositories
#killall # Stop Applications
#nano # Text Editor
#pciutils # Computer Utility Info
#pipewire # Sound
#usbutils # USB Utility Info
#wacomtablet # Wacom Tablet
#wget # Downloader
#zsh # Shell
#
# General home-manager
#alacritty # Terminal Emulator
#dunst # Notifications
#doom emacs # Text Editor
#libnotify # Dependency for Dunst
#neovim # Text Editor
#rofi # Menu
#rofi-power-menu # Power Menu
#udiskie # Auto Mounting
#vim # Text Editor
#
# Xorg configuration
#xclip # Console Clipboard
#xorg.xev # Input Viewer
#xorg.xkill # Kill Applications
#xorg.xrandr # Screen Settings
#xterm # Terminal
#
# Xorg home-manager
#flameshot # Screenshot
#picom # Compositer
#sxhkd # Shortcuts
#
# Wayland configuration
#autotiling # Tiling Script
#grim # Image Grabber
#slurp # Region Selector
#swappy # Screenshot Editor
#swayidle # Idle Management Daemon
#wev # Input Viewer
#wl-clipboard # Console Clipboard
#wlr-randr # Screen Settings
#xwayland # X for Wayland
#
# Wayland home-manager
#mpvpaper # Video Wallpaper
#pamixer # Pulse Audio Mixer
swaybg # Background
#swaylock-fancy # Screen Locker
#waybar # Bar
#
# Desktop
#ansible # Automation
#blueman # Bluetooth
#deluge # Torrents
discord # Chat
#ffmpeg # Video Support (dslr)
#gmtp # Mount MTP (GoPro)
#gphoto2 # Digital Photography
#handbrake # Encoder
#heroic # Game Launcher
#hugo # Static Website Builder
#lutris # Game Launcher
#mkvtoolnix # Matroska Tool
#plex-media-player# Media Player
#prismlauncher # MC Launcher
#steam # Games
#simple-scan # Scanning
#sshpass # Ansible dependency
#
# Laptop
#cbatticon # Battery Notifications
#blueman # Bluetooth
#light # Display Brightness
#libreoffice # Office Tools
#simple-scan # Scanning
#
# Flatpak
#obs-studio # Recording/Live Streaming
];
stateVersion = "22.05";
};
programs = {
home-manager.enable = true;
};
}

View file

@ -0,0 +1,41 @@
{ config, pkgs, user, ... }:
{
imports = # For now, if applying to other system, swap files
[ (import ./hardware-configuration.nix) ] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix
(import ../../modules/desktop/virtualisation/default.nix) ++
(import ../../modules/hardware/default.nix) ++
[ (import ../../modules/desktop/hyprland/default.nix) ]; # Window Manager
hardware.sane = {
# Used for scanning with Xsane
enable = true;
extraBackends = [ pkgs.sane-airscan ];
};
environment = {
systemPackages = with pkgs; [
simple-scan
];
};
programs = {
# No xbacklight, this is the alterantive
dconf.enable = true;
light.enable = true;
};
services = {
tlp.enable = true; # TLP and auto-cpufreq for power management
#logind.lidSwitch = "ignore"; # Laptop does not go to sleep when lid is closed
auto-cpufreq.enable = true;
blueman.enable = true;
};
#temporary bluetooth fix
systemd.tmpfiles.rules = [
"d /var/lib/bluetooth 700 root root - -"
];
systemd.targets."bluetooth".after = [ "systemd-tmpfiles-setup.service" ];
}

View file

@ -0,0 +1,43 @@
# 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" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/88ae54e9-a47f-4ef0-acae-256803662304";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-9d4b251f-b7d5-4a28-8e5d-6df09b434e47".device = "/dev/disk/by-uuid/9d4b251f-b7d5-4a28-8e5d-6df09b434e47";
fileSystems."/boot/efi" =
{
device = "/dev/disk/by-uuid/C3A8-F13F";
fsType = "vfat";
};
swapDevices = [ ];
# 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.enp2s0f0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

40
hosts/thinkpad/home.nix Normal file
View file

@ -0,0 +1,40 @@
{ pkgs, ... }:
{
imports =
[
../../modules/shell/git/home.nix
../../modules/desktop/hyprland/home.nix
];
home = {
# Specific packages for laptop
packages = with pkgs; [
# Applications
libreoffice # Office packages
# Display
#light # xorg.xbacklight not supported. Other option is just use xrandr.
# Power Management
#auto-cpufreq # Power management
#tlp # Power management
];
};
# programs = {
# alacritty.settings.font.size = 11;
# };
services = {
# Applets
blueman-applet.enable = true; # Bluetooth
network-manager-applet.enable = true; # Network
# cbatticon = {
# enable = true;
# criticalLevelPercent = 10;
# lowLevelPercent = 20;
# iconType = null;
# };
};
}

View file

@ -0,0 +1,65 @@
{ config, lib, pkgs, system, hyprland, ... }:
let
exec = "exec Hyprland";
in
{
imports = [ ../../programs/waybar.nix ];
environment = {
loginShellInit = ''
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
${exec}
fi
''; # Will automatically open Hyprland when logged into tty1
variables = {
#WLR_NO_HARDWARE_CURSORS="1"; # Possible variables needed in vm
#WLR_RENDERER_ALLOW_SOFTWARE="1";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
XDG_SESSION_DESKTOP = "Hyprland";
};
sessionVariables = {
QT_QPA_PLATFORM = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
GDK_BACKEND = "wayland";
WLR_NO_HARDWARE_CURSORS = "1";
MOZ_ENABLE_WAYLAND = "1";
};
systemPackages = with pkgs; [
grim
mpvpaper
slurp
swappy
swaylock
wl-clipboard
wlr-randr
];
};
security.pam.services.swaylock = {
text = ''
auth include login
'';
};
programs = {
hyprland = {
enable = true;
};
};
xdg.portal = {
# Required for flatpak with window managers and for file browsing
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
};
nixpkgs.overlays = [
# Waybar with experimental features
(final: prev: {
waybar = hyprland.packages.${system}.waybar-hyprland;
})
];
}

View file

@ -0,0 +1,186 @@
{ pkgs, ... }:
let
hyprlandConf = ''
monitor=,preferred,auto,auto
$mainMod=SUPER
general {
border_size=3
gaps_in=5
gaps_out=7
col.active_border=rgba(33ccffee) rgba(00ff99ee) 45deg
col.inactive_border=0x66333333
layout=dwindle
}
decoration {
rounding=5
multisample_edges=true
active_opacity=0.93
inactive_opacity=0.93
fullscreen_opacity=1
blur=true
drop_shadow=false
}
animations {
enabled=true
bezier = myBezier,0.1,0.7,0.1,1.05
animation=fade,1,7,default
animation=windows,1,7,myBezier
animation=windowsOut,1,3,default,popin 60%
animation=windowsMove,1,7,myBezier
}
input {
kb_layout=us
kb_options=caps:ctrl_modifier
follow_mouse=2
repeat_delay=250
numlock_by_default=1
accel_profile=flat
sensitivity=0.8
touchpad {
natural_scroll=true
middle_button_emulation=true
tap-to-click=true
}
}
}
gestures {
workspace_swipe=true
workspace_swipe_fingers=3
workspace_swipe_distance=100
}
dwindle {
pseudotile=false
force_split=2
}
debug {
damage_tracking=2
}
bindm=$mainMod,mouse:272,movewindow
bindm=$mainMod,mouse:273,resizewindow
bind=$mainMod,Return,exec,${pkgs.alacritty}/bin/alacritty
bind=$mainMod,Q,killactive,
bind=$mainMod,Escape,exit,
bind=$mainMod,L,exec,${pkgs.swaylock}/bin/swaylock
bind=$mainMod,E,exec,${pkgs.pcmanfm}/bin/pcmanfm
bind=$mainMod,H,togglefloating,
#bind=$mainMod,Space,exec,${pkgs.rofi}/bin/rofi -show drun
bind=$mainMod,Space,exec,${pkgs.wofi}/bin/wofi --show drun
bind=$mainMod,P,pseudo,
bind=$mainMod,F,fullscreen,
bind=$mainMod,R,forcerendererreload
bind=$mainMod,R,exec,${pkgs.hyprland}/bin/hyprctl reload
bind=$mainMod,left,movefocus,l
bind=$mainMod,right,movefocus,r
bind=$mainMod,up,movefocus,u
bind=$mainMod,down,movefocus,d
bind=$mainMod SHIFT,left,movewindow,l
bind=$mainMod SHIFT,right,movewindow,r
bind=$mainMod SHIFT,up,movewindow,u
bind=$mainMod SHIFT,down,movewindow,d
bind=$mainMod,1,workspace,1
bind=$mainMod,2,workspace,2
bind=$mainMod,3,workspace,3
bind=$mainMod,4,workspace,4
bind=$mainMod,5,workspace,5
bind=$mainMod,6,workspace,6
bind=$mainMod,7,workspace,7
bind=$mainMod,8,workspace,8
bind=$mainMod,9,workspace,9
bind=$mainMod,0,workspace,10
bind=$mainMod,right,workspace,+1
bind=$mainMod,left,workspace,-1
bind=$mainMod SHIFT,1,movetoworkspace,1
bind=$mainMod SHIFT,2,movetoworkspace,2
bind=$mainMod SHIFT,3,movetoworkspace,3
bind=$mainMod SHIFT,4,movetoworkspace,4
bind=$mainMod SHIFT,5,movetoworkspace,5
bind=$mainMod SHIFT,6,movetoworkspace,6
bind=$mainMod SHIFT,7,movetoworkspace,7
bind=$mainMod SHIFT,8,movetoworkspace,8
bind=$mainMod SHIFT,9,movetoworkspace,9
bind=$mainMod SHIFT,0,movetoworkspace,10
bind=$mainMod SHIFT,right,movetoworkspace,+1
bind=$mainMod SHIFT,left,movetoworkspace,-1
bind=CTRL,right,resizeactive,20 0
bind=CTRL,left,resizeactive,-20 0
bind=CTRL,up,resizeactive,0 -20
bind=CTRL,down,resizeactive,0 20
bind=,print,exec,${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.swappy}/bin/swappy -f - -o ~/Pictures/$(date +%Hh_%Mm_%Ss_%d_%B_%Y).png && notify-send "Saved to ~/Pictures/$(date +%Hh_%Mm_%Ss_%d_%B_%Y).png"
bind=,XF86AudioLowerVolume,exec,${pkgs.pamixer}/bin/pamixer -d 10
bind=,XF86AudioRaiseVolume,exec,${pkgs.pamixer}/bin/pamixer -i 10
bind=,XF86AudioMute,exec,${pkgs.pamixer}/bin/pamixer -t
bind=,XF86AudioMicMute,exec,${pkgs.pamixer}/bin/pamixer --default-source -t
bind=,XF86MonBrightnessDown,exec,${pkgs.light}/bin/light -U 10
bind=,XF86MonBrightnessUP,exec,${pkgs.light}/bin/light -A 10
#windowrule=float,^(Rofi)$
windowrule=float,title:^(Volume Control)$
windowrule=float,title:^(Picture-in-Picture)$
windowrule=pin,title:^(Picture-in-Picture)$
windowrule=move 75% 75% ,title:^(Picture-in-Picture)$
windowrule=size 24% 24% ,title:^(Picture-in-Picture)$
exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once=${pkgs.waybar}/bin/waybar
exec-once=${pkgs.blueman}/bin/blueman-applet
exec-once=${pkgs.swaybg}/bin/swaybg -m fill -i $HOME/.config/wall
'';
in
{
xdg.configFile."hypr/hyprland.conf".text = hyprlandConf;
programs.swaylock.settings = {
image = "$HOME/.config/lock";
color = "000000f0";
font-size = "24";
indicator-idle-visible = false;
indicator-radius = 100;
indicator-thickness = 20;
inside-color = "00000000";
inside-clear-color = "00000000";
inside-ver-color = "00000000";
inside-wrong-color = "00000000";
key-hl-color = "79b360";
line-color = "000000f0";
line-clear-color = "000000f0";
line-ver-color = "000000f0";
line-wrong-color = "000000f0";
ring-color = "ffffff50";
ring-clear-color = "bbbbbb50";
ring-ver-color = "bbbbbb50";
ring-wrong-color = "b3606050";
text-color = "ffffff";
text-ver-color = "ffffff";
text-wrong-color = "ffffff";
show-failed-attempts = true;
};
services.swayidle = {
enable = true;
events = [
{ event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock -f"; }
{ event = "lock"; command = "lock"; }
];
timeouts = [
{ timeout = 300; command = "${pkgs.swaylock}/bin/swaylock -f"; }
];
systemdTarget = "xdg-desktop-portal-hyprland.service";
};
}

View file

@ -0,0 +1,4 @@
[
./docker.nix
./virtualbox.nix
]

View file

@ -0,0 +1,21 @@
{ config, pkgs, user, ... }:
{
virtualisation = {
docker.enable = true;
};
users.groups.docker.members = [ "${user}" ];
#environment = {
# interactiveShellInit = ''
# alias rtmp='docker start nginx-rtmp'
# ''; # Alias to easily start container
#};
environment.systemPackages = with pkgs; [
docker-compose
distrobox
];
}

View file

@ -0,0 +1,20 @@
{ config, pkgs, user, ... }:
{
virtualisation.virtualbox.host.enable = true;
users.extraGroups.vboxusers.members = [ "${user}" ];
virtualisation.virtualbox.host.enableExtensionPack = true;
#environment = {
# interactiveShellInit = ''
# alias rtmp='docker start nginx-rtmp'
# ''; # Alias to easily start container
#};
environment.systemPackages = with pkgs; [
vagrant
];
}

View file

@ -0,0 +1,3 @@
[
# ./nvim
]

View file

@ -0,0 +1,15 @@
theme = "onedark"
[editor]
line-number = "relative"
mouse = true
auto-completion = true
[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"
[editor.file-picker]
hidden = false

View file

@ -0,0 +1,25 @@
{ pkgs, ... }:
{
programs = {
helix = { enable = true; };
};
xdg.configFile = { "helix/config.toml".source = ./config.toml; };
home.packages = with pkgs; [
pyright
nil
taplo
yaml-language-server
terraform-ls
lua-language-server
rust-analyzer
nixfmt
nodePackages_latest.bash-language-server
nodePackages_latest.typescript-language-server
python311Packages.python-lsp-server
];
}

View file

View file

@ -0,0 +1,16 @@
vim.opt.expandtab = true
vim.opt.hidden = true
vim.opt.incsearch = true
vim.opt.mouse = "a"
vim.opt.relativenumber = true
vim.opt.shiftwidth = 2
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.signcolumn = "yes:3"
vim.opt.tabstop = 2
vim.opt.timeoutlen = 0
vim.wo.wrap = false
vim.opt.exrc = true
vim.cmd("syntax on")
vim.opt.clipboard = "unnamedplus"

View file

@ -0,0 +1,28 @@
local lspc = require'lspconfig'
lspc.nil_ls.setup{}
lspc.clangd.setup{}
local buf_map = function(bufnr, mode, lhs, rhs, opts)
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts or {
silent = true,
})
end
lspc.tsserver.setup({
on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
local ts_utils = require("nvim-lsp-ts-utils")
ts_utils.setup({})
ts_utils.setup_client(client)
buf_map(bufnr, "n", "gs", ":TSLspOrganize<CR>")
buf_map(bufnr, "n", "gi", ":TSLspRenameFile<CR>")
buf_map(bufnr, "n", "go", ":TSLspImportAll<CR>")
on_attach(client, bufnr)
end,
})

View file

@ -0,0 +1,73 @@
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
local cmp = require("cmp")
local lspkind = require("lspkind")
cmp.setup({
sources = {
{ name = "nvim_lsp" },
{ name = "cmp_tabnine" },
{ name = "treesitter" },
{ name = "buffer" },
{ name = "path" },
{ name = "vsnip" },
-- { name = "copilot" },
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
formatting = {
format = lspkind.cmp_format({
with_text = true,
menu = {
buffer = "[Buf]",
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
latex_symbols = "[Latex]",
treesitter = "[TS]",
cmp_tabnine = "[TN]",
vsnip = "[Snip]",
},
}),
},
mapping = {
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, {
"i",
"s",
}),
},
})

View file

@ -0,0 +1,20 @@
-- set colorscheme
vim.cmd 'set termguicolors'
vim.g.catppuccin_flavour = "mocha"
require("catppuccin").setup()
vim.cmd [[colorscheme catppuccin]]
-- enable colorizer
require'colorizer'.setup()
-- set sign
vim.cmd 'sign define DiagnosticSignError text= linehl= texthl=DiagnosticSignError numhl='
vim.cmd 'sign define DiagnosticSignHint text= linehl= texthl=DiagnosticSignHint numhl='
vim.cmd 'sign define DiagnosticSignInfo text= linehl= texthl=DiagnosticSignInfo numhl='
vim.cmd 'sign define DiagnosticSignWarn text= linehl= texthl=DiagnosticSignWarn numhl='
-- set lightline theme to horizon
vim.g.lightline = { colorscheme = "catppuccin" }

View file

@ -0,0 +1,14 @@
require'nvim-treesitter.configs'.setup {
textobjects = {
select = {
enable = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
},
}

View file

@ -0,0 +1,30 @@
require("nvim-treesitter.configs").setup({
highlight = {
enable = true,
disable = {},
},
rainbow = {
enable = true,
extended_mode = true,
},
autotag = {
enable = true,
},
context_commentstring = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
})
-- breaks highlight
-- vim.cmd([[set foldmethod=expr]])
-- vim.cmd([[set foldlevel=10]])
-- vim.cmd([[set foldexpr=nvim_treesitter#foldexpr()]])

View file

@ -0,0 +1,29 @@
-- telescope
require('telescope').load_extension('fzy_native')
-- null-ls
local nb = require('null-ls').builtins
require('null-ls').setup({
sources = {
nb.formatting.alejandra,
nb.code_actions.statix,
nb.diagnostics.cppcheck,
nb.diagnostics.deadnix,
nb.diagnostics.statix,
nb.diagnostics.eslint,
nb.completion.spell,
},
})
require("gitsigns").setup()
-- autopairs
require('nvim-autopairs').setup{}
-- copy to system clipboard
vim.api.nvim_set_keymap( 'v', '<Leader>y', '"+y', {noremap = true})
vim.api.nvim_set_keymap( 'n', '<Leader>y', ':%+y<CR>', {noremap = true})
-- paste from system clipboard
vim.api.nvim_set_keymap( 'n', '<Leader>p', '"+p', {noremap = true})

View file

@ -0,0 +1,39 @@
vim.g.mapleader = " "
local wk = require("which-key")
wk.setup({})
wk.register({
["<leader>"] = {
b = { "<cmd>Telescope buffers<cr>", "Buffers" },
["/"] = { "<cmd>Telescope live_grep<cr>", "Live Grep" },
f = { "<cmd>Telescope find_files<cr>", "Find File" },
g = {
name = "Git / VCS",
i = { "<cmd>lua require('telescope').extensions.gh.issues()<cr>", "Github Issues" },
p = { "<cmd>lua require('telescope').extensions.gh.pull_request()<cr>", "Github PRs" },
b = { "<cmd>ToggleBlameLine<cr>", "Toggle BlameLine" },
c = { "<cmd>Neogit commit<cr>", "Commit" },
s = { "<cmd>Neogit kind=split<cr>", "Staging" },
},
a = { "<cmd>lua require('telescope.builtin').lsp_code_actions()<cr>", "Code Actions" },
d = { "<cmd>lua require('telescope.builtin').lsp_document_diagnostics()<cr>", "LSP Diagnostics" },
k = { "<cmd>lua vim.lsp.buf.signature_help()<cr>", "Signature Help" },
l = {
name = "LSP",
f = { "<cmd>lua vim.lsp.buf.formatting_sync()<cr>", "Format file"},
q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Set Loclist" },
e = { "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<cr>", "Show Line Diagnostics" },
},
p = { "\"+p", "Paste from clipboard" },
P = { "\"+P", "Paste from clipboard before cursor" },
y = { "\"+y", "Yank to clipboard" },
},
g = {
l = { "$", "Line end" },
h = { "0", "Line start" },
s = { "^", "First non-blank in line" },
e = { "G", "Bottom" },
},
})

View file

@ -0,0 +1,65 @@
{ pkgs, ... }: {
programs.neovim = {
enable = true;
vimAlias = true;
viAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
catppuccin-nvim
cmp-buffer
cmp-nvim-lsp
cmp-path
cmp-spell
cmp-treesitter
cmp-vsnip
friendly-snippets
gitsigns-nvim
lightline-vim
lspkind-nvim
neogit
null-ls-nvim
nvim-autopairs
nvim-cmp
nvim-colorizer-lua
nvim-lspconfig
nvim-tree-lua
nvim-ts-rainbow
(nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars))
plenary-nvim
telescope-fzy-native-nvim
telescope-nvim
telescope-github-nvim
vim-floaterm
vim-sneak
vim-vsnip
which-key-nvim
];
extraPackages = with pkgs; [ gcc ripgrep fd deadnix ];
extraConfig =
let
luaRequire = module:
builtins.readFile (builtins.toString
./config
+ "/${module}.lua");
luaConfig = builtins.concatStringsSep "\n" (map luaRequire [
"init"
"lspconfig"
"nvim-cmp"
"theming"
"treesitter"
"treesitter-textobjects"
"utils"
"which-key"
]);
in
''
lua << 
${luaConfig}

'';
};
}

View file

@ -0,0 +1,13 @@
{ pkgs, ... }:
{
hardware.bluetooth = {
enable = true;
#hsphfpd.enable = true; # HSP & HFP daemon
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
};
}

View file

@ -0,0 +1,3 @@
[
./bluetooth.nix
]

437
modules/programs/waybar.nix Normal file
View file

@ -0,0 +1,437 @@
{ config, lib, pkgs, host, user, ... }:
{
environment.systemPackages = with pkgs; [
waybar
];
home-manager.users.${user} = {
# Home-manager waybar config
programs.waybar = {
enable = true;
systemd = {
enable = true;
target = "sway-session.target"; # Needed for waybar to start automatically
};
style = ''
* {
border: none;
font-family: FiraCode Nerd Font Mono;
/*font-weight: bold;*/
font-size: 12px;
text-shadow: 0px 0px 5px #000000;
}
button:hover {
background-color: rgba(80,100,100,0.4);
}
window#waybar {
background-color: rgba(0,0,0,0.5);
background: transparent;
transition-property: background-color;
transition-duration: .5s;
border-bottom: none;
}
window#waybar.hidden {
opacity: 0.2;
}
#workspace,
#mode,
#clock,
#pulseaudio,
#custom-sink,
#network,
#mpd,
#memory,
#network,
#window,
#cpu,
#disk,
#backlight,
#battery,
#custom-ds4,
#tray {
color: #999999;
background-clip: padding-box;
}
#custom-menu {
color: #A7C7E7;
padding: 0px 5px 0px 5px;
}
#workspaces button {
padding: 0px 5px;
min-width: 5px;
color: rgba(255,255,255,0.8);
}
#workspaces button:hover {
background-color: rgba(0,0,0,0.2);
}
/*#workspaces button.focused {*/
#workspaces button.active {
color: rgba(255,255,255,0.8);
background-color: rgba(80,100,100,0.4);
}
#workspaces button.visible {
color: #ccffff;
}
#workspaces button.hidden {
color: #999999;
}
#battery.warning {
color: #ff5d17;
background-color: rgba(0,0,0,0);
}
#battery.critical {
color: #ff200c;
background-color: rgba(0,0,0,0);
}
#battery.charging {
color: #9ece6a;
background-color: rgba(0,0,0,0);
}
'';
settings = with host; {
Main = {
layer = "top";
position = "top";
height = 16;
output = [
"${mainMonitor}"
];
tray = { spacing = 5; };
#modules-center = [ "clock" ];
modules-left = with config;
if programs.hyprland.enable == true then
[ "custom/menu" "wlr/workspaces" ]
else if programs.sway.enable == true then
[ "sway/workspaces" "sway/window" "sway/mode" ]
else [ ];
modules-right =
if hostName == "desktop" then
[ "custom/ds4" "custom/pad" "network" "cpu" "memory" "custom/pad" "pulseaudio" "custom/sink" "custom/pad" "clock" "tray" ]
else
[ "cpu" "memory" "custom/pad" "battery" "custom/pad" "backlight" "custom/pad" "pulseaudio" "custom/pad" "clock" "tray" ];
"custom/pad" = {
format = " ";
tooltip = false;
};
"custom/menu" = {
format = "<span font='16'></span>";
#on-click = ''${pkgs.rofi}/bin/rofi -show power-menu -modi "power-menu:rofi-power-menu --choices=logout/suspend/reboot/shutdown"'';
#on-click-right = "${pkgs.rofi}/bin/rofi -show drun";
on-click = ''~/.config/wofi/power.sh'';
on-click-right = "${pkgs.wofi}/bin/wofi --show drun";
tooltip = false;
};
"sway/workspaces" = {
format = "<span font='12'>{icon}</span>";
format-icons = {
"1" = "";
"2" = "";
"3" = "";
"4" = "";
"5" = "";
};
all-outputs = true;
persistent_workspaces = {
"1" = [ ];
"2" = [ ];
"3" = [ ];
"4" = [ ];
"5" = [ ];
};
};
"wlr/workspaces" = {
format = "<span font='11'>{name}</span>";
#format = "<span font='12'>{icon}</span>";
#format-icons = {
# "1"="";
# "2"="";
# "3"="";
# "4"="";
# "5"="";
# "6"="";
# "7"="";
# "8"="";
# "9"="";
# "10"="";
#};
#all-outputs = true;
active-only = false;
on-click = "activate";
};
clock = {
format = "{:%b %d %H:%M} ";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
#format-alt = "{:%A, %B %d, %Y} ";
};
cpu = {
format = " {usage}% <span font='11'></span> ";
interval = 1;
};
disk = {
format = "{percentage_used}% <span font='11'></span>";
path = "/";
interval = 30;
};
memory = {
format = "{}% <span font='11'></span>";
interval = 1;
};
backlight = {
device = "intel_backlight";
format = "{percent}% <span font='11'>{icon}</span>";
format-icons = [ "" "" ];
on-scroll-down = "${pkgs.light}/bin/light -U 5";
on-scroll-up = "${pkgs.light}/bin/light -A 5";
};
battery = {
interval = 60;
states = {
warning = 30;
critical = 15;
};
format = "{capacity}% <span font='11'>{icon}</span>";
format-charging = "{capacity}% <span font='11'></span>";
format-icons = [ "" "" "" "" "" ];
max-length = 25;
};
network = {
format-wifi = "<span font='11'></span>";
format-ethernet = "<span font='11'>󰈀</span>";
#format-ethernet = "<span font='11'></span> {ifname}: {ipaddr}/{cidr}";
format-linked = "<span font='11'>󱘖</span> {ifname} (No IP)";
format-disconnected = "<span font='11'>󱘖</span> Not connected";
#format-alt = "{ifname}: {ipaddr}/{cidr}";
tooltip-format = "{essid} {ipaddr}/{cidr}";
#on-click-right = "${pkgs.alacritty}/bin/alacritty -e nmtui";
};
pulseaudio = {
format = "<span font='11'>{icon}</span> {volume}% {format_source} ";
format-bluetooth = "<span font='11'>{icon}</span> {volume}% {format_source} ";
format-bluetooth-muted = "<span font='11'>x</span> {volume}% {format_source} ";
format-muted = "<span font='11'>x</span> {volume}% {format_source} ";
#format-source = "{volume}% <span font='11'></span>";
format-source = "<span font='10'></span> ";
format-source-muted = "<span font='11'> </span> ";
format-icons = {
default = [ "" "" "" ];
headphone = "";
#hands-free = "";
#headset = "";
#phone = "";
#portable = "";
#car = "";
};
tooltip-format = "{desc}, {volume}%";
on-click = "${pkgs.pamixer}/bin/pamixer -t";
on-click-right = "${pkgs.pamixer}/bin/pamixer --default-source -t";
on-click-middle = "${pkgs.pavucontrol}/bin/pavucontrol";
};
"custom/sink" = {
format = "{}";
exec = "$HOME/.config/waybar/script/sink.sh";
interval = 2;
on-click = "$HOME/.config/waybar/script/switch.sh";
tooltip = false;
};
"custom/ds4" = {
format = "{}";
exec = "$HOME/.config/waybar/script/ds4.sh";
interval = 60;
};
tray = {
icon-size = 13;
};
};
Sec =
if hostName == "desktop" || hostName == "work" then {
layer = "top";
position = "top";
height = 16;
output =
if hostName == "desktop" then [
"${secondMonitor}"
] else [
"${secondMonitor}"
"${thirdMonitor}"
];
modules-left = [ "custom/menu" "wlr/workspaces" ];
modules-right =
if hostName == "desktop" then
[ "custom/ds4" "custom/pad" "pulseaudio" "custom/sink" "custom/pad" "clock" ]
else
[ "cpu" "memory" "custom/pad" "battery" "custom/pad" "backlight" "custom/pad" "pulseaudio" "custom/pad" "clock" ];
"custom/pad" = {
format = " ";
tooltip = false;
};
"custom/menu" = {
format = "<span font='16'></span>";
#on-click = "${pkgs.rofi}/bin/rofi -show p -modi p:${pkgs.rofi-power-menu}/bin/rofi-power-menu -theme $HOME/.config/rofi/config.rasi";
#on-click-right = "${pkgs.rofi}/bin/rofi -show drun";
on-click = ''~/.config/wofi/power.sh'';
on-click-right = "${pkgs.wofi}/bin/wofi --show drun";
tooltip = false;
};
"wlr/workspaces" = {
format = "<span font='11'>{name}</span>";
#format = "<span font='12'>{icon}</span>";
#format-icons = {
# "1"="";
# "2"="";
# "3"="";
# "4"="";
# "5"="";
# "6"="";
# "7"="";
# "8"="";
# "9"="";
# "10"="";
#};
active-only = false;
on-click = "activate";
#on-scroll-up = "hyprctl dispatch workspace e+1";
#on-scroll-down = "hyprctl dispatch workspace e-1";
};
clock = {
format = "{:%b %d %H:%M}";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
#format-alt = "{:%A, %B %d, %Y} ";
};
cpu = {
format = " {usage}% <span font='11'></span> ";
interval = 1;
};
disk = {
format = "{percentage_used}% <span font='11'></span>";
path = "/";
interval = 30;
};
memory = {
format = "{}% <span font='11'></span>";
interval = 1;
};
backlight = {
device = "intel_backlight";
format = "{percent}% <span font='11'>{icon}</span>";
format-icons = [ "" "" ];
on-scroll-down = "${pkgs.light}/bin/light -U 5";
on-scroll-up = "${pkgs.light}/bin/light -A 5";
};
battery = {
interval = 60;
states = {
warning = 30;
critical = 15;
};
format = "{capacity}% <span font='11'>{icon}</span>";
format-charging = "{capacity}% <span font='11'></span>";
format-icons = [ "" "" "" "" "" ];
max-length = 25;
};
pulseaudio = {
format = "<span font='11'>{icon}</span> {volume}% {format_source} ";
format-bluetooth = "<span font='11'>{icon}</span> {volume}% {format_source} ";
format-bluetooth-muted = "<span font='11'>x</span> {volume}% {format_source} ";
format-muted = "<span font='11'>x</span> {volume}% {format_source} ";
#format-source = "{volume}% <span font='11'></span> ";
format-source = "<span font='10'></span> ";
format-source-muted = "<span font='11'></span> ";
format-icons = {
default = [ "" "" "" ];
headphone = "";
#hands-free = "";
#headset = "";
#phone = "";
#portable = "";
#car = "";
};
tooltip-format = "{desc}, {volume}%";
on-click = "${pkgs.pamixer}/bin/pamixer -t";
on-click-right = "${pkgs.pamixer}/bin/pamixer --default-source -t";
on-click-middle = "${pkgs.pavucontrol}/bin/pavucontrol";
};
"custom/sink" = {
#format = "<span font='10'>蓼</span>";
format = "{}";
exec = "$HOME/.config/waybar/script/sink.sh";
interval = 2;
on-click = "$HOME/.config/waybar/script/switch.sh";
tooltip = false;
};
"custom/ds4" = {
format = "{}";
exec = "$HOME/.config/waybar/script/ds4.sh";
interval = 60;
};
} else { };
};
};
home.file = {
".config/waybar/script/sink.sh" = {
# Custom script: Toggle speaker/headset
text = ''
#!/bin/sh
HEAD=$(awk '/ Built-in Audio Analog Stereo/ { print $2 }' <(${pkgs.wireplumber}/bin/wpctl status | grep "*") | sed -n 2p)
SPEAK=$(awk '/ S10 Bluetooth Speaker/ { print $2 }' <(${pkgs.wireplumber}/bin/wpctl status | grep "*") | head -n 1)
if [[ $HEAD = "*" ]]; then
printf "<span font='13'></span>\n"
elif [[ $SPEAK = "*" ]]; then
printf "<span font='10'>󰓃</span>\n"
fi
exit 0
'';
executable = true;
};
".config/waybar/script/switch.sh" = {
# Custom script: Toggle speaker/headset
text = ''
#!/bin/sh
ID1=$(awk '/ Built-in Audio Analog Stereo/ {sub(/.$/,"",$2); print $2 }' <(${pkgs.wireplumber}/bin/wpctl status) | head -n 1)
ID2=$(awk '/ S10 Bluetooth Speaker/ {sub(/.$/,"",$2); print $2 }' <(${pkgs.wireplumber}/bin/wpctl status) | sed -n 2p)
HEAD=$(awk '/ Built-in Audio Analog Stereo/ { print $2 }' <(${pkgs.wireplumber}/bin/wpctl status | grep "*") | sed -n 2p)
SPEAK=$(awk '/ S10 Bluetooth Speaker/ { print $2 }' <(${pkgs.wireplumber}/bin/wpctl status | grep "*") | head -n 1)
if [[ $HEAD = "*" ]]; then
${pkgs.wireplumber}/bin/wpctl set-default $ID2
elif [[ $SPEAK = "*" ]]; then
${pkgs.wireplumber}/bin/wpctl set-default $ID1
fi
exit 0
'';
executable = true;
};
".config/waybar/script/ds4.sh" = {
# Custom script: Dualshock battery indicator
text = ''
#!/bin/sh
FILE=/sys/class/power_supply/sony_controller_battery_e8:47:3a:05:c0:2b/capacity
FILE2=/sys/class/power_supply/ps-controller-battery-e8:47:3a:05:c0:2b/capacity
if [[ -f $FILE ]] then
DS4BATT=$(cat $FILE)
printf "<span font='13'>󰊴</span> $DS4BATT%%\n"
elif [[ -f $FILE2 ]] then
DS4BATT=$(cat $FILE2)
printf "<span font='13'>󰊴</span> $DS4BATT%%\n"
else
printf "\n"
fi
exit 0
'';
executable = true;
};
};
};
}

98
modules/programs/wofi.nix Normal file
View file

@ -0,0 +1,98 @@
{ config, lib, pkgs, ... }:
let
inherit (config.lib.formats.rasi) mkLiteral;# Theme.rasi alternative. Add Theme here
colors = import ../themes/colors.nix;
in
{
home = {
packages = with pkgs; [
wofi
];
};
home.file = {
".config/wofi/config" = {
text = ''
width=280
lines=10
xoffset=5
yoffset=5
location=1
prompt=Search...
filter_rate=100
allow_markup=false
no_actions=true
halign=fill
orientation=vertical
content_halign=fill
insensitive=true
allow_images=true
image_size=20
hide_scroll=true
'';
};
".config/wofi/style.css" = with colors.scheme.doom; {
text = ''
window {
margin: 0px;
background-color: #${bg};
}
#input {
all: unset;
min-height: 20px;
padding: 4px 10px;
margin: 4px;
border: none;
color: #dfdfdf;
font-weight: bold;
background-color: #${bg};
outline: #dfdfdf;
}
#inner-box {
font-weight: bold;
border-radius: 0px;
}
#outer-box {
margin: 0px;
padding: 3px;
border: none;
border-radius: 10px;
border: 3px solid #${text};
}
#text:selected {
color: #282c34;
background-color: transparent;
}
#entry:selected {
background-color: #${text};
}
'';
};
".config/wofi/power.sh" = with colors.scheme.doom; {
executable = true;
text = ''
#!/bin/sh
entries=" Suspend\n Reboot\n Shutdown"
selected=$(echo -e $entries|wofi --dmenu --cache-file /dev/null | awk '{print tolower($2)}')
case $selected in
suspend)
exec systemctl suspend;;
reboot)
exec systemctl reboot;;
shutdown)
exec systemctl poweroff -i;;
esac
'';
};
};
}

View file

@ -0,0 +1,5 @@
[
# ./git.nix
./zsh.nix
# ./direnv.nix
]

View file

@ -0,0 +1,20 @@
{ config, lib, pkgs, user, ... }: {
programs.git = {
enable = true;
userName = "Glen Goodwin";
userEmail = "glen.goodwin1992@gmail.com";
extraConfig = {
merge = {
ff = "only";
};
};
};
home.packages = with pkgs; [
cocogitto
lazygit
gh
pre-commit
];
}

34
modules/shell/zsh.nix Normal file
View file

@ -0,0 +1,34 @@
{ pkgs, ... }:
{
programs = {
zsh = {
enable = true;
autosuggestions.enable = true; # Auto suggest options and highlights syntax, searches in history for options
syntaxHighlighting.enable = true;
enableCompletion = true;
histSize = 100000;
ohMyZsh = {
# Extra plugins for zsh
enable = true;
plugins = [ "git" ];
};
shellInit = '' # Zsh theme
# Spaceship
source ${pkgs.spaceship-prompt}/share/zsh/site-functions/prompt_spaceship_setup
autoload -U promptinit; promptinit
# Hook direnv
#emulate zsh -c "$(direnv hook zsh)"
# Swag
${pkgs.nitch}/bin/nitch
#eval "$(direnv hook zsh)"
eval "$(atuin init zsh)"
clear
pfetch
'';
};
};
}

View file

@ -0,0 +1,76 @@
{ config, lib, pkgs, user, ... }: {
programs.zsh = {
enable = true;
shellAliases = {
update = "sudo nixos-rebuild switch";
reload = "source ~/.zshrc";
"." = "cd ../";
".." = "cd ../../";
"..." = "cd ../../../";
"...." = "cd ../../../../";
ls = "exa --icons";
l = "exa -al --icons";
la = "exa -a --color=always --group-directories-first --icons"; # all files and dirs
ll = "exa -l --color=always --group-directories-first --icons"; # long format
lt = "exa -aT --color=always --group-directories-first --icons"; # tree listing
cat = "bat";
ps = "procs";
grep = "rg";
# Default flags
rm = "rm -i";
chmod = "chmod -R";
cp = "cp -R -i -v";
mv = "mv -i -v";
mkdir = "mkdir -p -v";
df = "df -h";
du = "du -h -s";
dd = "dd status=progress bs=4M conv=fdatasync ";
wgetpaste = "wgetpaste -Xx";
sudo = "sudo "; # Makes sudo work with es
ssh = "TERM=xterm ssh"; # Fixes some issues with ssh on some terminals
wget = "wget -c";
ping = "ping -c 5";
# Misc alieses I use often
ports = "netstat -tulanp";
rmd = "rm -rf";
mine = "sudo chown -R $(whoami):users";
benchmark = "hyperfine --warmup 3 ";
c = "clear";
listen = "lsof -P -i -n";
nc = "nordvpn connect sweden";
nd = "nordvpn disconnect";
tra = "transmission-remote -a";
clock = "sudo ntpd -gq";
octal = "stat -c '%a %n'";
};
zplug = {
enable = true;
plugins = [
{ name = "zsh-users/zsh-autosuggestions"; }
{ name = "zsh-users/zsh-completions"; }
{ name = "zsh-users/zsh-syntax-highlighting"; }
{ name = "MichaelAquilina/zsh-you-should-use"; }
];
};
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
};
initExtra = ''
#clear
#neofetch
eval "$(atuin init zsh)"
'';
};
}

49
modules/themes/colors.nix Normal file
View file

@ -0,0 +1,49 @@
#
# System themes
#
{
scheme = {
doom = {
scheme = "Doom One Dark";
black = "000000";
red = "ff6c6b";
orange = "da8548";
yellow = "ecbe7b";
green = "95be65";
teal = "4db5bd";
blue = "6eaafb";
dark-blue = "2257a0";
magenta = "c678dd";
violet = "a9a1e1";
cyan = "6cdcf7";
dark-cyan = "5699af";
emphasis = "50536b";
text = "dfdfdf";
text-alt = "b2b2b2";
fg = "abb2bf";
bg = "282c34";
};
dracula = {
scheme = "Dracula";
base00 = "282936"; #background
base01 = "3a3c4e";
base02 = "4d4f68";
base03 = "626483";
base04 = "62d6e8";
base05 = "e9e9f4"; #foreground
base06 = "f1f2f8";
base07 = "f7f7fb";
base08 = "ea51b2";
base09 = "b45bcf";
base0A = "00f769";
base0B = "ebff87";
base0C = "a1efe4";
base0D = "62d6e8";
base0E = "b45bcf";
base0F = "00f769";
};
};
}