From cee415973f2f60e71a9b124e6354d6940eb08398 Mon Sep 17 00:00:00 2001 From: DashieTM Date: Sat, 10 May 2025 13:29:37 +0200 Subject: [PATCH] Add gh --- base/common_hardware.nix | 348 ++++---- base/env.nix | 48 +- flake.nix | 260 +++--- home/common.nix | 82 +- home/default.nix | 98 +-- lib/default.nix | 288 +++---- modules/programs/basePackages.nix | 256 +++--- modules/programs/coding.nix | 1066 +++++++++++++----------- modules/programs/default.nix | 98 +-- modules/programs/fancontrol.nix | 72 +- modules/programs/fish.nix | 1 + modules/programs/git.nix | 4 +- modules/programs/hyprland/hyprland.nix | 804 +++++++++--------- 13 files changed, 1747 insertions(+), 1678 deletions(-) diff --git a/base/common_hardware.nix b/base/common_hardware.nix index 8eb4e78..45b7779 100644 --- a/base/common_hardware.nix +++ b/base/common_hardware.nix @@ -1,174 +1,174 @@ -{ - mkDashDefault, - pkgs, - config, - lib, - hostName, - modulesPath, - ... -}: let - username = config.conf.username; -in { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - wsl.enable = mkDashDefault config.conf.wsl; - - # Bootloader. - boot = lib.mkIf (!config.conf.wsl) { - consoleLogLevel = mkDashDefault 0; - - lanzaboote = lib.mkIf config.conf.secureBoot { - enable = mkDashDefault true; - pkiBundle = mkDashDefault "/var/lib/sbctl"; - settings.reboot-for-bitlocker = mkDashDefault true; - }; - - loader = { - systemd-boot = { - enable = - if config.conf.secureBoot - then lib.mkForce false - else if config.conf.useSystemdBootloader - then true - else mkDashDefault false; - configurationLimit = 5; - }; - efi.canTouchEfiVariables = mkDashDefault true; - }; - - kernelPackages = mkDashDefault pkgs.linuxPackages_latest; - initrd = { - verbose = mkDashDefault false; - availableKernelModules = [ - "nvme" - "xhci_pci" - "ahci" - "usbhid" - "usb_storage" - "sd_mod" - ]; - }; - kernelParams = - [ - ''resume="PARTLABEL=SWAP"'' - ''quiet'' - ''udev.log_level=3'' - ] - ++ config.conf.bootParams; - }; - - networking = { - useDHCP = mkDashDefault true; - networkmanager.enable = mkDashDefault true; - hostName = mkDashDefault hostName; - }; - - time = { - timeZone = mkDashDefault config.conf.timezone; - hardwareClockInLocalTime = mkDashDefault config.conf.systemLocalTime; - }; - - i18n.defaultLocale = mkDashDefault config.conf.locale; - - services = { - lorri.enable = mkDashDefault true; - xserver.enable = mkDashDefault true; - fstrim.enable = mkDashDefault true; - pulseaudio.enable = mkDashDefault false; - pipewire = { - enable = mkDashDefault true; - alsa = { - enable = mkDashDefault true; - support32Bit = mkDashDefault true; - }; - jack.enable = mkDashDefault true; - pulse.enable = mkDashDefault true; - }; - }; - - nixpkgs.hostPlatform = mkDashDefault config.conf.system; - nix = { - gc = { - automatic = mkDashDefault true; - dates = mkDashDefault "weekly"; - options = mkDashDefault "--delete-older-than 7d --delete-generations +5"; - }; - settings = { - trusted-users = [username]; - auto-optimise-store = mkDashDefault true; - - builders-use-substitutes = mkDashDefault true; - - substituters = [ - "https://hyprland.cachix.org" - "https://anyrun.cachix.org" - "https://cache.garnix.io" - "https://oxipaste.cachix.org" - "https://oxinoti.cachix.org" - "https://oxishut.cachix.org" - "https://oxidash.cachix.org" - "https://oxicalc.cachix.org" - "https://hyprdock.cachix.org" - "https://reset.cachix.org" - "https://chaotic-nyx.cachix.org/" - ]; - - trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" - "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" - "oxipaste.cachix.org-1:n/oA3N3Z+LJP7eIWOwuoLd9QnPyZXqFjLgkahjsdDGc=" - "oxinoti.cachix.org-1:dvSoJl2Pjo5HMaNngdBbSaixK9BSf2N8gzjP2MdGvfc=" - "oxishut.cachix.org-1:axyAGF3XMh1IyMAW4UMbQCdMNovDH0KH6hqLLRJH8jU=" - "oxidash.cachix.org-1:5K2FNHp7AS8VF7LmQkJAUG/dm6UHCz4ngshBVbjFX30=" - "oxicalc.cachix.org-1:qF3krFc20tgSmtR/kt6Ku/T5QiG824z79qU5eRCSBTQ=" - "hyprdock.cachix.org-1:HaROK3fBvFWIMHZau3Vq1TLwUoJE8yRbGLk0lEGzv3Y=" - "reset.cachix.org-1:LfpnUUdG7QM/eOkN7NtA+3+4Ar/UBeYB+3WH+GjP9Xo=" - "chaotic-nyx.cachix.org-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8=" - ]; - - experimental-features = mkDashDefault "nix-command flakes pipe-operators"; - }; - }; - - hardware = { - cpu.${config.conf.cpu}.updateMicrocode = - mkDashDefault - config.hardware.enableRedistributableFirmware; - }; - - security.rtkit.enable = mkDashDefault true; - - environment.variables = { - XDG_CACHE_HOME = mkDashDefault "$HOME/.cache"; - DIRENV_LOG_FORMAT = mkDashDefault ""; - QT_QPA_PLATFORMTHEME = mkDashDefault "qt5ct"; - }; - - # allows user change later on - users = { - mutableUsers = mkDashDefault true; - users.${username} = { - isNormalUser = mkDashDefault true; - description = mkDashDefault username; - extraGroups = [ - "networkmanager" - "wheel" - "gamemode" - "docker" - "vboxusers" - "video" - "audio" - ]; - packages = with pkgs; [ - home-manager - xdg-desktop-portal-gtk - ]; - # this password will only last for the first login - # e.g. login, then change to whatever else, this also ensures no public hash is available - password = mkDashDefault "firstlogin"; - }; - }; -} +{ + mkDashDefault, + pkgs, + config, + lib, + hostName, + modulesPath, + ... +}: let + username = config.conf.username; +in { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + wsl.enable = mkDashDefault config.conf.wsl; + + # Bootloader. + boot = lib.mkIf (!config.conf.wsl) { + consoleLogLevel = mkDashDefault 0; + + lanzaboote = lib.mkIf config.conf.secureBoot { + enable = mkDashDefault true; + pkiBundle = mkDashDefault "/var/lib/sbctl"; + settings.reboot-for-bitlocker = mkDashDefault true; + }; + + loader = { + systemd-boot = { + enable = + if config.conf.secureBoot + then lib.mkForce false + else if config.conf.useSystemdBootloader + then true + else mkDashDefault false; + configurationLimit = 5; + }; + efi.canTouchEfiVariables = mkDashDefault true; + }; + + kernelPackages = mkDashDefault pkgs.linuxPackages_latest; + initrd = { + verbose = mkDashDefault false; + availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; + }; + kernelParams = + [ + ''resume="PARTLABEL=SWAP"'' + ''quiet'' + ''udev.log_level=3'' + ] + ++ config.conf.bootParams; + }; + + networking = { + useDHCP = mkDashDefault true; + networkmanager.enable = mkDashDefault true; + hostName = mkDashDefault hostName; + }; + + time = { + timeZone = mkDashDefault config.conf.timezone; + hardwareClockInLocalTime = mkDashDefault config.conf.systemLocalTime; + }; + + i18n.defaultLocale = mkDashDefault config.conf.locale; + + services = { + lorri.enable = mkDashDefault true; + xserver.enable = mkDashDefault true; + fstrim.enable = mkDashDefault true; + pulseaudio.enable = mkDashDefault false; + pipewire = { + enable = mkDashDefault true; + alsa = { + enable = mkDashDefault true; + support32Bit = mkDashDefault true; + }; + jack.enable = mkDashDefault true; + pulse.enable = mkDashDefault true; + }; + }; + + nixpkgs.hostPlatform = mkDashDefault config.conf.system; + nix = { + gc = { + automatic = mkDashDefault true; + dates = mkDashDefault "weekly"; + options = mkDashDefault "--delete-older-than 7d --delete-generations +5"; + }; + settings = { + trusted-users = [username]; + auto-optimise-store = mkDashDefault true; + + builders-use-substitutes = mkDashDefault true; + + substituters = [ + "https://hyprland.cachix.org" + "https://anyrun.cachix.org" + "https://cache.garnix.io" + "https://oxipaste.cachix.org" + "https://oxinoti.cachix.org" + "https://oxishut.cachix.org" + "https://oxidash.cachix.org" + "https://oxicalc.cachix.org" + "https://hyprdock.cachix.org" + "https://reset.cachix.org" + "https://chaotic-nyx.cachix.org/" + ]; + + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" + "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" + "oxipaste.cachix.org-1:n/oA3N3Z+LJP7eIWOwuoLd9QnPyZXqFjLgkahjsdDGc=" + "oxinoti.cachix.org-1:dvSoJl2Pjo5HMaNngdBbSaixK9BSf2N8gzjP2MdGvfc=" + "oxishut.cachix.org-1:axyAGF3XMh1IyMAW4UMbQCdMNovDH0KH6hqLLRJH8jU=" + "oxidash.cachix.org-1:5K2FNHp7AS8VF7LmQkJAUG/dm6UHCz4ngshBVbjFX30=" + "oxicalc.cachix.org-1:qF3krFc20tgSmtR/kt6Ku/T5QiG824z79qU5eRCSBTQ=" + "hyprdock.cachix.org-1:HaROK3fBvFWIMHZau3Vq1TLwUoJE8yRbGLk0lEGzv3Y=" + "reset.cachix.org-1:LfpnUUdG7QM/eOkN7NtA+3+4Ar/UBeYB+3WH+GjP9Xo=" + "chaotic-nyx.cachix.org-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8=" + ]; + + experimental-features = mkDashDefault "nix-command flakes pipe-operators"; + }; + }; + + hardware = { + cpu.${config.conf.cpu}.updateMicrocode = + mkDashDefault + config.hardware.enableRedistributableFirmware; + }; + + security.rtkit.enable = mkDashDefault true; + + environment.variables = { + XDG_CACHE_HOME = mkDashDefault "$HOME/.cache"; + DIRENV_LOG_FORMAT = mkDashDefault ""; + QT_QPA_PLATFORMTHEME = mkDashDefault "qt5ct"; + }; + + # allows user change later on + users = { + mutableUsers = mkDashDefault true; + users.${username} = { + isNormalUser = mkDashDefault true; + description = mkDashDefault username; + extraGroups = [ + "networkmanager" + "wheel" + "gamemode" + "docker" + "vboxusers" + "video" + "audio" + ]; + packages = with pkgs; [ + home-manager + xdg-desktop-portal-gtk + ]; + # this password will only last for the first login + # e.g. login, then change to whatever else, this also ensures no public hash is available + password = mkDashDefault "firstlogin"; + }; + }; +} diff --git a/base/env.nix b/base/env.nix index 0eaf068..7937030 100644 --- a/base/env.nix +++ b/base/env.nix @@ -1,24 +1,24 @@ -{ - mkDashDefault, - pkgs, - config, - lib, - ... -}: { - environment = { - variables = { - GSETTINGS_SCHEMA_DIR = mkDashDefault "${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}"; - NEOVIDE_MAXIMIZED = mkDashDefault "0"; - GPG_TTY = mkDashDefault "$(tty)"; - EDITOR = mkDashDefault "neovide --no-fork"; - SUDO_EDITOR = mkDashDefault "neovide --no-fork"; - SCRIPTS = mkDashDefault "$HOME/.config/scripts"; - }; - sessionVariables = { - NIXOS_OZONE_WL = mkDashDefault "1"; - GOPATH = mkDashDefault "$HOME/.go"; - FLAKE = mkDashDefault config.conf.nixosConfigPath; - NH_FLAKE = mkDashDefault config.conf.nixosConfigPath; - }; - }; -} +{ + mkDashDefault, + pkgs, + config, + lib, + ... +}: { + environment = { + variables = { + GSETTINGS_SCHEMA_DIR = mkDashDefault "${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}"; + NEOVIDE_MAXIMIZED = mkDashDefault "0"; + GPG_TTY = mkDashDefault "$(tty)"; + EDITOR = mkDashDefault "neovide --no-fork"; + SUDO_EDITOR = mkDashDefault "neovide --no-fork"; + SCRIPTS = mkDashDefault "$HOME/.config/scripts"; + }; + sessionVariables = { + NIXOS_OZONE_WL = mkDashDefault "1"; + GOPATH = mkDashDefault "$HOME/.go"; + FLAKE = mkDashDefault config.conf.nixosConfigPath; + NH_FLAKE = mkDashDefault config.conf.nixosConfigPath; + }; + }; +} diff --git a/flake.nix b/flake.nix index bbddc3a..6290e63 100644 --- a/flake.nix +++ b/flake.nix @@ -1,130 +1,130 @@ -{ - description = "DashNix"; - - inputs = { - unstable.url = "github:NixOs/nixpkgs/nixos-unstable"; - stable.url = "github:NixOs/nixpkgs/nixos-24.11"; - nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; - nur.url = "github:nix-community/NUR"; - lanzaboote = { - url = "github:nix-community/lanzaboote/v0.4.2"; - inputs.nixpkgs.follows = "unstable"; - }; - - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "unstable"; - }; - - sops-nix.url = "github:Mic92/sops-nix"; - - Hyprspace = { - url = "github:KZDKM/Hyprspace"; - inputs.hyprland.follows = "hyprland"; - }; - - hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; - - ironbar = { - url = "github:JakeStanger/ironbar"; - inputs.nixpkgs.follows = "unstable"; - }; - - zen-browser.url = "github:youwen5/zen-browser-flake"; - - # TODO move to upstream repository after merged nix flake pr - fancontrol.url = "git+https://github.com/DashieTM/fancontrol-gui?ref=nix-flake"; - - stylix.url = "github:danth/stylix"; - base16.url = "github:SenchoPens/base16.nix"; - disko.url = "github:nix-community/disko/latest"; - - anyrun.url = "github:Kirottu/anyrun"; - oxicalc.url = "github:Xetibo/OxiCalc"; - oxishut.url = "github:Xetibo/OxiShut"; - oxinoti.url = "github:Xetibo/OxiNoti"; - oxidash.url = "github:Xetibo/OxiDash"; - oxipaste.url = "github:Xetibo/OxiPaste"; - oxirun.url = "github:Xetibo/OxiRun"; - hyprdock.url = "github:Xetibo/hyprdock"; - reset.url = "github:Xetibo/ReSet"; - reset-plugins.url = "github:Xetibo/ReSet-Plugins"; - - # absolute insanity - chaoticNyx.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; - - dashvim = { - url = "github:Xetibo/DashVim"; - }; - }; - - outputs = {self, ...} @ inputs: let - currentSystem = "x86_64-linux"; - permittedPackages = [ - "olm-3.2.16" - # well done dotnet... - # this is just for omnisharp - "dotnet-core-combined" - "dotnet-wrapped-combined" - "dotnet-combined" - "dotnet-sdk-6.0.428" - "dotnet-sdk-wrapped-6.0.428" - "dotnet-sdk-6.0.136" - "dotnet-sdk-wrapped-6.0.136" - "dotnet-sdk-7.0.120" - "dotnet-sdk-wrapped-7.0.120" - "dotnet-sdk-7.0.410" - "dotnet-sdk-wrapped-7.0.410" - "jitsi-meet-1.0.8043" - "nextcloud-27.1.11" - ]; - stable = import inputs.stable { - system = currentSystem; - config = { - allowUnfree = true; - permittedInsecurePackages = permittedPackages; - }; - overlays = [ - inputs.nur.overlays.default - inputs.chaoticNyx.overlays.default - ]; - }; - unstable = import inputs.unstable { - system = currentSystem; - config = { - allowUnsupportedSystem = true; - permittedInsecurePackages = permittedPackages; - # Often happens with neovim, this should not block everything. - allowBroken = true; - allowUnfree = true; - }; - overlays = [ - inputs.nur.overlays.default - inputs.chaoticNyx.overlays.default - ]; - }; - in rec { - dashNixLib = import ./lib { - inherit - self - inputs - unstable - stable - ; - system = currentSystem; - lib = inputs.unstable.lib; - }; - docs = import ./docs { - inherit inputs; - pkgs = unstable; - system = currentSystem; - lib = inputs.unstable.lib; - build_systems = dashNixLib.build_systems; - }; - dashNixInputs = inputs; - stablePkgs = stable; - unstablePkgs = unstable; - modules = ./modules; - iso = dashNixLib.buildIso.config.system.build.isoImage; - }; -} +{ + description = "DashNix"; + + inputs = { + unstable.url = "github:NixOs/nixpkgs/nixos-unstable"; + stable.url = "github:NixOs/nixpkgs/nixos-24.11"; + nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; + nur.url = "github:nix-community/NUR"; + lanzaboote = { + url = "github:nix-community/lanzaboote/v0.4.2"; + inputs.nixpkgs.follows = "unstable"; + }; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "unstable"; + }; + + sops-nix.url = "github:Mic92/sops-nix"; + + Hyprspace = { + url = "github:KZDKM/Hyprspace"; + inputs.hyprland.follows = "hyprland"; + }; + + hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; + + ironbar = { + url = "github:JakeStanger/ironbar"; + inputs.nixpkgs.follows = "unstable"; + }; + + zen-browser.url = "github:youwen5/zen-browser-flake"; + + # TODO move to upstream repository after merged nix flake pr + fancontrol.url = "git+https://github.com/DashieTM/fancontrol-gui?ref=nix-flake"; + + stylix.url = "github:danth/stylix"; + base16.url = "github:SenchoPens/base16.nix"; + disko.url = "github:nix-community/disko/latest"; + + anyrun.url = "github:Kirottu/anyrun"; + oxicalc.url = "github:Xetibo/OxiCalc"; + oxishut.url = "github:Xetibo/OxiShut"; + oxinoti.url = "github:Xetibo/OxiNoti"; + oxidash.url = "github:Xetibo/OxiDash"; + oxipaste.url = "github:Xetibo/OxiPaste"; + oxirun.url = "github:Xetibo/OxiRun"; + hyprdock.url = "github:Xetibo/hyprdock"; + reset.url = "github:Xetibo/ReSet"; + reset-plugins.url = "github:Xetibo/ReSet-Plugins"; + + # absolute insanity + chaoticNyx.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; + + dashvim = { + url = "github:Xetibo/DashVim"; + }; + }; + + outputs = {self, ...} @ inputs: let + currentSystem = "x86_64-linux"; + permittedPackages = [ + "olm-3.2.16" + # well done dotnet... + # this is just for omnisharp + "dotnet-core-combined" + "dotnet-wrapped-combined" + "dotnet-combined" + "dotnet-sdk-6.0.428" + "dotnet-sdk-wrapped-6.0.428" + "dotnet-sdk-6.0.136" + "dotnet-sdk-wrapped-6.0.136" + "dotnet-sdk-7.0.120" + "dotnet-sdk-wrapped-7.0.120" + "dotnet-sdk-7.0.410" + "dotnet-sdk-wrapped-7.0.410" + "jitsi-meet-1.0.8043" + "nextcloud-27.1.11" + ]; + stable = import inputs.stable { + system = currentSystem; + config = { + allowUnfree = true; + permittedInsecurePackages = permittedPackages; + }; + overlays = [ + inputs.nur.overlays.default + inputs.chaoticNyx.overlays.default + ]; + }; + unstable = import inputs.unstable { + system = currentSystem; + config = { + allowUnsupportedSystem = true; + permittedInsecurePackages = permittedPackages; + # Often happens with neovim, this should not block everything. + allowBroken = true; + allowUnfree = true; + }; + overlays = [ + inputs.nur.overlays.default + inputs.chaoticNyx.overlays.default + ]; + }; + in rec { + dashNixLib = import ./lib { + inherit + self + inputs + unstable + stable + ; + system = currentSystem; + lib = inputs.unstable.lib; + }; + docs = import ./docs { + inherit inputs; + pkgs = unstable; + system = currentSystem; + lib = inputs.unstable.lib; + build_systems = dashNixLib.build_systems; + }; + dashNixInputs = inputs; + stablePkgs = stable; + unstablePkgs = unstable; + modules = ./modules; + iso = dashNixLib.buildIso.config.system.build.isoImage; + }; +} diff --git a/home/common.nix b/home/common.nix index 1a3ccf3..11be1e2 100644 --- a/home/common.nix +++ b/home/common.nix @@ -1,41 +1,41 @@ -{ - mkDashDefault, - config, - lib, - ... -}: let - username = config.conf.username; -in { - manual = { - html.enable = mkDashDefault false; - json.enable = mkDashDefault false; - manpages.enable = mkDashDefault false; - }; - - fonts.fontconfig.enable = mkDashDefault true; - - home = { - username = mkDashDefault username; - homeDirectory = mkDashDefault "/home/${username}"; - sessionPath = ["$HOME/.cargo/bin"]; - - enableNixpkgsReleaseCheck = mkDashDefault false; - sessionVariables = { - GOROOT = mkDashDefault "$HOME/.go"; - QT_QPA_PLATFORMTHEME = mkDashDefault "qt5ct"; - }; - - keyboard = mkDashDefault null; - }; - - programs.nix-index = { - enable = mkDashDefault true; - enableFishIntegration = mkDashDefault true; - }; - - nix = { - extraOptions = lib.mkIf (config ? sops.secrets && config.sops.secrets ? access.path) '' - !include ${config.sops.secrets.access.path} - ''; - }; -} +{ + mkDashDefault, + config, + lib, + ... +}: let + username = config.conf.username; +in { + manual = { + html.enable = mkDashDefault false; + json.enable = mkDashDefault false; + manpages.enable = mkDashDefault false; + }; + + fonts.fontconfig.enable = mkDashDefault true; + + home = { + username = mkDashDefault username; + homeDirectory = mkDashDefault "/home/${username}"; + sessionPath = ["$HOME/.cargo/bin"]; + + enableNixpkgsReleaseCheck = mkDashDefault false; + sessionVariables = { + GOROOT = mkDashDefault "$HOME/.go"; + QT_QPA_PLATFORMTHEME = mkDashDefault "qt5ct"; + }; + + keyboard = mkDashDefault null; + }; + + programs.nix-index = { + enable = mkDashDefault true; + enableFishIntegration = mkDashDefault true; + }; + + nix = { + extraOptions = lib.mkIf (config ? sops.secrets && config.sops.secrets ? access.path) '' + !include ${config.sops.secrets.access.path} + ''; + }; +} diff --git a/home/default.nix b/home/default.nix index c459466..af3d656 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,49 +1,49 @@ -{ - mkDashDefault, - additionalHomeConfig, - additionalHomeMods, - additionalInputs, - config, - homeMods, - inputs, - lib, - mod, - pkgs, - root, - alternativePkgs, - system, - stable, - unstable, - ... -}: { - xdg = { - portal.config.common.default = mkDashDefault "*"; - portal = { - enable = mkDashDefault true; - extraPortals = [pkgs.xdg-desktop-portal-gtk]; - }; - }; - home-manager = { - useGlobalPkgs = mkDashDefault true; - useUserPackages = mkDashDefault true; - extraSpecialArgs = { - inherit inputs root additionalInputs alternativePkgs system stable unstable; - mkDashDefault = import ../lib/override.nix {inherit lib;}; - }; - - users.${config.conf.username} = { - disabledModules = ["programs/anyrun.nix"]; - imports = - [ - ./common.nix - ./themes - ./sync.nix - ../lib/foxwrappers.nix - ] - ++ homeMods - ++ additionalHomeMods - ++ lib.optional (builtins.pathExists mod) mod - ++ lib.optional (builtins.pathExists additionalHomeConfig) additionalHomeConfig; - }; - }; -} +{ + mkDashDefault, + additionalHomeConfig, + additionalHomeMods, + additionalInputs, + config, + homeMods, + inputs, + lib, + mod, + pkgs, + root, + alternativePkgs, + system, + stable, + unstable, + ... +}: { + xdg = { + portal.config.common.default = mkDashDefault "*"; + portal = { + enable = mkDashDefault true; + extraPortals = [pkgs.xdg-desktop-portal-gtk]; + }; + }; + home-manager = { + useGlobalPkgs = mkDashDefault true; + useUserPackages = mkDashDefault true; + extraSpecialArgs = { + inherit inputs root additionalInputs alternativePkgs system stable unstable; + mkDashDefault = import ../lib/override.nix {inherit lib;}; + }; + + users.${config.conf.username} = { + disabledModules = ["programs/anyrun.nix"]; + imports = + [ + ./common.nix + ./themes + ./sync.nix + ../lib/foxwrappers.nix + ] + ++ homeMods + ++ additionalHomeMods + ++ lib.optional (builtins.pathExists mod) mod + ++ lib.optional (builtins.pathExists additionalHomeConfig) additionalHomeConfig; + }; + }; +} diff --git a/lib/default.nix b/lib/default.nix index 3ee4fc8..2cdc15a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,144 +1,144 @@ -{ - inputs, - lib, - unstable, - self, - stable, - system, - ... -}: { - /* - * - # build_systems - - Builds system given a list of system names which are placed within your hosts/ directory. Note that each system has its own directory in hosts/ as well. - - A minimal configuration requires the file configuration.nix within each system directory, this will be the base config that is used across both NisOS and home-manager, specific optional files can also be added, hardware.nix for NisOS configuration and home.nix for home-manager configuration. - - The second parameter is the root of your configuration, which should be ./. in most cases. - - `root` - - : the root path of your configuration - - # Example usage - :::{.example} - ```nix - nixosConfigurations = build_systems { root = ./.; }; - ``` - ::: - */ - # let - # paths = builtins.readDir ; - # names = lib.lists.remove "default" ( - # map (name: lib.strings.removeSuffix ".nix" name) (lib.attrsets.mapAttrsToList (name: _: name) paths) - # ); - - # in - build_systems = { - root, - additionalMods ? { - nixos = []; - home = []; - }, - mods ? { - nixos = [ - inputs.lanzaboote.nixosModules.lanzaboote - inputs.nixos-wsl.nixosModules.default - inputs.home-manager.nixosModules.home-manager - inputs.stylix.nixosModules.stylix - inputs.disko.nixosModules.disko - ../base - ../home - ../modules - ]; - home = [ - inputs.anyrun.homeManagerModules.default - inputs.ironbar.homeManagerModules.default - inputs.oxicalc.homeManagerModules.default - inputs.oxishut.homeManagerModules.default - inputs.oxinoti.homeManagerModules.default - inputs.oxidash.homeManagerModules.default - inputs.oxipaste.homeManagerModules.default - inputs.oxirun.homeManagerModules.default - inputs.hyprdock.homeManagerModules.default - inputs.hyprland.homeManagerModules.default - inputs.reset.homeManagerModules.default - inputs.sops-nix.homeManagerModules.sops - inputs.dashvim.homeManagerModules.dashvim - inputs.fancontrol.homeManagerModules.default - ../modules - ]; - }, - additionalInputs ? {}, - overridePkgs ? false, - ... - }: - builtins.listToAttrs ( - map - (name: { - name = name; - value = let - mod = root + /hosts/${name}/configuration.nix; - additionalNixosConfig = root + /hosts/${name}/hardware.nix; - additionalHomeConfig = root + /hosts/${name}/home.nix; - args = { - inherit - self - inputs - mod - additionalHomeConfig - system - root - stable - unstable - ; - pkgs = lib.mkForce ( - if overridePkgs - then stable - else unstable - ); - alternativePkgs = - if overridePkgs - then unstable - else stable; - hostName = name; - homeMods = mods.home; - additionalHomeMods = additionalMods.home; - additionalInputs = additionalInputs; - mkDashDefault = import ./override.nix {inherit lib;}; - }; - in - inputs.unstable.lib.nixosSystem { - modules = - [ - {_module.args = args;} - mod - ] - ++ mods.nixos - ++ additionalMods.nixos - ++ inputs.unstable.lib.optional (builtins.pathExists additionalNixosConfig) additionalNixosConfig - ++ inputs.unstable.lib.optional (builtins.pathExists mod) mod; - }; - }) - ( - lib.lists.remove "" ( - lib.attrsets.mapAttrsToList (name: fType: - if fType == "directory" - then name - else "") ( - builtins.readDir (root + /hosts) - ) - ) - ) - ); - - buildIso = inputs.unstable.lib.nixosSystem { - specialArgs = { - inherit self inputs unstable; - }; - modules = [ - ../iso/configuration.nix - ]; - }; -} +{ + inputs, + lib, + unstable, + self, + stable, + system, + ... +}: { + /* + * + # build_systems + + Builds system given a list of system names which are placed within your hosts/ directory. Note that each system has its own directory in hosts/ as well. + + A minimal configuration requires the file configuration.nix within each system directory, this will be the base config that is used across both NisOS and home-manager, specific optional files can also be added, hardware.nix for NisOS configuration and home.nix for home-manager configuration. + + The second parameter is the root of your configuration, which should be ./. in most cases. + + `root` + + : the root path of your configuration + + # Example usage + :::{.example} + ```nix + nixosConfigurations = build_systems { root = ./.; }; + ``` + ::: + */ + # let + # paths = builtins.readDir ; + # names = lib.lists.remove "default" ( + # map (name: lib.strings.removeSuffix ".nix" name) (lib.attrsets.mapAttrsToList (name: _: name) paths) + # ); + + # in + build_systems = { + root, + additionalMods ? { + nixos = []; + home = []; + }, + mods ? { + nixos = [ + inputs.lanzaboote.nixosModules.lanzaboote + inputs.nixos-wsl.nixosModules.default + inputs.home-manager.nixosModules.home-manager + inputs.stylix.nixosModules.stylix + inputs.disko.nixosModules.disko + ../base + ../home + ../modules + ]; + home = [ + inputs.anyrun.homeManagerModules.default + inputs.ironbar.homeManagerModules.default + inputs.oxicalc.homeManagerModules.default + inputs.oxishut.homeManagerModules.default + inputs.oxinoti.homeManagerModules.default + inputs.oxidash.homeManagerModules.default + inputs.oxipaste.homeManagerModules.default + inputs.oxirun.homeManagerModules.default + inputs.hyprdock.homeManagerModules.default + inputs.hyprland.homeManagerModules.default + inputs.reset.homeManagerModules.default + inputs.sops-nix.homeManagerModules.sops + inputs.dashvim.homeManagerModules.dashvim + inputs.fancontrol.homeManagerModules.default + ../modules + ]; + }, + additionalInputs ? {}, + overridePkgs ? false, + ... + }: + builtins.listToAttrs ( + map + (name: { + name = name; + value = let + mod = root + /hosts/${name}/configuration.nix; + additionalNixosConfig = root + /hosts/${name}/hardware.nix; + additionalHomeConfig = root + /hosts/${name}/home.nix; + args = { + inherit + self + inputs + mod + additionalHomeConfig + system + root + stable + unstable + ; + pkgs = lib.mkForce ( + if overridePkgs + then stable + else unstable + ); + alternativePkgs = + if overridePkgs + then unstable + else stable; + hostName = name; + homeMods = mods.home; + additionalHomeMods = additionalMods.home; + additionalInputs = additionalInputs; + mkDashDefault = import ./override.nix {inherit lib;}; + }; + in + inputs.unstable.lib.nixosSystem { + modules = + [ + {_module.args = args;} + mod + ] + ++ mods.nixos + ++ additionalMods.nixos + ++ inputs.unstable.lib.optional (builtins.pathExists additionalNixosConfig) additionalNixosConfig + ++ inputs.unstable.lib.optional (builtins.pathExists mod) mod; + }; + }) + ( + lib.lists.remove "" ( + lib.attrsets.mapAttrsToList (name: fType: + if fType == "directory" + then name + else "") ( + builtins.readDir (root + /hosts) + ) + ) + ) + ); + + buildIso = inputs.unstable.lib.nixosSystem { + specialArgs = { + inherit self inputs unstable; + }; + modules = [ + ../iso/configuration.nix + ]; + }; +} diff --git a/modules/programs/basePackages.nix b/modules/programs/basePackages.nix index 3531f77..eb21428 100644 --- a/modules/programs/basePackages.nix +++ b/modules/programs/basePackages.nix @@ -1,128 +1,128 @@ -{ - mkDashDefault, - config, - lib, - options, - pkgs, - ... -}: { - options.mods = { - basePackages = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables default system packages. - ''; - }; - additionalPackages = lib.mkOption { - default = []; - example = [pkgs.openssl]; - type = with lib.types; listOf package; - description = '' - Additional packages to install. - Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install. - ''; - }; - specialPrograms = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - special program configuration to be added which require programs.something notation. - ''; - }; - specialServices = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - special services configuration to be added which require an services.something notation. - ''; - }; - }; - }; - - config = lib.optionalAttrs (options ? environment.systemPackages) { - environment.systemPackages = - if config.mods.basePackages.enable - then - with pkgs; - [ - adwaita-icon-theme - dbus - dconf - direnv - glib - gnome.nixos-gsettings-overrides - gsettings-desktop-schemas - gtk-layer-shell - gtk3 - gtk4 - gtk4-layer-shell - hicolor-icon-theme - icon-library - kdePackages.breeze-icons - kdePackages.breeze - libsForQt5.breeze-qt5 - kdePackages.qtstyleplugin-kvantum - libsForQt5.qtstyleplugin-kvantum - libadwaita - libxkbcommon - alejandra - openssl - seahorse - upower - xorg.xkbutils - sbctl - ] - ++ config.mods.basePackages.additionalPackages - else config.mods.basePackages.additionalPackages; - - gtk.iconCache.enable = false; - services = - if config.mods.basePackages.enable - then - { - preload.enable = mkDashDefault true; - upower.enable = mkDashDefault true; - dbus = { - enable = mkDashDefault true; - }; - avahi = { - enable = mkDashDefault true; - nssmdns4 = mkDashDefault true; - openFirewall = mkDashDefault true; - }; - } - // config.mods.basePackages.specialServices - else config.mods.basePackages.specialServices; - - programs = - if config.mods.basePackages.enable - then - { - nix-ld = { - enable = mkDashDefault true; - libraries = with pkgs; [ - jdk - zlib - ]; - }; - direnv = { - package = mkDashDefault pkgs.direnv; - silent = mkDashDefault false; - loadInNixShell = mkDashDefault true; - direnvrcExtra = mkDashDefault ""; - nix-direnv = { - enable = mkDashDefault true; - package = mkDashDefault pkgs.nix-direnv; - }; - }; - gnupg.agent.enable = mkDashDefault true; - } - // config.mods.basePackages.specialPrograms - else config.mods.basePackages.specialPrograms; - }; -} +{ + mkDashDefault, + config, + lib, + options, + pkgs, + ... +}: { + options.mods = { + basePackages = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables default system packages. + ''; + }; + additionalPackages = lib.mkOption { + default = []; + example = [pkgs.openssl]; + type = with lib.types; listOf package; + description = '' + Additional packages to install. + Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install. + ''; + }; + specialPrograms = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + special program configuration to be added which require programs.something notation. + ''; + }; + specialServices = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + special services configuration to be added which require an services.something notation. + ''; + }; + }; + }; + + config = lib.optionalAttrs (options ? environment.systemPackages) { + environment.systemPackages = + if config.mods.basePackages.enable + then + with pkgs; + [ + adwaita-icon-theme + dbus + dconf + direnv + glib + gnome.nixos-gsettings-overrides + gsettings-desktop-schemas + gtk-layer-shell + gtk3 + gtk4 + gtk4-layer-shell + hicolor-icon-theme + icon-library + kdePackages.breeze-icons + kdePackages.breeze + libsForQt5.breeze-qt5 + kdePackages.qtstyleplugin-kvantum + libsForQt5.qtstyleplugin-kvantum + libadwaita + libxkbcommon + alejandra + openssl + seahorse + upower + xorg.xkbutils + sbctl + ] + ++ config.mods.basePackages.additionalPackages + else config.mods.basePackages.additionalPackages; + + gtk.iconCache.enable = false; + services = + if config.mods.basePackages.enable + then + { + preload.enable = mkDashDefault true; + upower.enable = mkDashDefault true; + dbus = { + enable = mkDashDefault true; + }; + avahi = { + enable = mkDashDefault true; + nssmdns4 = mkDashDefault true; + openFirewall = mkDashDefault true; + }; + } + // config.mods.basePackages.specialServices + else config.mods.basePackages.specialServices; + + programs = + if config.mods.basePackages.enable + then + { + nix-ld = { + enable = mkDashDefault true; + libraries = with pkgs; [ + jdk + zlib + ]; + }; + direnv = { + package = mkDashDefault pkgs.direnv; + silent = mkDashDefault false; + loadInNixShell = mkDashDefault true; + direnvrcExtra = mkDashDefault ""; + nix-direnv = { + enable = mkDashDefault true; + package = mkDashDefault pkgs.nix-direnv; + }; + }; + gnupg.agent.enable = mkDashDefault true; + } + // config.mods.basePackages.specialPrograms + else config.mods.basePackages.specialPrograms; + }; +} diff --git a/modules/programs/coding.nix b/modules/programs/coding.nix index 46007ee..781d9dd 100644 --- a/modules/programs/coding.nix +++ b/modules/programs/coding.nix @@ -1,499 +1,567 @@ -{ - lib, - config, - pkgs, - options, - ... -}: { - options.mods = { - coding = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables coding packages. - ''; - }; - dashvim = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables dashvim package. - ''; - }; - jetbrains = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = '' - Enables jetbrains toolbox. - ''; - }; - vscodium = { - enable = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = '' - Enables vscodium. - ''; - }; - extensions = lib.mkOption { - default = []; - example = []; - type = with lib.types; listOf package; - description = "Extensions to be installed"; - }; - }; - penpot = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = "Enables penpot"; - }; - useDefaultPackages = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Use default base packages (only additionalPackages are installed if false)"; - }; - additionalPackages = lib.mkOption { - default = []; - example = []; - type = with lib.types; listOf package; - description = "Additional packages to be installed"; - }; - languages = { - haskell = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables haskell. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - haskellPackages.cabal-install - ghc - haskellPackages.haskell-language-server - ]; - example = []; - type = with lib.types; listOf package; - description = '' - haskell packages - ''; - }; - }; - typst = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables typst. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - typst - tinymist - ltex-ls - ]; - example = []; - type = with lib.types; listOf package; - description = '' - typst packages - ''; - }; - }; - go = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables go. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - go - gopls - ]; - example = []; - type = with lib.types; listOf package; - description = '' - Go packages - ''; - }; - }; - rust = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables rust. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [rustup]; - example = []; - type = with lib.types; listOf package; - description = '' - Rust packages - ''; - }; - }; - ts-js = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables TS/JS. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - nodejs_20 - deno - typescript - nodePackages.typescript-language-server - nodePackages.prettier - ]; - example = []; - type = with lib.types; listOf package; - description = '' - TS/JS packages - ''; - }; - }; - zig = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables zig. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - zig - zls - ]; - example = []; - type = with lib.types; listOf package; - description = '' - zig packages - ''; - }; - }; - java = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables java. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - gradle - maven - jdt-language-server - temurin-jre-bin - ]; - example = []; - type = with lib.types; listOf package; - description = '' - Java packages - ''; - }; - }; - dotnet = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables C#/F#. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - #.! - dotnet-sdk - omnisharp-roslyn - csharpier - netcoredbg - #fsharp - fsharp - fsautocomplete - ]; - example = []; - type = with lib.types; listOf package; - description = '' - C#/F# packages - ''; - }; - }; - C-CPP = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables C/C++. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - # broke - #bear - gdb - gcc - clang-tools - ]; - example = []; - type = with lib.types; listOf package; - description = '' - C/C++ packages - ''; - }; - }; - python = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables python. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - python3 - python312Packages.python-lsp-server - python312Packages.python-lsp-ruff - python312Packages.python-lsp-black - ]; - example = []; - type = with lib.types; listOf package; - description = '' - python packages - ''; - }; - }; - configFiles = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables Json/toml/yaml etc. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - #yaml - yamlfmt - yamllint - yaml-language-server - - #json - jq - ]; - example = []; - type = with lib.types; listOf package; - description = '' - packages for said filetypes - ''; - }; - }; - bash = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables bash. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - bash-language-server - shfmt - ]; - example = []; - type = with lib.types; listOf package; - description = '' - bash packages - ''; - }; - }; - html-css = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables html/css. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - tailwindcss - tailwindcss-language-server - # html-tidy - ]; - example = []; - type = with lib.types; listOf package; - description = '' - html/css packages - ''; - }; - }; - sql = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables sql. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [ - nodePackages.sql-formatter - sqls - ]; - example = []; - type = with lib.types; listOf package; - description = '' - sql packages - ''; - }; - }; - gleam = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables gleam. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [gleam]; - example = []; - type = with lib.types; listOf package; - description = '' - gleam packages - ''; - }; - }; - asm = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables assembly. - ''; - }; - packages = lib.mkOption { - default = with pkgs; [asm-lsp]; - example = []; - type = with lib.types; listOf package; - description = '' - assembly packages - ''; - }; - }; - }; - }; - }; - - config = let - basePackages = with pkgs; [ - gitui - meson - ninja - tree-sitter - unzip - pkg-config - sqlite - plantuml - d-spy - tmux - tmate - ]; - font_family = "${config.mods.stylix.fonts.monospace.name}"; - in - lib.mkIf config.mods.coding.enable ( - lib.optionalAttrs (options ? home.packages) { - programs.dashvim = lib.mkIf config.mods.coding.dashvim { - enable = true; - colorscheme = config.mods.stylix.colorscheme; - }; - programs.vscode = lib.mkIf config.mods.coding.vscodium.enable { - enable = true; - package = pkgs.vscodium; - profiles.default.extensions = config.mods.coding.vscodium.extensions; - }; - xdg.configFile."neovide/config.toml" = lib.mkIf config.mods.coding.dashvim { - source = (pkgs.formats.toml {}).generate "neovide" { - font = { - size = 12; - normal = { - family = font_family; - style = ""; - }; - bold = { - family = font_family; - style = "ExtraBold"; - }; - italic = { - family = font_family; - style = "Italic"; - }; - bold_italic = { - family = font_family; - style = "Bold Italic"; - }; - }; - }; - }; - home.packages = with pkgs; - [ - (lib.mkIf config.mods.coding.dashvim neovide) - (lib.mkIf config.mods.coding.jetbrains jetbrains-toolbox) - (lib.mkIf config.mods.coding.penpot pkgs.penpot-desktop) - ] - ++ config.mods.coding.additionalPackages - ++ (lib.lists.optionals config.mods.coding.useDefaultPackages basePackages) - ++ (lib.lists.optionals config.mods.coding.languages.haskell.enable config.mods.coding.languages.haskell.packages) - ++ (lib.lists.optionals config.mods.coding.languages.rust.enable config.mods.coding.languages.rust.packages) - ++ (lib.lists.optionals config.mods.coding.languages.go.enable config.mods.coding.languages.go.packages) - ++ (lib.lists.optionals config.mods.coding.languages.java.enable config.mods.coding.languages.java.packages) - ++ (lib.lists.optionals config.mods.coding.languages.dotnet.enable config.mods.coding.languages.dotnet.packages) - ++ (lib.lists.optionals config.mods.coding.languages.bash.enable config.mods.coding.languages.bash.packages) - ++ (lib.lists.optionals config.mods.coding.languages.C-CPP.enable config.mods.coding.languages.C-CPP.packages) - ++ (lib.lists.optionals config.mods.coding.languages.asm.enable config.mods.coding.languages.asm.packages) - ++ (lib.lists.optionals config.mods.coding.languages.sql.enable config.mods.coding.languages.sql.packages) - ++ (lib.lists.optionals config.mods.coding.languages.html-css.enable config.mods.coding.languages.html-css.packages) - ++ (lib.lists.optionals config.mods.coding.languages.configFiles.enable config.mods.coding.languages.configFiles.packages) - ++ (lib.lists.optionals config.mods.coding.languages.ts-js.enable config.mods.coding.languages.ts-js.packages) - ++ (lib.lists.optionals config.mods.coding.languages.typst.enable config.mods.coding.languages.typst.packages) - ++ (lib.lists.optionals config.mods.coding.languages.zig.enable config.mods.coding.languages.zig.packages) - ++ (lib.lists.optionals config.mods.coding.languages.gleam.enable config.mods.coding.languages.gleam.packages); - } - ); -} +{ + lib, + config, + pkgs, + options, + ... +}: let + font_family = "${config.mods.stylix.fonts.monospace.name}"; +in { + options.mods = { + coding = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables coding packages. + ''; + }; + dashvim = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables dashvim package. + ''; + }; + jetbrains = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables jetbrains toolbox. + ''; + }; + vscodium = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables vscodium. + ''; + }; + extensions = lib.mkOption { + default = []; + example = []; + type = with lib.types; listOf package; + description = "Extensions to be installed"; + }; + }; + penpot = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables penpot"; + }; + neovide = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables neovide"; + }; + config = lib.mkOption { + default = { + font = { + size = 12; + normal = { + family = font_family; + style = ""; + }; + bold = { + family = font_family; + style = "ExtraBold"; + }; + italic = { + family = font_family; + style = "Italic"; + }; + bold_italic = { + family = font_family; + style = "Bold Italic"; + }; + }; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "Config for neovide"; + }; + }; + gh = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables and configures gh"; + }; + config = lib.mkOption { + default = { + version = 1; + git_protocol = "ssh"; + editor = ""; + prompt = "enabled"; + prefer_editor_prompt = "disabled"; + pager = ""; + aliases = { + co = "pr checkout"; + }; + http_unix_socket = ""; + browser = ""; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "config for gh. Keep in mind, empty values refer to using environment variables"; + }; + hosts = lib.mkOption { + default = { + "github.com" = { + git_protocol = "ssh"; + users = { + ${config.mods.git.username} = ""; + }; + user = "${config.mods.git.username}"; + }; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "hosts for gh"; + }; + }; + useDefaultPackages = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Use default base packages (only additionalPackages are installed if false)"; + }; + additionalPackages = lib.mkOption { + default = []; + example = []; + type = with lib.types; listOf package; + description = "Additional packages to be installed"; + }; + languages = { + haskell = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables haskell. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + haskellPackages.cabal-install + ghc + haskellPackages.haskell-language-server + ]; + example = []; + type = with lib.types; listOf package; + description = '' + haskell packages + ''; + }; + }; + typst = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables typst. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + typst + tinymist + ltex-ls + ]; + example = []; + type = with lib.types; listOf package; + description = '' + typst packages + ''; + }; + }; + go = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables go. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + go + gopls + ]; + example = []; + type = with lib.types; listOf package; + description = '' + Go packages + ''; + }; + }; + rust = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables rust. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [rustup]; + example = []; + type = with lib.types; listOf package; + description = '' + Rust packages + ''; + }; + }; + ts-js = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables TS/JS. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + nodejs_20 + deno + typescript + nodePackages.typescript-language-server + nodePackages.prettier + ]; + example = []; + type = with lib.types; listOf package; + description = '' + TS/JS packages + ''; + }; + }; + zig = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables zig. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + zig + zls + ]; + example = []; + type = with lib.types; listOf package; + description = '' + zig packages + ''; + }; + }; + java = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables java. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + gradle + maven + jdt-language-server + temurin-jre-bin + ]; + example = []; + type = with lib.types; listOf package; + description = '' + Java packages + ''; + }; + }; + dotnet = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables C#/F#. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + #.! + dotnet-sdk + omnisharp-roslyn + csharpier + netcoredbg + fsharp + fsautocomplete + ]; + example = []; + type = with lib.types; listOf package; + description = '' + C#/F# packages + ''; + }; + }; + C-CPP = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables C/C++. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + bear + gdb + gcc + clang-tools + ]; + example = []; + type = with lib.types; listOf package; + description = '' + C/C++ packages + ''; + }; + }; + python = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables python. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + python3 + python312Packages.python-lsp-server + python312Packages.python-lsp-ruff + python312Packages.python-lsp-black + ]; + example = []; + type = with lib.types; listOf package; + description = '' + python packages + ''; + }; + }; + configFiles = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables Json/toml/yaml etc. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + #yaml + yamlfmt + yamllint + yaml-language-server + + #json + jq + ]; + example = []; + type = with lib.types; listOf package; + description = '' + packages for said filetypes + ''; + }; + }; + bash = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables bash. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + bash-language-server + shfmt + ]; + example = []; + type = with lib.types; listOf package; + description = '' + bash packages + ''; + }; + }; + html-css = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables html/css. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + tailwindcss + tailwindcss-language-server + # html-tidy + ]; + example = []; + type = with lib.types; listOf package; + description = '' + html/css packages + ''; + }; + }; + sql = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables sql. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + nodePackages.sql-formatter + sqls + ]; + example = []; + type = with lib.types; listOf package; + description = '' + sql packages + ''; + }; + }; + gleam = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables gleam. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [gleam]; + example = []; + type = with lib.types; listOf package; + description = '' + gleam packages + ''; + }; + }; + asm = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables assembly. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [asm-lsp]; + example = []; + type = with lib.types; listOf package; + description = '' + assembly packages + ''; + }; + }; + }; + }; + }; + + config = let + basePackages = with pkgs; [ + gitui + meson + ninja + tree-sitter + unzip + pkg-config + sqlite + plantuml + d-spy + tmux + tmate + ]; + in + lib.mkIf config.mods.coding.enable ( + lib.optionalAttrs (options ? home.packages) { + programs.dashvim = lib.mkIf config.mods.coding.dashvim { + enable = true; + colorscheme = config.mods.stylix.colorscheme; + }; + programs.vscode = lib.mkIf config.mods.coding.vscodium.enable { + enable = true; + package = pkgs.vscodium; + profiles.default.extensions = config.mods.coding.vscodium.extensions; + }; + xdg.configFile."neovide/config.toml" = lib.mkIf (config.mods.coding.dashvim || config.mods.coding.neovide.enable) { + source = + (pkgs.formats.toml {}).generate "neovide" + config.mods.coding.neovide.config; + }; + + xdg.configFile."gh/config.yml" = lib.mkIf config.mods.coding.gh.enable { + source = + (pkgs.formats.yaml {}).generate "config" + config.mods.coding.gh.config; + }; + xdg.configFile."gh/hosts.yml" = lib.mkIf config.mods.coding.gh.enable { + source = + (pkgs.formats.yaml {}).generate "hosts" + config.mods.coding.gh.hosts; + }; + + home.packages = with pkgs; + [ + (lib.mkIf (config.mods.coding.dashvim || config.mods.coding.neovide.enable) neovide) + (lib.mkIf config.mods.coding.jetbrains jetbrains-toolbox) + (lib.mkIf config.mods.coding.penpot pkgs.penpot-desktop) + (lib.mkIf config.mods.coding.gh.enable gh) + ] + ++ config.mods.coding.additionalPackages + ++ (lib.lists.optionals config.mods.coding.useDefaultPackages basePackages) + ++ (lib.lists.optionals config.mods.coding.languages.haskell.enable config.mods.coding.languages.haskell.packages) + ++ (lib.lists.optionals config.mods.coding.languages.rust.enable config.mods.coding.languages.rust.packages) + ++ (lib.lists.optionals config.mods.coding.languages.go.enable config.mods.coding.languages.go.packages) + ++ (lib.lists.optionals config.mods.coding.languages.java.enable config.mods.coding.languages.java.packages) + ++ (lib.lists.optionals config.mods.coding.languages.dotnet.enable config.mods.coding.languages.dotnet.packages) + ++ (lib.lists.optionals config.mods.coding.languages.bash.enable config.mods.coding.languages.bash.packages) + ++ (lib.lists.optionals config.mods.coding.languages.C-CPP.enable config.mods.coding.languages.C-CPP.packages) + ++ (lib.lists.optionals config.mods.coding.languages.asm.enable config.mods.coding.languages.asm.packages) + ++ (lib.lists.optionals config.mods.coding.languages.sql.enable config.mods.coding.languages.sql.packages) + ++ (lib.lists.optionals config.mods.coding.languages.html-css.enable config.mods.coding.languages.html-css.packages) + ++ (lib.lists.optionals config.mods.coding.languages.configFiles.enable config.mods.coding.languages.configFiles.packages) + ++ (lib.lists.optionals config.mods.coding.languages.ts-js.enable config.mods.coding.languages.ts-js.packages) + ++ (lib.lists.optionals config.mods.coding.languages.typst.enable config.mods.coding.languages.typst.packages) + ++ (lib.lists.optionals config.mods.coding.languages.zig.enable config.mods.coding.languages.zig.packages) + ++ (lib.lists.optionals config.mods.coding.languages.gleam.enable config.mods.coding.languages.gleam.packages); + } + ); +} diff --git a/modules/programs/default.nix b/modules/programs/default.nix index 17be977..b1d5103 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -1,49 +1,49 @@ -{ - imports = [ - ./acpid.nix - ./basePackages.nix - ./bluetooth.nix - ./browser - ./coding.nix - ./containers.nix - ./drives.nix - ./fancontrol.nix - ./fastfetch.nix - ./fish.nix - ./flatpak.nix - ./gaming.nix - ./gdm.nix - ./git.nix - ./gnome.nix - ./gnomeServices.nix - ./gpu.nix - ./greetd.nix - ./homePackages.nix - ./hyprland - ./kde.nix - ./kdeConnect.nix - ./keepassxc.nix - ./kitty.nix - ./media.nix - ./mime.nix - ./ncspot.nix - ./nextcloud.nix - ./oxi - ./piper.nix - ./plymouth.nix - ./printing.nix - ./scripts.nix - ./sddm.nix - ./sops.nix - ./starship.nix - ./streamcontroller.nix - ./stylix.nix - ./supersonic.nix - ./sway.nix - ./teams.nix - ./virtmanager.nix - ./xkb.nix - ./xone.nix - ./yazi - ]; -} +{ + imports = [ + ./acpid.nix + ./basePackages.nix + ./bluetooth.nix + ./browser + ./coding.nix + ./containers.nix + ./drives.nix + ./fancontrol.nix + ./fastfetch.nix + ./fish.nix + ./flatpak.nix + ./gaming.nix + ./gdm.nix + ./git.nix + ./gnome.nix + ./gnomeServices.nix + ./gpu.nix + ./greetd.nix + ./homePackages.nix + ./hyprland + ./kde.nix + ./kdeConnect.nix + ./keepassxc.nix + ./kitty.nix + ./media.nix + ./mime.nix + ./ncspot.nix + ./nextcloud.nix + ./oxi + ./piper.nix + ./plymouth.nix + ./printing.nix + ./scripts.nix + ./sddm.nix + ./sops.nix + ./starship.nix + ./streamcontroller.nix + ./stylix.nix + ./supersonic.nix + ./sway.nix + ./teams.nix + ./virtmanager.nix + ./xkb.nix + ./xone.nix + ./yazi + ]; +} diff --git a/modules/programs/fancontrol.nix b/modules/programs/fancontrol.nix index 87be9af..f7a2e3a 100644 --- a/modules/programs/fancontrol.nix +++ b/modules/programs/fancontrol.nix @@ -1,36 +1,36 @@ -{ - lib, - config, - options, - ... -}: { - options.mods.fancontrol = { - enable = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = "Enables fancontrol-gui with needed drivers"; - }; - forceId = lib.mkOption { - default = null; - example = "force_id=0x8628"; - type = with lib.types; nullOr str; - description = "Modprobe options for the it87 driver. Information at: https://wiki.archlinux.org/title/Lm_sensors#Gigabyte_B250/Z370/B450M/B560M/B660M/Z690/B550_motherboards"; - }; - }; - config = lib.mkIf config.mods.fancontrol.enable ( - lib.optionalAttrs (options ? home.packages) { - programs.fancontrol-gui.enable = true; - } - // (lib.optionalAttrs (options ? boot.kernelModules) { - boot = { - kernelParams = ["acpi_enforce_resources=lax"]; - extraModulePackages = with config.boot.kernelPackages; [liquidtux it87]; - kernelModules = ["v4l2loopback" "it87"]; - extraModprobeConfig = lib.mkIf (config.mods.fancontrol.forceId != null) '' - options it87 ${config.mods.fancontrol.forceId} - ''; - }; - }) - ); -} +{ + lib, + config, + options, + ... +}: { + options.mods.fancontrol = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables fancontrol-gui with needed drivers"; + }; + forceId = lib.mkOption { + default = null; + example = "force_id=0x8628"; + type = with lib.types; nullOr str; + description = "Modprobe options for the it87 driver. Information at: https://wiki.archlinux.org/title/Lm_sensors#Gigabyte_B250/Z370/B450M/B560M/B660M/Z690/B550_motherboards"; + }; + }; + config = lib.mkIf config.mods.fancontrol.enable ( + lib.optionalAttrs (options ? home.packages) { + programs.fancontrol-gui.enable = true; + } + // (lib.optionalAttrs (options ? boot.kernelModules) { + boot = { + kernelParams = ["acpi_enforce_resources=lax"]; + extraModulePackages = with config.boot.kernelPackages; [liquidtux it87]; + kernelModules = ["v4l2loopback" "it87"]; + extraModprobeConfig = lib.mkIf (config.mods.fancontrol.forceId != null) '' + options it87 ${config.mods.fancontrol.forceId} + ''; + }; + }) + ); +} diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index fc89e95..2f18036 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -52,6 +52,7 @@ in { alias rebuild='nh os switch -- --accept-flake-config' alias update='nix flake update --flake $FLAKE --accept-flake-config' + alias gcli='gh' abbr --add ls 'lsd' abbr --add :q 'exit' abbr --add gh 'git push origin' diff --git a/modules/programs/git.nix b/modules/programs/git.nix index dec2aa5..9189329 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -6,13 +6,13 @@ }: { options.mods.git = { username = lib.mkOption { - default = "DashieTM"; + default = ""; example = "globi"; type = lib.types.str; description = "Git user name"; }; email = lib.mkOption { - default = "fabio.lenherr@gmail.com"; + default = ""; example = "globi@globus.glob"; type = lib.types.str; description = "Git email"; diff --git a/modules/programs/hyprland/hyprland.nix b/modules/programs/hyprland/hyprland.nix index c6ce857..049041d 100644 --- a/modules/programs/hyprland/hyprland.nix +++ b/modules/programs/hyprland/hyprland.nix @@ -1,402 +1,402 @@ -{ - mkDashDefault, - config, - lib, - options, - pkgs, - inputs, - ... -}: let - browserName = - if (builtins.isString config.mods.homePackages.browser) - then config.mods.homePackages.browser - else if config.mods.homePackages.browser ? meta && config.mods.homePackages.browser.meta ? mainProgram - then config.mods.homePackages.browser.meta.mainProgram - else config.mods.homePackages.browser.pname; -in { - options.mods.hyprland = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enable Hyprland - ''; - }; - monitor = lib.mkOption { - default = [ - # main monitor - "${config.conf.defaultMonitor},${config.conf.defaultMonitorMode},0x0,${config.conf.defaultMonitorScale}" - # all others - ]; - example = ["DP-1,3440x1440@180,2560x0,1,vrr,0"]; - type = with lib.types; listOf str; - description = '' - The monitor configuration for hyprland. - ''; - }; - workspace = lib.mkOption { - default = []; - example = ["2,monitor:DP-1, default:true"]; - type = with lib.types; listOf str; - description = '' - The workspace configuration for hyprland. - ''; - }; - noAtomic = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = '' - Use tearing - ''; - }; - extraAutostart = lib.mkOption { - default = []; - example = ["your application"]; - type = lib.types.listOf lib.types.str; - description = '' - Extra exec_once. - ''; - }; - useDefaultConfig = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Use preconfigured Hyprland config. - ''; - }; - customConfig = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - Custom Hyprland configuration. - Will be merged with default configuration if enabled. - ''; - }; - plugins = lib.mkOption { - default = []; - example = []; - type = with lib.types; listOf package; - description = '' - Plugins to be added to Hyprland. - ''; - }; - pluginConfig = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - Plugin configuration to be added to Hyprland. - ''; - }; - hyprspaceEnable = lib.mkOption { - default = false; - type = lib.types.bool; - example = true; - description = '' - Enables Hyprspace plugin for hyprland. - Please note, plugins tend to break VERY often. - ''; - }; - }; - - config = lib.mkIf config.mods.hyprland.enable ( - lib.optionalAttrs (options ? wayland.windowManager.hyprland) { - # install Hyprland related packages - home.packages = with pkgs; [ - xorg.xprop - grim - slurp - satty - xdg-desktop-portal-gtk - # xdg-desktop-portal-hyprland - copyq - wl-clipboard - hyprcursor - hyprpicker - ]; - - wayland.windowManager.hyprland = { - enable = true; - settings = - if config.mods.hyprland.useDefaultConfig - then - lib.mkMerge - [ - { - "$mod" = "SUPER"; - - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizeactive" - ]; - - bind = [ - # screenshots - ''$mod SUPER,S,exec,grim -g "$(slurp)" - | wl-copy'' - ''$mod SUPERSHIFT,S,exec,grim -g "$(slurp)" - | satty -f -'' - ''$mod SUPERSHIFTALT,S,exec,grim -c -g "2560,0 3440x1440" - | wl-copy'' - - # regular programs - "$mod SUPER,F,exec,${browserName}" - (lib.mkIf ( - browserName == "firefox" || browserName == "zen" - ) "$mod SUPERSHIFT,F,exec,${browserName} -p special") - "$mod SUPER,T,exec,kitty -1" - "$mod SUPER,E,exec,nautilus -w" - "$mod SUPER,N,exec,neovide" - (lib.mkIf (config.mods.hyprland.anyrun.enable) "$mod SUPER,R,exec,anyrun") - (lib.mkIf (config.mods.oxi.oxirun.enable) "$mod SUPER,R,exec,oxirun") - (lib.mkIf (config.mods.oxi.oxidash.enable) "$mod SUPER,M,exec,oxidash") - (lib.mkIf (config.mods.oxi.oxicalc.enable) "$mod SUPER,G,exec,oxicalc") - (lib.mkIf (config.mods.oxi.oxishut.enable) "$mod SUPER,D,exec,oxishut") - (lib.mkIf (config.mods.oxi.oxipaste.enable) "$mod SUPER,A,exec,oxipaste-iced") - (lib.mkIf (config.mods.oxi.hyprdock.enable) "$mod SUPERSHIFT,P,exec,hyprdock --gui") - "$mod SUPERSHIFT,L,exec, playerctl -a pause & hyprlock & systemctl suspend" - "$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate" - - # media keys - (lib.mkIf config.mods.scripts.audioControl ",XF86AudioMute,exec, audioControl mute") - (lib.mkIf config.mods.scripts.audioControl ",XF86AudioLowerVolume,exec, audioControl sink -5%") - (lib.mkIf config.mods.scripts.audioControl ",XF86AudioRaiseVolume,exec, audioControl sink +5%") - ",XF86AudioPlay,exec, playerctl play-pause" - ",XF86AudioNext,exec, playerctl next" - ",XF86AudioPrev,exec, playerctl previous" - (lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessDown,exec, changeBrightness brightness 10%-") - (lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessUp,exec, changeBrightness brightness +10%") - - # hyprland keybinds - # misc - "$mod SUPER,V,togglefloating," - "$mod SUPER,B,fullscreen," - "$mod SUPER,C,togglesplit" - "$mod SUPER,Q,killactive," - "$mod SUPERSHIFTALT,M,exit," - "$mod SUPERSHIFT,W,togglespecialworkspace" - - # move - "$mod SUPER,left,movewindow,l" - "$mod SUPER,right,movewindow,r" - "$mod SUPER,up,movewindow,u" - "$mod SUPER,down,movewindow,d" - - # workspaces - "$mod SUPER,1,workspace,1" - "$mod SUPER,2,workspace,2" - "$mod SUPER,3,workspace,3" - "$mod SUPER,4,workspace,4" - "$mod SUPER,5,workspace,5" - "$mod SUPER,6,workspace,6" - "$mod SUPER,7,workspace,7" - "$mod SUPER,8,workspace,8" - "$mod SUPER,9,workspace,9" - "$mod SUPER,0,workspace,10" - - # move to workspace - "$mod SUPERSHIFT,1,movetoworkspace,1" - "$mod SUPERSHIFT,2,movetoworkspace,2" - "$mod SUPERSHIFT,3,movetoworkspace,3" - "$mod SUPERSHIFT,4,movetoworkspace,4" - "$mod SUPERSHIFT,5,movetoworkspace,5" - "$mod SUPERSHIFT,6,movetoworkspace,6" - "$mod SUPERSHIFT,7,movetoworkspace,7" - "$mod SUPERSHIFT,8,movetoworkspace,8" - "$mod SUPERSHIFT,9,movetoworkspace,9" - "$mod SUPERSHIFT,0,movetoworkspace,10" - - # move to workspace silent - "$mod SUPERSHIFTALT,1,movetoworkspacesilent,1" - "$mod SUPERSHIFTALT,2,movetoworkspacesilent,2" - "$mod SUPERSHIFTALT,3,movetoworkspacesilent,3" - "$mod SUPERSHIFTALT,4,movetoworkspacesilent,4" - "$mod SUPERSHIFTALT,5,movetoworkspacesilent,5" - "$mod SUPERSHIFTALT,6,movetoworkspacesilent,6" - "$mod SUPERSHIFTALT,7,movetoworkspacesilent,7" - "$mod SUPERSHIFTALT,8,movetoworkspacesilent,8" - "$mod SUPERSHIFTALT,9,movetoworkspacesilent,9" - "$mod SUPERSHIFTALT,0,movetoworkspacesilent,10" - - # preselection - "$mod SUPERALT,j,layoutmsg,preselect l" - "$mod SUPERALT,k,layoutmsg,preselect d" - "$mod SUPERALT,l,layoutmsg,preselect u" - "$mod SUPERALT,semicolon,layoutmsg,preselect r" - "$mod SUPERALT,h,layoutmsg,preselect n" - ]; - - binde = [ - # hyprland keybinds - # focus - "$mod SUPER,J,movefocus,l" - "$mod SUPER,semicolon,movefocus,r" - "$mod SUPER,L,movefocus,u" - "$mod SUPER,K,movefocus,d" - - # resize - "$mod SUPER,U,resizeactive,-20 0" - "$mod SUPER,P,resizeactive,20 0" - "$mod SUPER,O,resizeactive,0 -20" - "$mod SUPER,I,resizeactive,0 20" - ]; - - general = { - gaps_out = "3,5,5,5"; - border_size = 3; - "col.active_border" = lib.mkOverride 51 "0xFFFF0000 0xFF00FF00 0xFF0000FF 45deg"; - # "col.inactive_border" = "0x66333333"; - allow_tearing = lib.mkIf config.mods.hyprland.noAtomic true; - }; - - decoration = { - rounding = 4; - }; - - animations = { - bezier = "penguin,0.05,0.9,0.1,1.0"; - animation = [ - "windowsMove,1,4,default" - "windows,1,7,default,popin 70%" - "windowsOut,1,7,default,popin 70%" - "border,1,10,default" - "fade,1,7,default" - "workspaces,1,6,default" - "layers,1,3,default,popin" - ]; - }; - - dwindle = { - preserve_split = true; - pseudotile = 0; - permanent_direction_override = false; - }; - - input = { - kb_layout = "${config.mods.xkb.layout}"; - kb_variant = "${config.mods.xkb.variant}"; - repeat_delay = 200; - force_no_accel = true; - touchpad = { - natural_scroll = true; - tap-to-click = true; - tap-and-drag = true; - }; - }; - - misc = { - animate_manual_resizes = 1; - enable_swallow = true; - disable_splash_rendering = true; - disable_hyprland_logo = true; - swallow_regex = "^(.*)(kitty)(.*)$"; - initial_workspace_tracking = 1; - # just doesn't work - enable_anr_dialog = false; - }; - - cursor = { - enable_hyprcursor = true; - no_hardware_cursors = mkDashDefault config.mods.gpu.nvidia.enable; - # done with nix, this would break the current setup otherwise - sync_gsettings_theme = false; - }; - - gestures = { - workspace_swipe = true; - }; - - monitor = config.mods.hyprland.monitor; - workspace = config.mods.hyprland.workspace; - - env = [ - "GTK_CSD,0" - ''TERM,"kitty /bin/fish"'' - "XDG_CURRENT_DESKTOP=Hyprland" - "XDG_SESSION_TYPE=wayland" - "XDG_SESSION_DESKTOP=Hyprland" - "HYPRCURSOR_THEME,${config.mods.stylix.cursor.name}" - "HYPRCURSOR_SIZE,${toString config.mods.stylix.cursor.size}" - "XCURSOR_THEME,${config.mods.stylix.cursor.name}" - "XCURSOR_SIZE,${toString config.mods.stylix.cursor.size}" - "QT_QPA_PLATFORM,wayland" - "QT_QPA_PLATFORMTHEME,qt5ct" - "QT_WAYLAND_FORCE_DPI,96" - "QT_AUTO_SCREEN_SCALE_FACTOR,0" - "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" - "QT_SCALE_FACTOR,1" - ''EDITOR,"neovide --novsync --nofork"'' - (lib.mkIf config.mods.hyprland.noAtomic "WLR_DRM_NO_ATOMIC,1") - "GTK_USE_PORTAL, 1" - - (lib.mkIf config.mods.gpu.nvidia.enable "LIBVA_DRIVER_NAME,nvidia") - (lib.mkIf config.mods.gpu.nvidia.enable "XDG_SESSION_TYPE,wayland") - (lib.mkIf config.mods.gpu.nvidia.enable "GBM_BACKEND,nvidia-drm") - (lib.mkIf config.mods.gpu.nvidia.enable "__GLX_VENDOR_LIBRARY_NAME,nvidia") - ]; - - layerrule = [ - # layer rules - # mainly to disable animations within slurp and grim - "noanim, selection" - ]; - - windowrule = [ - # window rules - "float,class:^(.*)(OxiCalc)(.*)$" - "float,class:^(.*)(winecfg.exe)(.*)$" - "float,class:^(.*)(copyq)(.*)$" - "center,class:^(.*)(swappy)(.*)$" - "float,title:^(.*)(reset)(.*)$" - "workspace 10 silent,class:^(.*)(steam)(.*)$" - "workspace 9 silent,class:^(.*)(dota)(.*)$" - "workspace 9 silent,class:^(.*)(battlebits)(.*)$" - "workspace 9 silent,class:^(.*)(aoe)(.*)$" - "suppressevent fullscreen maximize,class:^(.*)(neovide)(.*)$" - "immediate,class:^(.*)(Pal)$" - "immediate,class:^(.*)(dota2)$" - "immediate,class:^(.*)(needforspeedheat.exe)$" - ]; - - exec-once = - [ - # environment - "systemctl --user import-environment" - "dbus-update-activation-environment --systemd --all" - "hyprctl setcursor Bibata-Modern-Classic 24" - - # other programs - "hyprpaper" - "ironbar" - "${browserName}" - "oxipaste_daemon" - "oxinoti" - ] - ++ config.mods.hyprland.extraAutostart; - - plugin = - lib.mkMerge - [ - { - hyprspace = lib.mkIf config.mods.hyprland.hyprspaceEnable { - bind = [ - "SUPER, W, overview:toggle, toggle" - ]; - }; - } - config.mods.hyprland.pluginConfig - ]; - } - config.mods.hyprland.customConfig - ] - else lib.mkForce config.mods.hyprland.customConfig; - plugins = - [ - (lib.mkIf config.mods.hyprland.hyprspaceEnable inputs.Hyprspace.packages.${pkgs.system}.Hyprspace) - ] - ++ config.mods.hyprland.plugins; - }; - } - ); -} +{ + mkDashDefault, + config, + lib, + options, + pkgs, + inputs, + ... +}: let + browserName = + if (builtins.isString config.mods.homePackages.browser) + then config.mods.homePackages.browser + else if config.mods.homePackages.browser ? meta && config.mods.homePackages.browser.meta ? mainProgram + then config.mods.homePackages.browser.meta.mainProgram + else config.mods.homePackages.browser.pname; +in { + options.mods.hyprland = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enable Hyprland + ''; + }; + monitor = lib.mkOption { + default = [ + # main monitor + "${config.conf.defaultMonitor},${config.conf.defaultMonitorMode},0x0,${config.conf.defaultMonitorScale}" + # all others + ]; + example = ["DP-1,3440x1440@180,2560x0,1,vrr,0"]; + type = with lib.types; listOf str; + description = '' + The monitor configuration for hyprland. + ''; + }; + workspace = lib.mkOption { + default = []; + example = ["2,monitor:DP-1, default:true"]; + type = with lib.types; listOf str; + description = '' + The workspace configuration for hyprland. + ''; + }; + noAtomic = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Use tearing + ''; + }; + extraAutostart = lib.mkOption { + default = []; + example = ["your application"]; + type = lib.types.listOf lib.types.str; + description = '' + Extra exec_once. + ''; + }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use preconfigured Hyprland config. + ''; + }; + customConfig = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Custom Hyprland configuration. + Will be merged with default configuration if enabled. + ''; + }; + plugins = lib.mkOption { + default = []; + example = []; + type = with lib.types; listOf package; + description = '' + Plugins to be added to Hyprland. + ''; + }; + pluginConfig = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Plugin configuration to be added to Hyprland. + ''; + }; + hyprspaceEnable = lib.mkOption { + default = false; + type = lib.types.bool; + example = true; + description = '' + Enables Hyprspace plugin for hyprland. + Please note, plugins tend to break VERY often. + ''; + }; + }; + + config = lib.mkIf config.mods.hyprland.enable ( + lib.optionalAttrs (options ? wayland.windowManager.hyprland) { + # install Hyprland related packages + home.packages = with pkgs; [ + xorg.xprop + grim + slurp + satty + xdg-desktop-portal-gtk + # xdg-desktop-portal-hyprland + copyq + wl-clipboard + hyprcursor + hyprpicker + ]; + + wayland.windowManager.hyprland = { + enable = true; + settings = + if config.mods.hyprland.useDefaultConfig + then + lib.mkMerge + [ + { + "$mod" = "SUPER"; + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizeactive" + ]; + + bind = [ + # screenshots + ''$mod SUPER,S,exec,grim -g "$(slurp)" - | wl-copy'' + ''$mod SUPERSHIFT,S,exec,grim -g "$(slurp)" - | satty -f -'' + ''$mod SUPERSHIFTALT,S,exec,grim -c -g "2560,0 3440x1440" - | wl-copy'' + + # regular programs + "$mod SUPER,F,exec,${browserName}" + (lib.mkIf ( + browserName == "firefox" || browserName == "zen" + ) "$mod SUPERSHIFT,F,exec,${browserName} -p special") + "$mod SUPER,T,exec,kitty -1" + "$mod SUPER,E,exec,nautilus -w" + "$mod SUPER,N,exec,neovide" + (lib.mkIf (config.mods.hyprland.anyrun.enable) "$mod SUPER,R,exec,anyrun") + (lib.mkIf (config.mods.oxi.oxirun.enable) "$mod SUPER,R,exec,oxirun") + (lib.mkIf (config.mods.oxi.oxidash.enable) "$mod SUPER,M,exec,oxidash") + (lib.mkIf (config.mods.oxi.oxicalc.enable) "$mod SUPER,G,exec,oxicalc") + (lib.mkIf (config.mods.oxi.oxishut.enable) "$mod SUPER,D,exec,oxishut") + (lib.mkIf (config.mods.oxi.oxipaste.enable) "$mod SUPER,A,exec,oxipaste-iced") + (lib.mkIf (config.mods.oxi.hyprdock.enable) "$mod SUPERSHIFT,P,exec,hyprdock --gui") + "$mod SUPERSHIFT,L,exec, playerctl -a pause & hyprlock & systemctl suspend" + "$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate" + + # media keys + (lib.mkIf config.mods.scripts.audioControl ",XF86AudioMute,exec, audioControl mute") + (lib.mkIf config.mods.scripts.audioControl ",XF86AudioLowerVolume,exec, audioControl sink -5%") + (lib.mkIf config.mods.scripts.audioControl ",XF86AudioRaiseVolume,exec, audioControl sink +5%") + ",XF86AudioPlay,exec, playerctl play-pause" + ",XF86AudioNext,exec, playerctl next" + ",XF86AudioPrev,exec, playerctl previous" + (lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessDown,exec, changeBrightness brightness 10%-") + (lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessUp,exec, changeBrightness brightness +10%") + + # hyprland keybinds + # misc + "$mod SUPER,V,togglefloating," + "$mod SUPER,B,fullscreen," + "$mod SUPER,C,togglesplit" + "$mod SUPER,Q,killactive," + "$mod SUPERSHIFTALT,M,exit," + "$mod SUPERSHIFT,W,togglespecialworkspace" + + # move + "$mod SUPER,left,movewindow,l" + "$mod SUPER,right,movewindow,r" + "$mod SUPER,up,movewindow,u" + "$mod SUPER,down,movewindow,d" + + # workspaces + "$mod SUPER,1,workspace,1" + "$mod SUPER,2,workspace,2" + "$mod SUPER,3,workspace,3" + "$mod SUPER,4,workspace,4" + "$mod SUPER,5,workspace,5" + "$mod SUPER,6,workspace,6" + "$mod SUPER,7,workspace,7" + "$mod SUPER,8,workspace,8" + "$mod SUPER,9,workspace,9" + "$mod SUPER,0,workspace,10" + + # move to workspace + "$mod SUPERSHIFT,1,movetoworkspace,1" + "$mod SUPERSHIFT,2,movetoworkspace,2" + "$mod SUPERSHIFT,3,movetoworkspace,3" + "$mod SUPERSHIFT,4,movetoworkspace,4" + "$mod SUPERSHIFT,5,movetoworkspace,5" + "$mod SUPERSHIFT,6,movetoworkspace,6" + "$mod SUPERSHIFT,7,movetoworkspace,7" + "$mod SUPERSHIFT,8,movetoworkspace,8" + "$mod SUPERSHIFT,9,movetoworkspace,9" + "$mod SUPERSHIFT,0,movetoworkspace,10" + + # move to workspace silent + "$mod SUPERSHIFTALT,1,movetoworkspacesilent,1" + "$mod SUPERSHIFTALT,2,movetoworkspacesilent,2" + "$mod SUPERSHIFTALT,3,movetoworkspacesilent,3" + "$mod SUPERSHIFTALT,4,movetoworkspacesilent,4" + "$mod SUPERSHIFTALT,5,movetoworkspacesilent,5" + "$mod SUPERSHIFTALT,6,movetoworkspacesilent,6" + "$mod SUPERSHIFTALT,7,movetoworkspacesilent,7" + "$mod SUPERSHIFTALT,8,movetoworkspacesilent,8" + "$mod SUPERSHIFTALT,9,movetoworkspacesilent,9" + "$mod SUPERSHIFTALT,0,movetoworkspacesilent,10" + + # preselection + "$mod SUPERALT,j,layoutmsg,preselect l" + "$mod SUPERALT,k,layoutmsg,preselect d" + "$mod SUPERALT,l,layoutmsg,preselect u" + "$mod SUPERALT,semicolon,layoutmsg,preselect r" + "$mod SUPERALT,h,layoutmsg,preselect n" + ]; + + binde = [ + # hyprland keybinds + # focus + "$mod SUPER,J,movefocus,l" + "$mod SUPER,semicolon,movefocus,r" + "$mod SUPER,L,movefocus,u" + "$mod SUPER,K,movefocus,d" + + # resize + "$mod SUPER,U,resizeactive,-20 0" + "$mod SUPER,P,resizeactive,20 0" + "$mod SUPER,O,resizeactive,0 -20" + "$mod SUPER,I,resizeactive,0 20" + ]; + + general = { + gaps_out = "3,5,5,5"; + border_size = 3; + "col.active_border" = lib.mkOverride 51 "0xFFFF0000 0xFF00FF00 0xFF0000FF 45deg"; + # "col.inactive_border" = "0x66333333"; + allow_tearing = lib.mkIf config.mods.hyprland.noAtomic true; + }; + + decoration = { + rounding = 4; + }; + + animations = { + bezier = "penguin,0.05,0.9,0.1,1.0"; + animation = [ + "windowsMove,1,4,default" + "windows,1,7,default,popin 70%" + "windowsOut,1,7,default,popin 70%" + "border,1,10,default" + "fade,1,7,default" + "workspaces,1,6,default" + "layers,1,3,default,popin" + ]; + }; + + dwindle = { + preserve_split = true; + pseudotile = 0; + permanent_direction_override = false; + }; + + input = { + kb_layout = "${config.mods.xkb.layout}"; + kb_variant = "${config.mods.xkb.variant}"; + repeat_delay = 200; + force_no_accel = true; + touchpad = { + natural_scroll = true; + tap-to-click = true; + tap-and-drag = true; + }; + }; + + misc = { + animate_manual_resizes = 1; + enable_swallow = true; + disable_splash_rendering = true; + disable_hyprland_logo = true; + swallow_regex = "^(.*)(kitty)(.*)$"; + initial_workspace_tracking = 1; + # just doesn't work + enable_anr_dialog = false; + }; + + cursor = { + enable_hyprcursor = true; + no_hardware_cursors = mkDashDefault config.mods.gpu.nvidia.enable; + # done with nix, this would break the current setup otherwise + sync_gsettings_theme = false; + }; + + gestures = { + workspace_swipe = true; + }; + + monitor = config.mods.hyprland.monitor; + workspace = config.mods.hyprland.workspace; + + env = [ + "GTK_CSD,0" + ''TERM,"kitty /bin/fish"'' + "XDG_CURRENT_DESKTOP=Hyprland" + "XDG_SESSION_TYPE=wayland" + "XDG_SESSION_DESKTOP=Hyprland" + "HYPRCURSOR_THEME,${config.mods.stylix.cursor.name}" + "HYPRCURSOR_SIZE,${toString config.mods.stylix.cursor.size}" + "XCURSOR_THEME,${config.mods.stylix.cursor.name}" + "XCURSOR_SIZE,${toString config.mods.stylix.cursor.size}" + "QT_QPA_PLATFORM,wayland" + "QT_QPA_PLATFORMTHEME,qt5ct" + "QT_WAYLAND_FORCE_DPI,96" + "QT_AUTO_SCREEN_SCALE_FACTOR,0" + "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" + "QT_SCALE_FACTOR,1" + ''EDITOR,"neovide --novsync --nofork"'' + (lib.mkIf config.mods.hyprland.noAtomic "WLR_DRM_NO_ATOMIC,1") + "GTK_USE_PORTAL, 1" + + (lib.mkIf config.mods.gpu.nvidia.enable "LIBVA_DRIVER_NAME,nvidia") + (lib.mkIf config.mods.gpu.nvidia.enable "XDG_SESSION_TYPE,wayland") + (lib.mkIf config.mods.gpu.nvidia.enable "GBM_BACKEND,nvidia-drm") + (lib.mkIf config.mods.gpu.nvidia.enable "__GLX_VENDOR_LIBRARY_NAME,nvidia") + ]; + + layerrule = [ + # layer rules + # mainly to disable animations within slurp and grim + "noanim, selection" + ]; + + windowrule = [ + # window rules + "float,class:^(.*)(OxiCalc)(.*)$" + "float,class:^(.*)(winecfg.exe)(.*)$" + "float,class:^(.*)(copyq)(.*)$" + "center,class:^(.*)(swappy)(.*)$" + "float,title:^(.*)(reset)(.*)$" + "workspace 10 silent,class:^(.*)(steam)(.*)$" + "workspace 9 silent,class:^(.*)(dota)(.*)$" + "workspace 9 silent,class:^(.*)(battlebits)(.*)$" + "workspace 9 silent,class:^(.*)(aoe)(.*)$" + "suppressevent fullscreen maximize,class:^(.*)(neovide)(.*)$" + "immediate,class:^(.*)(Pal)$" + "immediate,class:^(.*)(dota2)$" + "immediate,class:^(.*)(needforspeedheat.exe)$" + ]; + + exec-once = + [ + # environment + "systemctl --user import-environment" + "dbus-update-activation-environment --systemd --all" + "hyprctl setcursor Bibata-Modern-Classic 24" + + # other programs + "hyprpaper" + "ironbar" + "${browserName}" + "oxipaste_daemon" + "oxinoti" + ] + ++ config.mods.hyprland.extraAutostart; + + plugin = + lib.mkMerge + [ + { + hyprspace = lib.mkIf config.mods.hyprland.hyprspaceEnable { + bind = [ + "SUPER, W, overview:toggle, toggle" + ]; + }; + } + config.mods.hyprland.pluginConfig + ]; + } + config.mods.hyprland.customConfig + ] + else lib.mkForce config.mods.hyprland.customConfig; + plugins = + [ + (lib.mkIf config.mods.hyprland.hyprspaceEnable inputs.Hyprspace.packages.${pkgs.system}.Hyprspace) + ] + ++ config.mods.hyprland.plugins; + }; + } + ); +}