diff --git a/base/common_hardware.nix b/base/common_hardware.nix index 5071382..5b6b64c 100644 --- a/base/common_hardware.nix +++ b/base/common_hardware.nix @@ -1,10 +1,19 @@ -{ pkgs, config, lib, modulesPath, ... }: -let username = config.conf.username; -in { +{ + pkgs, + config, + lib, + modulesPath, + ... +}: +let + username = config.conf.username; +in +{ imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; # Bootloader. boot = { + consoleLogLevel = 0; loader = { systemd-boot = { enable = true; @@ -12,11 +21,26 @@ in { }; efi.canTouchEfiVariables = true; }; - plymouth = { enable = true; }; + plymouth = { + enable = true; + }; kernelPackages = config.conf.kernel; - initrd.availableKernelModules = - [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; - kernelParams = [ ''resume="PARTLABEL=SWAP"'' ] ++ config.conf.boot_params; + initrd = { + verbose = false; + availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; + }; + kernelParams = [ + ''resume="PARTLABEL=SWAP"'' + ''quiet'' + ''udev.log_level=3'' + ] ++ config.conf.boot_params; }; # Enable networking @@ -66,8 +90,7 @@ in { # Enable sound with pipewire. hardware = { pulseaudio.enable = false; - cpu.${config.conf.cpu}.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + cpu.${config.conf.cpu}.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; }; security.rtkit.enable = true; @@ -92,7 +115,10 @@ in { "video" "audio" ]; - packages = with pkgs; [ home-manager xdg-desktop-portal-gtk ]; + 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 = "firstlogin"; diff --git a/base/default.nix b/base/default.nix index 5a3407b..eafd8a5 100644 --- a/base/default.nix +++ b/base/default.nix @@ -1 +1,7 @@ -{ imports = [ ./env.nix ./xkb_layout.nix ./common_hardware.nix ]; } +{ + imports = [ + ./env.nix + ./xkb_layout.nix + ./common_hardware.nix + ]; +} diff --git a/base/env.nix b/base/env.nix index 9b76e00..9a62d7e 100644 --- a/base/env.nix +++ b/base/env.nix @@ -1,8 +1,8 @@ -{ pkgs, config, ... }: { +{ pkgs, config, ... }: +{ environment = { variables = { - GSETTINGS_SCHEMA_DIR = - "${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}"; + GSETTINGS_SCHEMA_DIR = "${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}"; NEOVIDE_MAXIMIZED = "0"; GPG_TTY = "$(tty)"; EDITOR = "neovide --no-fork"; diff --git a/base/xkb_layout.nix b/base/xkb_layout.nix index 5b407e0..ecbc97c 100644 --- a/base/xkb_layout.nix +++ b/base/xkb_layout.nix @@ -10,7 +10,8 @@ let key { [ u, U, udiaeresis, Udiaeresis ] }; }; ''; -in { +in +{ environment.systemPackages = [ pkgs.xorg.xkbcomp ]; services.xserver.xkb.extraLayouts.dashie = { description = "US layout with 'umlaut'"; diff --git a/example/flake.nix b/example/flake.nix index 056aef8..6f42a57 100644 --- a/example/flake.nix +++ b/example/flake.nix @@ -4,8 +4,7 @@ inputs = { dashvim.url = "github:DashieTM/DashVim"; hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; - ironbar.url = - "github:JakeStanger/ironbar?ref=3a1c60442382f970cdb7669814b6ef3594d9f048"; + ironbar.url = "github:JakeStanger/ironbar?ref=3a1c60442382f970cdb7669814b6ef3594d9f048"; anyrun.url = "github:Kirottu/anyrun"; nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable"; stable.url = "github:NixOs/nixpkgs/nixos-24.05"; @@ -22,10 +21,11 @@ }; }; - outputs = { ... }@inputs: { - nixosConfigurations = - (inputs.dashNix.dashNixLib.build_systems [ "example" ] ./.); - }; + outputs = + { ... }@inputs: + { + nixosConfigurations = (inputs.dashNix.dashNixLib.build_systems [ "example" ] ./.); + }; nixConfig = { builders-use-substitutes = true; diff --git a/example/hosts/example/configuration.nix b/example/hosts/example/configuration.nix index 54240e4..e1ca701 100644 --- a/example/hosts/example/configuration.nix +++ b/example/hosts/example/configuration.nix @@ -24,7 +24,12 @@ drive = { device = "/dev/disk/by-label/BOOT"; fsType = "vfat"; - options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ]; + options = [ + "rw" + "fmask=0022" + "dmask=0022" + "noatime" + ]; }; } { @@ -32,7 +37,11 @@ drive = { device = "/dev/disk/by-label/ROOT"; fsType = "ext4"; - options = [ "noatime" "nodiratime" "discard" ]; + options = [ + "noatime" + "nodiratime" + "discard" + ]; }; } ]; @@ -50,6 +59,8 @@ kde_connect.enable = true; # TODO change this to your main resolution # -> this will be your login manager - greetd = { resolution = "3440x1440@180"; }; + greetd = { + resolution = "3440x1440@180"; + }; }; } diff --git a/example/hosts/example/hardware.nix b/example/hosts/example/hardware.nix index 0967ef4..ffcd441 100644 --- a/example/hosts/example/hardware.nix +++ b/example/hosts/example/hardware.nix @@ -1 +1 @@ -{} +{ } diff --git a/example/hosts/example/home.nix b/example/hosts/example/home.nix index 0967ef4..ffcd441 100644 --- a/example/hosts/example/home.nix +++ b/example/hosts/example/home.nix @@ -1 +1 @@ -{} +{ } diff --git a/flake.nix b/flake.nix index 98736a6..c0b027a 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,9 @@ nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable"; stable.url = "github:NixOs/nixpkgs/nixos-24.05"; - nix-flatpak = { url = "github:gmodena/nix-flatpak"; }; + nix-flatpak = { + url = "github:gmodena/nix-flatpak"; + }; home-manager = { url = "github:nix-community/home-manager"; @@ -23,8 +25,7 @@ hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; ironbar = { - url = - "github:JakeStanger/ironbar?ref=3a1c60442382f970cdb7669814b6ef3594d9f048"; + url = "github:JakeStanger/ironbar?ref=3a1c60442382f970cdb7669814b6ef3594d9f048"; }; stylix.url = "github:danth/stylix"; @@ -47,11 +48,14 @@ }; }; - outputs = { ... }@inputs: + outputs = + { ... }@inputs: let stable = import inputs.stable { system = "x86_64-linux"; - config = { allowUnfree = true; }; + config = { + allowUnfree = true; + }; }; pkgs = import inputs.nixpkgs { system = "x86_64-linux"; @@ -61,7 +65,8 @@ allowUnfree = true; }; }; - in { + in + { dashNixLib = import ./lib { inherit inputs pkgs; }; dashNixInputs = inputs; stablePkgs = stable; diff --git a/home/common.nix b/home/common.nix index ecedf27..2cdcbcd 100644 --- a/home/common.nix +++ b/home/common.nix @@ -1,6 +1,13 @@ -{ config, lib, options, ... }: -let username = config.conf.username; -in { +{ + config, + lib, + options, + ... +}: +let + username = config.conf.username; +in +{ manual = { html.enable = false; json.enable = false; @@ -17,7 +24,9 @@ in { sessionPath = [ "$HOME/.cargo/bin" ]; - sessionVariables = { GOROOT = "$HOME/.go"; }; + sessionVariables = { + GOROOT = "$HOME/.go"; + }; keyboard = null; diff --git a/home/default.nix b/home/default.nix index 4e6e38e..59049e8 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,4 +1,13 @@ -{ inputs, pkgs, config, lib, mod, additionalHomeConfig, root, ... }: +{ + inputs, + pkgs, + config, + lib, + mod, + additionalHomeConfig, + root, + ... +}: let base_imports = [ inputs.anyrun.homeManagerModules.default @@ -16,7 +25,8 @@ let inputs.dashvim.homeManagerModules.dashvim ../modules ]; -in { +in +{ xdg = { portal.config.common.default = "*"; portal = { @@ -27,13 +37,21 @@ in { home-manager = { useGlobalPkgs = true; useUserPackages = true; - extraSpecialArgs = { inherit inputs root; }; + extraSpecialArgs = { + inherit inputs root; + }; users.${config.conf.username} = { - imports = [ ./common.nix ./xdg.nix ./themes ./sync.nix ] ++ base_imports + imports = + [ + ./common.nix + ./xdg.nix + ./themes + ./sync.nix + ] + ++ base_imports ++ lib.optional (builtins.pathExists mod) mod - ++ lib.optional (builtins.pathExists additionalHomeConfig) - additionalHomeConfig; + ++ lib.optional (builtins.pathExists additionalHomeConfig) additionalHomeConfig; }; }; } diff --git a/home/sync.nix b/home/sync.nix index f650434..d82e269 100644 --- a/home/sync.nix +++ b/home/sync.nix @@ -1,43 +1,56 @@ # derived from NixOS wiki -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let username = config.mods.nextcloud.username; - password = if (config.sops.secrets ? nextcloud.path) then - config.sops.secrets.nextcloud.path - else - ""; + password = + if (config.sops.secrets ? nextcloud.path) then config.sops.secrets.nextcloud.path else ""; url = config.mods.nextcloud.url; synclist = config.mods.nextcloud.synclist; -in lib.mkIf config.mods.nextcloud.enable { +in +lib.mkIf config.mods.nextcloud.enable { systemd.user = { - services = (builtins.listToAttrs (map (opts: { - name = "${opts.name}"; - value = { - Unit = { - Description = "Auto sync Nextcloud"; - After = "network-online.target"; - }; - Service = { - Type = "simple"; - ExecStart = - "${pkgs.bash}/bin/bash -c '${pkgs.nextcloud-client}/bin/nextcloudcmd -h --path ${opts.remote} ${opts.local} https://${username}:$(bat ${password})@${url}'"; - TimeoutStopSec = "180"; - KillMode = "process"; - KillSignal = "SIGINT"; - }; - Install.WantedBy = [ "multi-user.target" ]; - }; - }) synclist)); - timers = (builtins.listToAttrs (map (opts: { - name = "${opts.name}"; - value = { - Unit.Description = - "Automatic sync files with Nextcloud when booted up after 1 minute then rerun every 60 minutes"; - Timer.OnBootSec = "1min"; - Timer.OnUnitActiveSec = "60min"; - Install.WantedBy = [ "multi-user.target" "timers.target" ]; - }; - }) synclist)); + services = ( + builtins.listToAttrs ( + map (opts: { + name = "${opts.name}"; + value = { + Unit = { + Description = "Auto sync Nextcloud"; + After = "network-online.target"; + }; + Service = { + Type = "simple"; + ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.nextcloud-client}/bin/nextcloudcmd -h --path ${opts.remote} ${opts.local} https://${username}:$(bat ${password})@${url}'"; + TimeoutStopSec = "180"; + KillMode = "process"; + KillSignal = "SIGINT"; + }; + Install.WantedBy = [ "multi-user.target" ]; + }; + }) synclist + ) + ); + timers = ( + builtins.listToAttrs ( + map (opts: { + name = "${opts.name}"; + value = { + Unit.Description = "Automatic sync files with Nextcloud when booted up after 1 minute then rerun every 60 minutes"; + Timer.OnBootSec = "1min"; + Timer.OnUnitActiveSec = "60min"; + Install.WantedBy = [ + "multi-user.target" + "timers.target" + ]; + }; + }) synclist + ) + ); startServices = true; }; } diff --git a/home/themes/default.nix b/home/themes/default.nix index be2d0b5..10c4ace 100644 --- a/home/themes/default.nix +++ b/home/themes/default.nix @@ -1,4 +1,9 @@ -{ config, inputs, pkgs, ... }: +{ + config, + inputs, + pkgs, + ... +}: let username = config.conf.username; # at time of using this here, stylix might not be evaluated yet @@ -22,10 +27,17 @@ let border: none; } ''; -in { - xdg.configFile."qt5ct/colors/tokyonight.conf" = { text = "${color}"; }; - xdg.configFile."qt6ct/colors/tokyonight.conf" = { text = "${color}"; }; - xdg.configFile."qt5ct/qss/tab.qss" = { text = "${qss}"; }; +in +{ + xdg.configFile."qt5ct/colors/tokyonight.conf" = { + text = "${color}"; + }; + xdg.configFile."qt6ct/colors/tokyonight.conf" = { + text = "${color}"; + }; + xdg.configFile."qt5ct/qss/tab.qss" = { + text = "${qss}"; + }; xdg.configFile."qt5ct/qt5ct.conf" = { text = '' [Appearance] @@ -101,4 +113,3 @@ in { ''; }; } - diff --git a/home/xdg.nix b/home/xdg.nix index eaaae39..aa9541a 100644 --- a/home/xdg.nix +++ b/home/xdg.nix @@ -7,39 +7,65 @@ let videoPlayer = [ "mpv" ]; audioPlayer = [ "io.bassi.Amberol" ]; - xdgAssociations = type: program: list: - builtins.listToAttrs (map (e: { - name = "${type}/${e}"; - value = program; - }) list); + xdgAssociations = + type: program: list: + builtins.listToAttrs ( + map (e: { + name = "${type}/${e}"; + value = program; + }) list + ); - image = xdgAssociations "image" imageViewer [ "png" "svg" "jpeg" "gif" ]; - video = xdgAssociations "video" videoPlayer [ "mp4" "avi" "mkv" ]; - audio = xdgAssociations "audio" audioPlayer [ "mp3" "flac" "wav" "aac" ]; - browserTypes = (xdgAssociations "application" browser [ - "json" - "x-extension-htm" - "x-extension-html" - "x-extension-shtml" - "x-extension-xht" - "x-extension-xhtml" - ]) // (xdgAssociations "x-scheme-handler" browser [ - "about" - "ftp" - "http" - "https" - "unknown" - ]); + image = xdgAssociations "image" imageViewer [ + "png" + "svg" + "jpeg" + "gif" + ]; + video = xdgAssociations "video" videoPlayer [ + "mp4" + "avi" + "mkv" + ]; + audio = xdgAssociations "audio" audioPlayer [ + "mp3" + "flac" + "wav" + "aac" + ]; + browserTypes = + (xdgAssociations "application" browser [ + "json" + "x-extension-htm" + "x-extension-html" + "x-extension-shtml" + "x-extension-xht" + "x-extension-xhtml" + ]) + // (xdgAssociations "x-scheme-handler" browser [ + "about" + "ftp" + "http" + "https" + "unknown" + ]); # XDG MIME types - associations = builtins.mapAttrs (_: v: (map (e: "${e}.desktop") v)) ({ - "application/pdf" = [ "org.pwmt.zathura-pdf-mupdf" ]; - "text/html" = browser; - "text/plain" = [ "neovide" ]; - "x-scheme-handler/chrome" = [ "com.brave.browser" ]; - "inode/directory" = [ "yazi" ]; - } // image // video // audio // browserTypes); -in { + associations = builtins.mapAttrs (_: v: (map (e: "${e}.desktop") v)) ( + { + "application/pdf" = [ "org.pwmt.zathura-pdf-mupdf" ]; + "text/html" = browser; + "text/plain" = [ "neovide" ]; + "x-scheme-handler/chrome" = [ "com.brave.browser" ]; + "inode/directory" = [ "yazi" ]; + } + // image + // video + // audio + // browserTypes + ); +in +{ xdg = { enable = true; cacheHome = config.home.homeDirectory + "/.local/cache"; diff --git a/lib/default.nix b/lib/default.nix index 8188fb3..0b33f2e 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,6 +1,8 @@ { inputs, pkgs, ... }: { /** + # 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. diff --git a/modules/conf.nix b/modules/conf.nix index 1a861d4..341d301 100644 --- a/modules/conf.nix +++ b/modules/conf.nix @@ -1,11 +1,23 @@ -{ lib, config, pkgs, options, ... }: { +{ + lib, + config, + pkgs, + options, + ... +}: +{ options.conf = { system = lib.mkOption { default = "x86_64-linux"; # no fisherprice unix support - type = with lib.types; - (enum [ "x86_64-linux" "aarch64-linux" "aarch64-linux-android" ]); + type = + with lib.types; + (enum [ + "x86_64-linux" + "aarch64-linux" + "aarch64-linux-android" + ]); example = "aarch64-linux"; description = '' System architecture. @@ -15,7 +27,12 @@ cpu = lib.mkOption { # TODO: how to enable arm? default = "amd"; - type = with lib.types; (enum [ "amd" "intel" ]); + type = + with lib.types; + (enum [ + "amd" + "intel" + ]); example = "intel"; description = '' cpu microcode. @@ -43,10 +60,12 @@ ironbar = { modules = lib.mkOption { default = [ ]; - example = [{ - type = "upower"; - class = "memory-usage"; - }]; + example = [ + { + type = "upower"; + class = "memory-usage"; + } + ]; type = with lib.types; listOf attrs; description = '' Adds modules to ironbar. @@ -129,8 +148,16 @@ }; nvim-colorscheme = lib.mkOption { - default = { tokyonight = { enable = true; }; }; - example = { catppuccin = { enable = true; }; }; + default = { + tokyonight = { + enable = true; + }; + }; + example = { + catppuccin = { + enable = true; + }; + }; type = lib.types.attrs; description = '' nixvim colorscheme. @@ -167,10 +194,8 @@ }; config = { - conf.kernel = - lib.mkIf (config.mods.gaming.enable && config.mods.gaming.kernel) - pkgs.linuxPackages_xanmod_latest; - } // (lib.optionalAttrs (options ? system.stateVersion) { - system.stateVersion = "unstable"; - }); + conf.kernel = lib.mkIf ( + config.mods.gaming.enable && config.mods.gaming.kernel + ) pkgs.linuxPackages_xanmod_latest; + } // (lib.optionalAttrs (options ? system.stateVersion) { system.stateVersion = "unstable"; }); } diff --git a/modules/default.nix b/modules/default.nix index 158764f..683596a 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1 +1,6 @@ -{ imports = [ ./programs ./conf.nix ]; } +{ + imports = [ + ./programs + ./conf.nix + ]; +} diff --git a/modules/programs/acpid.nix b/modules/programs/acpid.nix index f245095..2c0eeab 100644 --- a/modules/programs/acpid.nix +++ b/modules/programs/acpid.nix @@ -1,4 +1,10 @@ -{ lib, config, options, ... }: { +{ + lib, + config, + options, + ... +}: +{ options.mods = { acpid.enable = lib.mkOption { @@ -11,9 +17,7 @@ }; }; - config = lib.mkIf config.mods.acpid.enable - (lib.optionalAttrs (options ? virtualisation.virtualbox.host) { - services.acpid.enable = true; - }); + config = lib.mkIf config.mods.acpid.enable ( + lib.optionalAttrs (options ? virtualisation.virtualbox.host) { services.acpid.enable = true; } + ); } - diff --git a/modules/programs/base_packages.nix b/modules/programs/base_packages.nix index d13dec6..5d94c75 100644 --- a/modules/programs/base_packages.nix +++ b/modules/programs/base_packages.nix @@ -1,4 +1,12 @@ -{ config, lib, options, pkgs, inputs, ... }: { +{ + config, + lib, + options, + pkgs, + inputs, + ... +}: +{ options.mods = { default_base_packages = { enable = lib.mkOption { @@ -21,83 +29,89 @@ }; }; - config = (lib.optionalAttrs (options ? environment.systemPackages) { - environment.systemPackages = - config.mods.default_base_packages.additional_packages; - } // (lib.mkIf config.mods.default_base_packages.enable - (lib.optionalAttrs (options ? environment.systemPackages) { - environment.systemPackages = with pkgs; [ - openssl - dbus - glib - gtk4 - gtk3 - libadwaita - gtk-layer-shell - gtk4-layer-shell - direnv - dconf - gsettings-desktop-schemas - gnome.nixos-gsettings-overrides - bibata-cursors - xorg.xkbutils - libxkbcommon - icon-library - adwaita-icon-theme - hicolor-icon-theme - morewaita-icon-theme - kdePackages.breeze-icons - seahorse - upower - thunderbird - podman-tui - podman-compose - dive - ]; + config = ( + lib.optionalAttrs (options ? environment.systemPackages) { + environment.systemPackages = config.mods.default_base_packages.additional_packages; + } + // (lib.mkIf config.mods.default_base_packages.enable ( + lib.optionalAttrs (options ? environment.systemPackages) { + environment.systemPackages = with pkgs; [ + openssl + dbus + glib + gtk4 + gtk3 + libadwaita + gtk-layer-shell + gtk4-layer-shell + direnv + dconf + gsettings-desktop-schemas + gnome.nixos-gsettings-overrides + bibata-cursors + xorg.xkbutils + libxkbcommon + icon-library + adwaita-icon-theme + hicolor-icon-theme + morewaita-icon-theme + kdePackages.breeze-icons + seahorse + upower + thunderbird + podman-tui + podman-compose + dive + ]; - gtk.iconCache.enable = false; + gtk.iconCache.enable = false; - fonts.packages = with pkgs; [ cantarell-fonts ]; + fonts.packages = with pkgs; [ cantarell-fonts ]; - virtualisation = { - containers.enable = true; - podman = { - enable = true; - dockerCompat = true; - defaultNetwork.settings.dns_enabled = true; - }; - }; - - services = { - upower.enable = true; - dbus = { - enable = true; - packages = with pkgs; [ gnome2.GConf ]; - }; - avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - }; - }; - - programs = { - nix-ld = { - enable = true; - libraries = with pkgs; [ jdk zlib ]; - }; - direnv = { - package = pkgs.direnv; - silent = false; - loadInNixShell = true; - direnvrcExtra = ""; - nix-direnv = { + virtualisation = { + containers.enable = true; + podman = { enable = true; - package = pkgs.nix-direnv; + dockerCompat = true; + defaultNetwork.settings.dns_enabled = true; }; }; - ssh.startAgent = true; - gnupg.agent.enable = true; - }; - }))); + + services = { + upower.enable = true; + dbus = { + enable = true; + packages = with pkgs; [ gnome2.GConf ]; + }; + avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + }; + + programs = { + nix-ld = { + enable = true; + libraries = with pkgs; [ + jdk + zlib + ]; + }; + direnv = { + package = pkgs.direnv; + silent = false; + loadInNixShell = true; + direnvrcExtra = ""; + nix-direnv = { + enable = true; + package = pkgs.nix-direnv; + }; + }; + ssh.startAgent = true; + gnupg.agent.enable = true; + }; + } + )) + ); } diff --git a/modules/programs/bluetooth.nix b/modules/programs/bluetooth.nix index f18c9e9..7818d34 100644 --- a/modules/programs/bluetooth.nix +++ b/modules/programs/bluetooth.nix @@ -1,4 +1,10 @@ -{ lib, config, options, ... }: { +{ + lib, + config, + options, + ... +}: +{ options.mods = { bluetooth.enable = lib.mkOption { default = false; @@ -10,12 +16,12 @@ }; }; - config = lib.mkIf config.mods.bluetooth.enable - (lib.optionalAttrs (options ? hardware.bluetooth) { + config = lib.mkIf config.mods.bluetooth.enable ( + lib.optionalAttrs (options ? hardware.bluetooth) { hardware.bluetooth = { enable = true; powerOnBoot = true; }; - }); + } + ); } - diff --git a/modules/programs/coding.nix b/modules/programs/coding.nix index 9621220..595574c 100644 --- a/modules/programs/coding.nix +++ b/modules/programs/coding.nix @@ -1,4 +1,11 @@ -{ lib, config, pkgs, options, ... }: { +{ + lib, + config, + pkgs, + options, + ... +}: +{ options.mods = { coding = { enable = lib.mkOption { @@ -28,8 +35,8 @@ }; }; - config = lib.mkIf config.mods.coding.enable - (lib.optionalAttrs (options ? home.packages) { + config = 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; @@ -141,5 +148,6 @@ tmate ]; - }); + } + ); } diff --git a/modules/programs/drives.nix b/modules/programs/drives.nix index 7772f51..66206c4 100644 --- a/modules/programs/drives.nix +++ b/modules/programs/drives.nix @@ -1,4 +1,9 @@ -{ lib, config, options, ... }: +{ + lib, + config, + options, + ... +}: let driveModule = lib.types.submodule { @@ -19,12 +24,17 @@ let example = { device = "/dev/disk/by-label/DRIVE2"; fsType = "ext4"; - options = [ "noatime" "nodiratime" "discard" ]; + options = [ + "noatime" + "nodiratime" + "discard" + ]; }; }; }; }; -in { +in +{ options.mods = { useSwap = { enable = lib.mkOption { @@ -50,14 +60,20 @@ in { default = [ ]; - example = [{ - name = "drive2"; - drive = { - device = "/dev/disk/by-label/DRIVE2"; - fsType = "ext4"; - options = [ "noatime" "nodiratime" "discard" ]; - }; - }]; + example = [ + { + name = "drive2"; + drive = { + device = "/dev/disk/by-label/DRIVE2"; + fsType = "ext4"; + options = [ + "noatime" + "nodiratime" + "discard" + ]; + }; + } + ]; # TODO: how to make this work # type = with lib.types; listOf (attrsOf driveModule); type = with lib.types; listOf (attrsOf anything); @@ -67,33 +83,52 @@ in { }; }; - config = (lib.optionalAttrs (options ? fileSystems) { - fileSystems = builtins.listToAttrs (map ({ name, drive }: { - name = "/" + name; - value = drive; - }) config.mods.extraDrives) - // (lib.optionalAttrs config.mods.defaultDrives.enable) { - "/" = { - device = "/dev/disk/by-label/ROOT"; - fsType = "btrfs"; - options = [ "noatime" "nodiratime" "discard" ]; - }; + config = ( + lib.optionalAttrs (options ? fileSystems) { + fileSystems = + builtins.listToAttrs ( + map ( + { name, drive }: + { + name = "/" + name; + value = drive; + } + ) config.mods.extraDrives + ) + // (lib.optionalAttrs config.mods.defaultDrives.enable) { + "/" = { + device = "/dev/disk/by-label/ROOT"; + fsType = "btrfs"; + options = [ + "noatime" + "nodiratime" + "discard" + ]; + }; - "/boot" = { - device = "/dev/disk/by-label/BOOT"; - fsType = "vfat"; - options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ]; - }; + "/boot" = { + device = "/dev/disk/by-label/BOOT"; + fsType = "vfat"; + options = [ + "rw" + "fmask=0022" + "dmask=0022" + "noatime" + ]; + }; - "/home" = { - device = "/dev/disk/by-label/HOME"; - fsType = "btrfs"; - options = [ "noatime" "nodiratime" "discard" ]; + "/home" = { + device = "/dev/disk/by-label/HOME"; + fsType = "btrfs"; + options = [ + "noatime" + "nodiratime" + "discard" + ]; + }; }; - }; - # TODO make this convert to choice of drives -> thanks to funny types this doesn't work... - swapDevices = lib.mkIf config.mods.useSwap.enable [{ - device = "/dev/disk/by-label/SWAP"; - }]; - }); + # TODO make this convert to choice of drives -> thanks to funny types this doesn't work... + swapDevices = lib.mkIf config.mods.useSwap.enable [ { device = "/dev/disk/by-label/SWAP"; } ]; + } + ); } diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index f408b3d..d3305da 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.firefox = { enable = lib.mkOption { default = true; @@ -56,8 +63,8 @@ description = "Firefox extensions (from nur)"; }; }; - config = lib.mkIf config.mods.firefox.enable - (lib.optionalAttrs (options ? programs.firefox.profiles) { + config = lib.mkIf config.mods.firefox.enable ( + lib.optionalAttrs (options ? programs.firefox.profiles) { programs.firefox = { enable = true; policies = config.mods.firefox.configuration; @@ -72,5 +79,6 @@ extensions = config.mods.firefox.extensions; }; }; - }); + } + ); } diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 61d5741..54e6f67 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.fish = { enable = lib.mkOption { default = true; @@ -7,8 +14,8 @@ description = "Enables fish"; }; }; - config = lib.mkIf config.mods.fish.enable - (lib.optionalAttrs (options ? programs.fish) { + config = lib.mkIf config.mods.fish.enable ( + lib.optionalAttrs (options ? programs.fish) { programs.fish = { enable = true; shellInit = '' @@ -147,5 +154,6 @@ direnv hook fish | source ''; }; - }); + } + ); } diff --git a/modules/programs/flatpak.nix b/modules/programs/flatpak.nix index d0158cb..54011f3 100644 --- a/modules/programs/flatpak.nix +++ b/modules/programs/flatpak.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.flatpak = { enable = lib.mkOption { default = true; @@ -13,18 +20,22 @@ description = "Flatpak packages"; }; }; - config = lib.mkIf config.mods.flatpak.enable - (lib.optionalAttrs (options ? services.flatpak.remote) { - services.flatpak.remotes = lib.mkOptionDefault [{ - name = "flathub-stable"; - location = "https://dl.flathub.org/repo/flathub.flatpakrepo"; - }]; + config = lib.mkIf config.mods.flatpak.enable ( + lib.optionalAttrs (options ? services.flatpak.remote) { + services.flatpak.remotes = lib.mkOptionDefault [ + { + name = "flathub-stable"; + location = "https://dl.flathub.org/repo/flathub.flatpakrepo"; + } + ]; services.flatpak.uninstallUnmanaged = true; - } // lib.optionalAttrs (options ? services.flatpak.packages) { + } + // lib.optionalAttrs (options ? services.flatpak.packages) { services.flatpak.packages = [ # fallback if necessary, but generally avoided as nix is superior :) # default flatseal installation since flatpak permissions are totally not a broken idea "com.github.tchx84.Flatseal" ] ++ config.mods.flatpak.additional_packages; - }); + } + ); } diff --git a/modules/programs/gaming.nix b/modules/programs/gaming.nix index 57b0c30..2652010 100644 --- a/modules/programs/gaming.nix +++ b/modules/programs/gaming.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.gaming = { enable = lib.mkOption { default = false; @@ -7,7 +14,14 @@ description = "Enabled gaming related features."; }; tools = lib.mkOption { - default = with pkgs; [ gamemode steam lutris wine adwsteamgtk heroic ]; + default = with pkgs; [ + gamemode + steam + lutris + wine + adwsteamgtk + heroic + ]; example = [ ]; type = with lib.types; listOf package; description = "Install gaming related packages"; @@ -34,8 +48,7 @@ default = true; example = false; type = lib.types.bool; - description = - "Whether to use GPU performance setting. NOTE: this is at your own risk!"; + description = "Whether to use GPU performance setting. NOTE: this is at your own risk!"; }; gpu_device = lib.mkOption { default = 0; @@ -44,8 +57,8 @@ description = "Your gpu device.(Physical id of lshw)"; }; }; - config = lib.mkIf config.mods.gaming.enable - (lib.optionalAttrs (options ? environment.systemPackages) { + config = lib.mkIf config.mods.gaming.enable ( + lib.optionalAttrs (options ? environment.systemPackages) { environment.systemPackages = config.mods.gaming.tools; programs.steam.enable = config.mods.gaming.steam; @@ -53,7 +66,9 @@ programs.gamemode = { enableRenice = true; settings = { - general = { governor = "performance"; }; + general = { + governor = "performance"; + }; gpu = lib.mkIf config.mods.gaming.gpu_optimization { apply_gpu_optimisations = "accept-responsibility"; gpu_device = config.mods.gaming.gpu_device; @@ -66,5 +81,6 @@ }; }; }; - }); + } + ); } diff --git a/modules/programs/git.nix b/modules/programs/git.nix index ee5d258..e1bf3c5 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.git = { username = lib.mkOption { default = "DashieTM"; @@ -15,19 +22,9 @@ ssh_config = lib.mkOption { default = '' Host github.com - ${ - if (config.sops.secrets ? hub.path) then - "IdentityFile ${config.sops.secrets.hub.path}" - else - "" - } + ${if (config.sops.secrets ? hub.path) then "IdentityFile ${config.sops.secrets.hub.path}" else ""} Host gitlab.com - ${ - if (config.sops.secrets ? lab.path) then - "IdentityFile ${config.sops.secrets.lab.path}" - else - "" - } + ${if (config.sops.secrets ? lab.path) then "IdentityFile ${config.sops.secrets.lab.path}" else ""} Host dashie.org ${ if (config.sops.secrets ? dashie.path) then @@ -41,16 +38,22 @@ description = "ssh configuration (keys for git)"; }; }; - config = (lib.optionalAttrs (options ? programs.git && options ? home.file) { - programs.git = { - enable = true; - userName = config.mods.git.username; - userEmail = config.mods.git.email; - extraConfig = { - merge = { tool = "nvimdiff"; }; - diff = { tool = "nvimdiff"; }; + config = ( + lib.optionalAttrs (options ? programs.git && options ? home.file) { + programs.git = { + enable = true; + userName = config.mods.git.username; + userEmail = config.mods.git.email; + extraConfig = { + merge = { + tool = "nvimdiff"; + }; + diff = { + tool = "nvimdiff"; + }; + }; }; - }; - home.file.".ssh/config".text = config.mods.git.ssh_config; - }); + home.file.".ssh/config".text = config.mods.git.ssh_config; + } + ); } diff --git a/modules/programs/gnome_services.nix b/modules/programs/gnome_services.nix index fe6ad0e..f83418c 100644 --- a/modules/programs/gnome_services.nix +++ b/modules/programs/gnome_services.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods = { gnome_services.enable = lib.mkOption { default = true; @@ -11,17 +18,26 @@ }; }; - config = lib.mkIf config.mods.gnome_services.enable - (lib.optionalAttrs (options ? services.gnome.gnome-keyring) { + config = lib.mkIf config.mods.gnome_services.enable ( + lib.optionalAttrs (options ? services.gnome.gnome-keyring) { programs.dconf.enable = true; services = { # needed for GNOME services outside of GNOME Desktop - dbus.packages = with pkgs; [ gcr gnome.gnome-settings-daemon ]; + dbus.packages = with pkgs; [ + gcr + gnome.gnome-settings-daemon + ]; gnome.gnome-keyring.enable = true; gvfs.enable = true; }; - } // lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ nautilus sushi nautilus-python ]; - }); + } + // lib.optionalAttrs (options ? home.packages) { + home.packages = with pkgs; [ + nautilus + sushi + nautilus-python + ]; + } + ); } diff --git a/modules/programs/gpu.nix b/modules/programs/gpu.nix index 274b55f..24c37b6 100644 --- a/modules/programs/gpu.nix +++ b/modules/programs/gpu.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods = { nvidia.enable = lib.mkOption { @@ -37,8 +44,8 @@ }; }; - config = lib.mkIf config.mods.vapi.enable - (lib.optionalAttrs (options ? hardware.graphics) { + config = lib.mkIf config.mods.vapi.enable ( + lib.optionalAttrs (options ? hardware.graphics) { boot = lib.mkIf config.mods.amdgpu.enable { kernelModules = [ "kvm-amd" ]; initrd.kernelModules = [ "amdgpu" ]; @@ -46,20 +53,27 @@ }; hardware = { - graphics = let - base_packages = - [ pkgs.libvdpau-va-gl pkgs.vaapiVdpau pkgs.mesa.drivers ]; - rocm_packages = - [ pkgs.rocmPackages.clr.icd pkgs.rocm-opencl-runtime ]; - in { - enable = true; - enable32Bit = lib.mkDefault true; - extraPackages = base_packages - ++ (lib.lists.optionals config.mods.vapi.rocm.enable rocm_packages); - }; + graphics = + let + base_packages = [ + pkgs.libvdpau-va-gl + pkgs.vaapiVdpau + pkgs.mesa.drivers + ]; + rocm_packages = [ + pkgs.rocmPackages.clr.icd + pkgs.rocm-opencl-runtime + ]; + in + { + enable = true; + enable32Bit = lib.mkDefault true; + extraPackages = base_packages ++ (lib.lists.optionals config.mods.vapi.rocm.enable rocm_packages); + }; }; - } // lib.optionalAttrs (options ? hardware.graphics) - (lib.mkIf config.mods.nvidia.enable { + } + // lib.optionalAttrs (options ? hardware.graphics) ( + lib.mkIf config.mods.nvidia.enable { hardware.nvidia = { modesetting.enable = true; # powerManagement.enable = false; @@ -69,5 +83,7 @@ package = config.boot.kernelPackages.nvidiaPackages.beta; }; services.xserver.videoDrivers = [ "nvidia" ]; - })); + } + ) + ); } diff --git a/modules/programs/greetd.nix b/modules/programs/greetd.nix index c082ef4..52aa2a5 100644 --- a/modules/programs/greetd.nix +++ b/modules/programs/greetd.nix @@ -1,4 +1,12 @@ -{ config, lib, inputs, pkgs, options, ... }: { +{ + config, + lib, + inputs, + pkgs, + options, + ... +}: +{ options.mods = { greetd = { enable = lib.mkOption { @@ -38,60 +46,72 @@ }; }; - config = let - username = config.conf.username; - session = { - command = "${ + config = + let + username = config.conf.username; + session = { + command = "${ lib.getExe inputs.hyprland.packages.${config.conf.system}.hyprland } --config /etc/greetd/hyprgreet.conf"; - user = username; - }; - in lib.mkIf config.mods.greetd.enable - (lib.optionalAttrs (options ? environment) { - services.xserver.displayManager.session = [{ - manage = "desktop"; - name = "Hyprland"; - start = '' - ${lib.getExe pkgs.hyprland} & waitPID=$! - ''; - }]; - - # greetd display manager - programs.hyprland.enable = true; - services.greetd = { - enable = true; - settings = { - terminal.vt = 1; - default_session = session; + user = username; }; - }; + in + lib.mkIf config.mods.greetd.enable ( + lib.optionalAttrs (options ? environment) { + services.xserver.displayManager.session = [ + { + manage = "desktop"; + name = "Hyprland"; + start = '' + ${lib.getExe pkgs.hyprland} & waitPID=$! + ''; + } + ]; - environment.etc."greetd/environments".text = '' - Hyprland - ''; + # greetd display manager + programs.hyprland.enable = true; + services.greetd = { + enable = true; + settings = { + terminal.vt = 1; + default_session = session; + }; + }; - # should technically be the same, but this is configured instead in order to provide a decent out of the box login experience. - environment.etc."greetd/hyprgreet.conf".text = '' - exec-once=gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' + environment.etc."greetd/environments".text = '' + Hyprland + ''; - monitor=${config.mods.greetd.monitor},${config.mods.greetd.resolution},0x0,${config.mods.greetd.scale} - monitor=,disable + # should technically be the same, but this is configured instead in order to provide a decent out of the box login experience. + environment.etc."greetd/hyprgreet.conf".text = '' + exec-once=gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' - input { - kb_layout = ${config.mods.xkb.layout} - kb_variant = ${config.mods.xkb.variant} - force_no_accel = true + monitor=${config.mods.greetd.monitor},${config.mods.greetd.resolution},0x0,${config.mods.greetd.scale} + monitor=,disable + + input { + kb_layout = ${config.mods.xkb.layout} + kb_variant = ${config.mods.xkb.variant} + force_no_accel = true + } + + cursor { + enable_hyprcursor = false + } + + misc { + disable_splash_rendering = false + disable_hyprland_logo = false + } + + env=XCURSOR_THEME,${config.mods.stylix.cursor.name} + env=XCURSOR_SIZE,${config.mods.stylix.cursor.size} + + exec-once=regreet --style /home/${username}/.config/gtk-3.0/gtk.css; hyprctl dispatch exit + ''; + + # unlock GPG keyring on login + security.pam.services.greetd.enableGnomeKeyring = true; } - - misc { - disable_splash_rendering = false - disable_hyprland_logo = false - } - - exec-once=regreet --style /home/${username}/.config/gtk-3.0/gtk.css; hyprctl dispatch exit - ''; - - # unlock GPG keyring on login - security.pam.services.greetd.enableGnomeKeyring = true; - }); + ); } diff --git a/modules/programs/home_packages.nix b/modules/programs/home_packages.nix index e5ba917..e072514 100644 --- a/modules/programs/home_packages.nix +++ b/modules/programs/home_packages.nix @@ -1,4 +1,12 @@ -{ lib, options, config, pkgs, inputs, ... }: { +{ + lib, + options, + config, + pkgs, + inputs, + ... +}: +{ options.mods.home_packages = { enable = lib.mkOption { default = true; @@ -16,71 +24,76 @@ ''; }; }; - config = (lib.optionalAttrs (options ? home.packages) { - home.packages = config.mods.home_packages.additional_packages; - } // (lib.mkIf config.mods.home_packages.enable - (lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ - nheko - nextcloud-client - xournalpp - vesktop - kitty - ripgrep - # TODO add fcp once fixed.... - rm-improved - bat - fd - lsd - (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) - noto-fonts - flatpak - networkmanager - zoxide - fastfetch - gnome-keyring - dbus - killall - adw-gtk3 - qt5ct - qt6ct - gnutar - nix-index - libnotify - zenith - nh - amberol - pulseaudio - playerctl - ncspot - poppler_utils - brave - greetd.regreet - flake-checker - ffmpeg - system-config-printer - brightnessctl - ]; - - xdg.configFile."direnv/direnv.toml".source = - (pkgs.formats.toml { }).generate "direnv" { - global = { warn_timeout = "-1s"; }; - }; - - #my own programs - programs = { - hyprdock.enable = true; - oxicalc.enable = true; - ReSet.enable = true; - ReSet.config.plugins = [ - inputs.reset-plugins.packages."x86_64-linux".monitor - inputs.reset-plugins.packages."x86_64-linux".keyboard + config = ( + lib.optionalAttrs (options ? home.packages) { + home.packages = config.mods.home_packages.additional_packages; + } + // (lib.mkIf config.mods.home_packages.enable ( + lib.optionalAttrs (options ? home.packages) { + home.packages = with pkgs; [ + nheko + nextcloud-client + xournalpp + vesktop + kitty + ripgrep + # TODO add fcp once fixed.... + rm-improved + bat + fd + lsd + (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) + noto-fonts + flatpak + networkmanager + zoxide + fastfetch + gnome-keyring + dbus + killall + adw-gtk3 + qt5ct + qt6ct + gnutar + nix-index + libnotify + zenith + nh + amberol + pulseaudio + playerctl + ncspot + poppler_utils + brave + greetd.regreet + flake-checker + ffmpeg + system-config-printer + brightnessctl ]; - ReSet.config.plugin_config = { - Keyboard = { - path = "/home/${config.conf.username}/.config/reset/keyboard.conf"; + + xdg.configFile."direnv/direnv.toml".source = (pkgs.formats.toml { }).generate "direnv" { + global = { + warn_timeout = "-1s"; }; }; - }; - }))); + + #my own programs + programs = { + hyprdock.enable = true; + oxicalc.enable = true; + ReSet.enable = true; + ReSet.config.plugins = [ + inputs.reset-plugins.packages."x86_64-linux".monitor + inputs.reset-plugins.packages."x86_64-linux".keyboard + ]; + ReSet.config.plugin_config = { + Keyboard = { + path = "/home/${config.conf.username}/.config/reset/keyboard.conf"; + }; + }; + }; + } + )) + ); } diff --git a/modules/programs/hyprland/anyrun.nix b/modules/programs/hyprland/anyrun.nix index effa53d..33c38f7 100644 --- a/modules/programs/hyprland/anyrun.nix +++ b/modules/programs/hyprland/anyrun.nix @@ -1,4 +1,12 @@ -{ lib, config, pkgs, options, inputs, ... }: { +{ + lib, + config, + pkgs, + options, + inputs, + ... +}: +{ options.mods = { hyprland.anyrun = { enable = lib.mkOption { @@ -10,8 +18,8 @@ }; }; - config = lib.mkIf config.mods.hyprland.anyrun.enable - (lib.optionalAttrs (options ? programs.anyrun) { + config = lib.mkIf config.mods.hyprland.anyrun.enable ( + lib.optionalAttrs (options ? programs.anyrun) { programs.anyrun = { enable = true; config = { @@ -23,8 +31,12 @@ ]; #position = "center"; hideIcons = false; - width = { fraction = 0.3; }; - y = { fraction = 0.5; }; + width = { + fraction = 0.3; + }; + y = { + fraction = 0.5; + }; layer = "overlay"; hidePluginInfo = true; closeOnClick = true; @@ -79,5 +91,6 @@ } ''; }; - }); + } + ); } diff --git a/modules/programs/hyprland/hyprland.nix b/modules/programs/hyprland/hyprland.nix index f20b456..44e4bb6 100644 --- a/modules/programs/hyprland/hyprland.nix +++ b/modules/programs/hyprland/hyprland.nix @@ -1,4 +1,11 @@ -{ config, lib, options, pkgs, ... }: { +{ + config, + lib, + options, + pkgs, + ... +}: +{ options.mods = { hyprland = { enable = lib.mkOption { @@ -61,8 +68,8 @@ }; }; - config = lib.mkIf config.mods.hyprland.enable - (lib.optionalAttrs (options ? wayland.windowManager.hyprland) { + config = lib.mkIf config.mods.hyprland.enable ( + lib.optionalAttrs (options ? wayland.windowManager.hyprland) { # install Hyprland related packages home.packages = with pkgs; [ xorg.xprop @@ -82,15 +89,16 @@ lib.mkIf config.mods.hyprland.use_default_config { "$mod" = "SUPER"; - bindm = - [ "$mod, mouse:272, movewindow" "$mod, mouse:273, resizewindow" ]; + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; 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'' + ''$mod SUPERSHIFTALT,S,exec,grim -c -g "2560,0 3440x1440" - | wl-copy'' # regular programs "$mod SUPER,F,exec,firefox" @@ -108,19 +116,14 @@ "$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate" # media keys - (lib.mkIf config.mods.scripts.audio-control - ",XF86AudioMute,exec, audio-control mute") - (lib.mkIf config.mods.scripts.audio-control - ",XF86AudioLowerVolume,exec, audio-control sink -5%") - (lib.mkIf config.mods.scripts.audio-control - ",XF86AudioRaiseVolume,exec, audio-control sink +5%") + (lib.mkIf config.mods.scripts.audio-control ",XF86AudioMute,exec, audio-control mute") + (lib.mkIf config.mods.scripts.audio-control ",XF86AudioLowerVolume,exec, audio-control sink -5%") + (lib.mkIf config.mods.scripts.audio-control ",XF86AudioRaiseVolume,exec, audio-control sink +5%") ",XF86AudioPlay,exec, playerctl play-pause" ",XF86AudioNext,exec, playerctl next" ",XF86AudioPrev,exec, playerctl previous" - (lib.mkIf config.mods.scripts.change-brightness - ",XF86MonBrightnessDown,exec, change-brightness brightness 10%-") - (lib.mkIf config.mods.scripts.change-brightness - ",XF86MonBrightnessUp,exec, change-brightness brightness +10%") + (lib.mkIf config.mods.scripts.change-brightness ",XF86MonBrightnessDown,exec, change-brightness brightness 10%-") + (lib.mkIf config.mods.scripts.change-brightness ",XF86MonBrightnessUp,exec, change-brightness brightness +10%") # hyprland keybinds # misc @@ -199,13 +202,14 @@ general = { gaps_out = "3,5,5,5"; border_size = 3; - "col.active_border" = - lib.mkForce "0xFFFF0000 0xFF00FF00 0xFF0000FF 45deg"; + "col.active_border" = lib.mkForce "0xFFFF0000 0xFF00FF00 0xFF0000FF 45deg"; # "col.inactive_border" = "0x66333333"; allow_tearing = lib.mkIf config.mods.hyprland.no_atomic true; }; - decoration = { rounding = 4; }; + decoration = { + rounding = 4; + }; animations = { bezier = "penguin,0.05,0.9,0.1,1.0"; @@ -254,7 +258,9 @@ # no_break_fs_vrr = true; }; - gestures = { workspace_swipe = true; }; + gestures = { + workspace_swipe = true; + }; monitor = config.mods.hyprland.monitor; workspace = config.mods.hyprland.workspace; @@ -265,10 +271,10 @@ "XDG_CURRENT_DESKTOP=Hyprland" "XDG_SESSION_TYPE=wayland" "XDG_SESSION_DESKTOP=Hyprland" - "HYPRCURSOR_THEME,Bibata-Modern-Classic" - "HYPRCURSOR_SIZE,24" - "XCURSOR_THEME,Bibata-Modern-Classic" - "XCURSOR_SIZE,24" + "HYPRCURSOR_THEME,${config.mods.stylix.cursor.name}" + "HYPRCURSOR_SIZE,${config.mods.stylix.cursor.size}" + "XCURSOR_THEME,${config.mods.stylix.cursor.name}" + "XCURSOR_SIZE,${config.mods.stylix.cursor.size}" "QT_QPA_PLATFORM,wayland" "QT_QPA_PLATFORMTHEME,qt5ct" "QT_WAYLAND_FORCE_DPI,96" @@ -282,8 +288,7 @@ (lib.mkIf config.mods.nvidia.enable "LIBVA_DRIVER_NAME,nvidia") (lib.mkIf config.mods.nvidia.enable "XDG_SESSION_TYPE,wayland") (lib.mkIf config.mods.nvidia.enable "GBM_BACKEND,nvidia-drm") - (lib.mkIf config.mods.nvidia.enable - "__GLX_VENDOR_LIBRARY_NAME,nvidia") + (lib.mkIf config.mods.nvidia.enable "__GLX_VENDOR_LIBRARY_NAME,nvidia") ]; layerrule = [ @@ -338,9 +343,11 @@ # ]; # }; # }; - } // config.mods.hyprland.custom_config; + } + // config.mods.hyprland.custom_config; # wayland.windowManager.hyprland.plugins = [ # inputs.Hyprspace.packages.${pkgs.system}.Hyprspace # ]; - }); + } + ); } diff --git a/modules/programs/hyprland/hyprlock.nix b/modules/programs/hyprland/hyprlock.nix index d6e728e..091bb9e 100644 --- a/modules/programs/hyprland/hyprlock.nix +++ b/modules/programs/hyprland/hyprlock.nix @@ -1,4 +1,11 @@ -{ config, lib, options, pkgs, ... }: { +{ + config, + lib, + options, + pkgs, + ... +}: +{ options.mods = { hyprland.hyprlock = { enable = lib.mkOption { @@ -10,33 +17,40 @@ }; }; - config = lib.mkIf config.mods.hyprland.hyprlock.enable - (lib.optionalAttrs (options ? xdg.configFile) { + config = lib.mkIf config.mods.hyprland.hyprlock.enable ( + lib.optionalAttrs (options ? xdg.configFile) { home.packages = with pkgs; [ hyprlock ]; programs.hyprlock = lib.mkIf config.mods.hyprland.hyprlock.enable { enable = true; settings = { - background = [{ - monitor = ""; - path = ""; - color = "rgba(26, 27, 38, 1.0)"; - }]; + background = [ + { + monitor = ""; + path = ""; + color = "rgba(26, 27, 38, 1.0)"; + } + ]; - input-field = [{ - monitor = "${config.conf.monitor}"; + input-field = [ + { + monitor = "${config.conf.monitor}"; - placeholder_text = "password or something"; - }]; + placeholder_text = "password or something"; + } + ]; - label = [{ - monitor = "${config.conf.monitor}"; - text = "$TIME"; - font_size = 50; - position = "0, 200"; - valign = "center"; - halign = "center"; - }]; + label = [ + { + monitor = "${config.conf.monitor}"; + text = "$TIME"; + font_size = 50; + position = "0, 200"; + valign = "center"; + halign = "center"; + } + ]; }; }; - }); + } + ); } diff --git a/modules/programs/hyprland/hyprpaper.nix b/modules/programs/hyprland/hyprpaper.nix index ebf923c..d6eff04 100644 --- a/modules/programs/hyprland/hyprpaper.nix +++ b/modules/programs/hyprland/hyprpaper.nix @@ -1,4 +1,11 @@ -{ config, lib, options, pkgs, ... }: { +{ + config, + lib, + options, + pkgs, + ... +}: +{ options.mods = { hyprland.hyprpaper = { enable = lib.mkOption { @@ -20,12 +27,12 @@ }; }; - config = lib.mkIf config.mods.hyprland.hyprpaper.enable - (lib.optionalAttrs (options ? xdg.configFile) { + config = lib.mkIf config.mods.hyprland.hyprpaper.enable ( + lib.optionalAttrs (options ? xdg.configFile) { home.packages = with pkgs; [ hyprpaper ]; - xdg.configFile."hypr/hyprpaper.conf" = - lib.mkIf config.mods.hyprland.hyprpaper.enable { - text = config.mods.hyprland.hyprpaper.config; - }; - }); + xdg.configFile."hypr/hyprpaper.conf" = lib.mkIf config.mods.hyprland.hyprpaper.enable { + text = config.mods.hyprland.hyprpaper.config; + }; + } + ); } diff --git a/modules/programs/hyprland/ironbar.nix b/modules/programs/hyprland/ironbar.nix index 0c36283..dabf38f 100644 --- a/modules/programs/hyprland/ironbar.nix +++ b/modules/programs/hyprland/ironbar.nix @@ -1,6 +1,14 @@ -{ lib, config, pkgs, options, ... }: -let username = config.conf.username; -in { +{ + lib, + config, + pkgs, + options, + ... +}: +let + username = config.conf.username; +in +{ options.mods = { hyprland.ironbar = { enable = lib.mkOption { @@ -11,8 +19,8 @@ in { }; }; }; - config = lib.mkIf config.mods.hyprland.ironbar.enable - (lib.optionalAttrs (options ? programs.ironbar) { + config = lib.mkIf config.mods.hyprland.ironbar.enable ( + lib.optionalAttrs (options ? programs.ironbar) { programs.ironbar = { enable = true; @@ -164,78 +172,78 @@ in { } { type = "custom"; - bar = [{ - type = "button"; - class = "popup-button"; - label = ""; - on_click = "popup:toggle"; - }]; + bar = [ + { + type = "button"; + class = "popup-button"; + label = ""; + on_click = "popup:toggle"; + } + ]; class = "popup-button-box"; - popup = [{ - type = "box"; - orientation = "vertical"; - class = "audio-box"; - widgets = [ - { - type = "box"; - orientation = "horizontal"; - widgets = [ - { - type = "button"; - class = "audio-button"; - label = ""; - on_click = - "!/home/${username}/.config/eww/scripts/audio_control.sh bluetooth"; - } - { - type = "button"; - class = "audio-button"; - label = "󰋋"; - on_click = - "!/home/${username}/.config/eww/scripts/audio_control.sh internal"; - } - ]; - class = "audio-button-box"; - } - { - type = "label"; - label = "Output"; - } - { - type = "slider"; - class = "audio-slider"; - step = 1.0; - length = 200; - value = - "pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; - on_change = "!pactl set-sink-volume @DEFAULT_SINK@ $0%"; - } - { - type = "label"; - label = "Input"; - } - { - type = "slider"; - class = "audio-slider"; - step = 1.0; - length = 200; - value = - "pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; - on_change = - "!pactl set-source-volume @DEFAULT_SOURCE@ $0%"; - } - ]; - }]; + popup = [ + { + type = "box"; + orientation = "vertical"; + class = "audio-box"; + widgets = [ + { + type = "box"; + orientation = "horizontal"; + widgets = [ + { + type = "button"; + class = "audio-button"; + label = ""; + on_click = "!/home/${username}/.config/eww/scripts/audio_control.sh bluetooth"; + } + { + type = "button"; + class = "audio-button"; + label = "󰋋"; + on_click = "!/home/${username}/.config/eww/scripts/audio_control.sh internal"; + } + ]; + class = "audio-button-box"; + } + { + type = "label"; + label = "Output"; + } + { + type = "slider"; + class = "audio-slider"; + step = 1.0; + length = 200; + value = "pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; + on_change = "!pactl set-sink-volume @DEFAULT_SINK@ $0%"; + } + { + type = "label"; + label = "Input"; + } + { + type = "slider"; + class = "audio-slider"; + step = 1.0; + length = 200; + value = "pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; + on_change = "!pactl set-source-volume @DEFAULT_SOURCE@ $0%"; + } + ]; + } + ]; } { type = "custom"; - bar = [{ - type = "button"; - class = "popup-button"; - label = ""; - on_click = - "!oxidash --css /home/${username}/gits/oxidash/style.css"; - }]; + bar = [ + { + type = "button"; + class = "popup-button"; + label = ""; + on_click = "!oxidash --css /home/${username}/gits/oxidash/style.css"; + } + ]; class = "popup-button-box"; } { @@ -249,19 +257,24 @@ in { position = "top"; height = 10; anchor_to_edges = true; - start = [{ - type = "workspaces"; - all_monitors = true; - }]; - center = [{ - type = "focused"; - show_icon = true; - show_title = true; - icon_size = 20; - truncate = "end"; - }]; + start = [ + { + type = "workspaces"; + all_monitors = true; + } + ]; + center = [ + { + type = "focused"; + show_icon = true; + show_title = true; + icon_size = 20; + truncate = "end"; + } + ]; }; }; }; - }); + } + ); } diff --git a/modules/programs/kde_connect.nix b/modules/programs/kde_connect.nix index 6a4cae7..153a149 100644 --- a/modules/programs/kde_connect.nix +++ b/modules/programs/kde_connect.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods = { kde_connect.enable = lib.mkOption { @@ -11,21 +18,25 @@ }; }; - config = lib.mkIf config.mods.kde_connect.enable - (lib.optionalAttrs (options ? networking.firewall) { + config = lib.mkIf config.mods.kde_connect.enable ( + lib.optionalAttrs (options ? networking.firewall) { networking.firewall = { - allowedTCPPortRanges = [{ - from = 1714; - to = 1764; - } # KDE Connect - ]; - allowedUDPPortRanges = [{ - from = 1714; - to = 1764; - } # KDE Connect - ]; + allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } + # KDE Connect + ]; + allowedUDPPortRanges = [ + { + from = 1714; + to = 1764; + } + # KDE Connect + ]; }; - } // lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ kdeconnect ]; - }); + } + // lib.optionalAttrs (options ? home.packages) { home.packages = with pkgs; [ kdeconnect ]; } + ); } diff --git a/modules/programs/keepassxc.nix b/modules/programs/keepassxc.nix index 6a52fe6..fa7f24e 100644 --- a/modules/programs/keepassxc.nix +++ b/modules/programs/keepassxc.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.keepassxc = { enable = lib.mkOption { default = true; @@ -10,8 +17,7 @@ default = true; example = false; type = lib.types.bool; - description = - "Whether to overwrite the cache config of keepassxc. Note, this means that changes can't be applied via the program anymore!"; + description = "Whether to overwrite the cache config of keepassxc. Note, this means that changes can't be applied via the program anymore!"; }; cache_config = lib.mkOption { default = '' @@ -26,8 +32,8 @@ description = "Cache config to be used."; }; }; - config = lib.mkIf config.mods.keepassxc.enable - (lib.optionalAttrs (options ? home.file) { + config = lib.mkIf config.mods.keepassxc.enable ( + lib.optionalAttrs (options ? home.file) { home.packages = [ pkgs.keepassxc ]; xdg.configFile."keepassxc/keepassxc.ini" = { text = '' @@ -53,9 +59,9 @@ ''; }; - home.file.".cache/keepassxc/keepassxc.ini" = - lib.mkIf config.mods.keepassxc.use_cache_config { - text = config.mods.keepassxc.cache_config; - }; - }); + home.file.".cache/keepassxc/keepassxc.ini" = lib.mkIf config.mods.keepassxc.use_cache_config { + text = config.mods.keepassxc.cache_config; + }; + } + ); } diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index 07224c9..b7bac45 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, inputs, ... }: +{ + lib, + config, + options, + pkgs, + inputs, + ... +}: let base16 = pkgs.callPackage inputs.base16.lib { }; scheme = (base16.mkSchemeAttrs config.stylix.base16Scheme); @@ -20,12 +27,14 @@ let "e" = "d"; "f" = "e"; }; - base = "#" + lib.strings.concatStrings - ((lib.lists.take 5 (lib.strings.stringToCharacters scheme.base00)) ++ [ - hexTable."${(lib.lists.last - (lib.strings.stringToCharacters scheme.base00))}" - ]); -in { + base = + "#" + + lib.strings.concatStrings ( + (lib.lists.take 5 (lib.strings.stringToCharacters scheme.base00)) + ++ [ hexTable."${(lib.lists.last (lib.strings.stringToCharacters scheme.base00))}" ] + ); +in +{ options.mods.kitty = { enable = lib.mkOption { default = true; @@ -34,9 +43,11 @@ in { description = "Enables kitty"; }; }; - config = lib.mkIf config.mods.kitty.enable - (lib.optionalAttrs (options ? home.packages) { - stylix.targets.kitty = { enable = false; }; + config = lib.mkIf config.mods.kitty.enable ( + lib.optionalAttrs (options ? home.packages) { + stylix.targets.kitty = { + enable = false; + }; programs.kitty = { enable = true; settings = { @@ -89,6 +100,6 @@ in { }; }; - }); + } + ); } - diff --git a/modules/programs/layout.nix b/modules/programs/layout.nix index 3ca2443..c0e162c 100644 --- a/modules/programs/layout.nix +++ b/modules/programs/layout.nix @@ -1,4 +1,10 @@ -{ lib, options, config, ... }: { +{ + lib, + options, + config, + ... +}: +{ options.mods.xkb = { layout = lib.mkOption { default = "dashie"; @@ -13,11 +19,13 @@ description = "Your variant"; }; }; - config = (lib.optionalAttrs (options ? services.xserver) { - # Configure keymap in X11 - services.xserver = { - xkb.layout = "${config.mods.xkb.layout}"; - xkb.variant = "${config.mods.xkb.variant}"; - }; - }); + config = ( + lib.optionalAttrs (options ? services.xserver) { + # Configure keymap in X11 + services.xserver = { + xkb.layout = "${config.mods.xkb.layout}"; + xkb.variant = "${config.mods.xkb.variant}"; + }; + } + ); } diff --git a/modules/programs/media.nix b/modules/programs/media.nix index b115fbf..5530ff4 100644 --- a/modules/programs/media.nix +++ b/modules/programs/media.nix @@ -1,4 +1,11 @@ -{ lib, options, config, pkgs, ... }: { +{ + lib, + options, + config, + pkgs, + ... +}: +{ options.mods.media_packages = { enable = lib.mkOption { default = true; @@ -16,38 +23,42 @@ ''; }; }; - config = (lib.optionalAttrs (options ? home.packages) { - home.packages = config.mods.media_packages.additional_packages; - } // (lib.mkIf config.mods.media_packages.enable - (lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ - # base audio - pipewire - wireplumber - # audio control - playerctl - # images - imv - # videos - mpv - # pdf - zathura - evince - libreoffice-fresh - onlyoffice-bin - pdftk - pdfpc - polylux2pdfpc - # spotify - # video editing - kdenlive - # image creation - inkscape - gimp - krita - yt-dlp - ]; - programs.obs-studio.enable = true; - programs.obs-studio.plugins = with pkgs; [ obs-studio-plugins.obs-vaapi ]; - }))); + config = ( + lib.optionalAttrs (options ? home.packages) { + home.packages = config.mods.media_packages.additional_packages; + } + // (lib.mkIf config.mods.media_packages.enable ( + lib.optionalAttrs (options ? home.packages) { + home.packages = with pkgs; [ + # base audio + pipewire + wireplumber + # audio control + playerctl + # images + imv + # videos + mpv + # pdf + zathura + evince + libreoffice-fresh + onlyoffice-bin + pdftk + pdfpc + polylux2pdfpc + # spotify + # video editing + kdenlive + # image creation + inkscape + gimp + krita + yt-dlp + ]; + programs.obs-studio.enable = true; + programs.obs-studio.plugins = with pkgs; [ obs-studio-plugins.obs-vaapi ]; + } + )) + ); } diff --git a/modules/programs/ncspot.nix b/modules/programs/ncspot.nix index a7a62fc..98dfe96 100644 --- a/modules/programs/ncspot.nix +++ b/modules/programs/ncspot.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.ncspot = { enable = lib.mkOption { default = false; @@ -7,45 +14,45 @@ description = "Enables ncspot with a config"; }; }; - config = lib.mkIf config.mods.ncspot.enable - (lib.optionalAttrs (options ? home.packages) { + config = lib.mkIf config.mods.ncspot.enable ( + lib.optionalAttrs (options ? home.packages) { home.packages = with pkgs; [ ncspot ]; - xdg.configFile."ncspot/config.toml".source = - (pkgs.formats.toml { }).generate "ncspot" { - notify = true; - shuffle = true; - cover_max_scale = 2; - initial_screen = "library"; - library_tabs = [ "playlists" ]; - theme = { - background = "#1a1b26"; - primary = "#9aa5ce"; - secondary = "#414868"; - title = "#9ece6a"; - playing = "#7aa2f7"; - playing_selected = "#bb9af7"; - playing_bg = "#24283b"; - highlight = "#c0caf5"; - highlight_bg = "#24283b"; - error = "#414868"; - error_bg = "#f7768e"; - statusbar = "#ff9e64"; - statusbar_progress = "#7aa2f7"; - statusbar_bg = "#1a1b26"; - cmdline = "#c0caf5"; - cmdline_bg = "#24283b"; - search_match = "#f7768e"; - }; - keybindings = { - "j" = "move left 1"; - "k" = "move down 1"; - "l" = "move up 1"; - ";" = "move right 1"; - }; - notification_format = { - title = "%artists"; - body = "%title"; - }; + xdg.configFile."ncspot/config.toml".source = (pkgs.formats.toml { }).generate "ncspot" { + notify = true; + shuffle = true; + cover_max_scale = 2; + initial_screen = "library"; + library_tabs = [ "playlists" ]; + theme = { + background = "#1a1b26"; + primary = "#9aa5ce"; + secondary = "#414868"; + title = "#9ece6a"; + playing = "#7aa2f7"; + playing_selected = "#bb9af7"; + playing_bg = "#24283b"; + highlight = "#c0caf5"; + highlight_bg = "#24283b"; + error = "#414868"; + error_bg = "#f7768e"; + statusbar = "#ff9e64"; + statusbar_progress = "#7aa2f7"; + statusbar_bg = "#1a1b26"; + cmdline = "#c0caf5"; + cmdline_bg = "#24283b"; + search_match = "#f7768e"; }; - }); + keybindings = { + "j" = "move left 1"; + "k" = "move down 1"; + "l" = "move up 1"; + ";" = "move right 1"; + }; + notification_format = { + title = "%artists"; + body = "%title"; + }; + }; + } + ); } diff --git a/modules/programs/nextcloud.nix b/modules/programs/nextcloud.nix index 0b90c58..ab2333a 100644 --- a/modules/programs/nextcloud.nix +++ b/modules/programs/nextcloud.nix @@ -1,4 +1,5 @@ -{ lib, ... }: { +{ lib, ... }: +{ options.mods = { nextcloud = { enable = lib.mkOption { @@ -21,11 +22,13 @@ }; synclist = lib.mkOption { default = [ ]; - example = [{ - name = "sync globi folder"; - remote = "globi"; - local = "/home/globi"; - }]; + example = [ + { + name = "sync globi folder"; + remote = "globi"; + local = "/home/globi"; + } + ]; description = '' A list of folders to synchronize. This has to be an attribute list with the name, remote and local field (all strings). diff --git a/modules/programs/oxi/default.nix b/modules/programs/oxi/default.nix index 269d1fa..7dee3fd 100644 --- a/modules/programs/oxi/default.nix +++ b/modules/programs/oxi/default.nix @@ -1,5 +1,17 @@ -{ lib, config, options, inputs, ... }: { - imports = [ ./oxidash.nix ./oxinoti.nix ./oxishut.nix ./oxipaste.nix ]; +{ + lib, + config, + options, + inputs, + ... +}: +{ + imports = [ + ./oxidash.nix + ./oxinoti.nix + ./oxishut.nix + ./oxipaste.nix + ]; options.mods.oxi = { enable = lib.mkOption { default = true; @@ -32,8 +44,8 @@ }; }; }; - config = lib.mkIf config.mods.oxi.enable - (lib.optionalAttrs (options ? home.packages) { + config = lib.mkIf config.mods.oxi.enable ( + lib.optionalAttrs (options ? home.packages) { programs = { hyprdock.enable = lib.mkIf config.mods.oxi.hyprdock.enable true; oxicalc.enable = lib.mkIf config.mods.oxi.oxicalc.enable true; @@ -46,12 +58,12 @@ ]; plugin_config = { Keyboard = { - path = - "/home/${config.conf.username}/.config/reset/keyboard.conf"; + path = "/home/${config.conf.username}/.config/reset/keyboard.conf"; }; }; }; }; }; - }); + } + ); } diff --git a/modules/programs/oxi/oxidash.nix b/modules/programs/oxi/oxidash.nix index dfcf188..03cb684 100644 --- a/modules/programs/oxi/oxidash.nix +++ b/modules/programs/oxi/oxidash.nix @@ -1,4 +1,10 @@ -{ lib, config, options, ... }: { +{ + lib, + config, + options, + ... +}: +{ options.mods.oxi.oxidash = { enable = lib.mkOption { default = true; @@ -7,8 +13,8 @@ description = "Enables and configures oxidash"; }; }; - config = lib.mkIf (config.mods.oxi.oxidash.enable && config.mods.oxi.enable) - (lib.optionalAttrs (options ? xdg.configFile) { + config = lib.mkIf (config.mods.oxi.oxidash.enable && config.mods.oxi.enable) ( + lib.optionalAttrs (options ? xdg.configFile) { programs.oxidash.enable = true; xdg.configFile."oxidash/style.css" = { text = '' @@ -60,5 +66,6 @@ } ''; }; - }); + } + ); } diff --git a/modules/programs/oxi/oxinoti.nix b/modules/programs/oxi/oxinoti.nix index 5b9cfc9..188ec11 100644 --- a/modules/programs/oxi/oxinoti.nix +++ b/modules/programs/oxi/oxinoti.nix @@ -1,4 +1,10 @@ -{ lib, config, options, ... }: { +{ + lib, + config, + options, + ... +}: +{ options.mods.oxi.oxinoti = { enable = lib.mkOption { default = true; @@ -7,8 +13,8 @@ description = "Enables and configures oxinoti"; }; }; - config = lib.mkIf (config.mods.oxi.oxinoti.enable && config.mods.oxi.enable) - (lib.optionalAttrs (options ? xdg.configFile) { + config = lib.mkIf (config.mods.oxi.oxinoti.enable && config.mods.oxi.enable) ( + lib.optionalAttrs (options ? xdg.configFile) { programs.oxinoti.enable = true; xdg.configFile."oxinoti/style.css" = { text = # css @@ -100,5 +106,6 @@ dnd_override = 2 ''; }; - }); + } + ); } diff --git a/modules/programs/oxi/oxipaste.nix b/modules/programs/oxi/oxipaste.nix index c6783e4..aa4af70 100644 --- a/modules/programs/oxi/oxipaste.nix +++ b/modules/programs/oxi/oxipaste.nix @@ -1,4 +1,10 @@ -{ lib, config, options, ... }: { +{ + lib, + config, + options, + ... +}: +{ options.mods.oxi.oxipaste = { enable = lib.mkOption { default = true; @@ -7,8 +13,8 @@ description = "Enables and configures oxipaste"; }; }; - config = lib.mkIf (config.mods.oxi.oxipaste.enable && config.mods.oxi.enable) - (lib.optionalAttrs (options ? xdg.configFile) { + config = lib.mkIf (config.mods.oxi.oxipaste.enable && config.mods.oxi.enable) ( + lib.optionalAttrs (options ? xdg.configFile) { programs.oxipaste.enable = true; xdg.configFile."oxipaste/style.css" = { text = '' @@ -38,5 +44,6 @@ } ''; }; - }); + } + ); } diff --git a/modules/programs/oxi/oxishut.nix b/modules/programs/oxi/oxishut.nix index 3dc0900..466be06 100644 --- a/modules/programs/oxi/oxishut.nix +++ b/modules/programs/oxi/oxishut.nix @@ -1,4 +1,10 @@ -{ lib, config, options, ... }: { +{ + lib, + config, + options, + ... +}: +{ options.mods.oxi.oxishut = { enable = lib.mkOption { default = true; @@ -7,8 +13,8 @@ description = "Enables and configures oxishut"; }; }; - config = lib.mkIf (config.mods.oxi.oxishut.enable && config.mods.oxi.enable) - (lib.optionalAttrs (options ? xdg.configFile) { + config = lib.mkIf (config.mods.oxi.oxishut.enable && config.mods.oxi.enable) ( + lib.optionalAttrs (options ? xdg.configFile) { programs.oxishut.enable = true; xdg.configFile."oxishut/style.css" = { text = '' @@ -32,5 +38,6 @@ } ''; }; - }); + } + ); } diff --git a/modules/programs/piper.nix b/modules/programs/piper.nix index 4c47628..dac9ece 100644 --- a/modules/programs/piper.nix +++ b/modules/programs/piper.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.piper = { enable = lib.mkOption { default = false; @@ -7,10 +14,8 @@ description = "Enables the piper program and its daemon"; }; }; - config = lib.mkIf config.mods.piper.enable - (lib.optionalAttrs (options ? services.ratbagd) { - services.ratbagd.enable = true; - } // lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ piper ]; - }); + config = lib.mkIf config.mods.piper.enable ( + lib.optionalAttrs (options ? services.ratbagd) { services.ratbagd.enable = true; } + // lib.optionalAttrs (options ? home.packages) { home.packages = with pkgs; [ piper ]; } + ); } diff --git a/modules/programs/printing.nix b/modules/programs/printing.nix index 963de3b..80144b8 100644 --- a/modules/programs/printing.nix +++ b/modules/programs/printing.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.printing = { enable = lib.mkOption { default = true; @@ -7,8 +14,8 @@ description = "Enables the piper program and its daemon"; }; }; - config = lib.mkIf config.mods.printing.enable - (lib.optionalAttrs (options ? services.printing) { + config = lib.mkIf config.mods.printing.enable ( + lib.optionalAttrs (options ? services.printing) { # Enable CUPS to print documents. services.printing.enable = true; services.printing.browsing = true; @@ -19,5 +26,6 @@ nssmdns4 = true; openFirewall = true; }; - }); + } + ); } diff --git a/modules/programs/scripts.nix b/modules/programs/scripts.nix index 719ec5d..8a3889e 100644 --- a/modules/programs/scripts.nix +++ b/modules/programs/scripts.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.scripts = { change-brightness = lib.mkOption { default = true; @@ -15,106 +22,109 @@ scripts = lib.mkOption { default = [ ]; example = [ ]; - description = - "More scripts to be passed. (check existing ones for types and examples)"; + description = "More scripts to be passed. (check existing ones for types and examples)"; }; }; - config = (lib.optionalAttrs (options ? home.packages) { - home.packages = [ - (lib.mkIf config.mods.scripts.change-brightness - (pkgs.writeShellScriptBin "change-brightness" '' - set_brightness() { - brightnessctl set "$1" - CURRENT=$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}') - dunstify -a "changeBrightness" -r 3 -u low -i brightness-high -h int:value:"$CURRENT" "Brightness: ''${CURRENT}%" - } + config = ( + lib.optionalAttrs (options ? home.packages) { + home.packages = [ + (lib.mkIf config.mods.scripts.change-brightness ( + pkgs.writeShellScriptBin "change-brightness" '' + set_brightness() { + brightnessctl set "$1" + CURRENT=$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}') + dunstify -a "changeBrightness" -r 3 -u low -i brightness-high -h int:value:"$CURRENT" "Brightness: ''${CURRENT}%" + } - if [ "$1" == "brightness" ]; then - set_brightness "$2" - fi - '')) - (lib.mkIf config.mods.scripts.audio-control - (pkgs.writeShellScriptBin "audio-control" '' - ncspot() { - NUM=$(pactl list clients short | rg "ncspot" | awk -F 'PipeWire' ' { print $1 } ' | tr -d ' \t\n') - CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n') - pactl set-sink-input-volume "$CHANGE" "$1" - VOLUME=$(pactl list sink-inputs | rg "$NUM" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%') - notify-send -a "ncspot" -r 990 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Spotify Volume: ''${VOLUME}%" - } + if [ "$1" == "brightness" ]; then + set_brightness "$2" + fi + '' + )) + (lib.mkIf config.mods.scripts.audio-control ( + pkgs.writeShellScriptBin "audio-control" '' + ncspot() { + NUM=$(pactl list clients short | rg "ncspot" | awk -F 'PipeWire' ' { print $1 } ' | tr -d ' \t\n') + CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n') + pactl set-sink-input-volume "$CHANGE" "$1" + VOLUME=$(pactl list sink-inputs | rg "$NUM" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%') + notify-send -a "ncspot" -r 990 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Spotify Volume: ''${VOLUME}%" + } - firefox() { - STRING=$(pactl list clients short | rg "firefox" | awk -F 'PipeWire' ' { print $1 "," } ' | tr -d ' \t\n') - # NUMS=',' read -r -a array <<< "$STRING" - readarray -td, NUMS <<<"$STRING" - declare -p NUMS - for index in "''${!NUMS[@]}"; do #"''${!array[@]}" - NUM=$(echo "''${NUMS[index]}" | tr -d ' \t\n') - CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n') - pactl set-sink-input-volume "$CHANGE" "$1" - done - VOLUME=$(pactl list sink-inputs | rg "''${NUMS[0]}" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%') - notify-send -a "Firefox" -r 991 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Firefox Volume: ''${VOLUME}%" - } + firefox() { + STRING=$(pactl list clients short | rg "firefox" | awk -F 'PipeWire' ' { print $1 "," } ' | tr -d ' \t\n') + # NUMS=',' read -r -a array <<< "$STRING" + readarray -td, NUMS <<<"$STRING" + declare -p NUMS + for index in "''${!NUMS[@]}"; do #"''${!array[@]}" + NUM=$(echo "''${NUMS[index]}" | tr -d ' \t\n') + CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n') + pactl set-sink-input-volume "$CHANGE" "$1" + done + VOLUME=$(pactl list sink-inputs | rg "''${NUMS[0]}" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%') + notify-send -a "Firefox" -r 991 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Firefox Volume: ''${VOLUME}%" + } - internal() { - SPEAKER=$(pactl list sinks | grep "Name" | grep "alsa" | awk -F ': ' '{ print $2 }') - if [ "$SPEAKER" != "" ]; then - pactl set-default-sink "$SPEAKER" - pactl set-sink-mute "$SPEAKER" false - DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ') - notify-send "changed audio to "$DEVICE" " - else - notify-send "failed, not available!" - fi - } + internal() { + SPEAKER=$(pactl list sinks | grep "Name" | grep "alsa" | awk -F ': ' '{ print $2 }') + if [ "$SPEAKER" != "" ]; then + pactl set-default-sink "$SPEAKER" + pactl set-sink-mute "$SPEAKER" false + DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ') + notify-send "changed audio to "$DEVICE" " + else + notify-send "failed, not available!" + fi + } - set_volume_sink() { - pactl set-sink-volume @DEFAULT_SINK@ "$1" - CURRENT=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %') - notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Output Volume: ''${CURRENT}%" - } + set_volume_sink() { + pactl set-sink-volume @DEFAULT_SINK@ "$1" + CURRENT=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %') + notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Output Volume: ''${CURRENT}%" + } - set_volume_source() { - pactl set-source-volume @DEFAULT_SOURCE@ "$1" - CURRENT=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %') - notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Input Volume: ''${CURRENT}%" - } + set_volume_source() { + pactl set-source-volume @DEFAULT_SOURCE@ "$1" + CURRENT=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %') + notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Input Volume: ''${CURRENT}%" + } - bluetooth() { - SPEAKER=$(pactl list sinks | grep "Name" | grep "blue" | awk -F ': ' '{ print $2 }') - if [ "$SPEAKER" != "" ]; then - pactl set-default-sink "$SPEAKER" - pactl set-sink-mute "$SPEAKER" false - DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ') - notify-send "changed audio to "$DEVICE" " - else - notify-send "failed, not available!" - fi - } + bluetooth() { + SPEAKER=$(pactl list sinks | grep "Name" | grep "blue" | awk -F ': ' '{ print $2 }') + if [ "$SPEAKER" != "" ]; then + pactl set-default-sink "$SPEAKER" + pactl set-sink-mute "$SPEAKER" false + DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ') + notify-send "changed audio to "$DEVICE" " + else + notify-send "failed, not available!" + fi + } - mute() { - pactl set-sink-mute @DEFAULT_SINK@ toggle - MUTE=$(pactl get-sink-mute @DEFAULT_SINK@) - notify-send -a "Audio" -r 994 -u low -i audio-volume-high "Audio: $MUTE" - } + mute() { + pactl set-sink-mute @DEFAULT_SINK@ toggle + MUTE=$(pactl get-sink-mute @DEFAULT_SINK@) + notify-send -a "Audio" -r 994 -u low -i audio-volume-high "Audio: $MUTE" + } - if [ "$1" == "internal" ]; then - internal - elif [ "$1" == "bluetooth" ]; then - bluetooth - elif [ "$1" == "firefox" ]; then - firefox "$2" - elif [ "$1" == "ncspot" ]; then - ncspot "$2" - elif [ "$1" == "mute" ]; then - mute - elif [ "$1" == "sink" ]; then - set_volume_sink "$2" - elif [ "$1" == "source" ]; then - set_volume_source "$2" - fi - '')) - ] ++ config.mods.scripts.scripts; - }); + if [ "$1" == "internal" ]; then + internal + elif [ "$1" == "bluetooth" ]; then + bluetooth + elif [ "$1" == "firefox" ]; then + firefox "$2" + elif [ "$1" == "ncspot" ]; then + ncspot "$2" + elif [ "$1" == "mute" ]; then + mute + elif [ "$1" == "sink" ]; then + set_volume_sink "$2" + elif [ "$1" == "source" ]; then + set_volume_source "$2" + fi + '' + )) + ] ++ config.mods.scripts.scripts; + } + ); } diff --git a/modules/programs/sops.nix b/modules/programs/sops.nix index 8d93b88..b4b9657 100644 --- a/modules/programs/sops.nix +++ b/modules/programs/sops.nix @@ -1,4 +1,12 @@ -{ lib, pkgs, config, options, root, ... }: { +{ + lib, + pkgs, + config, + options, + root, + ... +}: +{ options.mods.sops = { enable = lib.mkOption { default = true; @@ -19,8 +27,8 @@ description = "secrets for sops"; }; }; - config = lib.mkIf config.mods.sops.enable - (lib.optionalAttrs (options ? home.packages) { + config = lib.mkIf config.mods.sops.enable ( + lib.optionalAttrs (options ? home.packages) { home.packages = with pkgs; [ sops ]; sops = { gnupg = { @@ -32,5 +40,6 @@ }; systemd.user.services.mbsync.Unit.After = [ "sops-nix.service" ]; - }); + } + ); } diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 69de20b..04f877e 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -1,4 +1,12 @@ -{ lib, config, options, pkgs, inputs, ... }: { +{ + lib, + config, + options, + pkgs, + inputs, + ... +}: +{ options.mods = { starship = { enable = lib.mkOption { @@ -30,99 +38,140 @@ }; # environment.systemPackages needed in order to configure systemwide - config = lib.mkIf config.mods.starship.enable - (lib.optionalAttrs (options ? environment.systemPackages) { - programs.starship = let - base16 = pkgs.callPackage inputs.base16.lib { }; - scheme = (base16.mkSchemeAttrs config.stylix.base16Scheme); - code_format = - "[](bg:prev_bg fg:#5256c3)[ $symbol ($version)](bg:#5256c3)"; - in { - enable = true; - interactiveOnly = true; - presets = lib.mkIf config.mods.starship.use_default_prompt - [ "pastel-powerline" ]; - settings = lib.mkIf config.mods.starship.use_default_prompt { - # derived from https://starship.rs/presets/pastel-powerline - format = - "$username$directory$git_branch$git_status$git_metrics[ ](bg:none fg:prev_bg)"; - right_format = - "$c$elixir$elm$golang$gradle$haskell$java$julia$nodejs$nim$rust$scala$python$ocaml$opa$perl$zig$dart$dotnet$nix_shell$shell$solidity[](bg:prev_bg fg:#3465A4)$time$os"; - username = { - show_always = false; - style_user = "bg:#5277C3 fg:#${scheme.base05}"; - style_root = "bg:#5277C3 fg:#${scheme.base05}"; - format = "[ $user ]($style)[](bg:#3465A4 fg:#5277C3)"; - disabled = false; - }; - os = { - symbols = { NixOS = "  "; }; - style = "bg:#3465A4 fg:#${scheme.base05}"; - disabled = false; - }; - directory = { - style = "bg:#3465A4 fg:#${scheme.base05}"; - format = "[ $path ]($style)"; - truncation_length = 3; - truncation_symbol = "…/"; - }; - git_branch = { - always_show_remote = true; - symbol = ""; - style = "bg:#5256c3 fg:#${scheme.base05}"; - format = - "[ ](bg:#5256c3 fg:prev_bg)[$symbol ($remote_name )$branch ]($style)"; - }; - git_status = { - staged = "+\${count} (fg:#C4A000)"; - ahead = "⇡\${count} (fg:#C4A000)"; - diverged = "⇕⇡\${count} (fg:#C4A000)"; - behind = "⇣\${count} (fg:#C4A000)"; - stashed = " "; - untracked = "?\${count} (fg:#C4A000)"; - modified = "!\${count} (fg:#C4A000)"; - deleted = "✘\${count} (fg:#C4A000)"; - conflicted = "=\${count} (fg:#C4A000)"; - renamed = "»\${count} (fg:#C4A000)"; - style = "bg:#5256c3 fg:fg:#C4A000"; - format = "[$all_status$ahead_behind]($style)"; - }; - git_metrics = { - disabled = false; - format = - "([| ](bg:#5256c3)[+$added]($added_style bg:#5256c3)[ -$deleted]($deleted_style bg:#5256c3))"; - }; - c = { format = code_format; }; - elixir = { format = code_format; }; - elm = { format = code_format; }; - golang = { format = code_format; }; - gradle = { format = code_format; }; - haskell = { format = code_format; }; - java = { format = code_format; }; - julia = { format = code_format; }; - nodejs = { format = code_format; }; - nim = { format = code_format; }; - nix_shell = { - symbol = ""; - format = code_format; - }; - rust = { format = code_format; }; - scala = { format = code_format; }; - typst = { format = code_format; }; - python = { format = code_format; }; - ocaml = { format = code_format; }; - opa = { format = code_format; }; - perl = { format = code_format; }; - zig = { format = code_format; }; - dart = { format = code_format; }; - dotnet = { format = code_format; }; - time = { - disabled = false; - time_format = "%R"; # Hour:Minute Format - style = "bg:#3465A4 fg:#${scheme.base05}"; - format = "[ $time ]($style)"; - }; - } // config.mods.starship.custom_prompt; - }; - }); + config = lib.mkIf config.mods.starship.enable ( + lib.optionalAttrs (options ? environment.systemPackages) { + programs.starship = + let + base16 = pkgs.callPackage inputs.base16.lib { }; + scheme = (base16.mkSchemeAttrs config.stylix.base16Scheme); + code_format = "[](bg:prev_bg fg:#5256c3)[ $symbol ($version)](bg:#5256c3)"; + in + { + enable = true; + interactiveOnly = true; + presets = lib.mkIf config.mods.starship.use_default_prompt [ "pastel-powerline" ]; + settings = + lib.mkIf config.mods.starship.use_default_prompt { + # derived from https://starship.rs/presets/pastel-powerline + format = "$username$directory$git_branch$git_status$git_metrics[ ](bg:none fg:prev_bg)"; + right_format = "$c$elixir$elm$golang$gradle$haskell$java$julia$nodejs$nim$rust$scala$python$ocaml$opa$perl$zig$dart$dotnet$nix_shell$shell$solidity[](bg:prev_bg fg:#3465A4)$time$os"; + username = { + show_always = false; + style_user = "bg:#5277C3 fg:#${scheme.base05}"; + style_root = "bg:#5277C3 fg:#${scheme.base05}"; + format = "[ $user ]($style)[](bg:#3465A4 fg:#5277C3)"; + disabled = false; + }; + os = { + symbols = { + NixOS = "  "; + }; + style = "bg:#3465A4 fg:#${scheme.base05}"; + disabled = false; + }; + directory = { + style = "bg:#3465A4 fg:#${scheme.base05}"; + format = "[ $path ]($style)"; + truncation_length = 3; + truncation_symbol = "…/"; + }; + git_branch = { + always_show_remote = true; + symbol = ""; + style = "bg:#5256c3 fg:#${scheme.base05}"; + format = "[ ](bg:#5256c3 fg:prev_bg)[$symbol ($remote_name )$branch ]($style)"; + }; + git_status = { + staged = "+\${count} (fg:#C4A000)"; + ahead = "⇡\${count} (fg:#C4A000)"; + diverged = "⇕⇡\${count} (fg:#C4A000)"; + behind = "⇣\${count} (fg:#C4A000)"; + stashed = " "; + untracked = "?\${count} (fg:#C4A000)"; + modified = "!\${count} (fg:#C4A000)"; + deleted = "✘\${count} (fg:#C4A000)"; + conflicted = "=\${count} (fg:#C4A000)"; + renamed = "»\${count} (fg:#C4A000)"; + style = "bg:#5256c3 fg:fg:#C4A000"; + format = "[$all_status$ahead_behind]($style)"; + }; + git_metrics = { + disabled = false; + format = "([| ](bg:#5256c3)[+$added]($added_style bg:#5256c3)[ -$deleted]($deleted_style bg:#5256c3))"; + }; + c = { + format = code_format; + }; + elixir = { + format = code_format; + }; + elm = { + format = code_format; + }; + golang = { + format = code_format; + }; + gradle = { + format = code_format; + }; + haskell = { + format = code_format; + }; + java = { + format = code_format; + }; + julia = { + format = code_format; + }; + nodejs = { + format = code_format; + }; + nim = { + format = code_format; + }; + nix_shell = { + symbol = ""; + format = code_format; + }; + rust = { + format = code_format; + }; + scala = { + format = code_format; + }; + typst = { + format = code_format; + }; + python = { + format = code_format; + }; + ocaml = { + format = code_format; + }; + opa = { + format = code_format; + }; + perl = { + format = code_format; + }; + zig = { + format = code_format; + }; + dart = { + format = code_format; + }; + dotnet = { + format = code_format; + }; + time = { + disabled = false; + time_format = "%R"; # Hour:Minute Format + style = "bg:#3465A4 fg:#${scheme.base05}"; + format = "[ $time ]($style)"; + }; + } + // config.mods.starship.custom_prompt; + }; + } + ); } diff --git a/modules/programs/stylix.nix b/modules/programs/stylix.nix index 987a912..2c8b7e2 100644 --- a/modules/programs/stylix.nix +++ b/modules/programs/stylix.nix @@ -1,4 +1,11 @@ -{ lib, config, options, pkgs, ... }: { +{ + lib, + config, + options, + pkgs, + ... +}: +{ options.mods.stylix = { colorscheme = lib.mkOption { default = { @@ -27,7 +34,13 @@ base0F = "F7768E"; }; example = "catppuccin-mocha"; - type = with lib.types; oneOf [ str attrs path ]; + type = + with lib.types; + oneOf [ + str + attrs + path + ]; description = '' Base16 colorscheme. Can be an attribute set with base00 to base0F, @@ -35,18 +48,18 @@ or a path to a custom yaml file. ''; }; - }; - config = (lib.optionalAttrs (options ? stylix) { - stylix = { - enable = true; - image = ../../base/black.jpg; - polarity = "dark"; - targets = { - nixvim.enable = false; - fish.enable = false; + cursor = lib.mkOption { + default = { + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Classic"; + size = 24; }; - - fonts = { + example = { }; + type = with lib.types; attrsOf anything; + description = "Xcursor config"; + }; + fonts = lib.mkOption { + default = { serif = { package = pkgs.cantarell-fonts; name = "Cantarell"; @@ -59,7 +72,6 @@ monospace = { package = (pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; }); - # name = "JetBrains Mono Nerd"; name = "JetBrainsMono Nerd Font Mono"; }; @@ -68,17 +80,30 @@ name = "Noto Color Emoji"; }; }; - - cursor = { - package = pkgs.bibata-cursors; - name = "Bibata-Modern-Classic"; - size = 24; - }; - - base16Scheme = (if builtins.isAttrs config.mods.stylix.colorscheme then - config.mods.stylix.colorscheme - else - "${pkgs.base16-schemes}/share/themes/${config.mods.stylix.colorscheme}.yaml"); + example = { }; + type = with lib.types; attrsOf anything; + description = "font config"; }; - }); + }; + config = ( + lib.optionalAttrs (options ? stylix) { + stylix = { + enable = true; + image = ../../base/black.jpg; + polarity = "dark"; + targets = { + nixvim.enable = false; + fish.enable = false; + }; + fonts = config.mods.stylix.fonts; + cursor = config.mods.stylix.cursor; + base16Scheme = ( + if builtins.isAttrs config.mods.stylix.colorscheme then + config.mods.stylix.colorscheme + else + "${pkgs.base16-schemes}/share/themes/${config.mods.stylix.colorscheme}.yaml" + ); + }; + } + ); } diff --git a/modules/programs/teams.nix b/modules/programs/teams.nix index 515daed..8555303 100644 --- a/modules/programs/teams.nix +++ b/modules/programs/teams.nix @@ -1,13 +1,20 @@ -{ lib, config, options, pkgs, ... }: -let callPackage = lib.callPackageWith pkgs; -in { +{ + lib, + config, + options, + pkgs, + ... +}: +let + callPackage = lib.callPackageWith pkgs; +in +{ options.mods.teams = { enable = lib.mkOption { default = false; example = true; type = lib.types.bool; - description = - "Enables teams via a chromium pwa (for the poor souls that have to use this for work)"; + description = "Enables teams via a chromium pwa (for the poor souls that have to use this for work)"; }; loopback = lib.mkOption { default = true; @@ -16,17 +23,18 @@ in { description = "Enables loopback for screensharing -> teams sucks :)"; }; }; - config = lib.mkIf config.mods.teams.enable - (lib.optionalAttrs (options ? home.packages) { + config = lib.mkIf config.mods.teams.enable ( + lib.optionalAttrs (options ? home.packages) { home.packages = [ (callPackage ../../override/teams.nix { }) ]; - } // (lib.optionalAttrs (options ? boot.kernelModules) { + } + // (lib.optionalAttrs (options ? boot.kernelModules) { boot = { - extraModulePackages = - [ pkgs.linuxKernel.packages.linux_xanmod_latest.v4l2loopback ]; + extraModulePackages = [ pkgs.linuxKernel.packages.linux_xanmod_latest.v4l2loopback ]; kernelModules = [ "v4l2loopback" ]; extraModprobeConfig = '' options v4l2loopback exclusive_caps=1 card_label="Virtual Camera" ''; }; - })); + }) + ); } diff --git a/modules/programs/virtualbox.nix b/modules/programs/virtualbox.nix index b5d80e9..1639305 100644 --- a/modules/programs/virtualbox.nix +++ b/modules/programs/virtualbox.nix @@ -1,4 +1,10 @@ -{ lib, config, options, ... }: { +{ + lib, + config, + options, + ... +}: +{ options.mods = { virtualbox.enable = lib.mkOption { @@ -12,7 +18,6 @@ }; config = lib.optionalAttrs (options ? virtualisation.virtualbox.host) { - virtualisation.virtualbox.host.enable = - lib.mkIf config.mods.virtualbox.enable true; + virtualisation.virtualbox.host.enable = lib.mkIf config.mods.virtualbox.enable true; }; } diff --git a/modules/programs/xone.nix b/modules/programs/xone.nix index 77ce121..0779744 100644 --- a/modules/programs/xone.nix +++ b/modules/programs/xone.nix @@ -1,4 +1,10 @@ -{ lib, config, options, ... }: { +{ + lib, + config, + options, + ... +}: +{ options.mods = { xone.enable = lib.mkOption { @@ -11,6 +17,5 @@ }; }; - config = - lib.optionalAttrs (options ? hardware) { hardware.xone.enable = true; }; + config = lib.optionalAttrs (options ? hardware) { hardware.xone.enable = true; }; } diff --git a/modules/programs/yazi/default.nix b/modules/programs/yazi/default.nix index 9e68ecd..692faf0 100644 --- a/modules/programs/yazi/default.nix +++ b/modules/programs/yazi/default.nix @@ -1,4 +1,10 @@ -{ lib, config, options, ... }: { +{ + lib, + config, + options, + ... +}: +{ options.mods.yazi = { enable = lib.mkOption { default = true; @@ -7,8 +13,7 @@ description = "Enables yazi"; }; }; - config = lib.mkIf config.mods.yazi.enable - (lib.optionalAttrs (options ? home.packages) { - programs.yazi = import ./yazi.nix; - }); + config = lib.mkIf config.mods.yazi.enable ( + lib.optionalAttrs (options ? home.packages) { programs.yazi = import ./yazi.nix; } + ); } diff --git a/modules/programs/yazi/yazi.nix b/modules/programs/yazi/yazi.nix index 51eac1f..b8ead8c 100644 --- a/modules/programs/yazi/yazi.nix +++ b/modules/programs/yazi/yazi.nix @@ -2,7 +2,9 @@ # don't ask.... enable = true; settings = { - log = { enabled = false; }; + log = { + enabled = false; + }; opener = { folder = [ @@ -16,14 +18,18 @@ orphan = true; } ]; - archive = [{ - run = ''unar "$1"''; - display_name = "Extract here"; - }]; - text = [{ - run = ''$EDITOR "$@"''; - orphan = true; - }]; + archive = [ + { + run = ''unar "$1"''; + display_name = "Extract here"; + } + ]; + text = [ + { + run = ''$EDITOR "$@"''; + orphan = true; + } + ]; image = [ { run = ''imv "$@"''; @@ -36,11 +42,13 @@ display_name = "Show EXIF"; } ]; - pdf = [{ - run = ''zathura "$@"''; - orphan = true; - display_name = "Open"; - }]; + pdf = [ + { + run = ''zathura "$@"''; + orphan = true; + display_name = "Open"; + } + ]; video = [ { run = ''mpv "$@"''; @@ -216,7 +224,10 @@ } { - on = [ "g" "g" ]; + on = [ + "g" + "g" + ]; run = "arrow -99999999"; desc = "Move cursor to the top"; } @@ -335,12 +346,20 @@ desc = "Toggle the visibility of hidden files"; } { - on = [ "" "f" "g>" ]; + on = [ + "" + "f" + "g>" + ]; run = "search fd"; desc = "Search files by name using fd"; } { - on = [ "" "f" "G>" ]; + on = [ + "" + "f" + "G>" + ]; run = "search rg"; desc = "Search files by content using ripgrep"; } @@ -362,22 +381,34 @@ # Copy { - on = [ "c" "c" ]; + on = [ + "c" + "c" + ]; run = "copy path"; desc = "Copy the absolute path"; } { - on = [ "c" "d" ]; + on = [ + "c" + "d" + ]; run = "copy dirname"; desc = "Copy the path of the parent directory"; } { - on = [ "c" "f" ]; + on = [ + "c" + "f" + ]; run = "copy filename"; desc = "Copy the name of the file"; } { - on = [ "c" "n" ]; + on = [ + "c" + "n" + ]; run = "copy name_without_ext"; desc = "Copy the name of the file without the extension"; } @@ -402,52 +433,82 @@ # Sorting { - on = [ "," "a" ]; + on = [ + "," + "a" + ]; run = "sort alphabetical --dir_first"; desc = "Sort alphabetically"; } { - on = [ "," "A" ]; + on = [ + "," + "A" + ]; run = "sort alphabetical --reverse --dir_first"; desc = "Sort alphabetically (reverse)"; } { - on = [ "," "c" ]; + on = [ + "," + "c" + ]; run = "sort created --dir_first"; desc = "Sort by creation time"; } { - on = [ "," "C" ]; + on = [ + "," + "C" + ]; run = "sort created --reverse --dir_first"; desc = "Sort by creation time (reverse)"; } { - on = [ "," "m" ]; + on = [ + "," + "m" + ]; run = "sort modified --dir_first"; desc = "Sort by modified time"; } { - on = [ "," "M" ]; + on = [ + "," + "M" + ]; run = "sort modified --reverse --dir_first"; desc = "Sort by modified time (reverse)"; } { - on = [ "," "n" ]; + on = [ + "," + "n" + ]; run = "sort natural --dir_first"; desc = "Sort naturally"; } { - on = [ "," "N" ]; + on = [ + "," + "N" + ]; run = "sort natural --reverse --dir_first"; desc = "Sort naturally (reverse)"; } { - on = [ "," "s" ]; + on = [ + "," + "s" + ]; run = "sort size --dir_first"; desc = "Sort by size"; } { - on = [ "," "S" ]; + on = [ + "," + "S" + ]; run = "sort size --reverse --dir_first"; desc = "Sort by size (reverse)"; } @@ -536,27 +597,42 @@ # Goto { - on = [ "g" "h" ]; + on = [ + "g" + "h" + ]; run = "cd ~"; desc = "Go to the home directory"; } { - on = [ "g" "c" ]; + on = [ + "g" + "c" + ]; run = "cd ~/.config"; desc = "Go to the config directory"; } { - on = [ "g" "d" ]; + on = [ + "g" + "d" + ]; run = "cd ~/Downloads"; desc = "Go to the downloads directory"; } { - on = [ "g" "t" ]; + on = [ + "g" + "t" + ]; run = "cd /tmp"; desc = "Go to the temporary directory"; } { - on = [ "g" "" ]; + on = [ + "g" + "" + ]; run = "cd --interactive"; desc = "Go to a directory interactively"; } @@ -718,7 +794,11 @@ } { on = [ "V" ]; - run = [ "move -999" "visual" "move 999" ]; + run = [ + "move -999" + "visual" + "move 999" + ]; desc = "Enter visual mode and select all"; } @@ -746,12 +826,18 @@ } { on = [ "I" ]; - run = [ "move -999" "insert" ]; + run = [ + "move -999" + "insert" + ]; desc = "Move to the BOL and enter insert mode"; } { on = [ "A" ]; - run = [ "move 999" "insert --append" ]; + run = [ + "move 999" + "insert --append" + ]; desc = "Move to the EOL and enter append mode"; } @@ -790,7 +876,10 @@ } { on = [ "D" ]; - run = [ "delete --cut" "move 999" ]; + run = [ + "delete --cut" + "move 999" + ]; desc = "Cut until the EOL"; } { @@ -800,12 +889,18 @@ } { on = [ "C" ]; - run = [ "delete --cut --insert" "move 999" ]; + run = [ + "delete --cut --insert" + "move 999" + ]; desc = "Cut until the EOL and enter insert mode"; } { on = [ "x" ]; - run = [ "delete --cut" "move 1 --in-operating" ]; + run = [ + "delete --cut" + "move 1 --in-operating" + ]; desc = "Cut the current character"; } @@ -1136,4 +1231,3 @@ # }; # }; } - diff --git a/override/teams.nix b/override/teams.nix index eff69a1..4370d7a 100644 --- a/override/teams.nix +++ b/override/teams.nix @@ -1,4 +1,11 @@ -{ stdenv, lib, copyDesktopItems, makeDesktopItem, chromium, ... }: +{ + stdenv, + lib, + copyDesktopItems, + makeDesktopItem, + chromium, + ... +}: stdenv.mkDerivation (final: { pname = "teams-pwa"; name = final.pname; @@ -10,8 +17,8 @@ stdenv.mkDerivation (final: { name = final.pname; icon = final.pname; exec = "${chromium}/bin/${ - chromium.meta.mainProgram or chromium.pname - } --app=https://teams.microsoft.com"; + chromium.meta.mainProgram or chromium.pname + } --app=https://teams.microsoft.com"; desktopName = "Microsoft Teams PWA"; genericName = "Progressive Web App for Microsoft Teams"; categories = [ "Network" ];