commit 3a345929b9604038577b179e13ee04ca7fc4323f Author: chris bell Date: Sat Oct 3 10:46:08 2026 -0500 adding desktop config diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e3543ec --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1790955005, + "narHash": "sha256-EEQKUylD8zuRTmDFX4rbwsHQ+iZhqqOldYcFN8SLcE0=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0560d64401a6d5370732a69d08bc4a6b135962d9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1790822859, + "narHash": "sha256-69xHQhAeMAD2wDXO7T2pcOZIF9Sga2W+JkmY2a11Ops=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c59305bab2065cfecc4944690d9eedbb56f3a9fa", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..20cea45 --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + zen-browser = { + url = "github:youwen5/zen-browser-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, ... }@inputs: + let + mkHost = name: nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ ./hosts/${name}/configuration.nix ]; + }; + in { + nixosConfigurations = { + p50 = mkHost "p50"; + desktop = mkHost "desktop"; + }; + }; + +} diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix new file mode 100644 index 0000000..ee265d1 --- /dev/null +++ b/hosts/desktop/configuration.nix @@ -0,0 +1,233 @@ +{ config, inputs, pkgs, ... }: + +{ + imports = + [ + /etc/nixos/hardware-configuration.nix + inputs.home-manager.nixosModules.default + ../../modules/nixos/nvidia.nix + ../../modules/nixos/bspwm.nix + ../../modules/nixos/cups.nix + ]; + + nixpkgs.overlays = [ + (import ./ghidra-m32r-overlay.nix) + ]; + + # Extra Nix Settings + nix.settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + }; + + programs.nix-ld.enable = true; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "nixos"; + networking.networkmanager.enable = true; + time.timeZone = "America/Chicago"; + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + # Enable sound with pipewire. + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Enable Direnv + programs.direnv.enable = true; + + # User Account + users.users.chris = { + isNormalUser = true; + description = "chris"; + extraGroups = [ "networkmanager" "wheel" "dialout" "storage" ]; + shell = pkgs.zsh; + packages = with pkgs; [ + telegram-desktop + discord + ungoogled-chromium + inkscape + obsidian + sourcegit + obs-studio + r2modman + signal-desktop + kdePackages.dolphin + flameshot + vscodium + nautilus + onlyoffice-desktopeditors + vlc + orca-slicer + blender + grayjay + vlc + kdePackages.kdenlive + kicad + ghidra + ]; + }; + + home-manager = { + useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; + users."chris" = import ./home.nix; + }; + + + services.freenet = { + enable = true; + }; + + # Garbage Collection + nix.gc = { + automatic = true; + dates = "weekly"; + persistent = true; + options = ""; + }; + + + # Mount the data drive + fileSystems."/data" = { + device = "/dev/disk/by-uuid/58c7b996-c436-47e8-8018-244417acf067"; + fsType = "ext4"; + options = [ "nofail" ]; + }; + + # ZSH + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + interactiveShellInit = '' + fastfetch + ''; + + shellAliases = { + ll = "ls -l"; + edit = "hx ~/dotfiles"; + update = "sh ~/dotfiles/rebuild.sh"; + ssh-server = "ssh braincell@192.168.1.3"; + calc = "kalker"; + n = "nvim ."; + # ssh-pihole = "ssh bell@192.168.1.23"; + }; + + histSize = 10000; + histFile = "$HOME/.zsh_history"; + setOptions = [ + "HIST_IGNORE_ALL_DUPS" + ]; + + oh-my-zsh = { + enable = true; + theme = "clean"; + plugins = ["git" "sudo" "direnv"]; + }; + }; + + # Steam + programs.steam.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # System Packages + environment.systemPackages = with pkgs; [ + vim + wget + git + file + helix + lazygit + nixd + fastfetch + disktui + busybox + kalker + nmap + screen + btop + udiskie + ]; + + # extra filesystems + boot.supportedFilesystems = { + exfat = true; + ntfs = true; + }; + + + # Enable Virtualization + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + virtualisation.podman = { + enable = true; + dockerCompat = true; + }; + + # Enable Flatpacks + services.flatpak.enable = true; + + # Xdg portal + xdg.portal = { + enable = true; + extraPortals = [pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-gnome]; + # config.common.default = ""; + }; + + # OpenSSH + services.openssh.enable = true; + + # UDisks (for auto mounting) + services.udisks2 = { + enable = true; + }; + + services.gvfs.enable = true; + + systemd.user.services.udiskie = { + description = "udiskie automount daemon"; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + serviceConfig = { + ExecStart = "${pkgs.udiskie}/bin/udiskie --automount --notify --tray"; + Restart = "always"; + }; + }; + + + # Firewall + networking.firewall.allowedTCPPorts = [ 9999 ]; + networking.firewall.allowedUDPPorts = [ 9999 ]; + + system.stateVersion = "25.11"; # Did you read the comment? DONT TOUCH :) +} diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix new file mode 100644 index 0000000..d43c32d --- /dev/null +++ b/hosts/desktop/hardware-configuration.nix @@ -0,0 +1,33 @@ +# 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" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/8240c6bd-46fa-4a0c-bc5a-7120ca9b4e32"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/8E53-D417"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/ebd7c6d8-9520-4c7b-81d9-3e6e89cf5303"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix new file mode 100644 index 0000000..c6c00dc --- /dev/null +++ b/hosts/desktop/home.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: + +{ + home.username = "chris"; + home.homeDirectory = "/home/chris"; + home.stateVersion = "26.05"; # Please read the comment before changing. + programs.home-manager.enable = true; + + imports = [ + ../../modules/home-manager/defaults.nix + ../../modules/home-manager/sxhkd.nix + ../../modules/home-manager/terminals/alacritty.nix + # ../../modules/home-manager/browsers/ugc.nix + ../../modules/home-manager/bspwm.nix + ../../modules/home-manager/polybar.nix + # ../../modules/home-manager/editors/helix.nix + ]; + + my.defaults = { + terminal = "alacritty"; + editor = "hx"; + browser = "zen"; + }; +} diff --git a/hosts/desktop/old-conf.nix b/hosts/desktop/old-conf.nix new file mode 100755 index 0000000..1360871 --- /dev/null +++ b/hosts/desktop/old-conf.nix @@ -0,0 +1,331 @@ +{ config, inputs, pkgs, ... }: + +{ + imports = + [ + /etc/nixos/hardware-configuration.nix + ./big-picture-launcher.nix + ]; + + nixpkgs.overlays = [ + (import ./ghidra-m32r-overlay.nix) + ]; + + # Extra Nix Settings + nix.settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + }; + + programs.nix-ld.enable = true; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + 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/Chicago"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Nvidia shit + hardware.graphics.enable = true; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia.open = false; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # DMs/WMs + environment.pathsToLink = ["/libexec"]; + + services.xserver = { + desktopManager = { + xterm.enable = false; + xfce.enable = true; + # lxqt.enable = true; + }; + + displayManager = { + # lightdm.enable = true; + # gdm.enable = true; + sddm.enable = true; + }; + + windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + dmenu + ]; + }; + }; + + # services.displayManager.defaultSession = "none+i3"; + # programs.i3lock.enable = true; + # end i3wm + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + # Enable sound with pipewire. + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Enable Direnv + programs.direnv.enable = true; + + # User Account + users.users.chris = { + isNormalUser = true; + description = "chris"; + extraGroups = [ "networkmanager" "wheel" "dialout" "storage" ]; + shell = pkgs.zsh; + packages = with pkgs; [ + telegram-desktop + discord + ungoogled-chromium + inkscape + obsidian + sourcegit + obs-studio + r2modman + signal-desktop + kdePackages.dolphin + flameshot + vscodium + # jetbrains.rider + nautilus + # element-desktop + onlyoffice-desktopeditors + vlc + orca-slicer + blender + # mudlet + grayjay + vlc + kdePackages.kdenlive + kicad + + + ghidra + ]; + }; + + services.freenet = { + enable = true; + }; + + # Garbage Collection + nix.gc = { + automatic = true; + dates = "weekly"; + persistent = true; + options = ""; + }; + + + # Printing + services.printing.drivers = [ + pkgs.brlaser + pkgs.brgenml1lpr + pkgs.brgenml1cupswrapper + ]; + + # Mount the data drive + fileSystems."/data" = { + device = "/dev/disk/by-uuid/58c7b996-c436-47e8-8018-244417acf067"; + fsType = "ext4"; + options = [ "nofail" ]; + }; + + + + # ZSH + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + interactiveShellInit = '' + fastfetch + ''; + + shellAliases = { + ll = "ls -l"; + edit = "hx ~/dotfiles"; + update = "sh ~/dotfiles/rebuild.sh"; + ssh-server = "ssh braincell@192.168.1.3"; + calc = "kalker"; + n = "nvim ."; + # ssh-pihole = "ssh bell@192.168.1.23"; + }; + + histSize = 10000; + histFile = "$HOME/.zsh_history"; + setOptions = [ + "HIST_IGNORE_ALL_DUPS" + ]; + + oh-my-zsh = { + enable = true; + theme = "clean"; + plugins = ["git" "sudo" "direnv"]; + }; + }; + + # Steam + programs.steam.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # System Packages + environment.systemPackages = with pkgs; [ + vim + wget + git + file + helix + lazygit + kitty + picom + arandr + feh + nixd + quickshell + inputs.noctalia.packages.${system}.default + xwayland-satellite + adw-gtk3 + nwg-look + fastfetch + swaylock + xdg-desktop-portal-gtk + xdg-desktop-portal-gnome + gnome-keyring + parted + gparted + disktui + busybox + kalker + nmap + screen + btop + udiskie + thunar + + distrobox + + wine + # wine-staging + wine-wayland + winetricks + ]; + + # programs.neovim = { + # enable = true; + # defaultEditor = true; + # }; + + # Emulate arm + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + + # extra filesystems + boot.supportedFilesystems = { + exfat = true; + ntfs = true; + }; + + + # Enable GDM + # services.xserver.displayManager.gdm.enable = true; + + # Enable Virtualization + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + virtualisation.podman = { + enable = true; + dockerCompat = true; + }; + + # Enable Flatpacks + services.flatpak.enable = true; + + # Xdg portal + xdg.portal = { + enable = true; + extraPortals = [pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-gnome]; + # config.common.default = ""; + }; + + # OpenSSH + services.openssh.enable = true; + + # UDisks (for auto mounting) + services.udisks2 = { + enable = true; + }; + + services.gvfs.enable = true; + + systemd.user.services.udiskie = { + description = "udiskie automount daemon"; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + serviceConfig = { + ExecStart = "${pkgs.udiskie}/bin/udiskie --automount --notify --tray"; + Restart = "always"; + }; + }; + + + # Firewall + networking.firewall.allowedTCPPorts = [ 9999 ]; + networking.firewall.allowedUDPPorts = [ 9999 ]; + # Or disable the firewall altoget. + # networking.firewall.enable = false; + + # networking.nameservers = [ "192.168.1.3" "1.1.1.1" ]; + + system.stateVersion = "25.11"; # Did you read the comment? DONT TOUCH :) +} diff --git a/hosts/p50/configuration.nix b/hosts/p50/configuration.nix new file mode 100644 index 0000000..1a0ff9f --- /dev/null +++ b/hosts/p50/configuration.nix @@ -0,0 +1,88 @@ +{ config, pkgs, inputs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ../../modules/nixos/bspwm.nix + ../../modules/nixos/quadro-m1000m.nix + ]; + + # Nix options + nix.settings = { + experimental-features = ["nix-command" "flakes"]; + }; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Use latest kernel. + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking.hostName = "p50"; # Define your hostname. + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/Chicago"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users."chris" = { + isNormalUser = true; + description = "chris"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + + + home-manager = { + useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; + users."chris" = import ./home.nix; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + environment.systemPackages = with pkgs; [ + vim + wget + helix + nixd + git + fastfetch + btop + ]; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + system.stateVersion = "26.05"; # Did you read the comment? + +} diff --git a/hosts/p50/hardware-configuration.nix b/hosts/p50/hardware-configuration.nix new file mode 100644 index 0000000..9392841 --- /dev/null +++ b/hosts/p50/hardware-configuration.nix @@ -0,0 +1,31 @@ +# 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 = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/e313b664-984e-4f55-ad80-388aa39457fc"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/96F9-3011"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/p50/home.nix b/hosts/p50/home.nix new file mode 100644 index 0000000..6917cbd --- /dev/null +++ b/hosts/p50/home.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: + +{ + home.username = "chris"; + home.homeDirectory = "/home/chris"; + home.stateVersion = "26.05"; # Please read the comment before changing. + programs.home-manager.enable = true; + + imports = [ + ../../modules/home-manager/defaults.nix + ../../modules/home-manager/sxhkd.nix + ../../modules/home-manager/terminals/alacritty.nix + ../../modules/home-manager/browsers/ugc.nix + ../../modules/home-manager/bspwm.nix + ../../modules/home-manager/polybar.nix + # ../../modules/home-manager/editors/helix.nix + ]; + + my.defaults = { + terminal = "alacritty"; + editor = "hx"; + browser = "chromium"; + }; +} diff --git a/modules/home-manager/browsers/ugc.nix b/modules/home-manager/browsers/ugc.nix new file mode 100644 index 0000000..ccc949d --- /dev/null +++ b/modules/home-manager/browsers/ugc.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +{ + programs.chromium = { + enable = true; + package = pkgs.ungoogled-chromium; + # extensions = [ { id = "..."; } ]; + }; +} diff --git a/modules/home-manager/browsers/zen.nix b/modules/home-manager/browsers/zen.nix new file mode 100644 index 0000000..70af60b --- /dev/null +++ b/modules/home-manager/browsers/zen.nix @@ -0,0 +1,7 @@ +{ pkgs, inputs, ... }: + +{ + home.packages = [ + inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default + ]; +} diff --git a/modules/home-manager/bspwm.nix b/modules/home-manager/bspwm.nix new file mode 100644 index 0000000..0d0a9c2 --- /dev/null +++ b/modules/home-manager/bspwm.nix @@ -0,0 +1,34 @@ +{ lib, pkgs, ... }: + +{ + xdg.configFile."bspwm/bspwmrc" = { + executable = true; + text = '' + #!/bin/sh + + bspc monitor -d 1 2 3 4 5 6 7 8 9 + + # Gaps and borders + bspc config window_gap 10 + bspc config border_width 2 + bspc config focused_border_color "#7aa2f7" + bspc config normal_border_color "#292e42" + + # Layout behaviour + bspc config split_ratio 0.50 + bspc config borderless_monocle true + bspc config gapless_monocle true + + # Launch polybar + ~/.config/polybar/launch.sh + ''; + }; + + home.activation.reloadBspwm = lib.hm.dag.entryAfter [ "linkGeneration" ] '' + if ${pkgs.procps}/bin/pgrep -x bspwm >/dev/null; then + PATH=${pkgs.bspwm}/bin:$PATH DISPLAY=:0 $HOME/.config/bspwm/bspwmrc \ + || echo "bspwmrc reload failed" >&2 + fi + ''; + +} diff --git a/modules/home-manager/defaults.nix b/modules/home-manager/defaults.nix new file mode 100644 index 0000000..9cf3328 --- /dev/null +++ b/modules/home-manager/defaults.nix @@ -0,0 +1,23 @@ +{ config, lib, ... }: + +let + cfg = config.my.defaults; + mkCmdOption = description: lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + inherit description; + }; +in +{ + options.my.defaults = { + terminal = mkCmdOption "Command for the default terminal ($TERMINAL)."; + browser = mkCmdOption "Command for the default browser ($BROWSER)."; + editor = mkCmdOption "Command for the default editor ($EDITOR and $VISUAL)."; + }; + + config.home.sessionVariables = lib.mkMerge [ + (lib.mkIf (cfg.terminal != null) { TERMINAL = cfg.terminal; }) + (lib.mkIf (cfg.browser != null) { BROWSER = cfg.browser; }) + (lib.mkIf (cfg.editor != null) { EDITOR = cfg.editor; VISUAL = cfg.editor; }) + ]; +} diff --git a/modules/home-manager/editors/helix.nix b/modules/home-manager/editors/helix.nix new file mode 100644 index 0000000..987d3f5 --- /dev/null +++ b/modules/home-manager/editors/helix.nix @@ -0,0 +1,6 @@ + +{ ... }: + +{ + programs.helix.enable = true; +} diff --git a/modules/home-manager/polybar.nix b/modules/home-manager/polybar.nix new file mode 100644 index 0000000..2e8c3c2 --- /dev/null +++ b/modules/home-manager/polybar.nix @@ -0,0 +1,91 @@ +{ lib, pkgs, ... }: + +let + polybar = pkgs.polybar.override { pulseSupport = true; }; +in +{ + home.packages = [ + polybar + pkgs.nerd-fonts.jetbrains-mono + ]; + fonts.fontconfig.enable = true; + + xdg.configFile."polybar/config.ini".text = '' + [colors] + background = #1a1b26 + foreground = #c0caf5 + primary = #7aa2f7 + dim = #565f89 + + [bar/main] + width = 100% + height = 22pt + background = ''${colors.background} + foreground = ''${colors.foreground} + font-0 = JetBrainsMono Nerd Font:size=10;2 + padding = 1 + module-margin = 1 + separator = | + separator-foreground = ''${colors.dim} + wm-restack = bspwm + enable-ipc = true + + modules-left = bspwm + modules-center = date + modules-right = pulseaudio cpu memory + + tray-position = right + + [module/bspwm] + type = internal/bspwm + label-focused = %name% + label-focused-background = ''${colors.primary} + label-focused-foreground = ''${colors.background} + label-focused-padding = 1 + label-occupied = %name% + label-occupied-padding = 1 + label-empty = %name% + label-empty-foreground = ''${colors.dim} + label-empty-padding = 1 + label-urgent = %name% + label-urgent-background = #f7768e + label-urgent-padding = 1 + + [module/date] + type = internal/date + interval = 5 + date = %a %b %d %H:%M + + [module/cpu] + type = internal/cpu + interval = 2 + label = CPU %percentage%% + + [module/memory] + type = internal/memory + interval = 5 + label = RAM %percentage_used%% + + [module/pulseaudio] + type = internal/pulseaudio + label-volume = VOL %percentage%% + label-muted = muted + label-muted-foreground = ''${colors.dim} + ''; + + xdg.configFile."polybar/launch.sh" = { + executable = true; + text = '' + #!/bin/sh + ${pkgs.procps}/bin/pkill -x polybar + while ${pkgs.procps}/bin/pgrep -x polybar >/dev/null; do sleep 0.2; done + ${pkgs.util-linux}/bin/setsid -f ${polybar}/bin/polybar main + ''; + }; + + # home.activation.reloadPolybar = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + # if ${pkgs.procps}/bin/pgrep -x bspwm >/dev/null; then + # DISPLAY=:0 $HOME/.config/polybar/launch.sh || true + # fi + # ''; +} diff --git a/modules/home-manager/sxhkd.nix b/modules/home-manager/sxhkd.nix new file mode 100644 index 0000000..d0b30ed --- /dev/null +++ b/modules/home-manager/sxhkd.nix @@ -0,0 +1,47 @@ +{ config, lib, pkgs, ... }: + +{ + xdg.configFile."sxhkd/sxhkdrc".text = '' + # terminal / launcher + super + Return + ${config.my.defaults.terminal} + super + space + dmenu_run + + # close window / quit bspwm + super + q + bspc node -c + super + alt + Escape + bspc quit + + # focus window + super + {Left,Down,Up,Right} + bspc node -f {west,south,north,east} + + # move (swap) window + super + shift + {Left,Down,Up,Right} + bspc node -s {west,south,north,east} + + # resize window + super + alt + {Left,Down,Up,Right} + bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0} + + # go to workspace / send window to workspace + super + {_,shift + }{1-9} + bspc {desktop -f,node -d} '^{1-9}' + + # workspace next/previous + super + ctrl + {Left,Right} + bspc desktop -f {prev,next}.local + + # fullscreen / floating + super + f + bspc node -t "~fullscreen" + super + shift + f + bspc node -t "~floating" + ''; + + home.activation.reloadSxhkd = lib.hm.dag.entryAfter [ "linkGeneration" ] '' + ${pkgs.procps}/bin/pkill -USR1 -x sxhkd || true + ''; +} diff --git a/modules/home-manager/terminals/alacritty.nix b/modules/home-manager/terminals/alacritty.nix new file mode 100644 index 0000000..64f9c8d --- /dev/null +++ b/modules/home-manager/terminals/alacritty.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + programs.alacritty = { + enable = true; + settings = { + font.size = 11; + window.opacity = 0.95; + }; + }; +} diff --git a/modules/nixos/bspwm.nix b/modules/nixos/bspwm.nix new file mode 100644 index 0000000..7550b2e --- /dev/null +++ b/modules/nixos/bspwm.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +{ + services.xserver = { + enable = true; + windowManager.bspwm = { + enable = true; + configFile = "/home/chris/.config/bspwm/bspwmrc"; + sxhkd.configFile = "/home/chris/.config/sxhkd/sxhkdrc"; + }; + displayManager.lightdm.enable = true; + }; + + services.displayManager.defaultSession = "none+bspwm"; + + environment.systemPackages = with pkgs; [ + xterm + dmenu + ]; +} diff --git a/modules/nixos/cups.nix b/modules/nixos/cups.nix new file mode 100644 index 0000000..709c119 --- /dev/null +++ b/modules/nixos/cups.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: + +{ + # Enable CUPS to print documents. + services.printing.enable = true; + + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + # Printing + services.printing.drivers = [ + pkgs.brlaser + pkgs.brgenml1lpr + pkgs.brgenml1cupswrapper + ]; +} diff --git a/modules/nixos/nvidia.nix b/modules/nixos/nvidia.nix new file mode 100644 index 0000000..acea41a --- /dev/null +++ b/modules/nixos/nvidia.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + hardware.graphics.enable = true; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia.open = false; +} diff --git a/modules/nixos/quadro-m1000m.nix b/modules/nixos/quadro-m1000m.nix new file mode 100644 index 0000000..7101468 --- /dev/null +++ b/modules/nixos/quadro-m1000m.nix @@ -0,0 +1,14 @@ +{ config, ... }: + +{ + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.graphics.enable = true; + + hardware.nvidia = { + open = false; + modesetting.enable = true; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.legacy_580; + }; +}