dotfiles

My PC Dotfiles & Website
commit 1b4a68f4f2e646425fdd3b89b0a5f300b63f3893
parent 3db25efda737010703942decf1efb3ad1b9d9af3
Author: maydayv7 <maydayv7@gmail.com>
Date:   Sun,  4 May 2025 20:12:19 +0530

style: Format with `nixfmt-rfc-style`

Diffstat:

MREADME.md | 34+++++++++++++++++++---------------
Mchecks/flake.nix | 57++++++++++++++++++++++++++++++---------------------------
Mdevices/flake.nix | 51++++++++++++++++++++++++++++++---------------------
Mdevices/futura.nix | 15+++++++++++----
Mdevices/valkyrie/default.nix | 34+++++++++++++++++++++++++---------
Mdevices/valkyrie/drivers.nix | 11++++++-----
Mdevices/vortex.nix | 25++++++++++++++++++-------
Mfiles/flake.nix | 302++++++++++++++++++++++++++++++++++++++++---------------------------------------
Dfiles/pantheon/dconf.nix | 303-------------------------------------------------------------------------------
Rfiles/pantheon/plank/dock.desktop -> files/plank/dock.desktop | 0
Rfiles/pantheon/plank/dock.theme -> files/plank/dock.theme | 0
Rfiles/pantheon/plank/launchers/io.elementary.code.dockitem -> files/plank/launchers/io.elementary.code.dockitem | 0
Rfiles/pantheon/plank/launchers/io.elementary.files.dockitem -> files/plank/launchers/io.elementary.files.dockitem | 0
Rfiles/pantheon/plank/launchers/io.elementary.mail.dockitem -> files/plank/launchers/io.elementary.mail.dockitem | 0
Rfiles/pantheon/plank/launchers/io.elementary.switchboard.dockitem -> files/plank/launchers/io.elementary.switchboard.dockitem | 0
Rfiles/pantheon/plank/launchers/io.elementary.terminal.dockitem -> files/plank/launchers/io.elementary.terminal.dockitem | 0
Mfiles/repl.nix | 68+++++++++++++++++++++++++++++++++++++++-----------------------------
Mfiles/vscode/settings.json | 65+++++++++++++++++++++++++++++++++++++----------------------------
Mflake.lock | 6+++---
Mflake.nix | 26++++++++++++++------------
Mlib/_mime.nix | 15+++++++++------
Mlib/build.nix | 135+++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
Mlib/map.nix | 176+++++++++++++++++++++++++++++++++++++++++++------------------------------------
Mlib/pack.nix | 12++++++++----
Mmodules/apps/default.nix | 8+++++---
Mmodules/apps/discord.nix | 10++++++----
Mmodules/apps/firefox.nix | 33++++++++++++++++++++-------------
Mmodules/apps/flatpak.nix | 34++++++++++++++++++++++------------
Mmodules/apps/games/default.nix | 16++++++++++++----
Mmodules/apps/games/osu.nix | 7++++---
Mmodules/apps/git/default.nix | 22+++++++++++++++++-----
Mmodules/apps/git/hosting.nix | 28++++++++++++++++++++--------
Mmodules/apps/git/runner.nix | 27++++++++++++++++++++-------
Mmodules/apps/git/user.nix | 6++++--
Mmodules/apps/media.nix | 10++++++----
Mmodules/apps/notes.nix | 24++++++++++++++++--------
Mmodules/apps/office.nix | 20++++++++++++++------
Mmodules/apps/spotify.nix | 21++++++++++++++++-----
Mmodules/apps/vscode.nix | 39++++++++++++++++++++++++++-------------
Mmodules/apps/wine.nix | 71+++++++++++++++++++++++++++++++++++++++++++++--------------------------
Mmodules/base/console.nix | 8+++++---
Mmodules/base/default.nix | 47++++++++++++++++++++++++++++++++++-------------
Mmodules/base/firmware.nix | 74++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mmodules/base/security.nix | 37+++++++++++++++++++++++--------------
Mmodules/configuration.nix | 258+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mmodules/gui/default.nix | 71++++++++++++++++++++++++++++++++++++++++++++++-------------------------
Mmodules/gui/desktop/gnome/default.nix | 64+++++++++++++++++++++++++++++++++++++---------------------------
Mmodules/gui/desktop/gnome/iso.nix | 8+++++---
Mmodules/gui/desktop/gnome/settings/apps.nix | 28+++++++++++++++++++++-------
Mmodules/gui/desktop/gnome/settings/default.nix | 152++++++++++++++++++++++++++++++++++++++++++-------------------------------------
Mmodules/gui/desktop/gnome/settings/extensions.nix | 917+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mmodules/gui/desktop/hyprland/apps/browser.nix | 5+++--
Mmodules/gui/desktop/hyprland/apps/files.nix | 57+++++++++++++++++++++++++++++++++------------------------
Mmodules/gui/desktop/hyprland/apps/media.nix | 19++++++++++---------
Mmodules/gui/desktop/hyprland/apps/misc.nix | 49++++++++++++++++++++++++++++++-------------------
Mmodules/gui/desktop/hyprland/apps/notify.nix | 100++++++++++++++++++++++++++++++++++++++++++-------------------------------------
Mmodules/gui/desktop/hyprland/apps/panel.nix | 138+++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------
Mmodules/gui/desktop/hyprland/apps/security.nix | 94++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
Mmodules/gui/desktop/hyprland/apps/settings.nix | 101+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
Mmodules/gui/desktop/hyprland/apps/terminal.nix | 6++++--
Mmodules/gui/desktop/hyprland/apps/text.nix | 13++++++++-----
Mmodules/gui/desktop/hyprland/apps/utilities.nix | 117+++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
Mmodules/gui/desktop/hyprland/default.nix | 51++++++++++++++++++++++++++++++++++-----------------
Mmodules/gui/desktop/hyprland/settings/default.nix | 8+++++---
Mmodules/gui/desktop/hyprland/settings/keybindings.nix | 17+++++++++++------
Mmodules/gui/desktop/hyprland/settings/plugins.nix | 11++++-------
Mmodules/gui/desktop/hyprland/theme.nix | 2+-
Dmodules/gui/desktop/pantheon.nix | 188-------------------------------------------------------------------------------
Amodules/gui/desktop/pantheon/default.nix | 192+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amodules/gui/desktop/pantheon/settings.nix | 308+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmodules/gui/desktop/xfce/compositor.nix | 35+++++++++++++++++++++--------------
Mmodules/gui/desktop/xfce/default.nix | 70+++++++++++++++++++++++++++++++++++++++-------------------------------
Mmodules/gui/desktop/xfce/iso.nix | 6++++--
Mmodules/gui/fonts.nix | 19+++++++++++--------
Mmodules/gui/gtk.nix | 18+++++++++++++-----
Mmodules/gui/qt.nix | 113+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mmodules/gui/theme.nix | 25+++++++++++++++++++------
Mmodules/gui/wayland.nix | 3++-
Mmodules/gui/xorg.nix | 15+++++++++++----
Mmodules/hardware/boot.nix | 35+++++++++++++++++++++++++----------
Mmodules/hardware/default.nix | 16+++++++++++-----
Mmodules/hardware/filesystem.nix | 350+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mmodules/hardware/gpu.nix | 58+++++++++++++++++++++++++++++++++++-----------------------
Mmodules/hardware/laptop.nix | 21++++++++++++++-------
Mmodules/hardware/mobile.nix | 13+++++++++----
Mmodules/hardware/printer.nix | 17+++++++++++++----
Mmodules/hardware/virtualisation/android.nix | 12+++++++-----
Mmodules/hardware/virtualisation/default.nix | 30++++++++++++++++++++++--------
Mmodules/hardware/virtualisation/vfio.nix | 32+++++++++++++++++++++++---------
Mmodules/nix/default.nix | 21++++++++++++++++-----
Mmodules/nix/index.nix | 5+++--
Mmodules/nix/registry.nix | 24++++++++++++------------
Mmodules/nix/tools.nix | 14++++++++++----
Mmodules/shell/bash.nix | 12+++++++-----
Mmodules/shell/default.nix | 34++++++++++++++++++++++++----------
Mmodules/shell/prompt.nix | 334++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mmodules/shell/zsh.nix | 10++++++----
Mmodules/user/default.nix | 182+++++++++++++++++++++++++++++++++++++++++++------------------------------------
Mmodules/user/home.nix | 12++++++++----
Mmodules/user/security.nix | 71++++++++++++++++++++++++++++++++++++++++++++---------------------------
Mpackages/firefox-elementary/default.nix | 37+++++++++++++++++++------------------
Mpackages/flake.nix | 114++++++++++++++++++++++++++++++++++++++++++-------------------------------------
Mpackages/geany-catppuccin/default.nix | 45+++++++++++++++++++++++----------------------
Mpackages/gnome-pano/default.nix | 71++++++++++++++++++++++++++++++++++++++---------------------------------
Mpackages/hyprshellevents/default.nix | 58++++++++++++++++++++++++++++++++--------------------------
Mpackages/kebihelp/default.nix | 56+++++++++++++++++++++++++++++++-------------------------
Mpackages/kitty-search/default.nix | 37+++++++++++++++++++------------------
Mpackages/kvlibadwaita/default.nix | 43++++++++++++++++++++++---------------------
Mpackages/wine/7zip.nix | 114+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mpackages/wine/notepad++.nix | 149++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Mscripts/hyprutils.nix | 567++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mscripts/install.nix | 163+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mscripts/nixos.nix | 715++++++++++++++++++++++++++++++++++++++++---------------------------------------
Msecrets/default.nix | 27+++++++++++++--------------
Mshells/cc.nix | 9++++++++-
Mshells/default.nix | 34+++++++++++++++++++++++++---------
Mshells/flake.nix | 15+++++++++------
Mshells/java.nix | 10++++++++--
Mshells/lua.nix | 5++++-
Mshells/python.nix | 7++++---
Mshells/rust.nix | 3+--
Mshells/sql.nix | 2+-
Msite/default.nix | 20++++++++------------
Msite/flake.nix | 32+++++++++++++++++---------------
Msite/shell.nix | 11+++++++++--
Musers/default.nix | 39++++++++++++++++++++++++++-------------
Musers/navya.nix | 3++-
Musers/v7/default.nix | 8++++----
128 files changed, 4927 insertions(+), 3925 deletions(-)

diff --git a/README.md b/README.md @@ -32,22 +32,26 @@ This [repository](https://github.com/maydayv7/dotfiles) contains the configurati <details> <summary>Theming</summary> -- [Adwaita GTK3](https://github.com/lassekongo83/adw-gtk3): Theme from `libadwaita` ported to GTK3 -- [Arc Theme](https://github.com/jnsh/arc-theme): Flat GTK theme with transparent elements for various desktop shells, window managers and applications -- [Arc KDE Theme](https://github.com/PapirusDevelopmentTeam/arc-kde): Port of the Arc GTK Theme for Plasma Desktop +- [Starship](https://starship.rs/) Prompt Theme: Minimal, blazing-fast, and infinitely customizable prompt for any shell - [Bibata Cursor](https://github.com/ful1e5/Bibata_Cursor): Compact and material designed cursor set +- [Papirus Icon Theme](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme): Pixel perfect icon theme for Linux - [Catppuccin](https://github.com/catppuccin) Theme: A community-driven Pastel Theme consisting of 4 soothing warm Flavors with 26 eye-candy Colors each -- [DNOME](https://github.com/GeopJr/DNOME) Discord Theme: Discord Theme inspired by Adwaita, designed to integrate Discord with GNOME -- Firefox [Elementary Theme](https://github.com/Zonnev/elementaryos-firefox-theme): Elementary OS Theme for the Mozilla Firefox Browser, used for better desktop integration -- Firefox [GNOME Theme](https://github.com/rafaelmardojai/firefox-gnome-theme): GNOME Theme for the Mozilla Firefox Browser, used for better desktop integration + +- [Adwaita GTK3](https://github.com/lassekongo83/adw-gtk3): Theme from `libadwaita` ported to GTK3 - [KvLibadwaita](https://github.com/GabePoel/KvLibadwaita) Kvantum Theme: Integrates QT Apps with GNOME Desktop -- [Nordic](https://github.com/orblazer/discord-nordic) Discord Theme: Discord Theme using the [Nord](<(https://www.nordtheme.com/)>) color palette -- [Starship](https://starship.rs/) Prompt Theme: Minimal, blazing-fast, and infinitely customizable prompt for any shell -- [VS Code Adwaita Theme](https://github.com/piousdeer/vscode-adwaita): Integrates Visual Studio Code with GNOME Desktop -- [VS Code Arc Theme](https://github.com/alvesvaren/arc-dark-vscode): Port of the Arc Dark GTK Theme for Visual Studio Code -- [VS Code Elementary Theme](https://github.com/sixpounder/vscode-elementary-theme): Integrates Visual Studio Code with Pantheon Desktop +- Firefox [GNOME Theme](https://github.com/rafaelmardojai/firefox-gnome-theme): GNOME Theme for the Mozilla Firefox Browser, used for better desktop integration +- VS Code [Adwaita Theme](https://github.com/piousdeer/vscode-adwaita): Integrates Visual Studio Code with GNOME Desktop +- Discord [DNOME](https://github.com/GeopJr/DNOME) Theme: Discord Theme inspired by Adwaita, designed to integrate Discord with GNOME + +- [Arc Theme](https://github.com/jnsh/arc-theme): Flat GTK theme with transparent elements for various desktop shells, window managers and applications +- [Arc KDE Theme](https://github.com/PapirusDevelopmentTeam/arc-kde): Port of the Arc GTK Theme for Plasma Desktop +- VS Code [Arc Theme](https://github.com/alvesvaren/arc-dark-vscode): Port of the Arc Dark GTK Theme for Visual Studio Code +- Discord [Nordic](https://github.com/orblazer/discord-nordic) Theme: Discord Theme using the [Nord](<(https://www.nordtheme.com/)>) color palette - Logseg [Nord Theme](https://github.com/Bad3r/Logseq-Nord-Theme): Logseq in an arctic, north-bluish color palette -- Logseq [Bonofix Theme][https://github.com/Sansui233/logseq-bonofix-theme]: A clean Logseq theme with focus on long-time writing experience + +- Firefox [Elementary Theme](https://github.com/Zonnev/elementaryos-firefox-theme): Elementary OS Theme for the Mozilla Firefox Browser, used for better desktop integration +- VS Code [Elementary Theme](https://github.com/sixpounder/vscode-elementary-theme): Integrates Visual Studio Code with Pantheon Desktop +- Logseq [Bonofix Theme](https://github.com/Sansui233/logseq-bonofix-theme): A clean Logseq theme with focus on long-time writing experience </details> @@ -435,7 +439,7 @@ The system build cache is publicly hosted using [Cachix](https://www.cachix.org) #### Continuous Integration -This repository makes use of [`GitHub Actions`](./checks/github/workflows) in order to automatically check the configuration syntax on every commit (using and [`statix`](https://github.com/nerdypepper/statix)) and format it (using [`treefmt`](https://github.com/numtide/treefmt)), update the `inputs` every week, build the configuration and upload the build cache to [Cachix](https://app.cachix.org/cache/maydayv7-dotfiles) as well as publish the Install Media `.iso` to a draft Release upon creation of a tag (You can also find `GitLab CI/CD` configuration in [`.gitlab`](./checks/gitlab/.gitlab-ci.yml)). A `git` [hook](./.git-hooks) is used to check the commit message to adhere to the [`Conventional Commits`](https://www.conventionalcommits.org) specification +This repository makes use of [`GitHub Actions`](./checks/github/workflows) in order to automatically check the configuration syntax on every commit and format it (using [`treefmt-nix`](https://github.com/numtide/treefmt-nix)), update the `inputs` and build the Install Media `.iso` every month, and upload the build cache to [Cachix](https://app.cachix.org/cache/maydayv7-dotfiles) (You can also find `GitLab CI/CD` configuration in [`.gitlab`](./checks/gitlab/.gitlab-ci.yml)). A `git` [hook](./.git-hooks) is used to check the commit message to adhere to the [`Conventional Commits`](https://www.conventionalcommits.org) specification ###### Variables @@ -444,7 +448,7 @@ This repository makes use of [`GitHub Actions`](./checks/github/workflows) in or ### Home Manager -The [`home-manager`](https://github.com/nix-community/home-manager) module is used in tandem with the system configuration in order to define user-specific configuration. The `config.user.homeConfig` option has been declared in [`modules/user/default.nix`](./modules/user/default.nix) independent of the original module, from which the final configuration is built, in order to prevent infinite recursion while configuring multiple users per system. The system `config` can be accessed using the `sys` parameter in `home-manager` modules +The [`home-manager`](https://github.com/nix-community/home-manager) module is used in tandem with the system configuration in order to define user-specific configuration. The `config.user.homeConfig` option, from which the final user configuration is built, has been declared in [`modules/user/default.nix`](./modules/user/default.nix) in order to effortlessly configure shared configuration for all users of the system. The system `config` can be accessed using the `sys` parameter in `home-manager` modules ## Links @@ -825,7 +829,7 @@ _Thanks a lot! ;)_ </details> -> Last Updated: **April** 2025 +> Last Updated: **May** 2025 If you like this project, consider leaving a [star](https://github.com/maydayv7/dotfiles) diff --git a/checks/flake.nix b/checks/flake.nix @@ -2,38 +2,41 @@ config, inputs, ... -}: { +}: +{ ## Configuration Checks ## - imports = [inputs.formatter.flakeModule]; + imports = [ inputs.formatter.flakeModule ]; - perSystem = {system, ...}: { - ## Code Formatter - treefmt.config = { - projectRootFile = "flake.nix"; - settings.global.excludes = [ - "_*" - "result/**" - "flake.lock" - ]; + perSystem = + { system, ... }: + { + ## Code Formatter + treefmt.config = { + projectRootFile = "flake.nix"; + settings.global.excludes = [ + "_*" + "result/**" + "flake.lock" + ]; - programs = { - alejandra.enable = true; - statix.enable = true; - shellcheck.enable = false; - stylua.enable = true; - deadnix = { - enable = true; - no-lambda-arg = true; - }; + programs = { + nixfmt.enable = true; + statix.enable = true; + shellcheck.enable = false; + stylua.enable = true; + deadnix = { + enable = true; + no-lambda-arg = true; + }; - prettier = { - enable = true; - settings.bracketSameLine = true; + prettier = { + enable = true; + settings.bracketSameLine = true; + }; }; }; - }; - # Formatting Shell - devShells.format = config.allSystems."${system}".treefmt.build.devShell; - }; + # Formatting Shell + devShells.format = config.allSystems."${system}".treefmt.build.devShell; + }; } diff --git a/devices/flake.nix b/devices/flake.nix @@ -3,38 +3,47 @@ util, inputs, ... -}: let +}: +let inherit (inputs) self; inherit (util) build map pack; inherit (lib) listToAttrs nameValuePair; -in { +in +{ flake = { ## Device Configuration ## nixosConfigurations = map.modules ./. (name: build.device (import name)); ## Install Media Configuration ## installMedia = - listToAttrs (builtins.map (name: - nameValuePair name (build.device { - description = "Install Media"; - format = "iso"; - - # Region - timezone = "Asia/Kolkata"; - locale = "IN"; + listToAttrs ( + builtins.map ( + name: + nameValuePair name ( + build.device { + description = "Install Media"; + format = "iso"; - kernel = "lts"; - gui.desktop = name + "-iso"; + # Region + timezone = "Asia/Kolkata"; + locale = "IN"; - user = { - name = "nixos"; - description = "Default User"; - minimal = true; - shells = null; - password = builtins.readFile ../users/passwords/default; - }; - })) (import ../modules/gui/desktop/iso.nix)) - // {default = self.installMedia.gnome;}; + kernel = "lts"; + gui.desktop = name + "-iso"; + user = { + name = "nixos"; + description = "Default User"; + minimal = true; + shells = null; + password = builtins.readFile ../users/passwords/default; + }; + } + ) + ) (import ../modules/gui/desktop/iso.nix) + ) + // { + default = self.installMedia.gnome; + }; }; # Install Media Checks diff --git a/devices/futura.nix b/devices/futura.nix @@ -12,17 +12,24 @@ boot = "efi"; cpu.cores = 4; filesystem = "simple"; - support = ["laptop"]; - modules = ["common-pc" "common-pc-laptop" "common-cpu-intel"]; + support = [ "laptop" ]; + modules = [ + "common-pc" + "common-pc-laptop" + "common-cpu-intel" + ]; }; - apps.list = ["firefox" "office"]; gui.desktop = "xfce"; + apps.list = [ + "firefox" + "office" + ]; # User Navya user = { name = "navya"; - groups = ["wheel"]; + groups = [ "wheel" ]; description = "Navya"; shell = "zsh"; }; diff --git a/devices/valkyrie/default.nix b/devices/valkyrie/default.nix @@ -7,30 +7,42 @@ locale = "IN"; kernel = "xanmod_stable"; - kernelModules = ["nvme" "thunderbolt"]; + kernelModules = [ + "nvme" + "thunderbolt" + ]; - imports = [./drivers.nix]; + imports = [ ./drivers.nix ]; hardware = { boot = "secure"; filesystem = "advanced"; - support = ["laptop" "mobile" "printer" "virtualisation"]; - modules = ["asus-zephyrus-ga402x-nvidia"]; + modules = [ "asus-zephyrus-ga402x-nvidia" ]; gpu = "nvidia"; cpu = { cores = 8; mode = "performance"; }; + support = [ + "laptop" + "mobile" + "printer" + "virtualisation" + ]; + vm = { - vfio = "setup"; - passthrough = ["10de:28e0" "10de:22be"]; android.enable = false; + vfio = "setup"; + passthrough = [ + "10de:28e0" + "10de:22be" + ]; }; }; apps = { wine.utilities = true; - games = ["osu"]; + games = [ "osu" ]; list = [ "discord" "firefox" @@ -66,9 +78,13 @@ user = { name = "v7"; description = "V 7"; - groups = ["wheel" "keys" "systemd-journal"]; uid = 1000; shell = "zsh"; - shells = ["bash"]; + shells = [ "bash" ]; + groups = [ + "wheel" + "keys" + "systemd-journal" + ]; }; } diff --git a/devices/valkyrie/drivers.nix b/devices/valkyrie/drivers.nix @@ -2,15 +2,16 @@ config, lib, ... -}: let +}: +let inherit (lib) hasPrefix mkIf; -in { +in +{ services.fwupd.enable = true; # https://gitlab.freedesktop.org/drm/amd/-/issues/3388 boot.kernelParams = [ - (mkIf (config.hardware.cpu.mode == "performance") - "amdgpu.dcdebugmask=0x10") + (mkIf (config.hardware.cpu.mode == "performance") "amdgpu.dcdebugmask=0x10") ]; # Remap Keys @@ -20,7 +21,7 @@ in { ''; # ASUS Software - user.persist.directories = [".config/rog"]; + user.persist.directories = [ ".config/rog" ]; services.asusd = { enable = true; enableUserService = true; diff --git a/devices/vortex.nix b/devices/vortex.nix @@ -7,19 +7,27 @@ locale = "IN"; kernel = "xanmod"; - kernelModules = ["nvme" "thunderbolt"]; + kernelModules = [ + "nvme" + "thunderbolt" + ]; - imports = [{services.fwupd.enable = true;}]; + imports = [ { services.fwupd.enable = true; } ]; hardware = { boot = "secure"; filesystem = "advanced"; - support = ["laptop" "mobile" "printer" "virtualisation"]; - modules = ["dell-inspiron-5509"]; - vm.android.enable = false; + modules = [ "dell-inspiron-5509" ]; cpu = { cores = 8; mode = "performance"; }; + + support = [ + "laptop" + "mobile" + "printer" + "virtualisation" + ]; }; apps = { @@ -55,9 +63,12 @@ user = { name = "v7"; description = "V 7"; - groups = ["wheel" "keys"]; uid = 1000; shell = "zsh"; - shells = ["bash"]; + shells = [ "bash" ]; + groups = [ + "wheel" + "keys" + ]; }; } diff --git a/files/flake.nix b/files/flake.nix @@ -2,192 +2,194 @@ util, inputs, ... -}: { +}: +{ ## Program Configuration and 'dotfiles' ## - flake.files = let - inherit (util) build map; - inherit (builtins) fromJSON readFile; - in rec { - # File Paths - path = { - toplevel = ./.; - - system = "/etc/nixos"; # Configuration Directory - persist = "/nix/state"; # Persisted Files - - gpg = "/etc/gpg"; # GPG Keys Directory - sops = ../secrets/secrets.yaml; # Encrypted Secrets - - cache = "maydayv7-dotfiles"; - flake = "github:maydayv7/dotfiles"; - repo = "https://github.com/maydayv7/dotfiles"; - }; + flake.files = + let + inherit (util) build map; + inherit (builtins) fromJSON readFile; + in + rec { + # File Paths + path = { + toplevel = ./.; + + system = "/etc/nixos"; # Configuration Directory + persist = "/nix/state"; # Persisted Files + + gpg = "/etc/gpg"; # GPG Keys Directory + sops = ../secrets/secrets.yaml; # Encrypted Secrets + + cache = "maydayv7-dotfiles"; + flake = "github:maydayv7/dotfiles"; + repo = "https://github.com/maydayv7/dotfiles"; + }; - # Interactive Nix Shell - # To explore syntax and configuration - repl = ./repl.nix; + # Interactive Nix Shell + # To explore syntax and configuration + repl = ./repl.nix; - # ASCII Art - ascii = map.files { - directory = ./ascii; - extension = ""; - recursive = true; - }; + # ASCII Art + ascii = map.files { + directory = ./ascii; + extension = ""; + recursive = true; + }; - # Directory Bookmarks - bookmarks = '' - file:///data/files Files - file:/// Computer - ''; + # Directory Bookmarks + bookmarks = '' + file:///data/files Files + file:/// Computer + ''; - # Base16 Color Schemes - colors = map.files { - directory = ./colors; - extension = ".yaml"; - }; + # Base16 Color Schemes + colors = map.files { + directory = ./colors; + extension = ".yaml"; + }; - # Fastfetch - fetch = readFile ./fastfetch.jsonc; + # Fastfetch + fetch = readFile ./fastfetch.jsonc; - # Geany Text Editor - geany = map.files { - directory = ./geany; - apply = readFile; - extension = ".conf"; - }; + # Geany Text Editor + geany = map.files { + directory = ./geany; + apply = readFile; + extension = ".conf"; + }; - # X11 Touchpad Gestures - gestures = readFile ./touchegg.xml; + # X11 Touchpad Gestures + gestures = readFile ./touchegg.xml; - # 'git' Version Control - git.hooks = ./git/hooks; + # 'git' Version Control + git.hooks = ./git/hooks; - # GNOME Desktop - gnome = - {iso = readFile ./gnome/iso;} - // map.files { - directory = ./gnome; - extension = ".json"; - }; + # GNOME Desktop + gnome = + { + iso = readFile ./gnome/iso; + } + // map.files { + directory = ./gnome; + extension = ".json"; + }; - # Hyprland WM - hyprland = - { - # Pyprland - pypr = readFile ./hyprland/pypr.toml; + # Hyprland WM + hyprland = + { + # Pyprland + pypr = readFile ./hyprland/pypr.toml; - # Hot Corners - waycorner = readFile ./hyprland/waycorner.toml; + # Hot Corners + waycorner = readFile ./hyprland/waycorner.toml; - # Keybinds Viewer - kebihelp = readFile ./hyprland/kebihelp.json; + # Keybinds Viewer + kebihelp = readFile ./hyprland/kebihelp.json; - # PcmanFM File Manager - pcmanfm = readFile ./hyprland/pcmanfm.conf; + # PcmanFM File Manager + pcmanfm = readFile ./hyprland/pcmanfm.conf; - # Greeter Configuration - greeter = readFile ./hyprland/greeter.conf; + # Greeter Configuration + greeter = readFile ./hyprland/greeter.conf; - # Launcher - hyprshell = { - config = readFile ./hyprland/hyprshell/config.ron; - style = readFile ./hyprland/hyprshell/style.css; + # Launcher + hyprshell = { + config = readFile ./hyprland/hyprshell/config.ron; + style = readFile ./hyprland/hyprshell/style.css; + }; + } + // map.files { + directory = ./hyprland/theme; + apply = readFile; + extension = ".css"; }; - } - // map.files { - directory = ./hyprland/theme; - apply = readFile; - extension = ".css"; - }; - - # Pictures - images = { - profile = ./images/Profile.png; - transparent = ./images/transparent.png; - }; - - # Logseq Notes - logseq = { - settings = ./logseq/settings; - prefs = readFile ./logseq/preferences.json; - }; - # Configuration Mutability - mutability = rec { - src = "https://gist.githubusercontent.com/piousdeer/b29c272eaeba398b864da6abf6cb5daa/raw/41e569ba110eb6ebbb463a6b1f5d9fe4f9e82375"; - module = { - url = src + "/mutability.nix"; - sha256 = "4b5ca670c1ac865927e98ac5bf5c131eca46cc20abf0bd0612db955bfc979de8"; + # Pictures + images = { + profile = ./images/Profile.png; + transparent = ./images/transparent.png; }; - vscode = { - url = src + "/vscode.nix"; - sha256 = "fed877fa1eefd94bc4806641cea87138df78a47af89c7818ac5e76ebacbd025f"; + # Logseq Notes + logseq = { + settings = ./logseq/settings; + prefs = readFile ./logseq/preferences.json; }; - }; - # Nano Text Editor - nano = readFile ./nanorc; + # Configuration Mutability + mutability = rec { + src = "https://gist.githubusercontent.com/piousdeer/b29c272eaeba398b864da6abf6cb5daa/raw/41e569ba110eb6ebbb463a6b1f5d9fe4f9e82375"; + module = { + url = src + "/mutability.nix"; + sha256 = "4b5ca670c1ac865927e98ac5bf5c131eca46cc20abf0bd0612db955bfc979de8"; + }; + + vscode = { + url = src + "/vscode.nix"; + sha256 = "fed877fa1eefd94bc4806641cea87138df78a47af89c7818ac5e76ebacbd025f"; + }; + }; - # Pantheon Desktop - pantheon = { - dconf = ./pantheon/dconf.nix; + # Nano Text Editor + nano = readFile ./nanorc; # Plank Dock plank = { - autostart = readFile ./pantheon/plank/dock.desktop; - launchers = ./pantheon/plank/launchers; - theme = readFile ./pantheon/plank/dock.theme; + autostart = readFile ./plank/dock.desktop; + launchers = ./plank/launchers; + theme = readFile ./plank/dock.theme; }; - }; - # Custom Proprietary Files - proprietary = inputs.proprietary.files; - inherit (proprietary) wallpapers; + # Custom Proprietary Files + proprietary = inputs.proprietary.files; + inherit (proprietary) wallpapers; - # Bash Scripts - scripts = map.files { - directory = ../scripts; - apply = build.script; - extension = ".sh"; - }; + # Bash Scripts + scripts = map.files { + directory = ../scripts; + apply = build.script; + extension = ".sh"; + }; - # Document Templates - templates = ./templates; + # Document Templates + templates = ./templates; - # Vesktop Discord Chat - vesktop = map.files { - directory = ./vesktop; - apply = readFile; - extension = ".json"; - }; + # Vesktop Discord Chat + vesktop = map.files { + directory = ./vesktop; + apply = readFile; + extension = ".json"; + }; - # Visual Studio Code Editor - vscode = map.files { - directory = ./vscode; - apply = file: fromJSON (readFile file); - extension = ".json"; - }; + # Visual Studio Code Editor + vscode = map.files { + directory = ./vscode; + apply = file: fromJSON (readFile file); + extension = ".json"; + }; - # XFCE Desktop - xfce = { - css = readFile ./xfce/gtk.css; - panel = ./xfce/panel; - settings = - {directory = ./xfce/settings;} - // map.files { - directory = ./xfce/settings; - apply = readFile; - extension = ".xml"; - }; - }; + # XFCE Desktop + xfce = { + css = readFile ./xfce/gtk.css; + panel = ./xfce/panel; + settings = + { + directory = ./xfce/settings; + } + // map.files { + directory = ./xfce/settings; + apply = readFile; + extension = ".xml"; + }; + }; - # My Personal Website - website = ../site; - }; + # My Personal Website + website = ../site; + }; perSystem = _: { # Formatting Errors - treefmt.config.programs.prettier.excludes = ["files/xfce/gtk.css"]; + treefmt.config.programs.prettier.excludes = [ "files/xfce/gtk.css" ]; }; } diff --git a/files/pantheon/dconf.nix b/files/pantheon/dconf.nix @@ -1,303 +0,0 @@ -{ - sys, - lib, - ... -}: -with lib.hm.gvariant; let - inherit (builtins) head; - fonts = sys.fonts.fontconfig.defaultFonts; -in { - ## Dconf Keys ## - # Generated via nix-community/dconf2nix - # Use 'dconf watch /' to record changes - dconf.settings = { - # Desktop - "io/elementary/desktop/agent-geoclue2".location-enabled = true; - "io/elementary/desktop/wingpanel".use-transparency = true; - "io/elementary/desktop/wingpanel/a11y".show-indicator = true; - "io/elementary/desktop/wingpanel/datetime".clock-format = "24h"; - "io/elementary/desktop/wingpanel/sound".max-volume = 100.0; - "io/elementary/desktop/wingpanel/power".show-percentage = true; - "io/elementary/desktop/wingpanel/bluetooth".bluetooth-enabled = false; - - "io/elementary/switchboard/keyboard".first-launch = false; - "io/elementary/files/preferences".singleclick-select = false; - "io/elementary/settings-daemon/datetime".show-weeks = true; - - "org/gnome/desktop/session".idle-delay = mkUint32 900; - "org/gnome/desktop/a11y/keyboard".togglekeys-enable = true; - "org/gnome/desktop/datetime".automatic-timezone = true; - "org/gnome/desktop/interface" = { - clock-format = "24h"; - clock-show-weekday = true; - cursor-size = 32; - enable-animations = true; - enable-hot-corners = true; - gtk-enable-primary-paste = true; - locate-pointer = true; - text-scaling-factor = 1.0; - }; - - "org/gnome/desktop/background" = rec { - color-shading-type = "solid"; - picture-options = "zoom"; - picture-uri = "file://${sys.gui.wallpaper}"; - picture-uri-dark = picture-uri; - }; - - "io/elementary/notifications/applications/gala-other" = { - remember = true; - sounds = true; - }; - - "org/gnome/desktop/sound" = { - allow-volume-above-100-percent = false; - event-sounds = true; - theme-name = "elementary"; - }; - - "org/gnome/settings-daemon/plugins/power" = { - power-button-action = "interactive"; - sleep-inactive-ac-timeout = 0; - sleep-inactive-ac-type = "nothing"; - sleep-inactive-battery-timeout = 1800; - }; - - "org/gnome/desktop/peripherals/touchpad" = { - click-method = "fingers"; - tap-to-click = true; - two-finger-scrolling-enabled = true; - }; - - "org/gnome/settings-daemon/plugins/color" = { - night-light-enabled = true; - night-light-schedule-automatic = false; - night-light-schedule-from = 19.0; - night-light-schedule-to = 7.0; - night-light-temperature = mkUint32 3700; - }; - - "io/elementary/settings-daemon/housekeeping" = { - cleanup-downloads-folder = false; - cleanup-screenshots-folder = false; - old-files-age = 30; - }; - - # Window Manager - "org/pantheon/desktop/gala/appearance".button-layout = ":minimize,maximize,close"; - "org/gnome/desktop/wm/preferences".titlebar-font = "${head fonts.sansSerif} Bold 11"; - - "org/pantheon/desktop/gala/behavior" = { - hotcorner-bottomleft = "show-workspace-view"; - hotcorner-bottomright = "switch-to-workspace-next"; - hotcorner-topleft = "open-launcher"; - }; - - "org/gnome/mutter" = { - attach-modal-dialogs = true; - center-new-windows = true; - dynamic-workspaces = true; - edge-tiling = true; - focus-change-on-pointer-rest = true; - workspaces-only-on-primary = true; - }; - - "org/gnome/mutter/keybindings" = { - cancel-input-capture = ["<Super><Shift>Escape"]; - toggle-tiled-left = []; - toggle-tiled-right = []; - }; - - # Apps - "desktop/ibus/panel/emoji".font = "${head fonts.emoji} 16"; - "desktop/ibus/panel" = { - show-icon-on-systray = false; - use-custom-font = true; - custom-font = "${head fonts.sansSerif} 10"; - }; - - "com/github/stsdc/monitor/settings" = { - background-state = true; - indicator-state = true; - indicator-cpu-state = false; - indicator-gpu-state = false; - indicator-memory-state = true; - indicator-network-download-state = false; - indicator-network-upload-state = false; - indicator-temperature-state = true; - }; - - "org/gnome/epiphany" = { - ask-for-default = false; - default-search-engine = "Google"; - use-google-search-suggestions = true; - }; - - "io/elementary/terminal/settings" = { - audible-bell = false; - follow-last-tab = "true"; - font = "${head fonts.monospace} Medium 13"; - natural-copy-paste = false; - unsafe-paste-alert = true; - }; - - "net/launchpad/plank/docks/dock1" = { - current-workspace-only = true; - icon-size = 60; - pressure-reveal = true; - theme = "default"; - zoom-enabled = true; - zoom-percent = 120; - }; - - "io/elementary/code/saved-state".outline-visible = true; - "io/elementary/code/settings" = { - autosave = false; - prefer-dark-style = true; - show-mini-map = true; - show-right-margin = true; - strip-trailing-on-save = true; - plugins-enabled = [ - "editorconfig" - "word-completion" - "brackets-completion" - "preserve-indent" - "detect-indent" - ]; - }; - - "com/github/hezral/clips" = { - first-run = false; - hide-on-startup = true; - min-column-number = 3; - persistent-mode = false; - prefer-dark-style = true; - protected-mode = true; - quick-paste = true; - shake-reveal = false; - show-close-button = false; - theme-optin = true; - }; - - # Keyboard Shortcuts - "org/gnome/desktop/wm/keybindings" = { - begin-move = []; - begin-resize = []; - close = ["<Super>q" "<Alt>F4"]; - cycle-group = []; - cycle-group-backward = []; - maximize = [""]; - minimize = ["<Super>Down"]; - move-to-monitor-down = []; - move-to-monitor-left = ["<Shift><Super>Left"]; - move-to-monitor-right = ["<Shift><Super>Right"]; - move-to-monitor-up = []; - move-to-workspace-1 = []; - move-to-workspace-2 = [""]; - move-to-workspace-3 = [""]; - move-to-workspace-4 = [""]; - move-to-workspace-5 = [""]; - move-to-workspace-6 = [""]; - move-to-workspace-7 = [""]; - move-to-workspace-8 = [""]; - move-to-workspace-9 = [""]; - move-to-workspace-down = []; - move-to-workspace-last = []; - move-to-workspace-left = ["<Primary><Super>Left"]; - move-to-workspace-right = ["<Primary><Super>Right"]; - move-to-workspace-up = []; - show-desktop = ["<Super>d"]; - switch-applications = ["<Alt>Tab"]; - switch-applications-backward = ["<Shift><Alt>Tab"]; - switch-group = ["<Super>Tab"]; - switch-group-backward = ["<Shift><Super>Tab"]; - switch-to-workspace-1 = ["<Super>Home"]; - switch-to-workspace-2 = [""]; - switch-to-workspace-3 = [""]; - switch-to-workspace-4 = [""]; - switch-to-workspace-5 = [""]; - switch-to-workspace-6 = [""]; - switch-to-workspace-7 = [""]; - switch-to-workspace-8 = [""]; - switch-to-workspace-9 = [""]; - switch-to-workspace-down = []; - switch-to-workspace-last = ["<Super>End"]; - switch-to-workspace-left = ["<Super>Left"]; - switch-to-workspace-right = ["<Super>Right"]; - switch-to-workspace-up = []; - toggle-maximized = ["<Super>Up"]; - unmaximize = []; - }; - - "org/gnome/settings-daemon/plugins/media-keys" = { - email = ["<Super>e"]; - home = ["<Super>f"]; - magnifier-zoom-in = ["<Super>equal"]; - magnifier-zoom-out = ["<Super>minus"]; - play = ["F4"]; - screenreader = []; - screensaver = ["<Super>l"]; - terminal = ["<Super>t"]; - volume-down = ["AudioLowerVolume"]; - volume-mute = [""]; - volume-up = ["AudioRaiseVolume"]; - www = ["<Super>w"]; - custom-keybindings = [ - "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" - "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" - "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/" - "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/" - ]; - }; - - "org/pantheon/desktop/gala/keybindings" = { - area-screenshot = ["Print"]; - expose-windows = [""]; - pip = [""]; - screenshot = ["<Shift>Print"]; - }; - - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { - name = "Task Manager"; - binding = "<Primary><Alt>Return"; - command = "com.github.stsdc.monitor"; - }; - - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { - name = "Terminal"; - binding = "<Super>t"; - command = "io.elementary.terminal"; - }; - - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = { - name = "Calculator"; - binding = "Calculator"; - command = "io.elementary.calculator"; - }; - - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3" = { - name = "Clipboard"; - binding = "<Super>v"; - command = "gtk-launch com.github.hezral.clips"; - }; - - # Gestures - "org/gnome/shell/extensions/windowgestures" = { - fn-fullscreen = true; - fn-maximized-snap = true; - fn-move = true; - fn-move-snap = true; - fn-resize = true; - pinch-enable = true; - pinch3-in = 0; - pinch3-out = 0; - pinch4-in = 14; - pinch4-out = 3; - swipe3-down = 1; - swipe4-updown = 22; - taphold-move = true; - three-finger = false; - use-active-window = true; - }; - }; -} diff --git a/files/pantheon/plank/dock.desktop b/files/plank/dock.desktop diff --git a/files/pantheon/plank/dock.theme b/files/plank/dock.theme diff --git a/files/pantheon/plank/launchers/io.elementary.code.dockitem b/files/plank/launchers/io.elementary.code.dockitem diff --git a/files/pantheon/plank/launchers/io.elementary.files.dockitem b/files/plank/launchers/io.elementary.files.dockitem diff --git a/files/pantheon/plank/launchers/io.elementary.mail.dockitem b/files/plank/launchers/io.elementary.mail.dockitem diff --git a/files/pantheon/plank/launchers/io.elementary.switchboard.dockitem b/files/plank/launchers/io.elementary.switchboard.dockitem diff --git a/files/pantheon/plank/launchers/io.elementary.terminal.dockitem b/files/plank/launchers/io.elementary.terminal.dockitem diff --git a/files/repl.nix b/files/repl.nix @@ -1,37 +1,47 @@ { path ? /etc/nixos, host ? false, -}: let - inherit (builtins) currentSystem getFlake head match pathExists readFile removeAttrs toString; +}: +let + inherit (builtins) + currentSystem + getFlake + head + match + pathExists + readFile + removeAttrs + toString + ; flake = - if pathExists "${path}/flake.nix" - then getFlake "${toString path}" - else getFlake "/etc/nixos"; + if pathExists "${path}/flake.nix" then getFlake "${toString path}" else getFlake "/etc/nixos"; pkgs = - if (flake.inputs ? nixpkgs) - then import flake.inputs.nixpkgs.outPath {} - else if (flake.legacyPackages ? currentSystem) - then import flake.legacyPackages."${currentSystem}" - else import <nixpkgs> {}; + if (flake.inputs ? nixpkgs) then + import flake.inputs.nixpkgs.outPath { } + else if (flake.legacyPackages ? currentSystem) then + import flake.legacyPackages."${currentSystem}" + else + import <nixpkgs> { }; in - { - inherit flake; - } - // builtins - // (removeAttrs (pkgs // pkgs.lib) ["options" "config"]) - // flake - // (flake.nixosConfigurations or {}) - // ( - if host - then - flake - .nixosConfigurations - ."${ - head (match '' - ([a-zA-Z0-9\-]+) - '' (readFile "/etc/hostname")) - }" - else {} - ) +{ + inherit flake; +} +// builtins +// (removeAttrs (pkgs // pkgs.lib) [ + "options" + "config" +]) +// flake +// (flake.nixosConfigurations or { }) +// ( + if host then + flake.nixosConfigurations."${head ( + match '' + ([a-zA-Z0-9\-]+) + '' (readFile "/etc/hostname") + )}" + else + { } +) diff --git a/files/vscode/settings.json b/files/vscode/settings.json @@ -1,8 +1,6 @@ { - "better-comments.highlightPlainText": true, "editor.cursorSmoothCaretAnimation": "on", "editor.cursorStyle": "line-thin", - "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.smoothScrolling": true, "editor.suggest.preview": true, @@ -15,19 +13,7 @@ "extensions.autoUpdate": false, "extensions.ignoreRecommendations": true, "files.autoSave": "onWindowChange", - "files.exclude": { - "**/.classpath": true, - "**/.factorypath": true, - "**/.project": true, - "**/.settings": true - }, "files.trimFinalNewlines": true, - "gitlens.advanced.commitOrdering": "date", - "gitlens.advanced.fileHistoryFollowsRenames": true, - "nix.enableLanguageServer": true, - "nix.formatterPath": "alejandra", - "nix.serverPath": "nil", - "scm.repositories.visible": 7, "search.showLineNumbers": true, "search.smartCase": true, "search.useGlobalIgnoreFiles": true, @@ -35,6 +21,25 @@ "terminal.integrated.cursorStyle": "line", "terminal.integrated.enableVisualBell": true, "terminal.integrated.tabs.separator": " / ", + "update.mode": "none", + "window.autoDetectColorScheme": false, + "window.closeWhenEmpty": true, + "window.commandCenter": true, + "window.dialogStyle": "custom", + "window.doubleClickIconToClose": true, + "window.menuBarVisibility": "toggle", + "window.titleSeparator": " / ", + "workbench.commandPalette.preserveInput": true, + "workbench.editor.highlightModifiedTabs": true, + "workbench.list.horizontalScrolling": true, + "workbench.list.smoothScrolling": true, + "workbench.startupEditor": "readme", + + "editor.defaultFormatter": "esbenp.prettier-vscode", + "better-comments.highlightPlainText": true, + "gitlens.advanced.commitOrdering": "date", + "gitlens.advanced.fileHistoryFollowsRenames": true, + "scm.repositories.visible": 7, "todohighlight.isCaseSensitive": true, "todohighlight.keywords": [ { @@ -63,18 +68,22 @@ "backgroundColor": "#3498db" } ], - "update.mode": "none", - "window.autoDetectColorScheme": false, - "window.closeWhenEmpty": true, - "window.commandCenter": true, - "window.dialogStyle": "custom", - "window.doubleClickIconToClose": true, - "window.menuBarVisibility": "toggle", - "window.titleSeparator": " / ", - "window.zoomLevel": 1, - "workbench.commandPalette.preserveInput": true, - "workbench.editor.highlightModifiedTabs": true, - "workbench.list.horizontalScrolling": true, - "workbench.list.smoothScrolling": true, - "workbench.startupEditor": "readme" + "nix.enableLanguageServer": true, + "nix.serverPath": "nil", + "nix.serverSettings": { + "nil": { + "formatting": { + "command": ["nixfmt"] + } + } + }, + "[nix]": { + "editor.defaultFormatter": "jnoortheen.nix-ide" + }, + "[cpp]": { + "editor.defaultFormatter": "ms-vscode.cpptools" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter" + } } diff --git a/flake.lock b/flake.lock @@ -813,11 +813,11 @@ ] }, "locked": { - "lastModified": 1745884815, - "narHash": "sha256-tqkJdi2K4UtBrxh/CN2Og+rfgW56m9UlnWYrG76UnnE=", + "lastModified": 1746122011, + "narHash": "sha256-jIZD8k6pbsr5eer0BwFCTuUyso11cnQldYwLF9oMp3w=", "owner": "H3rmt", "repo": "hyprswitch", - "rev": "058525f9dbb84319010f677f45f34fa007fd61b8", + "rev": "02bd2c400616cb96cd21ccc6b2f530143fcb511b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix @@ -210,28 +210,30 @@ }; ## Configuration ## - outputs = {self, ...} @ inputs: let - inherit (inputs.nixpkgs) lib; - map = import ./lib/map.nix lib; - in - inputs.framework.lib.mkFlake {inherit inputs;} { + outputs = + { self, ... }@inputs: + let + inherit (inputs.nixpkgs) lib; + map = import ./lib/map.nix lib; + in + inputs.framework.lib.mkFlake { inherit inputs; } { inherit (self) systems; debug = false; - _module.args = {util = self.lib;}; imports = map.flake ./.; + _module.args = { + util = self.lib; + }; flake = { # Supported Architectures systems = import inputs.systems; ## Custom Library Functions ## - lib = - lib.recursiveUpdate (map.modules ./lib (file: import file lib)) - { - nixpkgs = lib; - build.device = import ./modules/configuration.nix inputs; - }; + lib = lib.recursiveUpdate (map.modules ./lib (file: import file lib)) { + nixpkgs = lib; + build.device = import ./modules/configuration.nix inputs; + }; ## Configuration Template ## templates.default = with inputs.filters.lib; { diff --git a/lib/_mime.nix b/lib/_mime.nix @@ -71,9 +71,12 @@ "x-scheme-handler/unknown" ]; - calendar = ["text/calendar" "x-scheme-handler/webcal"]; + calendar = [ + "text/calendar" + "x-scheme-handler/webcal" + ]; - directory = ["inode/directory"]; + directory = [ "inode/directory" ]; document = [ "application/illustrator" @@ -133,11 +136,11 @@ "image/x-tga" ]; - magnet = ["x-scheme-handler/magnet"]; + magnet = [ "x-scheme-handler/magnet" ]; - mail = ["x-scheme-handler/mailto"]; + mail = [ "x-scheme-handler/mailto" ]; - markdown = ["text/markdown"]; + markdown = [ "text/markdown" ]; office = [ "application/rtf" @@ -152,7 +155,7 @@ "application/vnd.ms-powerpoint" ]; - pdf = ["application/pdf"]; + pdf = [ "application/pdf" ]; text = [ "text/plain" diff --git a/lib/build.nix b/lib/build.nix @@ -1,6 +1,6 @@ -lib: let - inherit - (builtins) +lib: +let + inherit (builtins) concatStringsSep filter hasAttr @@ -10,8 +10,7 @@ lib: let readFile ; - inherit - (lib) + inherit (lib) flatten hasPrefix mapAttrsToList @@ -19,47 +18,103 @@ lib: let replaceStrings splitString ; -in { +in +{ ## Builder Functions ## # Mime Types Handler - mime = option: - listToAttrs (flatten (mapAttrsToList (name: types: - if hasAttr name option - then map (type: nameValuePair type option."${name}") types - else []) - (import ./_mime.nix))); + mime = + option: + listToAttrs ( + flatten ( + mapAttrsToList ( + name: types: + if hasAttr name option then map (type: nameValuePair type option."${name}") types else [ ] + ) (import ./_mime.nix) + ) + ); # Script Builder - script = file: - concatStringsSep "\n" - ((filter (line: line != "" && !(hasPrefix "#!" line))) - (splitString "\n" (readFile file))); + script = + file: + concatStringsSep "\n" ( + (filter (line: line != "" && !(hasPrefix "#!" line))) (splitString "\n" (readFile file)) + ); # Theme Substituter - theme = { - accent ? "base0D", - colors ? null, - fonts ? null, - file, - }: let - color = ["@accent" "@white" "@base00" "@base01" "@base02" "@base03" "@base04" "@base05" "@base06" "@base07" "@base08" "@base09" "@base0A" "@base0B" "@base0C" "@base0D" "@base0E" "@base0F"]; - color' = with colors; [colors."${accent}" "FFFFFF" base00 base01 base02 base03 base04 base05 base06 base07 base08 base09 base0A base0B base0C base0D base0E base0F]; - font = ["@font" "@monospace"]; - font' = with fonts; [sansSerif.name monospace.name]; - in - if (colors != null && fonts != null) - then replaceStrings (color ++ font) (color' ++ font') file - else if (colors != null) - then replaceStrings color color' file - else if (fonts != null) - then replaceStrings font font' file - else throw "One of 'colors' or 'fonts' must be declared"; + theme = + { + accent ? "base0D", + colors ? null, + fonts ? null, + file, + }: + let + color = [ + "@accent" + "@white" + "@base00" + "@base01" + "@base02" + "@base03" + "@base04" + "@base05" + "@base06" + "@base07" + "@base08" + "@base09" + "@base0A" + "@base0B" + "@base0C" + "@base0D" + "@base0E" + "@base0F" + ]; + + color' = with colors; [ + colors."${accent}" + "FFFFFF" + base00 + base01 + base02 + base03 + base04 + base05 + base06 + base07 + base08 + base09 + base0A + base0B + base0C + base0D + base0E + base0F + ]; + + font = [ + "@font" + "@monospace" + ]; + + font' = with fonts; [ + sansSerif.name + monospace.name + ]; + in + if (colors != null && fonts != null) then + replaceStrings (color ++ font) (color' ++ font') file + else if (colors != null) then + replaceStrings color color' file + else if (fonts != null) then + replaceStrings font font' file + else + throw "One of 'colors' or 'fonts' must be declared"; # String Extractor - until = check: string: let - value = match "([^ ]+)${check}.*" string; - in - if (value == null) - then string - else concatStringsSep "" value; + until = + check: string: + let + value = match "([^ ]+)${check}.*" string; + in + if (value == null) then string else concatStringsSep "" value; } diff --git a/lib/map.nix b/lib/map.nix @@ -1,6 +1,6 @@ -lib: let - inherit - (builtins) +lib: +let + inherit (builtins) attrNames attrValues foldl' @@ -12,8 +12,7 @@ lib: let typeOf ; - inherit - (lib) + inherit (lib) flatten filterAttrs forEach @@ -30,52 +29,59 @@ lib: let # Import Checks checkName = name: _: !(hasPrefix "_" name); - checkAttr = name: let type = typeOf (import name); in type == "set" || type == "lambda"; -in rec { + checkAttr = + name: + let + type = typeOf (import name); + in + type == "set" || type == "lambda"; +in +rec { ## Mapping Functions ## - array = list: func: forEach list (name: getAttrFromPath [name] func); + array = list: func: forEach list (name: getAttrFromPath [ name ] func); list = func: foldl' (x: y: x + y + " ") "" (attrNames func); - filter = name: func: attrs: - filterAttrs (_: type: type != null) - (mapAttrs' func (filterAttrs name attrs)); + filter = + name: func: attrs: + filterAttrs (_: type: type != null) (mapAttrs' func (filterAttrs name attrs)); ## Files Map - files = { - directory, - recursive ? false, - apply ? id, - extension, - check ? (_: true), - }: - filter checkName (name: type: let - path = "${toString directory}/${name}"; - in - if (type == "directory" || type == "symlink") && recursive - then nameValuePair name (files {inherit path apply;}) + files = + { + directory, + recursive ? false, + apply ? id, + extension, + check ? (_: true), + }: + filter checkName ( + name: type: + let + path = "${toString directory}/${name}"; + in + if (type == "directory" || type == "symlink") && recursive then + nameValuePair name (files { + inherit path apply; + }) else if (type == "directory" || type == "symlink") - && ( - if (extension == ".nix") - then pathExists "${path}/default.nix" - else true - ) - then nameValuePair name (apply path) + && (if (extension == ".nix") then pathExists "${path}/default.nix" else true) + then + nameValuePair name (apply path) else if - type - == "regular" - && ( - if (extension == ".nix") - then name != "default.nix" && name != "flake.nix" - else true - ) + type == "regular" + && (if (extension == ".nix") then name != "default.nix" && name != "flake.nix" else true) && hasSuffix extension name && (check path) - then nameValuePair (removeSuffix extension name) (apply path) - else nameValuePair "" null) (readDir directory); + then + nameValuePair (removeSuffix extension name) (apply path) + else + nameValuePair "" null + ) (readDir directory); # Module Imports modules = { - __functor = _: directory: apply: + __functor = + _: directory: apply: files { inherit directory apply; extension = ".nix"; @@ -87,59 +93,69 @@ in rec { }; # Flake Imports - flake = directory: - attrValues (filter checkName (name: type: let - path = "${toString directory}/${name}"; - in - if - (type == "directory" || type == "symlink") - && (pathExists "${path}/flake.nix") - then nameValuePair name "${path}/flake.nix" - else nameValuePair "" null) (readDir directory)); + flake = + directory: + attrValues ( + filter checkName ( + name: type: + let + path = "${toString directory}/${name}"; + in + if (type == "directory" || type == "symlink") && (pathExists "${path}/flake.nix") then + nameValuePair name "${path}/flake.nix" + else + nameValuePair "" null + ) (readDir directory) + ); # Configuration Folder Creation - folder = { - directory, - path, - extension ? "", - apply, - replace ? { - placeholders = {}; - values = {}; - }, - }: - mapAttrs' (name: value: - nameValuePair "${path}/${name}${extension}" (apply value)) - (files { + folder = + { + directory, + path, + extension ? "", + apply, + replace ? { + placeholders = { }; + values = { }; + }, + }: + mapAttrs' (name: value: nameValuePair "${path}/${name}${extension}" (apply value)) (files { inherit directory extension; apply = file: with replace; replaceStrings placeholders values (readFile file); }); # Package Patches - patches = patch: - if isPath patch - then - flatten (mapAttrsToList (name: type: - if - type - == "regular" - && (hasSuffix ".diff" name || hasSuffix ".patch" name) - then patch + "/${name}" - else null) (readDir patch)) - else patch; + patches = + patch: + if isPath patch then + flatten ( + mapAttrsToList ( + name: type: + if type == "regular" && (hasSuffix ".diff" name || hasSuffix ".patch" name) then + patch + "/${name}" + else + null + ) (readDir patch) + ) + else + patch; # 'sops' Encrypted Secrets - secrets = { - directory, - neededForUsers ? false, - }: - filter checkName (name: type: - if type == "regular" && hasSuffix ".secret" name - then + secrets = + { + directory, + neededForUsers ? false, + }: + filter checkName ( + name: type: + if type == "regular" && hasSuffix ".secret" name then nameValuePair name { sopsFile = directory + "/${name}"; format = "binary"; inherit neededForUsers; } - else nameValuePair "" null) (readDir directory); + else + nameValuePair "" null + ) (readDir directory); } diff --git a/lib/pack.nix b/lib/pack.nix @@ -1,17 +1,21 @@ -lib: let +lib: +let inherit (builtins) attrNames; inherit (lib) genAttrs id mapAttrs'; -in { +in +{ ## Packager Functions ## # Device Configurations - device = attrs: + device = + attrs: mapAttrs' (_: name: { name = "Device-${name}"; value = attrs."${name}".config.system.build."nixos-rebuild"; }) (genAttrs (attrNames attrs) id); # User Home Configurations - user = attrs: user: + user = + attrs: user: mapAttrs' (_: name: { name = "User-${name}"; value = attrs."${user}".activationPackage; diff --git a/modules/apps/default.nix b/modules/apps/default.nix @@ -2,17 +2,19 @@ lib, util, ... -}: let +}: +let inherit (util.map) modules; inherit (lib) mkOption types; -in { +in +{ ## APPS Configuration ## imports = modules.list ./.; options.apps.list = mkOption { description = "List of Enabled Applications"; type = types.listOf (types.enum (modules.name ./.)); - default = []; + default = [ ]; }; # AppImage Support diff --git a/modules/apps/discord.nix b/modules/apps/discord.nix @@ -5,15 +5,17 @@ files, ... }: -with files.vesktop; let +with files.vesktop; +let enable = builtins.elem "discord" config.apps.list; -in { +in +{ ## Discord Configuration ## config = lib.mkIf enable { - environment.systemPackages = [pkgs.vesktop]; + environment.systemPackages = [ pkgs.vesktop ]; user = { - persist.directories = [".config/vesktop"]; + persist.directories = [ ".config/vesktop" ]; homeConfig.home.file = { ".config/vesktop/settings.json".text = prefs; ".config/vesktop/settings/settings.json".text = settings; diff --git a/modules/apps/firefox.nix b/modules/apps/firefox.nix @@ -4,22 +4,28 @@ util, pkgs, ... -}: let +}: +let enable = builtins.elem "firefox" config.apps.list; -in { +in +{ ## Firefox Browser Configuration ## config = lib.mkIf enable { environment = { - systemPackages = [pkgs.firefox]; + systemPackages = [ pkgs.firefox ]; sessionVariables.MOZ_USE_XINPUT2 = "1"; }; user = { - persist.directories = [".cache/mozilla/firefox" ".mozilla/firefox"]; + persist.directories = [ + ".cache/mozilla/firefox" + ".mozilla/firefox" + ]; + homeConfig = { # File Associations xdg.mimeApps.defaultApplications = util.build.mime { - browser = ["firefox.desktop"]; + browser = [ "firefox.desktop" ]; }; # Profile @@ -38,15 +44,16 @@ in { }; # Extensions - ExtensionSettings = let - extension = shortId: uuid: { - name = uuid; - value = { - installation_mode = "normal_installed"; - install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; + ExtensionSettings = + let + extension = shortId: uuid: { + name = uuid; + value = { + installation_mode = "normal_installed"; + install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; + }; }; - }; - in + in builtins.listToAttrs [ (extension "clearurls" "{74145f27-f039-47ce-a470-a662b129930a}") (extension "setupvpn" "@setupvpncom") diff --git a/modules/apps/flatpak.nix b/modules/apps/flatpak.nix @@ -3,10 +3,12 @@ lib, inputs, ... -}: let +}: +let enable = builtins.elem "flatpak" config.apps.list; -in { - imports = [inputs.flatpak.nixosModules.nix-flatpak]; +in +{ + imports = [ inputs.flatpak.nixosModules.nix-flatpak ]; ## Flatpak Configuration ## config = lib.mkIf enable { @@ -18,8 +20,12 @@ in { ]; xdg.portal.enable = true; - environment.persist.directories = ["/var/lib/flatpak"]; - user.persist.directories = [".cache/flatpak" ".local/share/flatpak" ".var/app"]; + environment.persist.directories = [ "/var/lib/flatpak" ]; + user.persist.directories = [ + ".cache/flatpak" + ".local/share/flatpak" + ".var/app" + ]; services.flatpak = { enable = true; @@ -41,19 +47,23 @@ in { # Use `flatpak remote-info --log` to find commit revisions packages = [ /* - { - appId = ""; - origin = ""; - commit = ""; - } + { + appId = ""; + origin = ""; + commit = ""; + } */ ]; # Platform Integration overrides.global = { Context = { - sockets = ["wayland" "!x11" "fallback-x11"]; - filesystems = ["~/.config/dconf:ro"]; + filesystems = [ "~/.config/dconf:ro" ]; + sockets = [ + "wayland" + "!x11" + "fallback-x11" + ]; }; Environment = { diff --git a/modules/apps/games/default.nix b/modules/apps/games/default.nix @@ -4,19 +4,27 @@ util, pkgs, ... -}: let - inherit (lib) mkIf mkOption mkOverride types; +}: +let + inherit (lib) + mkIf + mkOption + mkOverride + types + ; + inherit (util.map) modules; enable = builtins.elem "games" config.apps.list; wine = builtins.elem "wine" config.apps.list; wine' = pkgs.gaming.wine-tkg; -in { +in +{ imports = modules.list ./.; options.apps.games = mkOption { description = "List of Installed Games"; type = types.listOf (types.enum (modules.name ./.)); - default = []; + default = [ ]; }; ## Games Configuration ## diff --git a/modules/apps/games/osu.nix b/modules/apps/games/osu.nix @@ -3,9 +3,10 @@ lib, pkgs, ... -}: { +}: +{ config = lib.mkIf (builtins.elem "osu" config.apps.games) { - environment.systemPackages = [pkgs.osu-lazer-bin]; - user.persist.directories = [".local/share/osu"]; + environment.systemPackages = [ pkgs.osu-lazer-bin ]; + user.persist.directories = [ ".local/share/osu" ]; }; } diff --git a/modules/apps/git/default.nix b/modules/apps/git/default.nix @@ -4,8 +4,12 @@ pkgs, files, ... -}: { - imports = [./hosting.nix ./runner.nix]; +}: +{ + imports = [ + ./hosting.nix + ./runner.nix + ]; ## 'git' Configuration ## config = lib.mkIf (builtins.elem "git" config.apps.list) { @@ -21,9 +25,9 @@ # Settings user = { - persist.directories = [".config/gh"]; + persist.directories = [ ".config/gh" ]; homeConfig = { - imports = [./user.nix]; + imports = [ ./user.nix ]; # Hooks home.file.".git-hooks".source = files.git.hooks; @@ -75,7 +79,15 @@ }; # Globally Ignored Files - ignores = ["*~*" "*.bak" ".direnv" ".vscode" "result" "result-*" "tags.*"]; + ignores = [ + "*~*" + "*.bak" + ".direnv" + ".vscode" + "result" + "result-*" + "tags.*" + ]; # Additional Parameters extraConfig = { diff --git a/modules/apps/git/hosting.nix b/modules/apps/git/hosting.nix @@ -2,11 +2,19 @@ config, lib, ... -}: let - inherit (lib) mkEnableOption mkIf mkOption types; +}: +let + inherit (lib) + mkEnableOption + mkIf + mkOption + types + ; + inherit (config.apps.git.hosting) enable domain secret; opt = config.apps.git.hosting; -in { +in +{ options.apps.git.hosting = { enable = mkEnableOption "Enable Gitea Code Hosting"; domain = mkOption { @@ -35,7 +43,7 @@ in { ]; # User Configuration - user.groups = ["gitea"]; + user.groups = [ "gitea" ]; users.users.git = { useDefaultShell = true; home = "/var/lib/gitea"; @@ -63,10 +71,14 @@ in { }; # NGINX Secured Reverse Proxy - environment.persist.directories = ["/srv"]; + environment.persist.directories = [ "/srv" ]; networking.firewall = { - allowedUDPPorts = [7000]; - allowedTCPPorts = [80 443 7000]; + allowedUDPPorts = [ 7000 ]; + allowedTCPPorts = [ + 80 + 443 + 7000 + ]; }; security.acme = { @@ -77,7 +89,7 @@ in { email = "admin@${domain}"; dnsProvider = "cloudflare"; credentialsFile = secret; - extraLegoFlags = ["--dns.resolvers=8.8.8.8:53"]; + extraLegoFlags = [ "--dns.resolvers=8.8.8.8:53" ]; }; }; diff --git a/modules/apps/git/runner.nix b/modules/apps/git/runner.nix @@ -5,14 +5,27 @@ pkgs, files, ... -}: let - inherit (lib) mkIf mkMerge mkOption types; +}: +let + inherit (lib) + mkIf + mkMerge + mkOption + types + ; + inherit (config.apps.git) runner; -in { +in +{ options.apps.git.runner = { support = mkOption { description = "Support for 'git' Runners"; - type = types.nullOr (types.enum ["github" "gitlab"]); + type = types.nullOr ( + types.enum [ + "github" + "gitlab" + ] + ); default = null; }; secret = mkOption { @@ -34,11 +47,11 @@ in { } (mkIf (runner.support == "github") { # GitHub Runner - environment.systemPackages = [pkgs.act]; + environment.systemPackages = [ pkgs.act ]; services.github-runners.runner = { enable = true; url = files.path.repo; - extraLabels = ["self"]; + extraLabels = [ "self" ]; tokenFile = runner.secret; }; }) @@ -53,7 +66,7 @@ in { enable = true; services.default = { dockerImage = "alpine"; - tagList = ["self"]; + tagList = [ "self" ]; authenticationTokenConfigFile = runner.secret; }; }; diff --git a/modules/apps/git/user.nix b/modules/apps/git/user.nix @@ -3,10 +3,12 @@ options, lib, ... -}: let +}: +let cfg = config.credentials; opt = options.credentials.mail.description; -in { +in +{ ## User Credentials ## # Warnings assertions = [ diff --git a/modules/apps/media.nix b/modules/apps/media.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let enable = builtins.elem "media" config.apps.list; -in { +in +{ ## Media Configuration ## config = lib.mkIf enable { environment.systemPackages = with pkgs; [ @@ -16,8 +18,8 @@ in { user = { persist = { - files = [".config/rncbc.org/qpwgraph"]; - directories = [".config/pitivi"]; + files = [ ".config/rncbc.org/qpwgraph" ]; + directories = [ ".config/pitivi" ]; }; # Audio Effects diff --git a/modules/apps/notes.nix b/modules/apps/notes.nix @@ -6,32 +6,40 @@ files, ... }: -with files.logseq; let +with files.logseq; +let enable = builtins.elem "notes" config.apps.list; mutable = { mutable = true; force = true; }; -in { +in +{ ## Logseq Configuration ## config = lib.mkIf enable { - environment.systemPackages = [pkgs.logseq]; + environment.systemPackages = [ pkgs.logseq ]; user = { - persist.directories = [".logseq" ".config/Logseq"]; + persist.directories = [ + ".logseq" + ".config/Logseq" + ]; + homeConfig.home.file = { ".config/logseq/configs.edn".text = ''{:window/native-titlebar? true}''; - ".logseq/preferences.json" = {text = prefs;} // mutable; + ".logseq/preferences.json" = { + text = prefs; + } // mutable; } // util.map.folder { directory = settings; path = ".logseq/settings"; extension = ".json"; - apply = text: {inherit text;} // mutable; + apply = text: { inherit text; } // mutable; replace = { - placeholders = ["@bg"]; - values = [config.lib.stylix.colors.base00]; + placeholders = [ "@bg" ]; + values = [ config.lib.stylix.colors.base00 ]; }; }; }; diff --git a/modules/apps/office.nix b/modules/apps/office.nix @@ -6,11 +6,13 @@ pkgs, files, ... -}: let +}: +let enable = builtins.elem "office" config.apps.list; -in { +in +{ ## Office Environment Configuration ## - imports = [inputs.windows.nixosModules.onlyoffice]; + imports = [ inputs.windows.nixosModules.onlyoffice ]; config = lib.mkIf enable { # Applications programs = { @@ -71,7 +73,12 @@ in { # Dictionaries environment = { - pathsToLink = ["/share/hunspell" "/share/myspell" "/share/hyphen"]; + pathsToLink = [ + "/share/hunspell" + "/share/myspell" + "/share/hyphen" + ]; + variables."DICPATH" = "/run/current-system/sw/share/hunspell:/run/current-system/sw/share/hyphen"; }; @@ -105,8 +112,9 @@ in { homeConfig = { # File Associations - xdg.mimeApps.defaultApplications = - util.build.mime {office = ["onlyoffice-desktopeditors.desktop"];}; + xdg.mimeApps.defaultApplications = util.build.mime { + office = [ "onlyoffice-desktopeditors.desktop" ]; + }; home.file = { # Document Templates diff --git a/modules/apps/spotify.nix b/modules/apps/spotify.nix @@ -4,18 +4,29 @@ inputs, pkgs, ... -}: let +}: +let enable = builtins.elem "spotify" config.apps.list; spice = inputs.spotify.legacyPackages.${pkgs.system}; -in { +in +{ ## Spotify Configuration ## config = lib.mkIf enable { - environment.systemPackages = with pkgs; [spotify spot spicetify-cli]; + environment.systemPackages = with pkgs; [ + spotify + spot + spicetify-cli + ]; user = { - persist.directories = [".config/spotify" ".cache/spotify" ".cache/spot"]; + persist.directories = [ + ".config/spotify" + ".cache/spotify" + ".cache/spot" + ]; + homeConfig = { - imports = [inputs.spotify.homeManagerModules.default]; + imports = [ inputs.spotify.homeManagerModules.default ]; programs.spicetify = { enable = true; diff --git a/modules/apps/vscode.nix b/modules/apps/vscode.nix @@ -6,29 +6,41 @@ files, ... }: -with files.vscode; let +with files.vscode; +let inherit (builtins) elem head; enable = elem "vscode" config.apps.list; font = head config.fonts.fontconfig.defaultFonts.monospace; -in { +in +{ ## Visual Studio Code Editor Configuration ## config = lib.mkIf enable rec { - environment.systemPackages = [pkgs.nil user.homeConfig.programs.vscode.package]; + environment.systemPackages = [ + pkgs.nil + user.homeConfig.programs.vscode.package + ]; user = { - persist.directories = [".config/Code" ".vscode"]; + persist.directories = [ + ".config/Code" + ".vscode" + ]; + homeConfig = { # Mutable Configuration File imports = [ - ({config, ...}: (import (builtins.fetchurl { - inherit (files.mutability.vscode) url sha256; - }) {inherit config lib pkgs;})) + ( + { config, ... }: + (import (builtins.fetchurl { + inherit (files.mutability.vscode) url sha256; + }) { inherit config lib pkgs; }) + ) ]; # Environment xdg.mimeApps.defaultApplications = util.build.mime { - markdown = ["code.desktop"]; - text = ["code.desktop"]; + markdown = [ "code.desktop" ]; + text = [ "code.desktop" ]; }; programs.vscode = { @@ -39,11 +51,13 @@ in { inherit keybindings; # Settings - userSettings = - settings // {"editor.fontFamily" = "'${font}', 'monospace', monospace";}; + userSettings = settings // { + "editor.fontFamily" = "'${font}', 'monospace', monospace"; + }; # Useful Extensions - extensions = with pkgs.vscode-extensions; + extensions = + with pkgs.vscode-extensions; [ aaron-bond.better-comments divyanshuagrawal.competitive-programming-helper @@ -56,7 +70,6 @@ in { github.vscode-pull-request-github jgclark.vscode-todo-highlight jnoortheen.nix-ide - kamadorueda.alejandra ms-python.python ms-vscode-remote.remote-ssh ms-vscode.cpptools diff --git a/modules/apps/wine.nix b/modules/apps/wine.nix @@ -5,12 +5,21 @@ inputs, pkgs, ... -}: let +}: +let inherit (builtins) attrValues elem map; - inherit (lib) mkIf mkEnableOption mkOption optionals types; + inherit (lib) + mkIf + mkEnableOption + mkOption + optionals + types + ; + cfg = config.apps.wine; enable = elem "wine" config.apps.list; -in { +in +{ options.apps.wine = { utilities = mkEnableOption "Install Utility Windows apps"; package = mkOption { @@ -29,29 +38,39 @@ in { hardware.graphics.enable32Bit = true; # Utilities - user.persist.directories = - [".wine" ".cache/wine" ".cache/winetricks"] - ++ optionals cfg.utilities [".config/notepad++"]; + user.persist.directories = [ + ".wine" + ".cache/wine" + ".cache/winetricks" + ] ++ optionals cfg.utilities [ ".config/notepad++" ]; - environment.systemPackages = with pkgs.wine // pkgs; ( - map (name: - if (name.override.__functionArgs ? wine) - then name.override {wine = cfg.package;} - else name) ([ - cfg.package - winetricks - mkwindowsapp-tools - playonlinux - ] - # Wrapped Packages - ++ optionals cfg.utilities - (attrValues (util.map.modules ../../packages/wine - (name: - callPackage name { - inherit lib pkgs; - wine = cfg.package; - build = inputs.windows.lib."${pkgs.system}"; - })))) - ); + environment.systemPackages = + with pkgs.wine // pkgs; + (map + ( + name: if (name.override.__functionArgs ? wine) then name.override { wine = cfg.package; } else name + ) + ( + [ + cfg.package + winetricks + mkwindowsapp-tools + playonlinux + ] + # Wrapped Packages + ++ optionals cfg.utilities ( + attrValues ( + util.map.modules ../../packages/wine ( + name: + callPackage name { + inherit lib pkgs; + wine = cfg.package; + build = inputs.windows.lib."${pkgs.system}"; + } + ) + ) + ) + ) + ); }; } diff --git a/modules/base/console.nix b/modules/base/console.nix @@ -2,15 +2,17 @@ config, pkgs, ... -}: let +}: +let font = builtins.head config.fonts.fontconfig.defaultFonts.monospace; -in { +in +{ ## Console Configuration ## config = { # Setup console = { earlySetup = true; - packages = [pkgs.terminus_font]; + packages = [ pkgs.terminus_font ]; font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz"; useXkbConfig = true; }; diff --git a/modules/base/default.nix b/modules/base/default.nix @@ -6,25 +6,37 @@ inputs, pkgs, ... -}: let +}: +let inherit (builtins) attrNames map; - inherit (lib) hasPrefix mkIf mkOption optionals removePrefix types; + inherit (lib) + hasPrefix + mkIf + mkOption + optionals + removePrefix + types + ; + cfg = config.base; -in { +in +{ ## BASE Configuration ## - imports = util.map.modules.list ./. ++ [inputs.generators.nixosModules.all-formats]; + imports = util.map.modules.list ./. ++ [ inputs.generators.nixosModules.all-formats ]; options.base = { kernel = mkOption { description = "Linux Kernel Variant to be used"; default = "lts"; - type = types.enum (["lts"] ++ (map (name: removePrefix "linux_" name) (attrNames pkgs.linuxKernel.kernels))); + type = types.enum ( + [ "lts" ] ++ (map (name: removePrefix "linux_" name) (attrNames pkgs.linuxKernel.kernels)) + ); }; kernelModules = mkOption { description = "Linux Kernel Modules to load"; type = with types; listOf str; - default = []; + default = [ ]; }; }; @@ -32,13 +44,21 @@ in { # Kernel Configuration boot = { kernelPackages = - if (cfg.kernel == "lts") - then options.boot.kernelPackages.default - else pkgs.linuxKernel.packages."${"linux_" + cfg.kernel}"; + if (cfg.kernel == "lts") then + options.boot.kernelPackages.default + else + pkgs.linuxKernel.packages."${"linux_" + cfg.kernel}"; - initrd.availableKernelModules = - optionals (cfg.kernelModules != []) - (cfg.kernelModules ++ ["ahci" "sd_mod" "usbhid" "usb_storage" "xhci_pci"]); + initrd.availableKernelModules = optionals (cfg.kernelModules != [ ]) ( + cfg.kernelModules + ++ [ + "ahci" + "sd_mod" + "usbhid" + "usb_storage" + "xhci_pci" + ] + ); }; # Documentation @@ -49,7 +69,8 @@ in { # Essential Utilities environment = { - variables."NIXOS_SPECIALISATION" = with config.system.nixos; + variables."NIXOS_SPECIALISATION" = + with config.system.nixos; mkIf (hasPrefix "special." label) (removePrefix "special." label); systemPackages = with pkgs; [ diff --git a/modules/base/firmware.nix b/modules/base/firmware.nix @@ -3,10 +3,12 @@ inputs, pkgs, ... -}: let +}: +let inherit (lib) getExe' mkForce; -in { - imports = [inputs.gaming.nixosModules.pipewireLowLatency]; +in +{ + imports = [ inputs.gaming.nixosModules.pipewireLowLatency ]; ## Device Firmware ## config = { @@ -32,37 +34,45 @@ in { security.rtkit.enable = true; hardware.alsa.enablePersistence = true; - services.actkbd = let - step = "1%"; - mixer = getExe' pkgs.alsa-utils "amixer"; - in { - enable = true; - bindings = [ - { - keys = [113]; # "Mute" Key - events = ["key"]; - command = "${mixer} -q set Master toggle"; - } - { - keys = [114]; # "Lower Volume" Key - events = ["key" "rep"]; - command = "${mixer} -q set Master ${step}- unmute"; - } - { - keys = [115]; # "Raise Volume" Key - events = ["key" "rep"]; - command = "${mixer} -q set Master ${step}+ unmute"; - } - { - keys = [190]; # "Mic Mute" Key - events = ["key"]; - command = "${mixer} -q set Capture toggle"; - } - ]; - }; + services.actkbd = + let + step = "1%"; + mixer = getExe' pkgs.alsa-utils "amixer"; + in + { + enable = true; + bindings = [ + { + keys = [ 113 ]; # "Mute" Key + events = [ "key" ]; + command = "${mixer} -q set Master toggle"; + } + { + keys = [ 114 ]; # "Lower Volume" Key + events = [ + "key" + "rep" + ]; + command = "${mixer} -q set Master ${step}- unmute"; + } + { + keys = [ 115 ]; # "Raise Volume" Key + events = [ + "key" + "rep" + ]; + command = "${mixer} -q set Master ${step}+ unmute"; + } + { + keys = [ 190 ]; # "Mic Mute" Key + events = [ "key" ]; + command = "${mixer} -q set Capture toggle"; + } + ]; + }; # Network Settings - user.groups = ["networkmanager"]; + user.groups = [ "networkmanager" ]; environment.persist.directories = [ "/var/lib/alsa" "/etc/NetworkManager/system-connections" diff --git a/modules/base/security.nix b/modules/base/security.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ ## Security & Hardening Settings ## config = { # Protocols @@ -12,13 +13,17 @@ apparmor = { enable = true; killUnconfinedConfinables = true; - packages = [pkgs.apparmor-profiles]; + packages = [ pkgs.apparmor-profiles ]; }; }; boot = { # Parameters - kernelParams = ["page_alloc.shuffle=1" "page_poison=1" "slub_debug=FZP"]; + kernelParams = [ + "page_alloc.shuffle=1" + "page_poison=1" + "slub_debug=FZP" + ]; # Flags kernel.sysctl = { @@ -55,7 +60,7 @@ }; # Secure Modules - kernelModules = ["tcp_bbr"]; + kernelModules = [ "tcp_bbr" ]; # Old & Obscure Modules blacklistedKernelModules = [ @@ -91,15 +96,19 @@ ## Block Junk Sites networking.extraHosts = - builtins.readFile (pkgs.fetchurl { - # Shady Sites - url = "https://raw.githubusercontent.com/shreyasminocha/shady-hosts/a5647df22b0dc5ff6c866f21ee2d8b588682626a/hosts"; - sha256 = "sha256-f6xCphzFHFYfOhMv+488amAMy+rSyHxQs/21nyvBtiU="; - }) - + builtins.readFile (pkgs.fetchurl { - # Crypto Scams - url = "https://raw.githubusercontent.com/MetaMask/eth-phishing-detect/78e727318a77fd62521d220e25871cdb65b8f00d/src/hosts.txt"; - sha256 = "sha256-b3HvaLxnUJZOANUL/p+XPNvu9Aod9YLHYYtCZT5Lan0="; - }); + builtins.readFile ( + pkgs.fetchurl { + # Shady Sites + url = "https://raw.githubusercontent.com/shreyasminocha/shady-hosts/a5647df22b0dc5ff6c866f21ee2d8b588682626a/hosts"; + sha256 = "sha256-f6xCphzFHFYfOhMv+488amAMy+rSyHxQs/21nyvBtiU="; + } + ) + + builtins.readFile ( + pkgs.fetchurl { + # Crypto Scams + url = "https://raw.githubusercontent.com/MetaMask/eth-phishing-detect/78e727318a77fd62521d220e25871cdb65b8f00d/src/hosts.txt"; + sha256 = "sha256-b3HvaLxnUJZOANUL/p+XPNvu9Aod9YLHYYtCZT5Lan0="; + } + ); }; } diff --git a/modules/configuration.nix b/modules/configuration.nix @@ -1,153 +1,165 @@ -inputs: let +inputs: +let inherit (inputs) self; util = self.lib; inherit (self) files; in - ## Configuration Build Function ## - { - system ? "x86_64-linux", - name ? "nixos", - description ? "", - format ? null, - imports ? [], - timezone, - locale, - update ? "", - kernel, - kernelModules ? [], - apps ? {}, - gui ? {}, - hardware ? {}, - nix ? {}, - shell ? {}, - user ? null, - users ? null, - }: let - # Package Channel - pkgs = self.legacyPackages."${system}"; +## Configuration Build Function ## +{ + system ? "x86_64-linux", + name ? "nixos", + description ? "", + format ? null, + imports ? [ ], + timezone, + locale, + update ? "", + kernel, + kernelModules ? [ ], + apps ? { }, + gui ? { }, + hardware ? { }, + nix ? { }, + shell ? { }, + user ? null, + users ? null, +}: +let + # Package Channel + pkgs = self.legacyPackages."${system}"; - # Configuration Libraries - inherit (inputs.nixpkgs) lib; - inherit (lib) fileContents makeOverridable mkIf; - inherit - (builtins) - attrValues - getAttr - hashString - map - removeAttrs - replaceStrings - substring - ; + # Configuration Libraries + inherit (inputs.nixpkgs) lib; + inherit (lib) fileContents makeOverridable mkIf; + inherit (builtins) + attrValues + getAttr + hashString + map + removeAttrs + replaceStrings + substring + ; - # User Build Function - user' = { + # User Build Function + user' = + { name, description, uid ? 1000, - groups ? ["wheel"], + groups ? [ "wheel" ], password ? "", autologin ? false, shell ? "bash", - shells ? [], - homeConfig ? {}, + shells ? [ ], + homeConfig ? { }, minimal ? false, - }: { + }: + { user.settings."${name}" = { - inherit name description uid autologin minimal homeConfig; + inherit + name + description + uid + autologin + minimal + homeConfig + ; extraGroups = groups; hashedPassword = mkIf (password != "") password; initialHashedPassword = mkIf (password == "") ""; shell = pkgs."${shell}"; - shells = - if (shells == null) - then [] - else shells ++ [shell]; + shells = if (shells == null) then [ ] else shells ++ [ shell ]; }; }; - in - # Assertions - assert (user == null) -> (users != null); - ## Device Configuration ## - (makeOverridable lib.nixosSystem) { - inherit system; - specialArgs = { - inherit util inputs files; - lib = lib // {inherit (inputs.home.lib) hm;}; - }; +in +# Assertions +assert (user == null) -> (users != null); +## Device Configuration ## +(makeOverridable lib.nixosSystem) { + inherit system; + specialArgs = { + inherit util inputs files; + lib = lib // { + inherit (inputs.home.lib) hm; + }; + }; + + modules = [ + { + # Modulated Configuration Imports + imports = + imports + ++ attrValues (removeAttrs (util.map.modules ./. import) [ "configuration" ]) + ++ map user' (if (user != null) then [ user ] else users) + ++ util.map.array (hardware.modules or [ ]) inputs.hardware.nixosModules + ++ ( + if (format != null) then + [ + (getAttr format inputs.generators.nixosModules) + ( + if (format == "iso") then + { + image.baseName = lib.mkForce "nixos"; + environment.systemPackages = [ pkgs.custom.install ]; - modules = [ - { - # Modulated Configuration Imports - imports = - imports - ++ attrValues (removeAttrs (util.map.modules ./. import) ["configuration"]) - ++ map user' ( - if (user != null) - then [user] - else users + # Disabled Modules + user.homeConfig = lib.mkForce { }; + sops.secrets = lib.mkForce { }; + } + else + { } ) - ++ util.map.array (hardware.modules or []) inputs.hardware.nixosModules - ++ ( - if (format != null) - then [ - (getAttr format inputs.generators.nixosModules) - ( - if (format == "iso") - then { - image.baseName = lib.mkForce "nixos"; - environment.systemPackages = [pkgs.custom.install]; + ] + else + [ { environment.systemPackages = [ pkgs.custom.nixos ]; } ] + ); - # Disabled Modules - user.homeConfig = lib.mkForce {}; - sops.secrets = lib.mkForce {}; - } - else {} - ) - ] - else [{environment.systemPackages = [pkgs.custom.nixos];}] - ); + inherit + apps + gui + hardware + nix + shell + ; - inherit apps gui hardware nix shell; - base = {inherit kernel kernelModules;}; + base = { inherit kernel kernelModules; }; - # Device Name - networking = { - hostName = name; - hostId = substring 0 8 (hashString "md5" name); - }; + # Device Name + networking = { + hostName = name; + hostId = substring 0 8 (hashString "md5" name); + }; - # Localization - time.timeZone = timezone; - i18n.defaultLocale = "en_${locale}"; - environment.variables."LC_ALL" = "en_${locale}.UTF-8"; + # Localization + time.timeZone = timezone; + i18n.defaultLocale = "en_${locale}"; + environment.variables."LC_ALL" = "en_${locale}.UTF-8"; - # Package Configuration - nixpkgs = {inherit pkgs;}; - system = { - name = "${name}-${replaceStrings [" "] ["_"] description}"; + # Package Configuration + nixpkgs = { inherit pkgs; }; + system = { + name = "${name}-${replaceStrings [ " " ] [ "_" ] description}"; - # Updates - autoUpgrade = { - enable = mkIf (update != "") true; - dates = mkIf (update != "") update; - inherit (files.path) flake; - }; + # Updates + autoUpgrade = { + enable = mkIf (update != "") true; + dates = mkIf (update != "") update; + inherit (files.path) flake; + }; - switch.enable = - if (format != null) - then false - else true; + switch.enable = if (format != null) then false else true; - # Version - stateVersion = fileContents "${inputs.nixpkgs}/.version"; - configurationRevision = - if (self ? rev) - then "${substring 0 8 self.lastModifiedDate}.${self.shortRev}" - else if (self ? dirtyRev) - then self.dirtyShortRev - else "dirty"; - }; - } - ]; - } + # Version + stateVersion = fileContents "${inputs.nixpkgs}/.version"; + configurationRevision = + if (self ? rev) then + "${substring 0 8 self.lastModifiedDate}.${self.shortRev}" + else if (self ? dirtyRev) then + self.dirtyShortRev + else + "dirty"; + }; + } + ]; +} diff --git a/modules/gui/default.nix b/modules/gui/default.nix @@ -5,12 +5,24 @@ util, pkgs, ... -}: let +}: +let inherit (builtins) map; inherit (util.map.modules) list name; - inherit (lib) hasSuffix mkEnableOption mkForce mkIf mkMerge mkOption optional types; + inherit (lib) + hasSuffix + mkEnableOption + mkForce + mkIf + mkMerge + mkOption + optional + types + ; + inherit (config.gui) desktop; -in { +in +{ ## GUI Configuration ## imports = list ./. ++ list ./desktop; @@ -25,39 +37,48 @@ in { desktop = mkOption { description = "GUI Desktop Choice"; - type = types.enum ((name ./desktop) ++ map (x: x + "-iso") (import ./desktop/iso.nix) ++ [""]); + type = types.enum ((name ./desktop) ++ map (x: x + "-iso") (import ./desktop/iso.nix) ++ [ "" ]); default = ""; }; }; config = mkMerge [ - {warnings = optional (desktop == "") (options.gui.desktop.description + " is unset");} + { warnings = optional (desktop == "") (options.gui.desktop.description + " is unset"); } ## Desktop Environment - (mkIf (desktop != "" && !(hasSuffix "-iso" desktop)) - { - user.persist.directories = [".config/autostart" ".local/share/gvfs-metadata"]; - - # Utilities - programs.seahorse.enable = true; - user.homeConfig.services.mpris-proxy.enable = true; - services = { - gvfs.enable = true; - gnome.gnome-keyring.enable = true; - }; - - # Desktop Integration - environment.pathsToLink = ["/share/xdg-desktop-portal" "/share/applications"]; - xdg.portal = { - enable = true; - xdgOpenUsePortal = true; - }; - }) + (mkIf (desktop != "" && !(hasSuffix "-iso" desktop)) { + user.persist.directories = [ + ".config/autostart" + ".local/share/gvfs-metadata" + ]; + + # Utilities + programs.seahorse.enable = true; + user.homeConfig.services.mpris-proxy.enable = true; + services = { + gvfs.enable = true; + gnome.gnome-keyring.enable = true; + }; + + # Desktop Integration + environment.pathsToLink = [ + "/share/xdg-desktop-portal" + "/share/applications" + ]; + + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + }; + }) ## Install Media (mkIf (hasSuffix "-iso" desktop) { xdg.portal.enable = mkForce false; - environment.systemPackages = with pkgs; [epiphany gparted]; + environment.systemPackages = with pkgs; [ + epiphany + gparted + ]; }) ]; } diff --git a/modules/gui/desktop/gnome/default.nix b/modules/gui/desktop/gnome/default.nix @@ -5,12 +5,21 @@ pkgs, files, ... -} @ args: -with files; let - inherit (lib) gvariant hasPrefix mkIf mkForce mkMerge; +}@args: +with files; +let + inherit (lib) + gvariant + hasPrefix + mkIf + mkForce + mkMerge + ; + inherit (config.gui) desktop; exists = app: builtins.elem app config.apps.list; -in { +in +{ ## GNOME Configuration ## config = mkIf (hasPrefix "gnome" desktop) (mkMerge [ ## Environment Setup @@ -76,7 +85,7 @@ in { }; services = { - udev.packages = [pkgs.gnome-settings-daemon]; + udev.packages = [ pkgs.gnome-settings-daemon ]; telepathy.enable = true; switcherooControl.enable = true; gnome = { @@ -86,7 +95,7 @@ in { }; }; - apps.list = ["firefox"]; + apps.list = [ "firefox" ]; programs = { gnupg.agent.pinentryPackage = mkForce pkgs.pinentry.gnome3; nautilus-open-any-terminal = { @@ -112,14 +121,14 @@ in { }; # Screen Brightness - user.groups = ["i2c"]; + user.groups = [ "i2c" ]; hardware.i2c.enable = true; }) (mkIf (desktop == "gnome") { user.homeConfig = { # Desktop Settings - imports = [./settings]; + imports = [ ./settings ]; stylix.targets = { gnome.enable = true; ghostty.enable = true; @@ -127,18 +136,18 @@ in { # Default Applications xdg.mimeApps.defaultApplications = util.build.mime { - archive = ["org.gnome.FileRoller.desktop"]; - audio = ["org.gnome.Lollypop.desktop"]; - calendar = ["org.gnome.Calendar.desktop"]; - document = ["org.gnome.Papers.desktop"]; - directory = ["org.gnome.Nautilus.desktop"]; - image = ["org.gnome.Loupe.desktop"]; - magnet = ["de.haeckerfelix.Fragments.desktop"]; - mail = ["org.gnome.Geary.desktop"]; - markdown = ["org.gnome.gitlab.somas.Apostrophe.desktop"]; - pdf = ["org.gnome.Papers.desktop"]; - text = ["org.gnome.TextEditor.desktop"]; - video = ["io.github.celluloid_player.Celluloid.desktop"]; + archive = [ "org.gnome.FileRoller.desktop" ]; + audio = [ "org.gnome.Lollypop.desktop" ]; + calendar = [ "org.gnome.Calendar.desktop" ]; + document = [ "org.gnome.Papers.desktop" ]; + directory = [ "org.gnome.Nautilus.desktop" ]; + image = [ "org.gnome.Loupe.desktop" ]; + magnet = [ "de.haeckerfelix.Fragments.desktop" ]; + mail = [ "org.gnome.Geary.desktop" ]; + markdown = [ "org.gnome.gitlab.somas.Apostrophe.desktop" ]; + pdf = [ "org.gnome.Papers.desktop" ]; + text = [ "org.gnome.TextEditor.desktop" ]; + video = [ "io.github.celluloid_player.Celluloid.desktop" ]; }; ## Terminal @@ -252,24 +261,25 @@ in { # Firefox GNOME Theme stylix.targets.firefox = { enable = mkForce true; - profileNames = ["default"]; + profileNames = [ "default" ]; firefoxGnomeTheme.enable = true; }; home.file = { # Discord DNOME Theme - ".config/vesktop/settings/quickCss.css" = - mkIf (exists "discord") {text = ''@import url("https://raw.githack.com/GeopJr/DNOME/dist/DNOME.css");'';}; + ".config/vesktop/settings/quickCss.css" = mkIf (exists "discord") { + text = ''@import url("https://raw.githack.com/GeopJr/DNOME/dist/DNOME.css");''; + }; # Logseq Bonofix Theme - ".logseq/config.edn" = - mkIf (exists "notes") - {text = ''{:custom-css-url "@import url('https://cdn.jsdelivr.net/gh/sansui233/logseq-bonofix-theme/custom.css');"}'';}; + ".logseq/config.edn" = mkIf (exists "notes") { + text = ''{:custom-css-url "@import url('https://cdn.jsdelivr.net/gh/sansui233/logseq-bonofix-theme/custom.css');"}''; + }; }; # Code Editor programs.vscode.profiles.default = mkIf (exists "vscode") { - extensions = [pkgs.vscode-extensions.piousdeer.adwaita-theme]; + extensions = [ pkgs.vscode-extensions.piousdeer.adwaita-theme ]; userSettings = { "workbench.colorTheme" = "Adwaita Dark"; "workbench.productIconTheme" = "adwaita"; diff --git a/modules/gui/desktop/gnome/iso.nix b/modules/gui/desktop/gnome/iso.nix @@ -3,14 +3,16 @@ pkgs, files, ... -}: let +}: +let inherit (lib) mkForce; -in { +in +{ services.xserver = { displayManager.gdm.autoSuspend = false; # Disable Suspension desktopManager.gnome = { extraGSettingsOverrides = files.gnome.iso; - extraGSettingsOverridePackages = [pkgs.gnome-settings-daemon]; + extraGSettingsOverridePackages = [ pkgs.gnome-settings-daemon ]; favoriteAppsOverride = '' [org.gnome.shell] favorite-apps=[ 'org.gnome.Epiphany.desktop', 'nixos-manual.desktop', 'org.gnome.Console.desktop', 'org.gnome.Nautilus.desktop', 'gparted.desktop' ] diff --git a/modules/gui/desktop/gnome/settings/apps.nix b/modules/gui/desktop/gnome/settings/apps.nix @@ -3,15 +3,18 @@ lib, ... }: -with lib.hm.gvariant; let +with lib.hm.gvariant; +let inherit (builtins) head; fonts = sys.fonts.fontconfig.defaultFonts; -in { +in +{ dconf.settings = { # GTK+ Apps "org/gnome/desktop/calendar".show-weekdate = true; "ca/desrt/dconf-editor".show-warning = false; - "org/gnome/shell/world-clocks".locations = "[<(uint32 2, <('Coordinated Universal Time (UTC)', '@UTC', false, @a(dd) [], @a(dd) [])>)>]"; + "org/gnome/shell/world-clocks".locations = + "[<(uint32 2, <('Coordinated Universal Time (UTC)', '@UTC', false, @a(dd) [], @a(dd) [])>)>]"; "org/gnome/desktop/search-providers" = { sort-order = [ @@ -26,7 +29,11 @@ in { compose-as-html = true; formatting-toolbar-visible = false; migrated-config = true; - optional-plugins = ["email-templates" "sent-sound" "mail-merge"]; + optional-plugins = [ + "email-templates" + "sent-sound" + "mail-merge" + ]; startup-notifications = true; }; @@ -46,7 +53,11 @@ in { "org/gtk/gtk4/settings/file-chooser".sort-directories-first = true; "org/gnome/nautilus/icon-view" = { - captions = ["size" "date_modified" "none"]; + captions = [ + "size" + "date_modified" + "none" + ]; default-zoom-level = "medium"; }; @@ -72,7 +83,7 @@ in { auto-hide-map = true; auto-save-timeout = 60; completion-n-rows = 7; - draw-spaces = ["tab"]; + draw-spaces = [ "tab" ]; highlight-current-line = true; highlight-matching-brackets = true; overscroll = 7; @@ -165,7 +176,10 @@ in { "org/gnome/desktop/app-folders/folders/4bfbecbd-804e-4359-b1c2-00daef4c009e" = { name = "System"; - apps = ["nvidia-settings.desktop" "rog-control-center.desktop"]; + apps = [ + "nvidia-settings.desktop" + "rog-control-center.desktop" + ]; }; "org/gnome/desktop/app-folders/folders/1c3e59e4-a571-4ada-af1d-ed1ced384cfb" = { diff --git a/modules/gui/desktop/gnome/settings/default.nix b/modules/gui/desktop/gnome/settings/default.nix @@ -4,9 +4,11 @@ util, ... }: -with lib.hm.gvariant; let +with lib.hm.gvariant; +let fonts = sys.fonts.fontconfig.defaultFonts; -in { +in +{ imports = util.map.modules.list ./.; ## Dconf Keys ## @@ -15,84 +17,87 @@ in { dconf.settings = { # Keyboard Shortcuts "org/gnome/desktop/wm/keybindings" = { - always-on-top = ["<Super>p"]; - begin-move = []; - begin-resize = []; - close = ["<Super>q" "<Alt>F4"]; - cycle-group = []; - cycle-group-backward = []; - maximize = ["<Super>Up"]; - minimize = ["<Super>Down"]; - move-to-center = ["<Super>c"]; - move-to-monitor-down = []; - move-to-monitor-left = ["<Primary><Super>Left"]; - move-to-monitor-right = ["<Primary><Super>Right"]; - move-to-monitor-up = []; - move-to-workspace-1 = []; - move-to-workspace-down = []; - move-to-workspace-last = []; - move-to-workspace-left = ["<Shift><Super>Left"]; - move-to-workspace-right = ["<Shift><Super>Right"]; - move-to-workspace-up = []; - panel-main-menu = []; - panel-run-dialog = ["<Super>F2"]; - switch-applications = ["<Alt>Tab"]; - switch-applications-backward = ["<Shift><Alt>Tab"]; - switch-group = ["<Super>Tab"]; - switch-group-backward = ["<Shift><Super>Tab"]; - switch-to-workspace-down = []; - switch-to-workspace-left = ["<Super>Left"]; - switch-to-workspace-right = ["<Super>Right"]; - switch-to-workspace-up = []; - toggle-fullscreen = ["<Shift><Super>f"]; - toggle-maximized = ["<Super>m"]; - unmaximize = []; + always-on-top = [ "<Super>p" ]; + begin-move = [ ]; + begin-resize = [ ]; + close = [ + "<Super>q" + "<Alt>F4" + ]; + cycle-group = [ ]; + cycle-group-backward = [ ]; + maximize = [ "<Super>Up" ]; + minimize = [ "<Super>Down" ]; + move-to-center = [ "<Super>c" ]; + move-to-monitor-down = [ ]; + move-to-monitor-left = [ "<Primary><Super>Left" ]; + move-to-monitor-right = [ "<Primary><Super>Right" ]; + move-to-monitor-up = [ ]; + move-to-workspace-1 = [ ]; + move-to-workspace-down = [ ]; + move-to-workspace-last = [ ]; + move-to-workspace-left = [ "<Shift><Super>Left" ]; + move-to-workspace-right = [ "<Shift><Super>Right" ]; + move-to-workspace-up = [ ]; + panel-main-menu = [ ]; + panel-run-dialog = [ "<Super>F2" ]; + switch-applications = [ "<Alt>Tab" ]; + switch-applications-backward = [ "<Shift><Alt>Tab" ]; + switch-group = [ "<Super>Tab" ]; + switch-group-backward = [ "<Shift><Super>Tab" ]; + switch-to-workspace-down = [ ]; + switch-to-workspace-left = [ "<Super>Left" ]; + switch-to-workspace-right = [ "<Super>Right" ]; + switch-to-workspace-up = [ ]; + toggle-fullscreen = [ "<Shift><Super>f" ]; + toggle-maximized = [ "<Super>m" ]; + unmaximize = [ ]; }; "org/gnome/mutter/keybindings" = { - toggle-tiled-left = []; - toggle-tiled-right = []; + toggle-tiled-left = [ ]; + toggle-tiled-right = [ ]; }; "org/gnome/shell/keybindings" = { - focus-active-notification = []; - open-application-menu = []; - switch-to-application-1 = ["<Super>1"]; - switch-to-application-2 = ["<Super>2"]; - switch-to-application-3 = ["<Super>3"]; - switch-to-application-4 = ["<Super>4"]; - switch-to-application-5 = ["<Super>5"]; - switch-to-application-6 = ["<Super>6"]; - switch-to-application-7 = ["<Super>7"]; - switch-to-application-8 = ["<Super>8"]; - switch-to-application-9 = ["<Super>9"]; - toggle-application-view = []; - toggle-message-tray = ["<Super><Shift>n"]; - toggle-overview = []; - toggle-quick-settings = []; + focus-active-notification = [ ]; + open-application-menu = [ ]; + switch-to-application-1 = [ "<Super>1" ]; + switch-to-application-2 = [ "<Super>2" ]; + switch-to-application-3 = [ "<Super>3" ]; + switch-to-application-4 = [ "<Super>4" ]; + switch-to-application-5 = [ "<Super>5" ]; + switch-to-application-6 = [ "<Super>6" ]; + switch-to-application-7 = [ "<Super>7" ]; + switch-to-application-8 = [ "<Super>8" ]; + switch-to-application-9 = [ "<Super>9" ]; + toggle-application-view = [ ]; + toggle-message-tray = [ "<Super><Shift>n" ]; + toggle-overview = [ ]; + toggle-quick-settings = [ ]; }; "org/gnome/settings-daemon/plugins/media-keys" = { - area-screenshot = ["Print"]; - area-screenshot-clip = []; - control-center = ["<Super><Shift>grave"]; - email = ["<Super>e"]; - home = ["<Super>f"]; - magnifier = ["<Super>x"]; - magnifier-zoom-in = ["<Super>equal"]; - magnifier-zoom-out = ["<Super>minus"]; - rotate-video-lock-static = []; - screencast = ["<Alt>Print"]; - screenreader = []; - screenshot = ["<Shift>Print"]; - screenshot-clip = []; - screensaver = ["<Super>l"]; - terminal = ["<Super>t"]; - volume-down = ["AudioLowerVolume"]; - volume-up = ["AudioRaiseVolume"]; - window-screenshot = ["<Primary>Print"]; - window-screenshot-clip = []; - www = ["<Super>grave"]; + area-screenshot = [ "Print" ]; + area-screenshot-clip = [ ]; + control-center = [ "<Super><Shift>grave" ]; + email = [ "<Super>e" ]; + home = [ "<Super>f" ]; + magnifier = [ "<Super>x" ]; + magnifier-zoom-in = [ "<Super>equal" ]; + magnifier-zoom-out = [ "<Super>minus" ]; + rotate-video-lock-static = [ ]; + screencast = [ "<Alt>Print" ]; + screenreader = [ ]; + screenshot = [ "<Shift>Print" ]; + screenshot-clip = [ ]; + screensaver = [ "<Super>l" ]; + terminal = [ "<Super>t" ]; + volume-down = [ "AudioLowerVolume" ]; + volume-up = [ "AudioRaiseVolume" ]; + window-screenshot = [ "<Primary>Print" ]; + window-screenshot-clip = [ ]; + www = [ "<Super>grave" ]; custom-keybindings = [ "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" @@ -136,7 +141,10 @@ in { edge-tiling = false; focus-change-on-pointer-rest = true; workspaces-only-on-primary = true; - experimental-features = ["scale-monitor-framebuffer" "xwayland-native-scaling"]; + experimental-features = [ + "scale-monitor-framebuffer" + "xwayland-native-scaling" + ]; }; "org/gnome/desktop/interface" = { diff --git a/modules/gui/desktop/gnome/settings/extensions.nix b/modules/gui/desktop/gnome/settings/extensions.nix @@ -5,464 +5,491 @@ pkgs, files, ... -}: let - inherit (builtins) filter hasAttr head map; - inherit (lib) foldr hm mkForce optionals recursiveUpdate; +}: +let + inherit (builtins) + filter + hasAttr + head + map + ; + + inherit (lib) + foldr + hm + mkForce + optionals + recursiveUpdate + ; + homeDir = config.home.homeDirectory; font = head sys.fonts.fontconfig.defaultFonts.sansSerif; inherit (sys.lib.stylix) colors; # Shell Extensions - extensions = with pkgs.gnomeExtensions // hm.gvariant; ([ - {package = appindicator;} - {package = arrange-windows;} - {package = control-monitor-brightness-and-volume-with-ddcutil;} - {package = disconnect-wifi;} - {package = display-configuration-switcher;} - {package = gamemode-indicator-in-system-settings;} - {package = gsconnect;} - {package = guillotine;} - {package = hide-minimized;} - {package = invert-window-color;} - {package = media-progress;} - {package = night-light-slider-updated;} - {package = overview-hover;} - {package = removable-drive-menu;} - {package = screenshot-window-sizer;} - {package = unmess;} - {package = window-state-manager;} - {package = x11-gestures;} - {package = xlanguagetray;} - { - package = workspace-indicator; - disable = true; - } - { - package = gpu-supergfxctl-switch; - disable = !sys.services.supergfxd.enable; - } - { - package = top-bar-organizer; - settings = { - center-box-order = ["dateMenu"]; - left-box-order = [ - "activities" - "guillotine" - "guillotine@fopdoodle.net" - "appMenu" - "arrange-menu" - "tilingshell@ferrarodomenico.com" - ]; + extensions = + with pkgs.gnomeExtensions // hm.gvariant; + ( + [ + { package = appindicator; } + { package = arrange-windows; } + { package = control-monitor-brightness-and-volume-with-ddcutil; } + { package = disconnect-wifi; } + { package = display-configuration-switcher; } + { package = gamemode-indicator-in-system-settings; } + { package = gsconnect; } + { package = guillotine; } + { package = hide-minimized; } + { package = invert-window-color; } + { package = media-progress; } + { package = night-light-slider-updated; } + { package = overview-hover; } + { package = removable-drive-menu; } + { package = screenshot-window-sizer; } + { package = unmess; } + { package = window-state-manager; } + { package = x11-gestures; } + { package = xlanguagetray; } + { + package = workspace-indicator; + disable = true; + } + { + package = gpu-supergfxctl-switch; + disable = !sys.services.supergfxd.enable; + } + { + package = top-bar-organizer; + settings = { + center-box-order = [ "dateMenu" ]; + left-box-order = [ + "activities" + "guillotine" + "guillotine@fopdoodle.net" + "appMenu" + "arrange-menu" + "tilingshell@ferrarodomenico.com" + ]; - right-box-order = [ - "emoji-copy@felipeftn" - "a11y" - "aggregateMenu" - "drive-menu" - "pano@elhan.io" - "vitalsMenu" - "dwellClick" - "color-picker@tuberry" - "lockkeys" - "keyboard" - "screenSharing" - "screenRecording" - "quickSettings" - ]; - }; - } - { - package = color-picker; - settings.enable-format = true; - } - { - package = status-area-horizontal-spacing; - settings.hpadding = 4; - } - { - package = lock-keys; - name = "lockkeys"; - settings.style = "show-hide"; - } - { - package = power-profile-indicator-2; - name = "power-profile"; - settings.colored-icon = false; - } - { - package = user-themes; - name = "user-theme"; - settings.name = mkForce "custom"; - } - { - package = fullscreen-avoider; - settings = { - move-hot-corners = true; - move-notifications = true; - }; - } - { - package = window-title-is-back; - settings = { - colored-icon = true; - show-icon = false; - show-title = false; - }; - } - { - package = autohide-battery-percentage; - settings = { - hide-on-battery-level = 90; - hide-on-plugged-in = true; - hide-on-power-saving-disabled = false; - }; - } - { - package = emoji-copy; - settings = { - active-keybind = true; - always-show = false; - emoji-keybind = ["<Super><Shift>e"]; - paste-on-select = true; - }; - } - { - package = user-avatar-in-quick-settings; - name = "quick-settings-avatar"; - settings = { - avatar-position = 1; - avatar-realname = false; - avatar-size = 56; - }; - } - { - package = focus-changer; - settings = { - focus-down = ["<Super>s"]; - focus-left = ["<Super>a"]; - focus-right = ["<Super>d"]; - focus-up = ["<Super>w"]; - }; - } - { - package = vitals; - settings = { - hot-sensors = ["_default_icon_"]; - show-battery = true; - show-storage = false; - show-gpu = true; - include-static-gpu-info = false; - }; - } - { - package = alttab-mod; - name = "altTab-mod"; - settings = { - current-monitor-only = true; - current-monitor-only-window = true; - current-workspace-only = true; - disable-hover-select = false; - focus-on-select-window = true; - remove-delay = true; - }; - } - { - package = auto-activities; - settings = { - detect-minimized = true; - hide-on-new-window = true; - show-apps = false; - skip-last-workspace = false; - skip-taskbar = true; - }; - } - { - package = caffeine; - settings = { - indicator-position = 0; - inhibit-apps = ["startcenter.desktop"]; - nightlight-control = "never"; - show-indicator = "always"; - show-notifications = false; - }; - } - { - package = shortcuts; - settings = { - maxcolumns = 3; - shortcuts-file = files.gnome.shortcuts; - shortcuts-toggle-overview = ["<Super>slash"]; - show-icon = false; - use-custom-shortcuts = true; - use-transparency = true; - visibility = 55; - }; - } - { - package = window-gestures; - name = "windowgestures"; - settings = { - fn-fullscreen = true; - fn-maximized-snap = true; - fn-move = true; - fn-move-snap = true; - fn-resize = true; - pinch-enable = true; - pinch3-in = 0; - pinch3-out = 0; - pinch4-in = 14; - pinch4-out = 3; - swipe3-down = 1; - swipe4-updown = 22; - taphold-move = true; - three-finger = false; - use-active-window = true; - }; - } - { - package = wsp-windows-search-provider; - name = "windows-search-provider"; - settings = { - custom-prefixes = "; `"; - results-order = 1; - search-commands = false; - search-method = 1; - }; - } - { - package = pkgs.custom.gnome-pano; - settings = { - database-location = "${homeDir}/.local/share/clipboard"; - history-length = 250; - global-shortcut = ["<Super>v"]; - incognito-shortcut = ["<Ctrl><Super>v"]; - link-previews = true; - open-links-in-browser = true; - play-audio-on-copy = false; - send-notification-on-copy = false; - watch-exclusion-list = true; - wiggle-indicator = sys.gui.fancy; - window-position = mkUint32 2; - item-date-font-family = font; - item-date-font-size = 11; - item-title-font-family = font; - item-title-font-size = 20; - search-bar-font-family = font; - search-bar-font-size = 14; - }; - } - { - package = tiling-shell; - name = "tilingshell"; - settings = { - enable-blur-selected-tilepreview = false; - enable-blur-snap-assistant = false; - enable-snap-assist = false; - enable-tiling-system = true; - enable-window-border = false; - override-window-menu = true; - restore-window-original-size = true; - tiling-system-activation-key = ["0"]; - top-edge-maximize = true; - window-border-width = mkUint32 2; - inner-gaps = mkUint32 5; - outer-gaps = mkUint32 5; - move-window-down = ["<Shift><Super>s"]; - move-window-left = ["<Shift><Super>a"]; - move-window-right = ["<Shift><Super>d"]; - move-window-up = ["<Shift><Super>w"]; - }; - } - { - package = vertical-workspaces; - settings = { - aaa-loading-profile = true; - always-activate-selected-window = false; - animation-speed-factor = 100; - app-display-module = true; - app-favorites-module = true; - app-folder-order = 2; - app-grid-active-preview = false; - app-grid-animation = 4; - app-grid-bg-blur-sigma = 40; - app-grid-columns = 0; - app-grid-content = 2; - app-grid-folder-center = true; - app-grid-folder-columns = 0; - app-grid-folder-icon-grid = 2; - app-grid-folder-icon-size = -1; - app-grid-folder-rows = 0; - app-grid-icon-size = -1; - app-grid-incomplete-pages = false; - app-grid-names = 0; - app-grid-order = 1; - app-grid-page-width-scale = 80; - app-grid-performance = true; - app-grid-rows = 0; - app-grid-spacing = 12; - center-app-grid = true; - center-dash-to-ws = false; - center-search = true; - close-ws-button-mode = 2; - dash-bg-color = 0; - dash-bg-gs3-style = false; - dash-bg-opacity = 50; - dash-bg-radius = 0; - dash-icon-scroll = 1; - dash-isolate-workspaces = true; - dash-max-icon-size = 64; - dash-module = true; - dash-position = 2; - dash-position-adjust = 0; - dash-show-extensions-icon = 0; - dash-show-recent-files-icon = 0; - dash-show-windows-before-activation = 3; - enable-page-shortcuts = false; - favorites-notify = 1; - highlighting-style = 1; - hot-corner-action = 1; - hot-corner-fullscreen = false; - hot-corner-position = 1; - hot-corner-ripples = true; - layout-module = true; - message-tray-module = true; - new-window-focus-fix = false; - new-window-monitor-fix = false; - notification-position = 2; - osd-position = 3; - osd-window-module = true; - overlay-key-module = true; - overlay-key-primary = 1; - overlay-key-secondary = 1; - overview-bg-blur-sigma = 50; - overview-bg-brightness = 50; - overview-esc-behavior = 1; - overview-mode = 0; - panel-module = true; - panel-position = 0; - panel-visibility = 0; - recent-files-search-provider-module = false; - running-dot-style = 1; - search-bg-brightness = 30; - search-controller-module = true; - search-fuzzy = true; - search-icon-size = 96; - search-max-results-rows = 5; - search-module = true; - search-view-animation = 1; - search-width-scale = 105; - search-windows-icon-scroll = 1; - search-windows-order = 1; - sec-wst-position-adjust = 0; - secondary-ws-preview-scale = 100; - secondary-ws-preview-shift = false; - secondary-ws-thumbnail-scale = 5; - secondary-ws-thumbnails-position = 2; - show-app-icon-position = 0; - show-bg-in-overview = true; - show-search-entry = false; - show-ws-preview-bg = false; - show-ws-switcher-bg = false; - show-wst-labels = 1; - show-wst-labels-on-hover = true; - smooth-blur-transitions = true; - startup-state = 2; - swipe-tracker-module = true; - win-attention-handler-module = true; - win-preview-icon-size = 1; - win-preview-mid-mouse-btn-action = 1; - win-preview-sec-mouse-btn-action = 0; - win-preview-show-close-button = true; - win-title-position = 0; - window-attention-mode = 0; - window-icon-click-action = 1; - window-manager-module = true; - window-preview-module = true; - workspace-animation = 1; - workspace-animation-module = true; - workspace-module = true; - workspace-switcher-animation = 1; - workspace-switcher-popup-module = true; - ws-max-spacing = 350; - ws-preview-bg-radius = 30; - ws-preview-scale = 100; - ws-sw-popup-h-position = 50; - ws-sw-popup-mode = 0; - ws-sw-popup-v-position = 50; - ws-switcher-ignore-last = false; - ws-switcher-mode = 0; - ws-switcher-wraparound = false; - ws-thumbnail-scale = 10; - ws-thumbnail-scale-appgrid = 20; - ws-thumbnails-full = false; - ws-thumbnails-position = 5; - wst-position-adjust = 0; - }; - } - ] - ++ optionals sys.gui.fancy [ - { - package = rounded-window-corners-reborn; - settings = { - skip-libadwaita-app = false; - skip-libhandy-app = false; - border-width = 2; - border-color = with colors; mkTuple [(mkDouble base0D-dec-r) (mkDouble base0D-dec-g) (mkDouble base0D-dec-b) 1.0]; - global-rounded-corner-settings = ''{'padding': <{'left': 1, 'right': 1, 'top': 1, 'bottom': 1}>, 'keepRoundedCorners': <{'maximized': true, 'fullscreen': false}>, 'borderRadius': <uint32 12>, 'smoothing': <0.0>, 'enabled': <true>}''; - }; - } - { - package = panel-corners; - settings.panel-corners = true; - } - { - package = transparent-window-moving; - settings.window-opacity = 200; - } - { - package = gtk4-desktop-icons-ng-ding; - disable = true; #!# Currently buggy - settings = { - dark-text-in-labels = false; - show-drop-place = false; - show-network-volumes = false; - }; - } - ]); -in { + right-box-order = [ + "emoji-copy@felipeftn" + "a11y" + "aggregateMenu" + "drive-menu" + "pano@elhan.io" + "vitalsMenu" + "dwellClick" + "color-picker@tuberry" + "lockkeys" + "keyboard" + "screenSharing" + "screenRecording" + "quickSettings" + ]; + }; + } + { + package = color-picker; + settings.enable-format = true; + } + { + package = status-area-horizontal-spacing; + settings.hpadding = 4; + } + { + package = lock-keys; + name = "lockkeys"; + settings.style = "show-hide"; + } + { + package = power-profile-indicator-2; + name = "power-profile"; + settings.colored-icon = false; + } + { + package = user-themes; + name = "user-theme"; + settings.name = mkForce "custom"; + } + { + package = fullscreen-avoider; + settings = { + move-hot-corners = true; + move-notifications = true; + }; + } + { + package = window-title-is-back; + settings = { + colored-icon = true; + show-icon = false; + show-title = false; + }; + } + { + package = autohide-battery-percentage; + settings = { + hide-on-battery-level = 90; + hide-on-plugged-in = true; + hide-on-power-saving-disabled = false; + }; + } + { + package = emoji-copy; + settings = { + active-keybind = true; + always-show = false; + emoji-keybind = [ "<Super><Shift>e" ]; + paste-on-select = true; + }; + } + { + package = user-avatar-in-quick-settings; + name = "quick-settings-avatar"; + settings = { + avatar-position = 1; + avatar-realname = false; + avatar-size = 56; + }; + } + { + package = focus-changer; + settings = { + focus-down = [ "<Super>s" ]; + focus-left = [ "<Super>a" ]; + focus-right = [ "<Super>d" ]; + focus-up = [ "<Super>w" ]; + }; + } + { + package = vitals; + settings = { + hot-sensors = [ "_default_icon_" ]; + show-battery = true; + show-storage = false; + show-gpu = true; + include-static-gpu-info = false; + }; + } + { + package = alttab-mod; + name = "altTab-mod"; + settings = { + current-monitor-only = true; + current-monitor-only-window = true; + current-workspace-only = true; + disable-hover-select = false; + focus-on-select-window = true; + remove-delay = true; + }; + } + { + package = auto-activities; + settings = { + detect-minimized = true; + hide-on-new-window = true; + show-apps = false; + skip-last-workspace = false; + skip-taskbar = true; + }; + } + { + package = caffeine; + settings = { + indicator-position = 0; + inhibit-apps = [ "startcenter.desktop" ]; + nightlight-control = "never"; + show-indicator = "always"; + show-notifications = false; + }; + } + { + package = shortcuts; + settings = { + maxcolumns = 3; + shortcuts-file = files.gnome.shortcuts; + shortcuts-toggle-overview = [ "<Super>slash" ]; + show-icon = false; + use-custom-shortcuts = true; + use-transparency = true; + visibility = 55; + }; + } + { + package = window-gestures; + name = "windowgestures"; + settings = { + fn-fullscreen = true; + fn-maximized-snap = true; + fn-move = true; + fn-move-snap = true; + fn-resize = true; + pinch-enable = true; + pinch3-in = 0; + pinch3-out = 0; + pinch4-in = 14; + pinch4-out = 3; + swipe3-down = 1; + swipe4-updown = 22; + taphold-move = true; + three-finger = false; + use-active-window = true; + }; + } + { + package = wsp-windows-search-provider; + name = "windows-search-provider"; + settings = { + custom-prefixes = "; `"; + results-order = 1; + search-commands = false; + search-method = 1; + }; + } + { + package = pkgs.custom.gnome-pano; + settings = { + database-location = "${homeDir}/.local/share/clipboard"; + history-length = 250; + global-shortcut = [ "<Super>v" ]; + incognito-shortcut = [ "<Ctrl><Super>v" ]; + link-previews = true; + open-links-in-browser = true; + play-audio-on-copy = false; + send-notification-on-copy = false; + watch-exclusion-list = true; + wiggle-indicator = sys.gui.fancy; + window-position = mkUint32 2; + item-date-font-family = font; + item-date-font-size = 11; + item-title-font-family = font; + item-title-font-size = 20; + search-bar-font-family = font; + search-bar-font-size = 14; + }; + } + { + package = tiling-shell; + name = "tilingshell"; + settings = { + enable-blur-selected-tilepreview = false; + enable-blur-snap-assistant = false; + enable-snap-assist = false; + enable-tiling-system = true; + enable-window-border = false; + override-window-menu = true; + restore-window-original-size = true; + tiling-system-activation-key = [ "0" ]; + top-edge-maximize = true; + window-border-width = mkUint32 2; + inner-gaps = mkUint32 5; + outer-gaps = mkUint32 5; + move-window-down = [ "<Shift><Super>s" ]; + move-window-left = [ "<Shift><Super>a" ]; + move-window-right = [ "<Shift><Super>d" ]; + move-window-up = [ "<Shift><Super>w" ]; + }; + } + { + package = vertical-workspaces; + settings = { + aaa-loading-profile = true; + always-activate-selected-window = false; + animation-speed-factor = 100; + app-display-module = true; + app-favorites-module = true; + app-folder-order = 2; + app-grid-active-preview = false; + app-grid-animation = 4; + app-grid-bg-blur-sigma = 40; + app-grid-columns = 0; + app-grid-content = 2; + app-grid-folder-center = true; + app-grid-folder-columns = 0; + app-grid-folder-icon-grid = 2; + app-grid-folder-icon-size = -1; + app-grid-folder-rows = 0; + app-grid-icon-size = -1; + app-grid-incomplete-pages = false; + app-grid-names = 0; + app-grid-order = 1; + app-grid-page-width-scale = 80; + app-grid-performance = true; + app-grid-rows = 0; + app-grid-spacing = 12; + center-app-grid = true; + center-dash-to-ws = false; + center-search = true; + close-ws-button-mode = 2; + dash-bg-color = 0; + dash-bg-gs3-style = false; + dash-bg-opacity = 50; + dash-bg-radius = 0; + dash-icon-scroll = 1; + dash-isolate-workspaces = true; + dash-max-icon-size = 64; + dash-module = true; + dash-position = 2; + dash-position-adjust = 0; + dash-show-extensions-icon = 0; + dash-show-recent-files-icon = 0; + dash-show-windows-before-activation = 3; + enable-page-shortcuts = false; + favorites-notify = 1; + highlighting-style = 1; + hot-corner-action = 1; + hot-corner-fullscreen = false; + hot-corner-position = 1; + hot-corner-ripples = true; + layout-module = true; + message-tray-module = true; + new-window-focus-fix = false; + new-window-monitor-fix = false; + notification-position = 2; + osd-position = 3; + osd-window-module = true; + overlay-key-module = true; + overlay-key-primary = 1; + overlay-key-secondary = 1; + overview-bg-blur-sigma = 50; + overview-bg-brightness = 50; + overview-esc-behavior = 1; + overview-mode = 0; + panel-module = true; + panel-position = 0; + panel-visibility = 0; + recent-files-search-provider-module = false; + running-dot-style = 1; + search-bg-brightness = 30; + search-controller-module = true; + search-fuzzy = true; + search-icon-size = 96; + search-max-results-rows = 5; + search-module = true; + search-view-animation = 1; + search-width-scale = 105; + search-windows-icon-scroll = 1; + search-windows-order = 1; + sec-wst-position-adjust = 0; + secondary-ws-preview-scale = 100; + secondary-ws-preview-shift = false; + secondary-ws-thumbnail-scale = 5; + secondary-ws-thumbnails-position = 2; + show-app-icon-position = 0; + show-bg-in-overview = true; + show-search-entry = false; + show-ws-preview-bg = false; + show-ws-switcher-bg = false; + show-wst-labels = 1; + show-wst-labels-on-hover = true; + smooth-blur-transitions = true; + startup-state = 2; + swipe-tracker-module = true; + win-attention-handler-module = true; + win-preview-icon-size = 1; + win-preview-mid-mouse-btn-action = 1; + win-preview-sec-mouse-btn-action = 0; + win-preview-show-close-button = true; + win-title-position = 0; + window-attention-mode = 0; + window-icon-click-action = 1; + window-manager-module = true; + window-preview-module = true; + workspace-animation = 1; + workspace-animation-module = true; + workspace-module = true; + workspace-switcher-animation = 1; + workspace-switcher-popup-module = true; + ws-max-spacing = 350; + ws-preview-bg-radius = 30; + ws-preview-scale = 100; + ws-sw-popup-h-position = 50; + ws-sw-popup-mode = 0; + ws-sw-popup-v-position = 50; + ws-switcher-ignore-last = false; + ws-switcher-mode = 0; + ws-switcher-wraparound = false; + ws-thumbnail-scale = 10; + ws-thumbnail-scale-appgrid = 20; + ws-thumbnails-full = false; + ws-thumbnails-position = 5; + wst-position-adjust = 0; + }; + } + ] + ++ optionals sys.gui.fancy [ + { + package = rounded-window-corners-reborn; + settings = { + skip-libadwaita-app = false; + skip-libhandy-app = false; + border-width = 2; + border-color = + with colors; + mkTuple [ + (mkDouble base0D-dec-r) + (mkDouble base0D-dec-g) + (mkDouble base0D-dec-b) + 1.0 + ]; + global-rounded-corner-settings = ''{'padding': <{'left': 1, 'right': 1, 'top': 1, 'bottom': 1}>, 'keepRoundedCorners': <{'maximized': true, 'fullscreen': false}>, 'borderRadius': <uint32 12>, 'smoothing': <0.0>, 'enabled': <true>}''; + }; + } + { + package = panel-corners; + settings.panel-corners = true; + } + { + package = transparent-window-moving; + settings.window-opacity = 200; + } + { + package = gtk4-desktop-icons-ng-ding; + disable = true; # !# Currently buggy + settings = { + dark-text-in-labels = false; + show-drop-place = false; + show-network-volumes = false; + }; + } + ] + ); +in +{ dconf.settings = { - "org/gnome/shell" = let - list = enabled: - map (ext: ext.package.extensionUuid) - (filter ( - ext: - if enabled - then (!(ext.disable or false)) - else (ext.disable or false) - ) - extensions); - in { - disable-user-extensions = false; - disable-extension-version-validation = true; - disabled-extensions = list false; - enabled-extensions = list true; - }; + "org/gnome/shell" = + let + list = + enabled: + map (ext: ext.package.extensionUuid) ( + filter (ext: if enabled then (!(ext.disable or false)) else (ext.disable or false)) extensions + ); + in + { + disable-user-extensions = false; + disable-extension-version-validation = true; + disabled-extensions = list false; + enabled-extensions = list true; + }; } - // foldr recursiveUpdate {} (map - (ext: - if (hasAttr "settings" ext) - then + // foldr recursiveUpdate { } ( + map ( + ext: + if (hasAttr "settings" ext) then ( - if (hasAttr "name" ext) - then {"org/gnome/shell/extensions/${ext.name}" = ext.settings;} - else {"org/gnome/shell/extensions/${ext.package.extensionPortalSlug}" = ext.settings;} + if (hasAttr "name" ext) then + { "org/gnome/shell/extensions/${ext.name}" = ext.settings; } + else + { "org/gnome/shell/extensions/${ext.package.extensionPortalSlug}" = ext.settings; } ) - else {}) - extensions); + else + { } + ) extensions + ); home = { - packages = [pkgs.dconf2nix] ++ builtins.map (ext: ext.package) extensions; + packages = [ pkgs.dconf2nix ] ++ builtins.map (ext: ext.package) extensions; file.".config/guillotine.json".source = files.gnome.menu; # Action Menu }; } diff --git a/modules/gui/desktop/hyprland/apps/browser.nix b/modules/gui/desktop/hyprland/apps/browser.nix @@ -1,6 +1,7 @@ -{theme, ...}: { +{ theme, ... }: +{ ## Browser Configuration - apps.list = ["firefox"]; + apps.list = [ "firefox" ]; user.homeConfig = { programs.firefox = { policies.ExtensionSettings = { diff --git a/modules/gui/desktop/hyprland/apps/files.nix b/modules/gui/desktop/hyprland/apps/files.nix @@ -5,16 +5,24 @@ pkgs, files, ... -}: let - inherit (lib) hm getExe getExe' replaceStrings; +}: +let + inherit (lib) + hm + getExe + getExe' + replaceStrings + ; + inherit (config.gui) icons; terminal = "kitty"; nemo = pkgs.nemo-with-extensions; -in { +in +{ ## File Manager Configuration - services.dbus.packages = [nemo]; + services.dbus.packages = [ nemo ]; environment.systemPackages = - [nemo] + [ nemo ] ++ (with pkgs; [ cinnamon-desktop bulky @@ -31,8 +39,8 @@ in { homeConfig = { xdg.mimeApps.defaultApplications = util.build.mime { - archive = ["org.gnome.FileRoller.desktop"]; - directory = ["nemo.desktop"]; + archive = [ "org.gnome.FileRoller.desktop" ]; + directory = [ "nemo.desktop" ]; }; # Settings @@ -40,7 +48,7 @@ in { "org/gtk/gtk4/settings/file-chooser".sort-directories-first = true; "org/nemo/search".search-reverse-sort = false; "org/nemo/desktop".show-desktop-icons = false; - "org/nemo/plugins".disabled-actions = ["change-background.nemo_action"]; + "org/nemo/plugins".disabled-actions = [ "change-background.nemo_action" ]; "org/nemo/icon-view".captions = [ "size" "date_modified" @@ -60,7 +68,7 @@ in { home = { # Bulk Renamer - activation.nemo-rename = hm.dag.entryAfter ["writeBoundary"] '' + activation.nemo-rename = hm.dag.entryAfter [ "writeBoundary" ] '' if [[ -v DBUS_SESSION_BUS_ADDRESS ]] then export DCONF_DBUS_RUN_SESSION="" @@ -87,21 +95,22 @@ in { # Desktop Icons ".config/pcmanfm-qt/default/settings.conf".text = - replaceStrings [ - "@icon" - "@font" - "@terminal" - "@wallpaper" - "@archiver" - ] - [ - icons.name - config.stylix.fonts.sansSerif.name - terminal - (builtins.toString files.images.transparent) - "file-roller" - ] - files.hyprland.pcmanfm; + replaceStrings + [ + "@icon" + "@font" + "@terminal" + "@wallpaper" + "@archiver" + ] + [ + icons.name + config.stylix.fonts.sansSerif.name + terminal + (builtins.toString files.images.transparent) + "file-roller" + ] + files.hyprland.pcmanfm; }; }; }; diff --git a/modules/gui/desktop/hyprland/apps/media.nix b/modules/gui/desktop/hyprland/apps/media.nix @@ -2,7 +2,8 @@ util, pkgs, ... -}: { +}: +{ ## Media Configuration environment.systemPackages = with pkgs; [ celluloid @@ -26,20 +27,20 @@ homeConfig = { # Default Applications xdg.mimeApps.defaultApplications = util.build.mime { - audio = ["org.gnome.Lollypop.desktop"]; - document = ["org.gnome.Papers.desktop"]; - image = ["org.gnome.Shotwell-Viewer.desktop"]; - magnet = ["transmission-gtk.desktop"]; - pdf = ["org.gnome.Papers.desktop"]; - video = ["io.github.celluloid_player.Celluloid.desktop"]; + audio = [ "org.gnome.Lollypop.desktop" ]; + document = [ "org.gnome.Papers.desktop" ]; + image = [ "org.gnome.Shotwell-Viewer.desktop" ]; + magnet = [ "transmission-gtk.desktop" ]; + pdf = [ "org.gnome.Papers.desktop" ]; + video = [ "io.github.celluloid_player.Celluloid.desktop" ]; }; # Media Player services.playerctld.enable = true; programs.mpv = { enable = true; - defaultProfiles = ["gpu-hq"]; - scripts = [pkgs.mpvScripts.mpris]; + defaultProfiles = [ "gpu-hq" ]; + scripts = [ pkgs.mpvScripts.mpris ]; }; }; }; diff --git a/modules/gui/desktop/hyprland/apps/misc.nix b/modules/gui/desktop/hyprland/apps/misc.nix @@ -5,14 +5,16 @@ pkgs, theme, ... -}: let +}: +let inherit (builtins) concatStringsSep elem map; exists = app: elem app config.apps.list; -in { +in +{ ## 3rd Party Apps Configuration user.homeConfig = { # Theme - imports = [inputs.catppuccin.homeModules.catppuccin]; + imports = [ inputs.catppuccin.homeModules.catppuccin ]; catppuccin = with theme; { inherit accent; flavor = variant; @@ -22,7 +24,7 @@ in { # Code Editor programs.vscode.profiles.default = lib.mkIf (exists "vscode") { - extensions = [pkgs.vscode-extensions.catppuccin.catppuccin-vsc-icons]; + extensions = [ pkgs.vscode-extensions.catppuccin.catppuccin-vsc-icons ]; userSettings = with theme; { "workbench.iconTheme" = "${name}-${variant}"; "terminal.external.linuxExec" = "kitty"; @@ -31,15 +33,22 @@ in { home.file = { # Discord Chat - ".config/vesktop/settings/quickCss.css" = with theme; - lib.mkIf (exists "discord") {text = ''@import url("https://${name}.github.io/discord/dist/${name}-${variant}-${accent}.theme.css");'';}; + ".config/vesktop/settings/quickCss.css" = + with theme; + lib.mkIf (exists "discord") { + text = ''@import url("https://${name}.github.io/discord/dist/${name}-${variant}-${accent}.theme.css");''; + }; # Logseq Notes - ".logseq/config.edn" = with theme; - lib.mkIf (exists "notes") {text = ''{:custom-css-url "@import url('https://logseq.${name}.com/ctp-${variant}.css');"}'';}; + ".logseq/config.edn" = + with theme; + lib.mkIf (exists "notes") { + text = ''{:custom-css-url "@import url('https://logseq.${name}.com/ctp-${variant}.css');"}''; + }; # KDE Apps - ".config/kdeglobals".text = with config.lib.stylix.colors; + ".config/kdeglobals".text = + with config.lib.stylix.colors; '' [Colors:Selection] BackgroundNormal=${base0D-rgb-r},${base0D-rgb-g},${base0D-rgb-b} @@ -50,8 +59,9 @@ in { ForegroundLink=${base00-rgb-r},${base00-rgb-g},${base00-rgb-b} ForegroundVisited=${base00-rgb-r},${base00-rgb-g},${base00-rgb-b} '' - + (concatStringsSep "\n" (map ( - name: '' + + (concatStringsSep "\n" ( + map + (name: '' [Colors:${name}] BackgroundNormal=${base00-rgb-r},${base00-rgb-g},${base00-rgb-b} BackgroundAlternate=${base01-rgb-r},${base01-rgb-g},${base01-rgb-b} @@ -65,14 +75,15 @@ in { ForegroundNegative=${base08-rgb-r},${base08-rgb-g},${base08-rgb-b} ForegroundNeutral=${base0D-rgb-r},${base0D-rgb-g},${base0D-rgb-b} ForegroundPositive=${base0B-rgb-r},${base0B-rgb-g},${base0B-rgb-b} - '' - ) [ - "View" - "Window" - "Button" - "Tooltip" - "Complementary" - ])); + '') + [ + "View" + "Window" + "Button" + "Tooltip" + "Complementary" + ] + )); }; }; } diff --git a/modules/gui/desktop/hyprland/apps/notify.nix b/modules/gui/desktop/hyprland/apps/notify.nix @@ -3,14 +3,16 @@ lib, theme, ... -}: let +}: +let inherit (lib) mkForce; inherit (theme) icons; inherit (config.lib.stylix) colors; -in { +in +{ ## Notifications Configuration # Phone Connect - user.persist.directories = [".config/kdeconnect"]; + user.persist.directories = [ ".config/kdeconnect" ]; programs.kdeconnect.enable = true; user.homeConfig = { services.kdeconnect = { @@ -23,54 +25,58 @@ in { # Notifications Daemon stylix.targets.dunst.enable = true; - services.dunst = let - system = { - history_ignore = "yes"; - fullscreen = "show"; - highlight = "#${colors.base07}"; - }; - in { - enable = true; - iconTheme = icons; - settings = { - global = { - alignment = "center"; - corner_radius = 10; - follow = "mouse"; - format = "<b>%s</b>\\n%b"; - frame_width = 1; - horizontal_padding = 8; - icon_corner_radius = 10; - icon_position = "left"; - icon_theme = icons.name; - indicate_hidden = "yes"; - markup = "yes"; - max_icon_size = 64; - mouse_left_click = "do_action"; - mouse_middle_click = "close_all"; - mouse_right_click = "close_current"; - offset = "5x5"; - padding = 8; - progress_bar_corner_radius = 10; - separator_height = 1; - show_indicators = false; - shrink = "no"; - transparency = 10; - word_wrap = "yes"; + services.dunst = + let + system = { + history_ignore = "yes"; + fullscreen = "show"; + highlight = "#${colors.base07}"; }; + in + { + enable = true; + iconTheme = icons; + settings = { + global = { + alignment = "center"; + corner_radius = 10; + follow = "mouse"; + format = "<b>%s</b>\\n%b"; + frame_width = 1; + horizontal_padding = 8; + icon_corner_radius = 10; + icon_position = "left"; + icon_theme = icons.name; + indicate_hidden = "yes"; + markup = "yes"; + max_icon_size = 64; + mouse_left_click = "do_action"; + mouse_middle_click = "close_all"; + mouse_right_click = "close_current"; + offset = "5x5"; + padding = 8; + progress_bar_corner_radius = 10; + separator_height = 1; + show_indicators = false; + shrink = "no"; + transparency = 10; + word_wrap = "yes"; + }; - urgency_low.frame_color = mkForce "#${colors.base0E}"; - urgency_normal.frame_color = mkForce "#${colors.base0D}"; - fullscreen_delay.fullscreen = "delay"; - screenshot = {appname = "grimblast";} // system; - utility = {appname = "utility";} // system; - upower = - { + urgency_low.frame_color = mkForce "#${colors.base0E}"; + urgency_normal.frame_color = mkForce "#${colors.base0D}"; + fullscreen_delay.fullscreen = "delay"; + screenshot = { + appname = "grimblast"; + } // system; + utility = { + appname = "utility"; + } // system; + upower = { appname = "poweralertd"; new_icon = "/run/current-system/sw/share/icons/${icons.name}/24x24/apps/preferences-system-power.svg"; - } - // system; + } // system; + }; }; - }; }; } diff --git a/modules/gui/desktop/hyprland/apps/panel.nix b/modules/gui/desktop/hyprland/apps/panel.nix @@ -4,7 +4,8 @@ files, theme, ... -}: { +}: +{ ## Panel Configuration user.homeConfig = { stylix.targets.waybar = { @@ -13,7 +14,7 @@ addCss = false; }; - home.packages = [pkgs.wttrbar]; + home.packages = [ pkgs.wttrbar ]; programs.waybar = { enable = true; systemd.enable = true; @@ -66,7 +67,10 @@ "group/users" = { orientation = "horizontal"; - modules = ["user" "custom/power"]; + modules = [ + "user" + "custom/power" + ]; drawer.transition-left-to-right = true; }; @@ -90,7 +94,10 @@ format = "<small>{name}</small>{icon}"; on-scroll-up = "hyprctl dispatch workspace m+1"; on-scroll-down = "hyprctl dispatch workspace m-1"; - ignore-workspaces = ["special:scratch_.*" "special:minimized"]; + ignore-workspaces = [ + "special:scratch_.*" + "special:minimized" + ]; format-icons = { default = ""; special = " "; @@ -143,7 +150,11 @@ "group/menu" = { orientation = "horizontal"; - modules = ["custom/hide" "keyboard-state" "tray"]; + modules = [ + "custom/hide" + "keyboard-state" + "tray" + ]; drawer = { click-to-reveal = true; transition-left-to-right = true; @@ -179,24 +190,35 @@ on-click = "overskride"; }; - network = let - tooltip = "Strength: <b>{signaldBm}dBm ({signalStrength}%)</b>\nFrequency: <b>{frequency}MHz</b>\nInterface: <b>{ifname}</b>\nIP: <b>{ipaddr}/{cidr}</b>\nGateway: <b>{gwaddr}</b>\nNetmask: <b>{netmask}</b>"; - in { - format = "{ifname}"; - format-disconnected = "󰌙"; - format-wifi = "{icon}"; - format-ethernet = "󰌘"; - format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"]; - format-linked = "󰈁 {ifname}"; - tooltip-format-wifi = "Network: <big><b>{essid}</b></big>\n${tooltip}"; - tooltip-format-ethernet = "Network: <big><b>Wired</b></big>\n${tooltip}"; - tooltip-format-disconnected = "󰌙 Disconnected"; - on-click = "sh -c 'env XDG_CURRENT_DESKTOP=GNOME gnome-control-center wifi'"; - }; + network = + let + tooltip = "Strength: <b>{signaldBm}dBm ({signalStrength}%)</b>\nFrequency: <b>{frequency}MHz</b>\nInterface: <b>{ifname}</b>\nIP: <b>{ipaddr}/{cidr}</b>\nGateway: <b>{gwaddr}</b>\nNetmask: <b>{netmask}</b>"; + in + { + format = "{ifname}"; + format-disconnected = "󰌙"; + format-wifi = "{icon}"; + format-ethernet = "󰌘"; + format-icons = [ + "󰤯" + "󰤟" + "󰤢" + "󰤥" + "󰤨" + ]; + format-linked = "󰈁 {ifname}"; + tooltip-format-wifi = "Network: <big><b>{essid}</b></big>\n${tooltip}"; + tooltip-format-ethernet = "Network: <big><b>Wired</b></big>\n${tooltip}"; + tooltip-format-disconnected = "󰌙 Disconnected"; + on-click = "sh -c 'env XDG_CURRENT_DESKTOP=GNOME gnome-control-center wifi'"; + }; "group/media" = { orientation = "horizontal"; - modules = ["wireplumber" "mpris"]; + modules = [ + "wireplumber" + "mpris" + ]; drawer = { transition-left-to-right = false; transition-duration = 1000; @@ -209,14 +231,22 @@ reverse-scrolling = 1; format = "{icon}"; tooltip-format = "Volume: {volume}%\nDevice: {node_name}"; - format-icons = ["󰕿" "󰖀" "󰕾"]; + format-icons = [ + "󰕿" + "󰖀" + "󰕾" + ]; format-muted = ""; on-click = "pavucontrol"; }; mpris = { dynamic-len = 20; - dynamic-order = ["title" "artist" "length"]; + dynamic-order = [ + "title" + "artist" + "length" + ]; dynamic-separator = " - "; format = " {player}"; format-paused = "󰏤 <i>{player}</i>"; @@ -229,14 +259,27 @@ "group/display" = { orientation = "horizontal"; - modules = ["backlight" "custom/temperature"]; + modules = [ + "backlight" + "custom/temperature" + ]; drawer.transition-left-to-right = false; }; backlight = { format = "{icon}"; tooltip-format = "Backlight: {percent}%"; - format-icons = ["" "" "" "" "" "" "" "" ""]; + format-icons = [ + "" + "" + "" + "" + "" + "" + "" + "" + "" + ]; on-scroll-up = "hyprutils brightness down"; on-scroll-down = "hyprutils brightness up"; on-click = "nwg-displays"; @@ -252,7 +295,10 @@ "group/power" = { orientation = "horizontal"; - modules = ["battery" "power-profiles-daemon"]; + modules = [ + "battery" + "power-profiles-daemon" + ]; drawer.transition-left-to-right = false; }; @@ -263,7 +309,13 @@ format = "{icon}"; tooltip-format = "Battery: {capacity}%"; format-charging = ""; - format-icons = ["" "" "" "" ""]; + format-icons = [ + "" + "" + "" + "" + "" + ]; on-click-right = "hyprutils toggle fancy"; states = { good = 80; @@ -324,7 +376,10 @@ "group/notify" = { orientation = "horizontal"; - modules = ["custom/dunst" "idle_inhibitor"]; + modules = [ + "custom/dunst" + "idle_inhibitor" + ]; drawer.transition-left-to-right = false; }; @@ -333,17 +388,24 @@ on-click = "dunstctl history-pop"; on-click-right = "dunstctl set-paused toggle"; restart-interval = 1; - exec = with pkgs; "${writeShellApplication { - name = "notify"; - runtimeInputs = [coreutils dunst]; - text = '' - COUNT=$(dunstctl count waiting) - ENABLED="" - DISABLED="" - if [ "$COUNT" != 0 ]; then DISABLED=" $COUNT"; fi - if dunstctl is-paused | grep -q "false" ; then echo "$ENABLED"; else echo "$DISABLED"; fi - ''; - }}/bin/notify"; + exec = + with pkgs; + "${ + writeShellApplication { + name = "notify"; + runtimeInputs = [ + coreutils + dunst + ]; + text = '' + COUNT=$(dunstctl count waiting) + ENABLED="" + DISABLED="" + if [ "$COUNT" != 0 ]; then DISABLED=" $COUNT"; fi + if dunstctl is-paused | grep -q "false" ; then echo "$ENABLED"; else echo "$DISABLED"; fi + ''; + } + }/bin/notify"; }; idle_inhibitor = { diff --git a/modules/gui/desktop/hyprland/apps/security.nix b/modules/gui/desktop/hyprland/apps/security.nix @@ -5,10 +5,12 @@ pkgs, files, ... -}: let +}: +let inherit (lib) getExe getExe'; locker = pkgs.swaylock-effects; -in { +in +{ ## Security Configuration # User Authentication security = { @@ -35,47 +37,55 @@ in { }; # Idle Daemon - services.swayidle = let - pause = "${getExe pkgs.playerctl} pause -a;"; - lock = pre: flag: "sh -c 'if ! ${getExe' pkgs.procps "pgrep"} -x swaylock; then ${pre} ${getExe locker} -f ${flag}; fi'"; - in { - enable = true; - extraArgs = ["-w"]; - events = [ - { - event = "before-sleep"; - command = lock pause ""; - } - { - event = "lock"; - command = lock pause "--fade-in 0.2 --grace 15 --grace-no-mouse"; - } - ]; + services.swayidle = + let + pause = "${getExe pkgs.playerctl} pause -a;"; + lock = + pre: flag: + "sh -c 'if ! ${getExe' pkgs.procps "pgrep"} -x swaylock; then ${pre} ${getExe locker} -f ${flag}; fi'"; + in + { + enable = true; + extraArgs = [ "-w" ]; + events = [ + { + event = "before-sleep"; + command = lock pause ""; + } + { + event = "lock"; + command = lock pause "--fade-in 0.2 --grace 15 --grace-no-mouse"; + } + ]; - timeouts = let - audio = command: "${pkgs.writeShellScript "audio" '' - ${getExe pkgs.playerctl} status | ${getExe pkgs.gnugrep} Playing - if [ $? == 1 ]; then ${command}; fi - ''}"; # Check if audio is playing - shader = getExe pkgs.hyprshade; - dpms = "${getExe' config.programs.hyprland.package "hyprctl"} dispatch dpms"; - in [ - { - timeout = 240; # Dim display - command = audio "${shader} on dim"; - resumeCommand = "${shader} off"; - } - { - timeout = 300; # Turn off display - command = audio "${dpms} off"; - resumeCommand = "${dpms} on"; - } - { - timeout = 500; # Suspend device - command = audio "${dpms} on && ${lock "" ""} && ${getExe' pkgs.systemd "systemctl"} suspend"; - } - ]; - }; + timeouts = + let + audio = + command: + "${pkgs.writeShellScript "audio" '' + ${getExe pkgs.playerctl} status | ${getExe pkgs.gnugrep} Playing + if [ $? == 1 ]; then ${command}; fi + ''}"; # Check if audio is playing + shader = getExe pkgs.hyprshade; + dpms = "${getExe' config.programs.hyprland.package "hyprctl"} dispatch dpms"; + in + [ + { + timeout = 240; # Dim display + command = audio "${shader} on dim"; + resumeCommand = "${shader} off"; + } + { + timeout = 300; # Turn off display + command = audio "${dpms} off"; + resumeCommand = "${dpms} on"; + } + { + timeout = 500; # Suspend device + command = audio "${dpms} on && ${lock "" ""} && ${getExe' pkgs.systemd "systemctl"} suspend"; + } + ]; + }; # Logout programs.wlogout = { diff --git a/modules/gui/desktop/hyprland/apps/settings.nix b/modules/gui/desktop/hyprland/apps/settings.nix @@ -6,17 +6,19 @@ files, theme, ... -}: let +}: +let inherit (builtins) map toString; inherit (config.gui) cursors display; cursor = "${cursors.name}-Hyprcursor"; -in { +in +{ ## App Environment - xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; # Desktop Integration stylix.base16Scheme = files.colors.catppuccin; - environment.systemPackages = [pkgs.custom.cursors]; + environment.systemPackages = [ pkgs.custom.cursors ]; gui = with theme; { fonts.enable = true; inherit (theme) icons; @@ -74,37 +76,39 @@ in { ]); ## Shortcuts - bind = let - toggle = app: "pkill ${app} || uwsm app -u ${app}.scope -- ${app}"; - runOnce = app: "pgrep ${app} || uwsm app -u ${app}.scope -- ${app}"; - in [ - # Applications - "$mod, F, exec, nemo" - "$mod, T, exec, kitty" - "$mod, W, exec, firefox" - "$mod, Return, exec, ${runOnce "resources"}" - "$mod SHIFT, equal, exec, pypr toggle calc" - ", XF86Calculator, exec, qalculate-gtk" - - # Utilities - "$mod, A, exec, nwg-drawer" - "$mod SHIFT, slash, exec, ${toggle "kebihelp"} show -a" - "$mod SHIFT, C, exec, ${runOnce "hyprpicker"} -arf hex" - "$mod SHIFT, B, exec, ${runOnce "overskride"}" - "$mod, D, exec, ${runOnce "nwg-displays"}" - "$mod SHIFT, P, exec, pavucontrol" - "$mod SHIFT, N, exec, sh -c 'env XDG_CURRENT_DESKTOP=GNOME gnome-control-center wifi'" - "$mod, Escape, exec, ${toggle "wlogout"} -p layer-shell" - - # Tools - "$mod SHIFT, A, exec, hyprutils toggle service waybar" - "$mod SHIFT, D, exec, hyprutils toggle monitor ${display}" - "$mod, N, exec, dunstctl history-pop" - "$mod, S, exec, hyprutils toggle shader" - "$mod SHIFT, T, exec, pypr toggle term" - "$mod, V, exec, pypr show clip" - "$mod, backslash, exec, pypr toggle emoji" - ]; + bind = + let + toggle = app: "pkill ${app} || uwsm app -u ${app}.scope -- ${app}"; + runOnce = app: "pgrep ${app} || uwsm app -u ${app}.scope -- ${app}"; + in + [ + # Applications + "$mod, F, exec, nemo" + "$mod, T, exec, kitty" + "$mod, W, exec, firefox" + "$mod, Return, exec, ${runOnce "resources"}" + "$mod SHIFT, equal, exec, pypr toggle calc" + ", XF86Calculator, exec, qalculate-gtk" + + # Utilities + "$mod, A, exec, nwg-drawer" + "$mod SHIFT, slash, exec, ${toggle "kebihelp"} show -a" + "$mod SHIFT, C, exec, ${runOnce "hyprpicker"} -arf hex" + "$mod SHIFT, B, exec, ${runOnce "overskride"}" + "$mod, D, exec, ${runOnce "nwg-displays"}" + "$mod SHIFT, P, exec, pavucontrol" + "$mod SHIFT, N, exec, sh -c 'env XDG_CURRENT_DESKTOP=GNOME gnome-control-center wifi'" + "$mod, Escape, exec, ${toggle "wlogout"} -p layer-shell" + + # Tools + "$mod SHIFT, A, exec, hyprutils toggle service waybar" + "$mod SHIFT, D, exec, hyprutils toggle monitor ${display}" + "$mod, N, exec, dunstctl history-pop" + "$mod, S, exec, hyprutils toggle shader" + "$mod SHIFT, T, exec, pypr toggle term" + "$mod, V, exec, pypr show clip" + "$mod, backslash, exec, pypr toggle emoji" + ]; ## Layer Rules layerrule = [ @@ -149,31 +153,39 @@ in { "float, class:^(xdg-desktop-portal-gtk)" "dimaround, class:^(xdg-desktop-portal-gtk)" ] - ++ (map (class: [ + ++ (map + (class: [ "pin, class:^(${class})" "dimaround, class:^(${class})" "stayfocused, class:^(${class})" - ]) [ + ]) + [ "pinentry-" "gay.vaskel.Soteria" "gcr-prompter" - ]) - ++ (map (class: [ + ] + ) + ++ (map + (class: [ # Utilities "float, class:^(${class})" "pin, class:^(${class})" "persistentsize, class:^(${class})" - ]) [ + ]) + [ "io.github.kaii_lb.Overskride" "nwg-displays" "org.pulseaudio.pavucontrol" "gnome-control-center" "org.gnome.Settings" - ]) - ++ (map (title: [ + ] + ) + ++ (map + (title: [ # Dialogs "float, title:^(${title})(.*)$" - ]) [ + ]) + [ "Library" "Open File" "Open Folder" @@ -181,7 +193,8 @@ in { "Save File" "Select a File" ".*Properties" - ]) + ] + ) ); }; }; diff --git a/modules/gui/desktop/hyprland/apps/terminal.nix b/modules/gui/desktop/hyprland/apps/terminal.nix @@ -2,7 +2,8 @@ pkgs, theme, ... -}: { +}: +{ ## Terminal Configuration user.homeConfig = { programs.kitty = { @@ -10,7 +11,8 @@ themeFile = with theme; "${name-alt}-${variant-alt}"; keybindings = { "ctrl+c" = "copy_or_interrupt"; - "kitty_mod+f" = "launch --allow-remote-control kitty +kitten search/search.py @active-kitty-window-id"; + "kitty_mod+f" = + "launch --allow-remote-control kitty +kitten search/search.py @active-kitty-window-id"; }; settings = { diff --git a/modules/gui/desktop/hyprland/apps/text.nix b/modules/gui/desktop/hyprland/apps/text.nix @@ -5,9 +5,10 @@ files, theme, ... -}: { +}: +{ ## Text Configuration - environment.systemPackages = [pkgs.geany]; + environment.systemPackages = [ pkgs.geany ]; user = { persist.directories = [ ".config/clipse" @@ -17,14 +18,16 @@ homeConfig = { # Text Editor xdg.mimeApps.defaultApplications = util.build.mime { - markdown = ["geany.desktop"]; - text = ["geany.desktop"]; + markdown = [ "geany.desktop" ]; + text = [ "geany.desktop" ]; }; home.file = with files.geany; { ".config/geany/geany.conf".text = settings; ".config/geany/keybindings.conf".text = keybindings; - ".config/geany/colorschemes/theme.conf".source = with theme; "${pkgs.custom.geany-catppuccin}/share/geany/colorschemes/${name}-${variant}.conf"; + ".config/geany/colorschemes/theme.conf".source = + with theme; + "${pkgs.custom.geany-catppuccin}/share/geany/colorschemes/${name}-${variant}.conf"; }; # Clipboard Manager diff --git a/modules/gui/desktop/hyprland/apps/utilities.nix b/modules/gui/desktop/hyprland/apps/utilities.nix @@ -5,10 +5,12 @@ pkgs, files, ... -}: let +}: +let inherit (lib) getExe; inherit (config.lib.stylix) colors; -in { +in +{ environment.systemPackages = with pkgs; [ # Apps clipse @@ -71,8 +73,11 @@ in { }; # Backlight - user.groups = ["input" "video"]; hardware.brillo.enable = true; + user.groups = [ + "input" + "video" + ]; user = { persist.directories = [ @@ -94,42 +99,54 @@ in { # Display Temperature hyprsunset = { enable = true; - extraArgs = ["--identity"]; + extraArgs = [ "--identity" ]; transitions = { sunrise = { calendar = "*-*-* 07:00:00"; requests = [ - ["temperature" "6000"] - ["identity"] + [ + "temperature" + "6000" + ] + [ "identity" ] ]; }; sunset = { calendar = "*-*-* 19:00:00"; - requests = [["temperature" "4000"]]; + requests = [ + [ + "temperature" + "4000" + ] + ]; }; }; }; }; - systemd.user.services = let - target = ["graphical-session.target"]; - run = about: command: { - Install.WantedBy = target; - Unit = { - Description = about; - After = target; - }; - Service = { - Restart = "always"; - RestartSec = 1; - ExecStart = command; + systemd.user.services = + let + target = [ "graphical-session.target" ]; + run = about: command: { + Install.WantedBy = target; + Unit = { + Description = about; + After = target; + }; + Service = { + Restart = "always"; + RestartSec = 1; + ExecStart = command; + }; }; + in + { + hyprshell = run "Launcher" "${getExe pkgs.hyprworld.hyprshell} run"; + waycorner = run "Hot Corners" (getExe pkgs.waycorner); + wlclock = + with colors; + run "Desktop Clock" "${getExe pkgs.wlclock} --layer bottom --exclusive-zone true --position top-right --margin 10 --size 300 --corner-radius 10 --border-size 2 --hand-width 7 --marking-width 3 --background-colour #${base00}4d --clock-colour #${base0D} --border-colour #${base00}"; }; - in { - hyprshell = run "Launcher" "${getExe pkgs.hyprworld.hyprshell} run"; - waycorner = run "Hot Corners" (getExe pkgs.waycorner); - wlclock = with colors; run "Desktop Clock" "${getExe pkgs.wlclock} --layer bottom --exclusive-zone true --position top-right --margin 10 --size 300 --corner-radius 10 --border-size 2 --hand-width 7 --marking-width 3 --background-colour #${base00}4d --clock-colour #${base0D} --border-colour #${base00}"; - }; # Network Settings xdg.desktopEntries."org.gnome.Settings" = { @@ -137,39 +154,43 @@ in { comment = "Gnome Control Center"; icon = "org.gnome.Settings"; exec = "env XDG_CURRENT_DESKTOP=gnome gnome-control-center"; - categories = ["X-Preferences"]; + categories = [ "X-Preferences" ]; terminal = false; }; - home.file = with files.hyprland; let - build = file: - util.build.theme { - inherit colors file; - inherit (config.stylix) fonts; - }; - in { - # Application Drawer - ".config/nwg-drawer/drawer.css".text = drawer; + home.file = + with files.hyprland; + let + build = + file: + util.build.theme { + inherit colors file; + inherit (config.stylix) fonts; + }; + in + { + # Application Drawer + ".config/nwg-drawer/drawer.css".text = drawer; - # Pyprland - ".config/hypr/pyprland.toml".text = pypr; + # Pyprland + ".config/hypr/pyprland.toml".text = pypr; - # Keybinds Viewer - ".config/kebihelp.json".text = build kebihelp; + # Keybinds Viewer + ".config/kebihelp.json".text = build kebihelp; - # Hot Corners - ".config/waycorner/config.toml".text = waycorner; + # Hot Corners + ".config/waycorner/config.toml".text = waycorner; - # Launcher - ".config/hyprshell/config.ron".text = hyprshell.config; - ".config/hyprshell/styles.css".text = build hyprshell.style; + # Launcher + ".config/hyprshell/config.ron".text = hyprshell.config; + ".config/hyprshell/styles.css".text = build hyprshell.style; - # Shaders - ".config/hypr/shaders" = { - source = files.proprietary.shaders.path; - recursive = true; + # Shaders + ".config/hypr/shaders" = { + source = files.proprietary.shaders.path; + recursive = true; + }; }; - }; }; }; } diff --git a/modules/gui/desktop/hyprland/default.nix b/modules/gui/desktop/hyprland/default.nix @@ -5,17 +5,25 @@ pkgs, files, ... -} @ args: let +}@args: +let + inherit (lib) + getExe + mkForce + mkIf + mkMerge + replaceStrings + ; + inherit (config.gui) desktop; - inherit (lib) getExe mkForce mkIf mkMerge replaceStrings; theme = import ./theme.nix pkgs; -in { +in +{ ## Hyprland Configuration ## config = mkIf (desktop == "hyprland") ( mkMerge ( # App Configuration - (builtins.map (path: import path (args // {inherit theme;})) - (util.map.modules.list ./apps)) + (builtins.map (path: import path (args // { inherit theme; })) (util.map.modules.list ./apps)) ++ [ ## Environment Setup rec { @@ -39,8 +47,14 @@ in { enable = true; package = pkgs.greetd.regreet; settings.commands = { - reboot = ["systemctl" "reboot"]; - poweroff = ["systemctl" "poweroff"]; + reboot = [ + "systemctl" + "reboot" + ]; + poweroff = [ + "systemctl" + "poweroff" + ]; }; }; }; @@ -60,20 +74,23 @@ in { }; # Greeter - greetd.settings.default_session.command = with programs; + greetd.settings.default_session.command = + with programs; mkForce "${getExe hyprland.package} --config ${ - pkgs.writeText "greeter.conf" - (replaceStrings ["@greeter"] [(getExe regreet.package)] - (util.build.theme { - inherit (config.lib.stylix) colors; - file = files.hyprland.greeter; - })) + pkgs.writeText "greeter.conf" ( + replaceStrings [ "@greeter" ] [ (getExe regreet.package) ] ( + util.build.theme { + inherit (config.lib.stylix) colors; + file = files.hyprland.greeter; + } + ) + ) } &> /dev/null"; }; } { # Greeter - environment.persist.directories = ["/var/lib/regreet"]; + environment.persist.directories = [ "/var/lib/regreet" ]; stylix.targets.regreet.enable = true; programs.regreet = { extraCss = mkForce ""; @@ -83,8 +100,8 @@ in { # Settings user = { - persist.directories = [".config/hypr"]; - homeConfig.imports = [./settings]; + persist.directories = [ ".config/hypr" ]; + homeConfig.imports = [ ./settings ]; }; } ] diff --git a/modules/gui/desktop/hyprland/settings/default.nix b/modules/gui/desktop/hyprland/settings/default.nix @@ -3,11 +3,13 @@ lib, util, ... -}: let +}: +let inherit (lib) mkForce mkIf; inherit (sys.gui) display fancy; inherit (sys.lib.stylix.colors) base03 base05 base0D; -in { +in +{ ## Hyprland Settings imports = util.map.modules.list ./.; stylix.targets.hyprland.enable = true; @@ -22,7 +24,7 @@ in { settings = { # GPU Support - env = ["AQ_DRM_DEVICES, /dev/dri/card1:/dev/dri/card0"]; + env = [ "AQ_DRM_DEVICES, /dev/dri/card1:/dev/dri/card0" ]; # Display monitor = ", preferred, auto, 1"; diff --git a/modules/gui/desktop/hyprland/settings/keybindings.nix b/modules/gui/desktop/hyprland/settings/keybindings.nix @@ -83,16 +83,21 @@ _: { ] ++ # Workspaces - (with builtins; - concatLists (genList ( - n: let + ( + with builtins; + concatLists ( + genList ( + n: + let num = toString (n + 1); - in [ + in + [ "$mod, ${num}, split:workspace, ${num}" "$mod SHIFT, ${num}, split:movetoworkspace, ${num}" ] - ) - 9)); + ) 9 + ) + ); # Mouse bindm = [ diff --git a/modules/gui/desktop/hyprland/settings/plugins.nix b/modules/gui/desktop/hyprland/settings/plugins.nix @@ -3,7 +3,8 @@ config, pkgs, ... -}: { +}: +{ ## Plugin Settings wayland.windowManager.hyprland = { plugins = with pkgs.hyprworld; [ @@ -38,17 +39,13 @@ effects = false; ipc = false; }; - - mode = - if sys.gui.fancy - then "tilt" - else "none"; + mode = if sys.gui.fancy then "tilt" else "none"; tilt.function = "negative_quadratic"; }; }; # Overview - bind = ["$mod, grave, hyprexpo:expo, toggle"]; + bind = [ "$mod, grave, hyprexpo:expo, toggle" ]; }; }; } diff --git a/modules/gui/desktop/hyprland/theme.nix b/modules/gui/desktop/hyprland/theme.nix @@ -10,7 +10,7 @@ pkgs: rec { gtk = { name = "${name}-${variant}-${accent}-standard"; package = pkgs.catppuccin-gtk.override { - accents = [accent]; + accents = [ accent ]; inherit variant; }; }; diff --git a/modules/gui/desktop/pantheon.nix b/modules/gui/desktop/pantheon.nix @@ -1,188 +0,0 @@ -{ - config, - lib, - util, - pkgs, - files, - ... -}: -with files; let - inherit (config.gui) desktop; - exists = app: builtins.elem app config.apps.list; - inherit (lib) mkIf mkMerge; -in { - ## Pantheon Desktop Configuration ## - config = mkIf (desktop == "pantheon") (mkMerge [ - ## Environment Setup - { - # Session - services.xserver.desktopManager.pantheon.enable = true; - } - - { - # Desktop Integration - gui = { - fonts.enable = true; - gtk = { - enable = true; - theme = { - name = "io.elementary.stylesheet.blueberry"; - package = pkgs.pantheon.elementary-gtk-theme; - }; - }; - - qt = { - enable = true; - style = "gtk"; - }; - - cursors = { - name = "elementary"; - package = pkgs.pantheon.elementary-icon-theme; - size = 32; - }; - }; - - # Essential Utilities - apps.list = ["firefox"]; - services.pantheon.apps.enable = true; - - # Panel Indicators - services.xserver.desktopManager.pantheon.extraWingpanelIndicators = with pkgs; [ - monitor - wingpanel-indicator-ayatana - ]; - - environment = { - # Panel Indicator Compatibility - pathsToLink = ["/libexec"]; - - # Apps - systemPackages = with pkgs.pantheon // pkgs; [ - appeditor - gthumb - pantheon-tweaks - torrential - ]; - }; - - # Persisted Files - user.persist.directories = [ - ".config/evolution" - ".config/plank" - ".config/torrential" - ".local/share/contractor" - ".local/share/evolution" - ".local/share/io.elementary.code" - ".local/share/io.elementary.photos" - ".cache/evolution" - ".cache/io.elementary.appcenter" - ]; - - # Color Scheme - stylix.base16Scheme = colors.elementary; - } - - ## User Configuration - { - user.homeConfig = { - imports = [pantheon.dconf]; - stylix.targets.gnome.enable = false; - - # Default Applications - xdg.mimeApps.defaultApplications = util.build.mime { - audio = ["io.elementary.files.desktop"]; - calendar = ["io.elementary.calendar.desktop"]; - directory = ["io.elementary.files.desktop"]; - image = ["io.elementary.photos.desktop"]; - pdf = ["org.gnome.Evince.desktop"]; - text = ["io.elementary.code.desktop"]; - video = ["io.elementary.videos.desktop"]; - }; - - # App Indicator Autostart - systemd.user.services.indicator-application-gtk3 = { - Unit.Description = "Application Indicator"; - Install.wantedBy = ["graphical-session.target"]; - Service = { - Type = "Simple"; - ExecStart = "${pkgs.indicator-application-gtk3}/libexec/indicator-application/indicator-application-service"; - }; - }; - - home = { - file = with pantheon; { - # Plank Dock - ".config/autostart/Dock.desktop".text = plank.autostart; - ".local/share/plank/themes/default/dock.theme".text = plank.theme; - ".config/plank/dock1/launchers" = { - source = plank.launchers; - recursive = true; - force = true; - }; - - # Firefox Elementary Theme - ".mozilla/firefox/default/chrome/userChrome.css".source = "${pkgs.custom.firefox-elementary}/Windows/userChrome.css"; - ".mozilla/firefox/default/chrome/userContent.css".source = "${pkgs.custom.firefox-elementary}/userContent.css"; - ".mozilla/firefox/default/chrome/base.css".source = "${pkgs.custom.firefox-elementary}/base.css"; - - # Panel Indicators - ".config/autostart/ibus-daemon.desktop".text = '' - [Desktop Entry] - Name=IBus Daemon - Type=Application - Exec=${pkgs.ibus}/bin/ibus-daemon --daemonize --desktop=pantheon --replace --xim - Categories= - Terminal=false - NoDisplay=true - StartupNotify=false - ''; - - ".config/autostart/monitor-background.desktop".text = '' - [Desktop Entry] - Name=Monitor Indicators - Type=Application - Exec=/run/current-system/sw/bin/com.github.stsdc.monitor --start-in-background - Icon=com.github.stsdc.monitor - Categories= - Terminal=false - NoDisplay=true - StartupNotify=false - ''; - }; - }; - }; - } - - ## 3rd Party Apps Configuration - { - # Code Editor - user.homeConfig.programs.vscode.profiles.default = mkIf (exists "vscode") { - extensions = [pkgs.code.vscode-marketplace.sixpounder.elementary-theme]; - userSettings = { - "workbench.colorTheme" = "Elementary Dark"; - "terminal.external.linuxExec" = "io.elementary.terminal"; - }; - }; - - # Flatpak Apps - warnings = ["Flatpak app support is enabled by default while using Pantheon Desktop"]; - apps.list = ["flatpak"]; - services.flatpak = { - remotes = [ - { - name = "appcenter"; - location = "https://flatpak.elementary.io/repo.flatpakrepo"; - } - ]; - - packages = [ - { - appId = "com.github.hezral.clips"; - origin = "appcenter"; - } - ]; - }; - } - ]); -} diff --git a/modules/gui/desktop/pantheon/default.nix b/modules/gui/desktop/pantheon/default.nix @@ -0,0 +1,192 @@ +{ + config, + lib, + util, + pkgs, + files, + ... +}: +with files; +let + inherit (config.gui) desktop; + exists = app: builtins.elem app config.apps.list; + inherit (lib) mkIf mkMerge; +in +{ + ## Pantheon Desktop Configuration ## + config = mkIf (desktop == "pantheon") (mkMerge [ + ## Environment Setup + { + # Session + services.xserver.desktopManager.pantheon.enable = true; + } + + { + # Desktop Integration + gui = { + fonts.enable = true; + gtk = { + enable = true; + theme = { + name = "io.elementary.stylesheet.blueberry"; + package = pkgs.pantheon.elementary-gtk-theme; + }; + }; + + qt = { + enable = true; + style = "gtk"; + }; + + cursors = { + name = "elementary"; + package = pkgs.pantheon.elementary-icon-theme; + size = 32; + }; + }; + + # Essential Utilities + apps.list = [ "firefox" ]; + services.pantheon.apps.enable = true; + + # Panel Indicators + services.xserver.desktopManager.pantheon.extraWingpanelIndicators = with pkgs; [ + monitor + wingpanel-indicator-ayatana + ]; + + environment = { + # Panel Indicator Compatibility + pathsToLink = [ "/libexec" ]; + + # Apps + systemPackages = with pkgs.pantheon // pkgs; [ + appeditor + gthumb + pantheon-tweaks + torrential + ]; + }; + + # Persisted Files + user.persist.directories = [ + ".config/evolution" + ".config/plank" + ".config/torrential" + ".local/share/contractor" + ".local/share/evolution" + ".local/share/io.elementary.code" + ".local/share/io.elementary.photos" + ".cache/evolution" + ".cache/io.elementary.appcenter" + ]; + + # Color Scheme + stylix.base16Scheme = colors.elementary; + } + + ## User Configuration + { + user.homeConfig = { + imports = [ ./settings.nix ]; + stylix.targets.gnome.enable = false; + + # Default Applications + xdg.mimeApps.defaultApplications = util.build.mime { + audio = [ "io.elementary.files.desktop" ]; + calendar = [ "io.elementary.calendar.desktop" ]; + directory = [ "io.elementary.files.desktop" ]; + image = [ "io.elementary.photos.desktop" ]; + pdf = [ "org.gnome.Evince.desktop" ]; + text = [ "io.elementary.code.desktop" ]; + video = [ "io.elementary.videos.desktop" ]; + }; + + # App Indicator Autostart + systemd.user.services.indicator-application-gtk3 = { + Unit.Description = "Application Indicator"; + Install.wantedBy = [ "graphical-session.target" ]; + Service = { + Type = "Simple"; + ExecStart = "${pkgs.indicator-application-gtk3}/libexec/indicator-application/indicator-application-service"; + }; + }; + + home = { + file = { + # Plank Dock + ".config/autostart/Dock.desktop".text = plank.autostart; + ".local/share/plank/themes/default/dock.theme".text = plank.theme; + ".config/plank/dock1/launchers" = { + source = plank.launchers; + recursive = true; + force = true; + }; + + # Firefox Elementary Theme + ".mozilla/firefox/default/chrome/userChrome.css".source = + "${pkgs.custom.firefox-elementary}/Windows/userChrome.css"; + ".mozilla/firefox/default/chrome/userContent.css".source = + "${pkgs.custom.firefox-elementary}/userContent.css"; + ".mozilla/firefox/default/chrome/base.css".source = "${pkgs.custom.firefox-elementary}/base.css"; + + # Panel Indicators + ".config/autostart/ibus-daemon.desktop".text = '' + [Desktop Entry] + Name=IBus Daemon + Type=Application + Exec=${pkgs.ibus}/bin/ibus-daemon --daemonize --desktop=pantheon --replace --xim + Categories= + Terminal=false + NoDisplay=true + StartupNotify=false + ''; + + ".config/autostart/monitor-background.desktop".text = '' + [Desktop Entry] + Name=Monitor Indicators + Type=Application + Exec=/run/current-system/sw/bin/com.github.stsdc.monitor --start-in-background + Icon=com.github.stsdc.monitor + Categories= + Terminal=false + NoDisplay=true + StartupNotify=false + ''; + }; + }; + }; + } + + ## 3rd Party Apps Configuration + { + # Code Editor + user.homeConfig.programs.vscode.profiles.default = mkIf (exists "vscode") { + extensions = [ pkgs.code.vscode-marketplace.sixpounder.elementary-theme ]; + userSettings = { + "workbench.colorTheme" = "Elementary Dark"; + "terminal.external.linuxExec" = "io.elementary.terminal"; + }; + }; + + # Flatpak Apps + warnings = [ "Flatpak app support is enabled by default while using Pantheon Desktop" ]; + apps.list = [ "flatpak" ]; + services.flatpak = { + remotes = [ + { + name = "appcenter"; + location = "https://flatpak.elementary.io/repo.flatpakrepo"; + } + ]; + + packages = [ + { + appId = "com.github.hezral.clips"; + origin = "appcenter"; + } + ]; + }; + } + ]); +} diff --git a/modules/gui/desktop/pantheon/settings.nix b/modules/gui/desktop/pantheon/settings.nix @@ -0,0 +1,308 @@ +{ + sys, + lib, + ... +}: +with lib.hm.gvariant; +let + inherit (builtins) head; + fonts = sys.fonts.fontconfig.defaultFonts; +in +{ + ## Dconf Keys ## + # Generated via nix-community/dconf2nix + # Use 'dconf watch /' to record changes + dconf.settings = { + # Desktop + "io/elementary/desktop/agent-geoclue2".location-enabled = true; + "io/elementary/desktop/wingpanel".use-transparency = true; + "io/elementary/desktop/wingpanel/a11y".show-indicator = true; + "io/elementary/desktop/wingpanel/datetime".clock-format = "24h"; + "io/elementary/desktop/wingpanel/sound".max-volume = 100.0; + "io/elementary/desktop/wingpanel/power".show-percentage = true; + "io/elementary/desktop/wingpanel/bluetooth".bluetooth-enabled = false; + + "io/elementary/switchboard/keyboard".first-launch = false; + "io/elementary/files/preferences".singleclick-select = false; + "io/elementary/settings-daemon/datetime".show-weeks = true; + + "org/gnome/desktop/session".idle-delay = mkUint32 900; + "org/gnome/desktop/a11y/keyboard".togglekeys-enable = true; + "org/gnome/desktop/datetime".automatic-timezone = true; + "org/gnome/desktop/interface" = { + clock-format = "24h"; + clock-show-weekday = true; + cursor-size = 32; + enable-animations = true; + enable-hot-corners = true; + gtk-enable-primary-paste = true; + locate-pointer = true; + text-scaling-factor = 1.0; + }; + + "org/gnome/desktop/background" = rec { + color-shading-type = "solid"; + picture-options = "zoom"; + picture-uri = "file://${sys.gui.wallpaper}"; + picture-uri-dark = picture-uri; + }; + + "io/elementary/notifications/applications/gala-other" = { + remember = true; + sounds = true; + }; + + "org/gnome/desktop/sound" = { + allow-volume-above-100-percent = false; + event-sounds = true; + theme-name = "elementary"; + }; + + "org/gnome/settings-daemon/plugins/power" = { + power-button-action = "interactive"; + sleep-inactive-ac-timeout = 0; + sleep-inactive-ac-type = "nothing"; + sleep-inactive-battery-timeout = 1800; + }; + + "org/gnome/desktop/peripherals/touchpad" = { + click-method = "fingers"; + tap-to-click = true; + two-finger-scrolling-enabled = true; + }; + + "org/gnome/settings-daemon/plugins/color" = { + night-light-enabled = true; + night-light-schedule-automatic = false; + night-light-schedule-from = 19.0; + night-light-schedule-to = 7.0; + night-light-temperature = mkUint32 3700; + }; + + "io/elementary/settings-daemon/housekeeping" = { + cleanup-downloads-folder = false; + cleanup-screenshots-folder = false; + old-files-age = 30; + }; + + # Window Manager + "org/pantheon/desktop/gala/appearance".button-layout = ":minimize,maximize,close"; + "org/gnome/desktop/wm/preferences".titlebar-font = "${head fonts.sansSerif} Bold 11"; + + "org/pantheon/desktop/gala/behavior" = { + hotcorner-bottomleft = "show-workspace-view"; + hotcorner-bottomright = "switch-to-workspace-next"; + hotcorner-topleft = "open-launcher"; + }; + + "org/gnome/mutter" = { + attach-modal-dialogs = true; + center-new-windows = true; + dynamic-workspaces = true; + edge-tiling = true; + focus-change-on-pointer-rest = true; + workspaces-only-on-primary = true; + }; + + "org/gnome/mutter/keybindings" = { + cancel-input-capture = [ "<Super><Shift>Escape" ]; + toggle-tiled-left = [ ]; + toggle-tiled-right = [ ]; + }; + + # Apps + "desktop/ibus/panel/emoji".font = "${head fonts.emoji} 16"; + "desktop/ibus/panel" = { + show-icon-on-systray = false; + use-custom-font = true; + custom-font = "${head fonts.sansSerif} 10"; + }; + + "com/github/stsdc/monitor/settings" = { + background-state = true; + indicator-state = true; + indicator-cpu-state = false; + indicator-gpu-state = false; + indicator-memory-state = true; + indicator-network-download-state = false; + indicator-network-upload-state = false; + indicator-temperature-state = true; + }; + + "org/gnome/epiphany" = { + ask-for-default = false; + default-search-engine = "Google"; + use-google-search-suggestions = true; + }; + + "io/elementary/terminal/settings" = { + audible-bell = false; + follow-last-tab = "true"; + font = "${head fonts.monospace} Medium 13"; + natural-copy-paste = false; + unsafe-paste-alert = true; + }; + + "net/launchpad/plank/docks/dock1" = { + current-workspace-only = true; + icon-size = 60; + pressure-reveal = true; + theme = "default"; + zoom-enabled = true; + zoom-percent = 120; + }; + + "io/elementary/code/saved-state".outline-visible = true; + "io/elementary/code/settings" = { + autosave = false; + prefer-dark-style = true; + show-mini-map = true; + show-right-margin = true; + strip-trailing-on-save = true; + plugins-enabled = [ + "editorconfig" + "word-completion" + "brackets-completion" + "preserve-indent" + "detect-indent" + ]; + }; + + "com/github/hezral/clips" = { + first-run = false; + hide-on-startup = true; + min-column-number = 3; + persistent-mode = false; + prefer-dark-style = true; + protected-mode = true; + quick-paste = true; + shake-reveal = false; + show-close-button = false; + theme-optin = true; + }; + + # Keyboard Shortcuts + "org/gnome/desktop/wm/keybindings" = { + begin-move = [ ]; + begin-resize = [ ]; + close = [ + "<Super>q" + "<Alt>F4" + ]; + cycle-group = [ ]; + cycle-group-backward = [ ]; + maximize = [ "" ]; + minimize = [ "<Super>Down" ]; + move-to-monitor-down = [ ]; + move-to-monitor-left = [ "<Shift><Super>Left" ]; + move-to-monitor-right = [ "<Shift><Super>Right" ]; + move-to-monitor-up = [ ]; + move-to-workspace-1 = [ ]; + move-to-workspace-2 = [ "" ]; + move-to-workspace-3 = [ "" ]; + move-to-workspace-4 = [ "" ]; + move-to-workspace-5 = [ "" ]; + move-to-workspace-6 = [ "" ]; + move-to-workspace-7 = [ "" ]; + move-to-workspace-8 = [ "" ]; + move-to-workspace-9 = [ "" ]; + move-to-workspace-down = [ ]; + move-to-workspace-last = [ ]; + move-to-workspace-left = [ "<Primary><Super>Left" ]; + move-to-workspace-right = [ "<Primary><Super>Right" ]; + move-to-workspace-up = [ ]; + show-desktop = [ "<Super>d" ]; + switch-applications = [ "<Alt>Tab" ]; + switch-applications-backward = [ "<Shift><Alt>Tab" ]; + switch-group = [ "<Super>Tab" ]; + switch-group-backward = [ "<Shift><Super>Tab" ]; + switch-to-workspace-1 = [ "<Super>Home" ]; + switch-to-workspace-2 = [ "" ]; + switch-to-workspace-3 = [ "" ]; + switch-to-workspace-4 = [ "" ]; + switch-to-workspace-5 = [ "" ]; + switch-to-workspace-6 = [ "" ]; + switch-to-workspace-7 = [ "" ]; + switch-to-workspace-8 = [ "" ]; + switch-to-workspace-9 = [ "" ]; + switch-to-workspace-down = [ ]; + switch-to-workspace-last = [ "<Super>End" ]; + switch-to-workspace-left = [ "<Super>Left" ]; + switch-to-workspace-right = [ "<Super>Right" ]; + switch-to-workspace-up = [ ]; + toggle-maximized = [ "<Super>Up" ]; + unmaximize = [ ]; + }; + + "org/gnome/settings-daemon/plugins/media-keys" = { + email = [ "<Super>e" ]; + home = [ "<Super>f" ]; + magnifier-zoom-in = [ "<Super>equal" ]; + magnifier-zoom-out = [ "<Super>minus" ]; + play = [ "F4" ]; + screenreader = [ ]; + screensaver = [ "<Super>l" ]; + terminal = [ "<Super>t" ]; + volume-down = [ "AudioLowerVolume" ]; + volume-mute = [ "" ]; + volume-up = [ "AudioRaiseVolume" ]; + www = [ "<Super>w" ]; + custom-keybindings = [ + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/" + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/" + ]; + }; + + "org/pantheon/desktop/gala/keybindings" = { + area-screenshot = [ "Print" ]; + expose-windows = [ "" ]; + pip = [ "" ]; + screenshot = [ "<Shift>Print" ]; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { + name = "Task Manager"; + binding = "<Primary><Alt>Return"; + command = "com.github.stsdc.monitor"; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { + name = "Terminal"; + binding = "<Super>t"; + command = "io.elementary.terminal"; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = { + name = "Calculator"; + binding = "Calculator"; + command = "io.elementary.calculator"; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3" = { + name = "Clipboard"; + binding = "<Super>v"; + command = "gtk-launch com.github.hezral.clips"; + }; + + # Gestures + "org/gnome/shell/extensions/windowgestures" = { + fn-fullscreen = true; + fn-maximized-snap = true; + fn-move = true; + fn-move-snap = true; + fn-resize = true; + pinch-enable = true; + pinch3-in = 0; + pinch3-out = 0; + pinch4-in = 14; + pinch4-out = 3; + swipe3-down = 1; + swipe4-updown = 22; + taphold-move = true; + three-finger = false; + use-active-window = true; + }; + }; +} diff --git a/modules/gui/desktop/xfce/compositor.nix b/modules/gui/desktop/xfce/compositor.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ ## Picom Compositor Configuration ## services.picom = rec { enable = true; @@ -24,11 +25,11 @@ ]; # Opacity - opacityRules = ["95:class_g = 'Code'"]; + opacityRules = [ "95:class_g = 'Code'" ]; wintypes = { - tooltip = {opacity = 0.8;}; - popup_menu = {opacity = 0.9;}; - dropdown_menu = {opacity = 0.9;}; + tooltip.opacity = 0.8; + popup_menu.opacity = 0.9; + dropdown_menu.opacity = 0.9; }; settings = @@ -47,25 +48,28 @@ "class_g='Xfce4-panel'" ]; } - // # Fade - { + # Fade + // { fading = true; fade-in-step = 0.03; fade-out-step = 0.1; fade-delta = 15; no-fading-openclose = false; } - // # Blur - { + # Blur + // { blur-method = "dual_kawase"; blur-strength = 3; blur-background-exclude = shadowExclude; } - // # Animation - { + # Animation + // { animations = [ { - triggers = ["close" "hide"]; + triggers = [ + "close" + "hide" + ]; preset = "disappear"; scale = 0.4; opacity = { @@ -77,7 +81,10 @@ shadow-opacity = "opacity"; } { - triggers = ["open" "show"]; + triggers = [ + "open" + "show" + ]; opacity = { curve = "cubic-bezier(0.3,1.0,0.4,1)"; duration = 0.4; @@ -101,7 +108,7 @@ shadow-offset-y = "offset-y"; } { - triggers = ["geometry"]; + triggers = [ "geometry" ]; scale-x = { curve = "cubic-bezier(0.3,1.0,0.4,1)"; duration = 0.4; diff --git a/modules/gui/desktop/xfce/default.nix b/modules/gui/desktop/xfce/default.nix @@ -5,18 +5,26 @@ pkgs, files, ... -} @ args: -with files; let - inherit (config.gui) desktop display fancy icons wallpaper; - exists = app: builtins.elem app config.apps.list; +}@args: +with files; +let inherit (lib) hasPrefix mkIf mkMerge; + exists = app: builtins.elem app config.apps.list; + inherit (config.gui) + desktop + display + fancy + icons + wallpaper + ; # GTK+ Theme theme = { name = "Arc-Dark"; package = pkgs.arc-theme; }; -in { +in +{ ## XFCE Configuration ## config = mkIf (hasPrefix "xfce" desktop) (mkMerge [ { @@ -72,11 +80,11 @@ in { }; # Essential Utilities - xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; services = { blueman.enable = true; touchegg.enable = true; - xserver.displayManager.lightdm.greeters.gtk = {inherit theme;}; + xserver.displayManager.lightdm.greeters.gtk = { inherit theme; }; }; programs = { @@ -115,7 +123,7 @@ in { xfce4-windowck-plugin (writeShellApplication { name = "xfce4-panel-toggle"; - runtimeInputs = [xfce.xfconf]; + runtimeInputs = [ xfce.xfconf ]; text = '' for num in {0,1} do @@ -142,19 +150,21 @@ in { user.homeConfig = { # GTK+ Theming stylix.targets.xfce.enable = false; - gtk = {gtk3.extraCss = xfce.css;}; + gtk = { + gtk3.extraCss = xfce.css; + }; # Default Applications xdg.mimeApps.defaultApplications = util.build.mime { - archive = ["org.gnome.FileRoller.desktop"]; - audio = ["org.xfce.Parole.desktop"]; - calendar = ["org.xfce.orage.desktop"]; - directory = ["thunar.desktop"]; - image = ["org.xfce.ristretto.desktop"]; - magnet = ["transmission-gtk.desktop"]; - pdf = ["atril.desktop"]; - text = ["org.xfce.mousepad.desktop"]; - video = ["org.xfce.Parole.desktop"]; + archive = [ "org.gnome.FileRoller.desktop" ]; + audio = [ "org.xfce.Parole.desktop" ]; + calendar = [ "org.xfce.orage.desktop" ]; + directory = [ "thunar.desktop" ]; + image = [ "org.xfce.ristretto.desktop" ]; + magnet = [ "transmission-gtk.desktop" ]; + pdf = [ "atril.desktop" ]; + text = [ "org.xfce.mousepad.desktop" ]; + video = [ "org.xfce.Parole.desktop" ]; }; home.file = @@ -167,10 +177,10 @@ in { directory = xfce.panel; path = ".config/xfce4/panel"; extension = ".rc"; - apply = text: {inherit text;}; + apply = text: { inherit text; }; replace = { - placeholders = ["@font"]; - values = [config.stylix.fonts.sansSerif.name]; + placeholders = [ "@font" ]; + values = [ config.stylix.fonts.sansSerif.name ]; }; } // util.map.folder { @@ -202,11 +212,7 @@ in { config.stylix.cursor.name config.stylix.fonts.sansSerif.name config.stylix.fonts.monospace.name - ( - if fancy - then "false" - else "true" - ) + (if fancy then "false" else "true") ]; }; }; @@ -218,17 +224,19 @@ in { user.homeConfig = { home.file = { # Discord Nord Theme - ".config/vesktop/settings/quickCss.css" = - mkIf (exists "discord") {text = ''@import url(https://rawcdn.githack.com/orblazer/discord-nordic/f3f6833c70d0b27b1cde986233b7009d61917812/nordic.theme.css);'';}; + ".config/vesktop/settings/quickCss.css" = mkIf (exists "discord") { + text = ''@import url(https://rawcdn.githack.com/orblazer/discord-nordic/f3f6833c70d0b27b1cde986233b7009d61917812/nordic.theme.css);''; + }; # Logseq Nord Theme - ".logseq/config.edn" = - mkIf (exists "notes") {text = ''{:custom-css-url "@import url('https://cdn.jsdelivr.net/gh/bad3r/logseq-nord-theme@latest/custom.min.css');"}'';}; + ".logseq/config.edn" = mkIf (exists "notes") { + text = ''{:custom-css-url "@import url('https://cdn.jsdelivr.net/gh/bad3r/logseq-nord-theme@latest/custom.min.css');"}''; + }; }; # Code Editor programs.vscode.profiles.default = mkIf (exists "vscode") { - extensions = [pkgs.code.vscode-marketplace.alvesvaren.arc-dark]; + extensions = [ pkgs.code.vscode-marketplace.alvesvaren.arc-dark ]; userSettings = { "workbench.colorTheme" = "Arc Dark Theme"; "terminal.external.linuxExec" = "xfce4-terminal"; diff --git a/modules/gui/desktop/xfce/iso.nix b/modules/gui/desktop/xfce/iso.nix @@ -2,9 +2,11 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkForce; -in { +in +{ # Excluded Packages environment.xfce.excludePackages = with (pkgs.xfce // pkgs); [ tango-icon-theme diff --git a/modules/gui/fonts.nix b/modules/gui/fonts.nix @@ -3,7 +3,8 @@ lib, pkgs, ... -}: { +}: +{ options.gui.fonts.enable = lib.mkEnableOption "Enable Fonts Configuration"; ## Font Configuration ## @@ -28,13 +29,15 @@ }; # Emoji Support - defaultFonts = let - emoji = [stylix.fonts.emoji.name]; - in { - monospace = emoji; - sansSerif = emoji; - serif = emoji; - }; + defaultFonts = + let + emoji = [ stylix.fonts.emoji.name ]; + in + { + monospace = emoji; + sansSerif = emoji; + serif = emoji; + }; }; }; diff --git a/modules/gui/gtk.nix b/modules/gui/gtk.nix @@ -4,10 +4,18 @@ pkgs, files, ... -}: let - inherit (lib) mkEnableOption mkIf mkOption types; +}: +let + inherit (lib) + mkEnableOption + mkIf + mkOption + types + ; + cfg = config.gui.gtk; -in { +in +{ options.gui.gtk = { enable = mkEnableOption "Enable GTK Configuration"; theme = { @@ -27,9 +35,9 @@ in { config = mkIf cfg.enable { # Environment Setup programs.dconf.enable = true; - services.dbus.packages = [pkgs.dconf]; + services.dbus.packages = [ pkgs.dconf ]; environment = { - systemPackages = [cfg.theme.package]; + systemPackages = [ cfg.theme.package ]; variables."GTK_THEME" = cfg.theme.name; }; diff --git a/modules/gui/qt.nix b/modules/gui/qt.nix @@ -3,16 +3,32 @@ lib, pkgs, ... -}: let - inherit (lib) mkDefault mkEnableOption mkIf mkMerge mkOption types; +}: +let + inherit (lib) + mkDefault + mkEnableOption + mkIf + mkMerge + mkOption + types + ; + inherit (config.gui) qt icons; inherit (config.stylix) fonts; -in { +in +{ options.gui.qt = { enable = mkEnableOption "Enable QT Configuration"; style = mkOption { description = "QT Application Style"; - type = types.nullOr (types.enum ["gtk" "kvantum" "qtct"]); + type = types.nullOr ( + types.enum [ + "gtk" + "kvantum" + "qtct" + ] + ); default = null; }; @@ -30,7 +46,8 @@ in { }; ## QT Configuration ## - config = with qt.theme; + config = + with qt.theme; mkIf qt.enable (mkMerge [ { stylix.targets.qt.enable = false; @@ -54,7 +71,7 @@ in { }; environment = { - systemPackages = [package]; + systemPackages = [ package ]; etc."xdg/Kvantum/kvantum.kvconfig".text = '' [General] Theme=${name} @@ -78,51 +95,57 @@ in { }; }) - (mkIf (qt.style == "qtct") (let - pkg = with pkgs; [ - darkly - darkly-qt5 - ]; + (mkIf (qt.style == "qtct") ( + let + pkg = with pkgs; [ + darkly + darkly-qt5 + ]; - conf = version: - lib.generators.toINI {} { - Appearance = { - style = "Lightly"; - standard_dialogs = "default"; - icon_theme = icons.name; - custom_palette = true; - color_scheme_path = "${package}/share/${version}/colors/${name}.conf"; - }; + conf = + version: + lib.generators.toINI { } { + Appearance = { + style = "Lightly"; + standard_dialogs = "default"; + icon_theme = icons.name; + custom_palette = true; + color_scheme_path = "${package}/share/${version}/colors/${name}.conf"; + }; - Fonts = let - size = fonts.sizes.applications; - in { - fixed = "\"${fonts.monospace.name},${size},-1,5,50,0,0,0,0,0,Regular\""; - general = "\"${fonts.sansSerif.name},${size},-1,5,50,0,0,0,0,0,Regular\""; + Fonts = + let + size = fonts.sizes.applications; + in + { + fixed = "\"${fonts.monospace.name},${size},-1,5,50,0,0,0,0,0,Regular\""; + general = "\"${fonts.sansSerif.name},${size},-1,5,50,0,0,0,0,0,Regular\""; + }; + }; + in + { + qt.platformTheme = "qt5ct"; + environment = { + systemPackages = pkg; + etc = { + "xdg/qt5ct/qt5ct.conf" = conf "qt5ct"; + "xdg/qt6ct/qt6ct.conf" = conf "qt6ct"; }; }; - in { - qt.platformTheme = "qt5ct"; - environment = { - systemPackages = pkg; - etc = { - "xdg/qt5ct/qt5ct.conf" = conf "qt5ct"; - "xdg/qt6ct/qt6ct.conf" = conf "qt6ct"; - }; - }; - user.homeConfig = { - qt = { - enable = true; - platformTheme.name = "qtct"; - style.package = pkg; - }; + user.homeConfig = { + qt = { + enable = true; + platformTheme.name = "qtct"; + style.package = pkg; + }; - xdg.configFile = { - "qt5ct/qt5ct.conf" = conf "qt5ct"; - "qt6ct/qt6ct.conf" = conf "qt6ct"; + xdg.configFile = { + "qt5ct/qt5ct.conf" = conf "qt5ct"; + "qt6ct/qt6ct.conf" = conf "qt6ct"; + }; }; - }; - })) + } + )) ]); } diff --git a/modules/gui/theme.nix b/modules/gui/theme.nix @@ -5,13 +5,23 @@ pkgs, files, ... -}: let - inherit (lib) attrNames hasSuffix mkIf mkOption optionals types; +}: +let + inherit (lib) + attrNames + hasSuffix + mkIf + mkOption + optionals + types + ; + cfg = config.gui; enable = !(cfg.desktop == "" || hasSuffix "-iso" cfg.desktop); exists = app: builtins.elem app config.apps.list; -in { - imports = [inputs.stylix.nixosModules.stylix]; +in +{ + imports = [ inputs.stylix.nixosModules.stylix ]; options.gui = { icons = { @@ -59,8 +69,11 @@ in { ## Application Theming ## config = rec { environment.systemPackages = - [stylix.cursor.package] - ++ optionals enable [cfg.icons.package cfg.cursors.package]; + [ stylix.cursor.package ] + ++ optionals enable [ + cfg.icons.package + cfg.cursors.package + ]; stylix = { inherit enable; diff --git a/modules/gui/wayland.nix b/modules/gui/wayland.nix @@ -2,7 +2,8 @@ config, lib, ... -}: { +}: +{ options.gui.wayland.enable = lib.mkEnableOption "Enable Wayland Configuration"; ## Wayland Configuration ## diff --git a/modules/gui/xorg.nix b/modules/gui/xorg.nix @@ -1,6 +1,13 @@ -{lib, ...}: let - inherit (lib) mkDefault mkForce mkOption types; -in { +{ lib, ... }: +let + inherit (lib) + mkDefault + mkForce + mkOption + types + ; +in +{ options.gui.xorg.enable = mkOption { description = "Enable X11 Server Configuration"; type = types.bool; @@ -14,7 +21,7 @@ in { autorun = true; # Driver Settings - videoDrivers = mkDefault ["modesetting"]; + videoDrivers = mkDefault [ "modesetting" ]; }; user.homeConfig.xresources.extraConfig = '' diff --git a/modules/hardware/boot.nix b/modules/hardware/boot.nix @@ -5,24 +5,39 @@ inputs, pkgs, ... -}: let - inherit (lib) mkDefault mkForce mkIf mkMerge mkOption optional types; +}: +let + inherit (lib) + mkDefault + mkForce + mkIf + mkMerge + mkOption + optional + types + ; + loader = config.hardware.boot; -in { - imports = [inputs.boot.nixosModules.lanzaboote]; +in +{ + imports = [ inputs.boot.nixosModules.lanzaboote ]; options.hardware.boot = mkOption { description = "Supported Boot Firmware"; - type = types.nullOr (types.enum ["mbr" "efi" "secure"]); + type = types.nullOr ( + types.enum [ + "mbr" + "efi" + "secure" + ] + ); default = "efi"; }; ## Boot Configuration ## config = { - warnings = - optional (loader == null) - (options.hardware.boot.description + " is unset"); + warnings = optional (loader == null) (options.hardware.boot.description + " is unset"); } // mkIf (loader != null) (mkMerge [ { @@ -94,8 +109,8 @@ in { }; environment = { - systemPackages = [pkgs.sbctl]; - persist.directories = [boot.lanzaboote.pkiBundle]; + systemPackages = [ pkgs.sbctl ]; + persist.directories = [ boot.lanzaboote.pkiBundle ]; }; }) ]); diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix @@ -4,11 +4,13 @@ lib, util, ... -}: let +}: +let inherit (util.map) modules; inherit (lib) mkForce mkOption types; cfg = config.hardware; -in { +in +{ ## HARDWARE Configuration ## imports = modules.list ./.; @@ -22,7 +24,11 @@ in { mode = mkOption { description = "CPU Frequency Governor Mode"; - type = enum ["ondemand" "performance" "powersave"]; + type = enum [ + "ondemand" + "performance" + "powersave" + ]; default = "powersave"; }; }; @@ -30,13 +36,13 @@ in { modules = mkOption { description = "List of Modules imported from 'inputs.hardware'"; type = listOf (enum (attrNames inputs.hardware.nixosModules)); - default = []; + default = [ ]; }; support = mkOption { description = "List of Additional Supported Hardware"; type = listOf (enum (modules.name ./.)); - default = []; + default = [ ]; }; }; diff --git a/modules/hardware/filesystem.nix b/modules/hardware/filesystem.nix @@ -6,10 +6,10 @@ pkgs, files, ... -}: let +}: +let inherit (builtins) listToAttrs mapAttrs; - inherit - (lib) + inherit (lib) filterAttrs hasPrefix mkAfter @@ -24,17 +24,21 @@ ; inherit (config.hardware) filesystem; -in { +in +{ imports = - [inputs.impermanence.nixosModule] + [ inputs.impermanence.nixosModule ] ++ [ - (mkAliasOptionModule ["environment" "persist"] ["environment" "persistence" files.path.persist]) + (mkAliasOptionModule [ "environment" "persist" ] [ "environment" "persistence" files.path.persist ]) ]; options = with types; { hardware.filesystem = mkOption { description = "Disk File System Choice"; - type = nullOr (enum ["simple" "advanced"]); + type = nullOr (enum [ + "simple" + "advanced" + ]); default = null; }; @@ -42,15 +46,15 @@ in { files = mkOption { description = "Additional User Files to Preserve"; type = listOf str; - default = []; - example = [".bash_history"]; + default = [ ]; + example = [ ".bash_history" ]; }; directories = mkOption { description = "Additional User Directories to Preserve"; type = listOf (either str attrs); - default = []; - example = ["Downloads"]; + default = [ ]; + example = [ "Downloads" ]; }; }; }; @@ -58,9 +62,7 @@ in { ## File System Configuration ## config = mkMerge [ { - warnings = - optional (filesystem == null) - (options.hardware.filesystem.description + " is unset"); + warnings = optional (filesystem == null) (options.hardware.filesystem.description + " is unset"); ## Common Partitions boot.supportedFilesystems = { @@ -70,20 +72,19 @@ in { }; } - (mkIf (filesystem != null) - { - programs.fuse.userAllowOther = true; + (mkIf (filesystem != null) { + programs.fuse.userAllowOther = true; - # EFI System Partition - fileSystems."/boot" = { - device = "/dev/disk/by-partlabel/ESP"; - fsType = "vfat"; - }; + # EFI System Partition + fileSystems."/boot" = { + device = "/dev/disk/by-partlabel/ESP"; + fsType = "vfat"; + }; - # SWAP Partition - swapDevices = [{device = "/dev/disk/by-partlabel/swap";}]; - boot.kernel.sysctl."vm.swappiness" = 1; - }) + # SWAP Partition + swapDevices = [ { device = "/dev/disk/by-partlabel/swap"; } ]; + boot.kernel.sysctl."vm.swappiness" = 1; + }) ## Simple File System Configuration using EXT4 ## (mkIf (filesystem == "simple") { @@ -97,165 +98,176 @@ in { }) ## Advanced File System Configuration using ZFS ## - (mkIf (filesystem == "advanced") (let - rollback = '' - zfs rollback -r fspool/system/root@blank && echo "Rollback Complete!" - ''; - in { - fileSystems = - { - # ROOT Partition - "/" = { - device = "fspool/system/root"; - fsType = "zfs"; - }; + (mkIf (filesystem == "advanced") ( + let + rollback = '' + zfs rollback -r fspool/system/root@blank && echo "Rollback Complete!" + ''; + in + { + fileSystems = + { + # ROOT Partition + "/" = { + device = "fspool/system/root"; + fsType = "zfs"; + }; - # NIX Partition - "/nix" = { - device = "fspool/system/nix"; - fsType = "zfs"; - }; + # NIX Partition + "/nix" = { + device = "fspool/system/nix"; + fsType = "zfs"; + }; - # PERSISTENT Partition - "/data" = { - device = "fspool/data"; - fsType = "zfs"; - neededForBoot = true; - }; - } - // filterAttrs (name: _: hasPrefix "/etc" name) - (listToAttrs (map (item: nameValuePair item.directory {neededForBoot = true;}) - config.environment.persist.directories)); + # PERSISTENT Partition + "/data" = { + device = "fspool/data"; + fsType = "zfs"; + neededForBoot = true; + }; + } + // filterAttrs (name: _: hasPrefix "/etc" name) ( + listToAttrs ( + map ( + item: nameValuePair item.directory { neededForBoot = true; } + ) config.environment.persist.directories + ) + ); - # Boot Settings - boot = { - resumeDevice = "/dev/disk/by-partlabel/swap"; - kernelParams = ["elevator=none"]; - zfs = { - allowHibernation = true; - forceImportRoot = false; - forceImportAll = false; - devNodes = "/dev/disk/by-partlabel/System"; - }; + # Boot Settings + boot = { + resumeDevice = "/dev/disk/by-partlabel/swap"; + kernelParams = [ "elevator=none" ]; + zfs = { + allowHibernation = true; + forceImportRoot = false; + forceImportAll = false; + devNodes = "/dev/disk/by-partlabel/System"; + }; - initrd.systemd = { - enable = true; - services.rollback = { - description = "Wipe ZFS partition for Opt-In State Configuration"; - wantedBy = ["initrd.target"]; - after = ["zfs-import-fspool.service"]; - before = ["sysroot.mount"]; - path = [pkgs.zfs]; - unitConfig.DefaultDependencies = "no"; - serviceConfig.Type = "oneshot"; - script = rollback; + initrd.systemd = { + enable = true; + services.rollback = { + description = "Wipe ZFS partition for Opt-In State Configuration"; + wantedBy = [ "initrd.target" ]; + after = [ "zfs-import-fspool.service" ]; + before = [ "sysroot.mount" ]; + path = [ pkgs.zfs ]; + unitConfig.DefaultDependencies = "no"; + serviceConfig.Type = "oneshot"; + script = rollback; + }; }; }; - }; - # Debug - specialisation.recovery.configuration = { - boot.initrd = { - systemd.enable = mkForce false; - postResumeCommands = mkAfter rollback; + # Debug + specialisation.recovery.configuration = { + boot.initrd = { + systemd.enable = mkForce false; + postResumeCommands = mkAfter rollback; + }; }; - }; - # Persisted Files - environment.persistence = { - "${files.path.persist}" = { - files = ["/etc/machine-id"]; - directories = [ - files.path.system - "/var/log" - "/var/lib/AccountsService" - "/var/lib/nixos" - "/var/lib/systemd/coredump" - ]; - }; + # Persisted Files + environment.persistence = { + "${files.path.persist}" = { + files = [ "/etc/machine-id" ]; + directories = [ + files.path.system + "/var/log" + "/var/lib/AccountsService" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + ]; + }; - "/data" = { - hideMounts = true; - users = - mapAttrs (_: _: { + "/data" = { + hideMounts = true; + users = mapAttrs (_: _: { inherit (config.user.persist) files; - directories = - [ - "Desktop" - "Documents" - "Downloads" - "Music" - "Pictures" - "Projects" - "Public" - "Videos" - { - directory = ".local/share/keyrings"; - mode = "0700"; - } - ] - ++ config.user.persist.directories; - }) - config.user.settings; + directories = [ + "Desktop" + "Documents" + "Downloads" + "Music" + "Pictures" + "Projects" + "Public" + "Videos" + { + directory = ".local/share/keyrings"; + mode = "0700"; + } + ] ++ config.user.persist.directories; + }) config.user.settings; + }; }; - }; - - system.activationScripts.dotfiles = let - dir = with files.path; "${persist}/${system}"; - in '' - chown root:keys ${dir} - chmod 774 -R ${dir} - ''; - user.homeConfig.systemd.user.services.persist-trash = { - Unit.Description = "Persist Trash Folder"; - Install.WantedBy = ["default.target"]; - Service = let - dir = '' - LOCAL="$HOME/.local/share/Trash" - PERSIST="/data/home/$USER/Trash" - mkdir -p "$LOCAL" + system.activationScripts.dotfiles = + let + dir = with files.path; "${persist}/${system}"; + in + '' + chown root:keys ${dir} + chmod 774 -R ${dir} ''; - in { - Type = "oneshot"; - RemainAfterExit = true; - StandardOutput = "journal"; - ExecStart = "${pkgs.writeShellApplication { - name = "retrieve"; - runtimeInputs = [pkgs.coreutils]; - text = '' - ${dir} - if [ -d "$PERSIST" ] - then - cp -r "$PERSIST"/. "$LOCAL" - rm -rf "$PERSIST" - fi - ''; - }}/bin/retrieve"; - ExecStop = "${pkgs.writeShellApplication { - name = "migrate"; - runtimeInputs = [pkgs.coreutils]; - text = '' - ${dir} - mkdir -p "$PERSIST" - cp -r "$LOCAL"/. "$PERSIST" - ''; - }}/bin/migrate"; + + user.homeConfig.systemd.user.services.persist-trash = { + Unit.Description = "Persist Trash Folder"; + Install.WantedBy = [ "default.target" ]; + Service = + let + dir = '' + LOCAL="$HOME/.local/share/Trash" + PERSIST="/data/home/$USER/Trash" + mkdir -p "$LOCAL" + ''; + in + { + Type = "oneshot"; + RemainAfterExit = true; + StandardOutput = "journal"; + ExecStart = "${ + pkgs.writeShellApplication { + name = "retrieve"; + runtimeInputs = [ pkgs.coreutils ]; + text = '' + ${dir} + if [ -d "$PERSIST" ] + then + cp -r "$PERSIST"/. "$LOCAL" + rm -rf "$PERSIST" + fi + ''; + } + }/bin/retrieve"; + ExecStop = "${ + pkgs.writeShellApplication { + name = "migrate"; + runtimeInputs = [ pkgs.coreutils ]; + text = '' + ${dir} + mkdir -p "$PERSIST" + cp -r "$LOCAL"/. "$PERSIST" + ''; + } + }/bin/migrate"; + }; }; - }; - # Maintainence - services.zfs = { - trim.enable = true; - autoScrub.enable = true; - autoSnapshot = { - enable = true; - hourly = 12; - daily = 7; - weekly = 3; - monthly = 1; + # Maintainence + services.zfs = { + trim.enable = true; + autoScrub.enable = true; + autoSnapshot = { + enable = true; + hourly = 12; + daily = 7; + weekly = 3; + monthly = 1; + }; }; - }; - })) + } + )) ]; } diff --git a/modules/hardware/gpu.nix b/modules/hardware/gpu.nix @@ -2,26 +2,35 @@ config, lib, ... -}: let - inherit (lib) mkForce mkIf mkMerge mkOption types; +}: +let + inherit (lib) + mkForce + mkIf + mkMerge + mkOption + types + ; + cfg = config.hardware; -in { +in +{ options.hardware.gpu = mkOption { description = "Discrete GPU Support"; - type = with types; nullOr (enum ["nvidia"]); + type = with types; nullOr (enum [ "nvidia" ]); default = null; }; config = mkMerge [ (mkIf (cfg.gpu == "nvidia") { - services.xserver.videoDrivers = mkForce ["nvidia"]; + services.xserver.videoDrivers = mkForce [ "nvidia" ]; environment.variables = { "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; "LIBVA_DRIVER_NAME" = "nvidia"; }; boot = { - blacklistedKernelModules = ["nouveau"]; + blacklistedKernelModules = [ "nouveau" ]; kernelModules = [ "nvidia" "nvidia_modeset" @@ -32,24 +41,27 @@ in { ]; }; - hardware.nvidia = let - enable = cfg.vm.vfio != "on"; - mode = cfg.cpu.mode == "performance"; - in { - modesetting.enable = mkForce true; - nvidiaSettings = mkForce true; - dynamicBoost = {inherit enable;}; - powerManagement = {inherit enable;}; - prime = with cfg.nvidia.prime; - mkIf (amdgpuBusId != "" || intelBusId != "") { - sync.enable = mkForce false; - reverseSync.enable = mkForce mode; - offload = { - enable = mkForce (!mode); - enableOffloadCmd = mkForce (!mode); + hardware.nvidia = + let + enable = cfg.vm.vfio != "on"; + mode = cfg.cpu.mode == "performance"; + in + { + modesetting.enable = mkForce true; + nvidiaSettings = mkForce true; + dynamicBoost = { inherit enable; }; + powerManagement = { inherit enable; }; + prime = + with cfg.nvidia.prime; + mkIf (amdgpuBusId != "" || intelBusId != "") { + sync.enable = mkForce false; + reverseSync.enable = mkForce mode; + offload = { + enable = mkForce (!mode); + enableOffloadCmd = mkForce (!mode); + }; }; - }; - }; + }; }) ]; } diff --git a/modules/hardware/laptop.nix b/modules/hardware/laptop.nix @@ -4,9 +4,11 @@ pkgs, files, ... -}: let +}: +let enable = builtins.elem "laptop" config.hardware.support; -in { +in +{ ## Laptop Configuration ## config = lib.mkIf enable { services.logind = { @@ -26,11 +28,16 @@ in { [Desktop Entry] Type=Application Name=audio-tweaks - Exec=${pkgs.writeShellApplication { - name = "audio"; - text = files.scripts.audio; - runtimeInputs = with pkgs; [glib playerctl]; - }}/bin/audio + Exec=${ + pkgs.writeShellApplication { + name = "audio"; + text = files.scripts.audio; + runtimeInputs = with pkgs; [ + glib + playerctl + ]; + } + }/bin/audio ''; # Touchpad diff --git a/modules/hardware/mobile.nix b/modules/hardware/mobile.nix @@ -3,18 +3,23 @@ lib, pkgs, ... -}: let +}: +let enable = builtins.elem "mobile" config.hardware.support; -in { +in +{ ## Device Firmware ## config = lib.mkIf enable { # Android Compatibilty - user.groups = ["adbusers"]; + user.groups = [ "adbusers" ]; programs.adb.enable = true; # iOS Compatibility services.usbmuxd.enable = true; - environment.systemPackages = with pkgs; [libimobiledevice scrcpy]; + environment.systemPackages = with pkgs; [ + libimobiledevice + scrcpy + ]; #!# Run 'systemctl restart usbmuxd.service' if it doesn't work }; diff --git a/modules/hardware/printer.nix b/modules/hardware/printer.nix @@ -3,19 +3,28 @@ lib, pkgs, ... -}: let +}: +let enable = builtins.elem "printer" config.hardware.support; -in { +in +{ ## Printer Firmware ## config = lib.mkIf enable { # Scanning - user.groups = ["lp" "scanner"]; + user.groups = [ + "lp" + "scanner" + ]; hardware.sane.enable = true; # Printing services.printing = { enable = true; - drivers = with pkgs; [gutenprint brlaser cnijfilter2]; + drivers = with pkgs; [ + gutenprint + brlaser + cnijfilter2 + ]; extraConf = '' DefaultPaperSize A4 ''; diff --git a/modules/hardware/virtualisation/android.nix b/modules/hardware/virtualisation/android.nix @@ -4,9 +4,11 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkEnableOption mkIf optional; -in { +in +{ options.hardware.vm.android.enable = mkEnableOption "Enable Android Virtualisation"; ## Android Virtualisation ## @@ -28,7 +30,7 @@ in { ''; virtualisation.waydroid.enable = true; - environment.systemPackages = [pkgs.wl-clipboard]; + environment.systemPackages = [ pkgs.wl-clipboard ]; #!# Run 'waydroid init -s GAPPS -f' to install system image @@ -39,8 +41,8 @@ in { }; user = { - groups = ["android"]; - persist.directories = [".local/share/waydroid"]; + groups = [ "android" ]; + persist.directories = [ ".local/share/waydroid" ]; }; environment.persist.directories = [ diff --git a/modules/hardware/virtualisation/default.nix b/modules/hardware/virtualisation/default.nix @@ -4,26 +4,40 @@ util, pkgs, ... -}: let +}: +let enable = builtins.elem "virtualisation" config.hardware.support; -in { +in +{ imports = util.map.modules.list ./.; ## Virtualisation Settings ## config = lib.mkIf enable { # Environment Setup - user.groups = ["kvm" "libvirtd"]; - user.persist.directories = [".config/libvirt" ".local/share/libvirt"]; - environment.persist.directories = ["/var/lib/libvirt"]; + user.groups = [ + "kvm" + "libvirtd" + ]; + user.persist.directories = [ + ".config/libvirt" + ".local/share/libvirt" + ]; + environment.persist.directories = [ "/var/lib/libvirt" ]; security.virtualisation.flushL1DataCache = "cond"; boot = { - kernelModules = ["kvm-amd" "kvm-intel"]; + kernelModules = [ + "kvm-amd" + "kvm-intel" + ]; extraModprobeConfig = "options kvm_intel nested=1"; }; # VM Packages - environment.systemPackages = with pkgs; [libguestfs virtiofsd]; programs.virt-manager.enable = true; + environment.systemPackages = with pkgs; [ + libguestfs + virtiofsd + ]; #!# Run 'virsh net-start default' to start virtual network service @@ -41,7 +55,7 @@ in { swtpm.enable = true; ovmf = { enable = true; - packages = [pkgs.OVMFFull.fd]; + packages = [ pkgs.OVMFFull.fd ]; }; }; }; diff --git a/modules/hardware/virtualisation/vfio.nix b/modules/hardware/virtualisation/vfio.nix @@ -3,23 +3,37 @@ lib, pkgs, ... -}: let +}: +let inherit (builtins) concatStringsSep elem; - inherit (lib) generators mkForce mkIf mkMerge mkOption types; + inherit (lib) + generators + mkForce + mkIf + mkMerge + mkOption + types + ; + enable = elem "virtualisation" config.hardware.support; cfg = config.hardware.vm; -in { +in +{ options.hardware.vm = { vfio = mkOption { description = "Configure VFIO PCI passthrough"; - type = types.enum ["on" "off" "setup"]; + type = types.enum [ + "on" + "off" + "setup" + ]; default = "off"; }; passthrough = mkOption { description = "PCI Device IDs for VFIO"; type = types.listOf types.str; - default = []; + default = [ ]; example = [ "10de:28e0" # Graphics "10de:22be" # Audio @@ -65,11 +79,11 @@ in { }; # Looking Glass - user.groups = ["qemu-libvirtd"]; - systemd.tmpfiles.rules = ["f /dev/shm/looking-glass 0660 root qemu-libvirtd -"]; + user.groups = [ "qemu-libvirtd" ]; + systemd.tmpfiles.rules = [ "f /dev/shm/looking-glass 0660 root qemu-libvirtd -" ]; environment = { - systemPackages = [pkgs.looking-glass-client]; - etc."looking-glass-client.ini".text = generators.toINI {} { + systemPackages = [ pkgs.looking-glass-client ]; + etc."looking-glass-client.ini".text = generators.toINI { } { app.renderer = "egl"; win = { title = "Virtual Machine"; diff --git a/modules/nix/default.nix b/modules/nix/default.nix @@ -1,10 +1,15 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ ## NIX Configuration ## - imports = [./index.nix ./registry.nix ./tools.nix]; + imports = [ + ./index.nix + ./registry.nix + ./tools.nix + ]; config = { # Settings - user.persist.directories = [".cache/nix"]; + user.persist.directories = [ ".cache/nix" ]; nix = { # Version package = pkgs.nixFlakes; @@ -21,8 +26,14 @@ sandbox = true; # User Permissions - allowed-users = ["root" "@wheel"]; - trusted-users = ["root" "@wheel"]; + allowed-users = [ + "root" + "@wheel" + ]; + trusted-users = [ + "root" + "@wheel" + ]; # Binary Cache inherit ((import ../../flake.nix).nixConfig) trusted-substituters trusted-public-keys; diff --git a/modules/nix/index.nix b/modules/nix/index.nix @@ -3,13 +3,14 @@ lib, inputs, ... -}: { +}: +{ options.nix.index = lib.mkEnableOption "Enable Package Indexer"; ## Package Indexer ## config = lib.mkIf config.nix.index { user.homeConfig = { - imports = [inputs.index.hmModules.nix-index]; + imports = [ inputs.index.hmModules.nix-index ]; programs.nix-index-database.comma.enable = true; }; }; diff --git a/modules/nix/registry.nix b/modules/nix/registry.nix @@ -2,7 +2,8 @@ lib, inputs, ... -}: { +}: +{ ## Nix Registry ## config = { nixpkgs.flake = { @@ -11,18 +12,17 @@ }; nix = { - nixPath = ["/etc/nix/inputs"]; - registry = - builtins.mapAttrs (_: value: {flake = value;}) - (lib.filterAttrs (_: value: value ? outputs) inputs); + nixPath = [ "/etc/nix/inputs" ]; + registry = builtins.mapAttrs (_: value: { flake = value; }) ( + lib.filterAttrs (_: value: value ? outputs) inputs + ); }; - environment.etc = - lib.mapAttrs' - (name: value: { - name = "nix/inputs/${name}"; - value = {source = value.outPath;}; - }) - inputs; + environment.etc = lib.mapAttrs' (name: value: { + name = "nix/inputs/${name}"; + value = { + source = value.outPath; + }; + }) inputs; }; } diff --git a/modules/nix/tools.nix b/modules/nix/tools.nix @@ -3,17 +3,23 @@ lib, pkgs, ... -}: { +}: +{ options.nix.tools = lib.mkEnableOption "Enable Additional Nix Tools"; ## Nix Tools ## config = lib.mkIf config.nix.tools { - user.persist.directories = [".cache/manix"]; - nix.settings.system-features = ["kvm" "big-parallel" "recursive-nix"]; + user.persist.directories = [ ".cache/manix" ]; + nix.settings.system-features = [ + "kvm" + "big-parallel" + "recursive-nix" + ]; + environment.systemPackages = with pkgs; [ - alejandra cachix manix + nixfmt-rfc-style nodePackages.prettier shellcheck statix diff --git a/modules/shell/bash.nix b/modules/shell/bash.nix @@ -3,17 +3,19 @@ lib, pkgs, ... -}: let +}: +let inherit (builtins) any attrValues elem; enable = any (value: elem "bash" value.shells) (attrValues config.user.settings); -in { +in +{ ## Bourne Shell Configuration ## config = lib.mkIf enable { # Shell Environment - environment.shells = [pkgs.bashInteractive]; + environment.shells = [ pkgs.bashInteractive ]; user.persist = { - files = [".bash_history"]; - directories = [".local/share/bash"]; + files = [ ".bash_history" ]; + directories = [ ".local/share/bash" ]; }; programs.bash = { diff --git a/modules/shell/default.nix b/modules/shell/default.nix @@ -6,12 +6,22 @@ files, ... }: -with files; let +with files; +let inherit (util.map) modules; inherit (builtins) listToAttrs map; - inherit (lib) getExe' mkEnableOption mkBefore mkIf mkMerge nameValuePair; + inherit (lib) + getExe' + mkEnableOption + mkBefore + mkIf + mkMerge + nameValuePair + ; + shells = lib.remove "prompt" (modules.name ./.); -in { +in +{ ## SHELL Configuration ## imports = modules.list ./.; @@ -65,10 +75,14 @@ in { ## Program Configuration services.lorri.enable = true; # Faster 'nix shell' programs = - listToAttrs (map (shell: - nameValuePair shell - {promptInit = mkBefore ''eval $(${getExe' pkgs.thefuck "thefuck"} --alias "fix")'';}) - shells) + listToAttrs ( + map ( + shell: + nameValuePair shell { + promptInit = mkBefore ''eval $(${getExe' pkgs.thefuck "thefuck"} --alias "fix")''; + } + ) shells + ) // { command-not-found.enable = true; # Command Not Found Search yazi.enable = true; # File Browser @@ -91,14 +105,14 @@ in { settings = { style = "full"; italic-text = "always"; - map-syntax = [".ignore:Git Ignore"]; + map-syntax = [ ".ignore:Git Ignore" ]; }; }; }; user = { persist = { - files = [".hstr_favorites"]; + files = [ ".hstr_favorites" ]; directories = [ ".config/micro" ".local/share/direnv" @@ -116,7 +130,7 @@ in { colors = "auto"; icons = "auto"; git = true; - extraOptions = ["--group-directories-first"]; + extraOptions = [ "--group-directories-first" ]; }; # Micro Configuration diff --git a/modules/shell/prompt.nix b/modules/shell/prompt.nix @@ -2,192 +2,198 @@ config, lib, ... -}: { +}: +{ ## Shell Prompt Configuration ## options.shell.prompt = lib.mkEnableOption "Enable Fancy Shell Prompt"; config = lib.mkIf config.shell.prompt { - programs.starship = let - open = ""; - close = ""; - char = "⮞"; - - build = a: b: c: - build' { - icon = a; - var = b; - color = c; - }; + programs.starship = + let + open = ""; + close = ""; + char = "⮞"; + + build = + a: b: c: + build' { + icon = a; + var = b; + color = c; + }; - build' = { - icon, - var, - color, - style ? "fg:white", - end ? "[${close}](fg:base04)", - ... - }: "[─](fg:base04)[${open}](fg:${color})[${icon}](fg:base01 bg:${color})[${close}](fg:${color} bg:base04)[ ${var}](${style} bg:base04)${end}"; - in { - enable = true; - settings = { - add_newline = true; - continuation_prompt = "${char} "; - format = "[╭](fg:base04)$os$directory$git_branch$git_status$fill$c$python$java$nodejs$dotnet$status$cmd_duration$shell$username$hostname$time$line_break$character"; - character = { - format = "[╰─$symbol](fg:base04) "; - success_symbol = "[${char}](fg:bold white)"; - error_symbol = "[${char}](fg:bold red)"; - }; + build' = + { + icon, + var, + color, + style ? "fg:white", + end ? "[${close}](fg:base04)", + ... + }: + "[─](fg:base04)[${open}](fg:${color})[${icon}](fg:base01 bg:${color})[${close}](fg:${color} bg:base04)[ ${var}](${style} bg:base04)${end}"; + in + { + enable = true; + settings = { + add_newline = true; + continuation_prompt = "${char} "; + format = "[╭](fg:base04)$os$directory$git_branch$git_status$fill$c$python$java$nodejs$dotnet$status$cmd_duration$shell$username$hostname$time$line_break$character"; + character = { + format = "[╰─$symbol](fg:base04) "; + success_symbol = "[${char}](fg:bold white)"; + error_symbol = "[${char}](fg:bold red)"; + }; - os = { - disabled = false; - format = "(fg:base04)[${open}](fg:white)[$symbol](fg:base01 bg:white)[${close}](fg:white)"; - symbols = { - Android = ""; - Arch = ""; - Fedora = ""; - Linux = ""; - Macos = ""; - NixOS = ""; - Ubuntu = ""; - Windows = ""; - Unknown = ""; + os = { + disabled = false; + format = "(fg:base04)[${open}](fg:white)[$symbol](fg:base01 bg:white)[${close}](fg:white)"; + symbols = { + Android = ""; + Arch = ""; + Fedora = ""; + Linux = ""; + Macos = ""; + NixOS = ""; + Ubuntu = ""; + Windows = ""; + Unknown = ""; + }; }; - }; - directory = { - disabled = false; - format = build "󰉋" "$read_only$truncation_symbol$path" "blue"; - home_symbol = "~"; - truncation_symbol = "…/"; - truncation_length = 4; - truncate_to_repo = false; - read_only = ""; - }; + directory = { + disabled = false; + format = build "󰉋" "$read_only$truncation_symbol$path" "blue"; + home_symbol = "~"; + truncation_symbol = "…/"; + truncation_length = 4; + truncate_to_repo = false; + read_only = ""; + }; - git_branch = { - disabled = false; - format = build' { - icon = ""; - var = "$branch"; - color = "green"; - end = ""; + git_branch = { + disabled = false; + format = build' { + icon = ""; + var = "$branch"; + color = "green"; + end = ""; + }; }; - }; - git_status = { - disabled = false; - format = "[$ahead_behind$all_status](fg:green bg:base04)[${close}](fg:base04)"; - ahead = " ⇡$count"; - behind = " ⇣$count"; - diverged = " ⇡$ahead_count ⇣$behind_count"; - conflicted = " =$count"; - deleted = " ×$count"; - modified = " !$count"; - renamed = " »$count"; - staged = " +$count"; - stashed = " *$count"; - untracked = " ?$count"; - up_to_date = ""; - }; + git_status = { + disabled = false; + format = "[$ahead_behind$all_status](fg:green bg:base04)[${close}](fg:base04)"; + ahead = " ⇡$count"; + behind = " ⇣$count"; + diverged = " ⇡$ahead_count ⇣$behind_count"; + conflicted = " =$count"; + deleted = " ×$count"; + modified = " !$count"; + renamed = " »$count"; + staged = " +$count"; + stashed = " *$count"; + untracked = " ?$count"; + up_to_date = ""; + }; - c.format = build " C" "$version" "bright-white"; - python.format = build " Python" "$version" "bright-white"; - java.format = build " Java" "$version" "bright-white"; - nodejs.format = build "󰎙 Node.js" "$version" "bright-white"; - dotnet.format = build "󰪮 .NET" "$version" "bright-white"; + c.format = build " C" "$version" "bright-white"; + python.format = build " Python" "$version" "bright-white"; + java.format = build " Java" "$version" "bright-white"; + nodejs.format = build "󰎙 Node.js" "$version" "bright-white"; + dotnet.format = build "󰪮 .NET" "$version" "bright-white"; - fill = { - symbol = "─"; - style = "fg:base04"; - }; + fill = { + symbol = "─"; + style = "fg:base04"; + }; - status = { - disabled = false; - format = build "" "$status" "red"; - }; + status = { + disabled = false; + format = build "" "$status" "red"; + }; - cmd_duration = { - min_time = 500; - format = build "󰦖" "$duration" "orange"; - }; + cmd_duration = { + min_time = 500; + format = build "󰦖" "$duration" "orange"; + }; - shell = { - disabled = false; - format = build "" "$indicator" "purple"; - bash_indicator = "bash"; - fish_indicator = "fish"; - zsh_indicator = "zsh"; - unknown_indicator = "shell"; - }; + shell = { + disabled = false; + format = build "" "$indicator" "purple"; + bash_indicator = "bash"; + fish_indicator = "fish"; + zsh_indicator = "zsh"; + unknown_indicator = "shell"; + }; - username = { - show_always = true; - style_user = "fg:white"; - style_root = "bold fg:red"; - format = build' { - icon = ""; - var = "$user"; - color = "yellow"; - style = "$style"; + username = { + show_always = true; + style_user = "fg:white"; + style_root = "bold fg:red"; + format = build' { + icon = ""; + var = "$user"; + color = "yellow"; + style = "$style"; + }; }; - }; - hostname = { - disabled = false; - format = build "" "$hostname" "cyan"; - ssh_only = false; - }; + hostname = { + disabled = false; + format = build "" "$hostname" "cyan"; + ssh_only = false; + }; - time = { - disabled = false; - format = build "" "$time" "blue"; - time_format = "%H:%M"; - }; + time = { + disabled = false; + format = build "" "$time" "blue"; + time_format = "%H:%M"; + }; - palette = "base16"; - palettes.base16 = with config.lib.stylix.colors.withHashtag; { - black = base00; - bright-black = base03; - white = base05; - bright-white = base07; - bright-yellow = yellow; - purple = magenta; - bright-purple = bright-magenta; - inherit - blue - brown - cyan - green - magenta - orange - red - yellow - bright-blue - bright-cyan - bright-green - bright-magenta - bright-orange - bright-red - base00 - base01 - base02 - base03 - base04 - base05 - base06 - base07 - base08 - base09 - base0A - base0B - base0C - base0D - base0E - base0F - ; + palette = "base16"; + palettes.base16 = with config.lib.stylix.colors.withHashtag; { + black = base00; + bright-black = base03; + white = base05; + bright-white = base07; + bright-yellow = yellow; + purple = magenta; + bright-purple = bright-magenta; + inherit + blue + brown + cyan + green + magenta + orange + red + yellow + bright-blue + bright-cyan + bright-green + bright-magenta + bright-orange + bright-red + base00 + base01 + base02 + base03 + base04 + base05 + base06 + base07 + base08 + base09 + base0A + base0B + base0C + base0D + base0E + base0F + ; + }; }; }; - }; }; } diff --git a/modules/shell/zsh.nix b/modules/shell/zsh.nix @@ -3,10 +3,12 @@ lib, pkgs, ... -}: let +}: +let inherit (builtins) any attrValues elem; enable = any (value: elem "zsh" value.shells) (attrValues config.user.settings); -in { +in +{ ## Z Shell Configuration ## config = lib.mkIf enable { # Shell Environment @@ -49,8 +51,8 @@ in { system.userActivationScripts.zshrc = "touch .zshrc"; user.persist = { - files = [".zsh_history"]; - directories = [".cache/zsh"]; + files = [ ".zsh_history" ]; + directories = [ ".cache/zsh" ]; }; }; } diff --git a/modules/user/default.nix b/modules/user/default.nix @@ -5,11 +5,17 @@ inputs, files, ... -}: let - inherit (util.map) modules; - inherit (builtins) all attrNames attrValues mapAttrs pathExists; - inherit - (lib) +}: +let + inherit (builtins) + all + attrNames + attrValues + mapAttrs + pathExists + ; + + inherit (lib) filterAttrs findFirst findSingle @@ -22,6 +28,7 @@ types ; + inherit (util.map) modules; inherit (config.user) groups homeConfig settings; # Merged Sets Type @@ -29,19 +36,23 @@ name = "mergedAttrs"; merge = _: getValues; }; -in { +in +{ ## USER Configuration ## - imports = modules.list ./. ++ [inputs.home.nixosModules.home-manager]; + imports = modules.list ./. ++ [ inputs.home.nixosModules.home-manager ]; options = { # Global Home Manager Configuration home-manager.users = mkOption { - type = types.attrsOf (types.submoduleWith { - modules = - if (all (value: value.minimal) (attrValues settings)) - then [{home.stateVersion = config.system.stateVersion;}] - else homeConfig; - }); + type = types.attrsOf ( + types.submoduleWith { + modules = + if (all (value: value.minimal) (attrValues settings)) then + [ { home.stateVersion = config.system.stateVersion; } ] + else + homeConfig; + } + ); }; # Configuration Options @@ -49,67 +60,72 @@ in { homeConfig = mkOption { description = "Shared User Home Configuration"; type = mergedAttrs; - default = {}; + default = { }; }; groups = mkOption { description = "Additional User Groups"; type = types.listOf types.str; - default = []; + default = [ ]; }; settings = mkOption { description = "User Settings"; - default = {}; - type = with types; - attrsOf (submodule ({ - options, - config, - ... - }: { - freeformType = attrsOf anything; - options = { - forwarded = mkOption {}; - autologin = mkEnableOption "Enable Automatic User Login"; - minimal = mkEnableOption "Enable Minimal User Configuration"; - extraGroups = mkOption { - apply = group: group ++ optionals config.isNormalUser groups; - }; - shells = mkOption { - description = "List of Additional Supported Shells"; - type = listOf (enum (modules.name ../shell)); - default = ["bash"]; - }; - homeConfig = mkOption { - description = "User Specific Home Configuration"; - type = mergedAttrs; - default = {}; - }; - }; + default = { }; + type = + with types; + attrsOf ( + submodule ( + { + options, + config, + ... + }: + { + freeformType = attrsOf anything; + options = { + forwarded = mkOption { }; + autologin = mkEnableOption "Enable Automatic User Login"; + minimal = mkEnableOption "Enable Minimal User Configuration"; + extraGroups = mkOption { + apply = group: group ++ optionals config.isNormalUser groups; + }; + shells = mkOption { + description = "List of Additional Supported Shells"; + type = listOf (enum (modules.name ../shell)); + default = [ "bash" ]; + }; + homeConfig = mkOption { + description = "User Specific Home Configuration"; + type = mergedAttrs; + default = { }; + }; + }; - config = { - isNormalUser = true; - group = "users"; - useDefaultShell = false; - homeConfig = let - path = ../../. + "/users/${config.name}"; - in - if (pathExists (path + "/default.nix")) - then { - imports = [path]; - } - else if (pathExists (path + ".nix")) - then { - imports = [(path + ".nix")]; - } - else {}; + config = { + isNormalUser = true; + group = "users"; + useDefaultShell = false; + homeConfig = + let + path = ../../. + "/users/${config.name}"; + in + if (pathExists (path + "/default.nix")) then + { + imports = [ path ]; + } + else if (pathExists (path + ".nix")) then + { + imports = [ (path + ".nix") ]; + } + else + { }; - forwarded = - filterAttrs - (name: _: !(options ? "${name}") || name == "extraGroups") - config; - }; - })); + forwarded = filterAttrs (name: _: !(options ? "${name}") || name == "extraGroups") config; + }; + } + ) + ); }; }; }; @@ -121,37 +137,37 @@ in { users = mapAttrs (_: name: name.forwarded) settings; extraUsers.root = { isNormalUser = false; - extraGroups = ["wheel"]; + extraGroups = [ "wheel" ]; }; }; # Login - services.displayManager.autoLogin = let - find = - findSingle (value: value.autologin || value.minimal) "0" "1" - (attrValues settings); - in rec { - enable = - if (find == "0") - then false - else if (config.services.displayManager.defaultSession == null) - then throw "Graphical Environment must be present for Automatic Log-In" - else if (find == "1") - then throw "Only one User can be Automatically Logged-In" - else true; + services.displayManager.autoLogin = + let + find = findSingle (value: value.autologin || value.minimal) "0" "1" (attrValues settings); + in + rec { + enable = + if (find == "0") then + false + else if (config.services.displayManager.defaultSession == null) then + throw "Graphical Environment must be present for Automatic Log-In" + else if (find == "1") then + throw "Only one User can be Automatically Logged-In" + else + true; - user = - mkIf enable - (findFirst (name: with settings."${name}"; autologin || minimal) "nixos" - (attrNames settings)); - }; + user = mkIf enable ( + findFirst (name: with settings."${name}"; autologin || minimal) "nixos" (attrNames settings) + ); + }; # Home Management home-manager = { useGlobalPkgs = true; useUserPackages = true; backupFileExtension = "bak"; - users = mapAttrs (_: value: {imports = value.homeConfig;}) settings; + users = mapAttrs (_: value: { imports = value.homeConfig; }) settings; extraSpecialArgs = { inherit util inputs files; sys = config; diff --git a/modules/user/home.nix b/modules/user/home.nix @@ -3,7 +3,8 @@ lib, files, ... -}: { +}: +{ ## User Home Configuration ## config = { # Environment Settings @@ -19,9 +20,12 @@ ../../users # Mutable Configuration Files - ({config, ...}: (import (builtins.fetchurl { - inherit (files.mutability.module) url sha256; - }) {inherit config lib;})) + ( + { config, ... }: + (import (builtins.fetchurl { + inherit (files.mutability.module) url sha256; + }) { inherit config lib; }) + ) ]; # SystemD User Services diff --git a/modules/user/security.nix b/modules/user/security.nix @@ -4,21 +4,38 @@ util, files, ... -}: let - inherit (lib) filterAttrs mkAfter mkDefault mkForce mkIf; - inherit (builtins) all attrNames attrValues hasAttr mapAttrs readFile; +}: +let + inherit (lib) + filterAttrs + mkAfter + mkDefault + mkForce + mkIf + ; + + inherit (builtins) + all + attrNames + attrValues + hasAttr + mapAttrs + readFile + ; + inherit (config.sops) secrets; inherit (config.user) settings; enable = all (value: value.minimal) (attrValues settings); directory = ../../users/passwords; -in { +in +{ ## Security Settings ## config = { # Passwords services.openssh.enable = mkIf enable (mkForce false); sops.secrets = - if enable - then (mkForce {}) + if enable then + (mkForce { }) else util.map.secrets { inherit directory; @@ -26,13 +43,12 @@ in { }; users = { - users = - mapAttrs (name: value: { - hashedPasswordFile = mkIf (!value.minimal) secrets."${name}.secret".path; - }) - settings; + users = mapAttrs (name: value: { + hashedPasswordFile = mkIf (!value.minimal) secrets."${name}.secret".path; + }) settings; extraUsers.root.hashedPasswordFile = - mkIf (hasAttr "root.secret" secrets) secrets."root.secret".path; + mkIf (hasAttr "root.secret" secrets) + secrets."root.secret".path; }; # Authentication @@ -50,7 +66,10 @@ in { commands = [ { command = "ALL"; - options = ["NOPASSWD" "SETENV"]; + options = [ + "NOPASSWD" + "SETENV" + ]; } ]; } @@ -58,20 +77,18 @@ in { }; # Recovery Account - specialisation.recovery.configuration = - mkIf (!(all (value: value.minimal) (attrValues settings))) - { - security.sudo.extraConfig = mkAfter "recovery ALL=(ALL:ALL) NOPASSWD:ALL"; - users.extraUsers.recovery = { - name = "recovery"; - description = "Recovery Account"; - isNormalUser = true; - uid = 1100; - group = "users"; - extraGroups = ["wheel"]; - useDefaultShell = true; - initialHashedPassword = mkDefault (readFile (directory + "/default")); - }; + specialisation.recovery.configuration = mkIf (!(all (value: value.minimal) (attrValues settings))) { + security.sudo.extraConfig = mkAfter "recovery ALL=(ALL:ALL) NOPASSWD:ALL"; + users.extraUsers.recovery = { + name = "recovery"; + description = "Recovery Account"; + isNormalUser = true; + uid = 1100; + group = "users"; + extraGroups = [ "wheel" ]; + useDefaultShell = true; + initialHashedPassword = mkDefault (readFile (directory + "/default")); }; + }; }; } diff --git a/packages/firefox-elementary/default.nix b/packages/firefox-elementary/default.nix @@ -3,26 +3,27 @@ pkgs, ... }: -with pkgs; let +with pkgs; +let metadata = import ./metadata.nix; in - stdenv.mkDerivation rec { - pname = "elementaryos-firefox-theme"; - version = metadata.rev; +stdenv.mkDerivation rec { + pname = "elementaryos-firefox-theme"; + version = metadata.rev; - src = fetchFromGitHub { - owner = "Zonnev"; - repo = pname; - inherit (metadata) rev sha256; - }; + src = fetchFromGitHub { + owner = "Zonnev"; + repo = pname; + inherit (metadata) rev sha256; + }; - dontBuild = true; - installPhase = "mkdir -p $out/ && cp -r . $out/"; + dontBuild = true; + installPhase = "mkdir -p $out/ && cp -r . $out/"; - meta = with lib; { - description = "An Elementary OS Theme for Firefox"; - homepage = metadata.repo; - license = licenses.mpl20; - maintainers = ["maydayv7"]; - }; - } + meta = with lib; { + description = "An Elementary OS Theme for Firefox"; + homepage = metadata.repo; + license = licenses.mpl20; + maintainers = [ "maydayv7" ]; + }; +} diff --git a/packages/flake.nix b/packages/flake.nix @@ -2,49 +2,55 @@ util, inputs, ... -}: let +}: +let inherit (util) map; inherit (builtins) any attrValues isPath; -in { +in +{ ## Packages Configuration ## - perSystem = { - self', - system, - lib, - inputs', - pkgs, - ... - }: + perSystem = + { + self', + system, + lib, + inputs', + pkgs, + ... + }: rec { # Package Channel _module.args.pkgs = legacyPackages; - legacyPackages = with inputs; let - # Channel Configuration - src = nixpkgs; - config = import ../modules/nix/config.nix; + legacyPackages = + with inputs; + let + # Channel Configuration + src = nixpkgs; + config = import ../modules/nix/config.nix; - # Channel Patches - patches = map.patches ./patches; - pkgs' = import src {inherit system;}; - in + # Channel Patches + patches = map.patches ./patches; + pkgs' = import src { inherit system; }; + in ( - if !(any isPath patches) - then import src + if !(any isPath patches) then + import src else - import (pkgs'.applyPatches { - inherit src patches; - name = "nixpkgs-patched-${src.shortRev}"; - }) - ) { - inherit system config; + import ( + pkgs'.applyPatches { + inherit src patches; + name = "nixpkgs-patched-${src.shortRev}"; + } + ) + ) + { + inherit system config; - # Package Overrides - overlays = - (attrValues self.overlays or {}) - ++ [ + # Package Overrides + overlays = (attrValues self.overlays or { }) ++ [ (_: _: { custom = self.packages."${system}"; - unstable = import unstable {inherit system config;}; + unstable = import unstable { inherit system config; }; code = vscode.extensions."${system}"; gaming = gaming.packages."${system}"; @@ -57,29 +63,31 @@ in { // hyprshell.packages."${system}"; }) ]; - }; - } - // (let - # Package Calling Function - call = rec { - __functor = _: name: pkg name {}; - pkg = name: args: pkgs.callPackage name ({inherit lib util pkgs;} // args); - script = name: - pkg name { - inherit inputs; - inherit (inputs.self) files; }; - }; - in { - # Custom Packages - apps = - map.modules ../scripts (name: inputs.utils.lib.mkApp {drv = call.script name;}) - // {default = self'.apps.nixos;}; - packages = - map.modules ./. call - // map.modules ../scripts call.script - // inputs'.proprietary.packages; - }); + } + // ( + let + # Package Calling Function + call = rec { + __functor = _: name: pkg name { }; + pkg = name: args: pkgs.callPackage name ({ inherit lib util pkgs; } // args); + script = + name: + pkg name { + inherit inputs; + inherit (inputs.self) files; + }; + }; + in + { + # Custom Packages + apps = map.modules ../scripts (name: inputs.utils.lib.mkApp { drv = call.script name; }) // { + default = self'.apps.nixos; + }; + packages = + map.modules ./. call // map.modules ../scripts call.script // inputs'.proprietary.packages; + } + ); # Package Overrides flake.overlays = map.modules ./overlays import; diff --git a/packages/geany-catppuccin/default.nix b/packages/geany-catppuccin/default.nix @@ -3,30 +3,31 @@ pkgs, ... }: -with pkgs; let +with pkgs; +let metadata = import ./metadata.nix; in - stdenv.mkDerivation { - pname = "geany-catppuccin"; - version = metadata.rev; +stdenv.mkDerivation { + pname = "geany-catppuccin"; + version = metadata.rev; - src = fetchFromGitHub { - owner = "catppuccin"; - repo = "geany"; - inherit (metadata) rev sha256; - }; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "geany"; + inherit (metadata) rev sha256; + }; - dontBuild = true; - patches = [./selection.patch]; - installPhase = '' - mkdir -p $out/share/geany/colorschemes/ - cp -r ./src/. $out/share/geany/colorschemes/ - ''; + dontBuild = true; + patches = [ ./selection.patch ]; + installPhase = '' + mkdir -p $out/share/geany/colorschemes/ + cp -r ./src/. $out/share/geany/colorschemes/ + ''; - meta = with lib; { - description = "Soothing pastel theme for Geany"; - homepage = metadata.repo; - license = licenses.mit; - maintainers = ["maydayv7"]; - }; - } + meta = with lib; { + description = "Soothing pastel theme for Geany"; + homepage = metadata.repo; + license = licenses.mit; + maintainers = [ "maydayv7" ]; + }; +} diff --git a/packages/gnome-pano/default.nix b/packages/gnome-pano/default.nix @@ -3,42 +3,47 @@ pkgs, ... }: -with pkgs; let +with pkgs; +let uuid = "pano@elhan.io"; in - stdenv.mkDerivation rec { - pname = "pano"; - version = "v23-alpha5"; - src = fetchzip { - url = "https://github.com/oae/gnome-shell-pano/releases/download/${version}/${uuid}.zip"; - sha256 = "sha256-kTaJOSyFtBa/fl3Mot8Q8qyhwJwhcbBY4FvdztqUP4w="; - stripRoot = false; - }; +stdenv.mkDerivation rec { + pname = "pano"; + version = "v23-alpha5"; + src = fetchzip { + url = "https://github.com/oae/gnome-shell-pano/releases/download/${version}/${uuid}.zip"; + sha256 = "sha256-kTaJOSyFtBa/fl3Mot8Q8qyhwJwhcbBY4FvdztqUP4w="; + stripRoot = false; + }; - patches = [ - (substituteAll { - src = ./imports.patch; - inherit gsound libgda5; - }) - ]; + patches = [ + (substituteAll { + src = ./imports.patch; + inherit gsound libgda5; + }) + ]; - nativeBuildInputs = [wrapGAppsHook]; - buildInputs = [gnome-shell libgda5 gsound]; - installPhase = '' - mkdir -p $out/share/gnome-shell/extensions - cp -r -T . $out/share/gnome-shell/extensions/${uuid} - ''; + nativeBuildInputs = [ wrapGAppsHook ]; + buildInputs = [ + gnome-shell + libgda5 + gsound + ]; + installPhase = '' + mkdir -p $out/share/gnome-shell/extensions + cp -r -T . $out/share/gnome-shell/extensions/${uuid} + ''; - passthru = { - extensionPortalSlug = pname; - extensionUuid = uuid; - }; + passthru = { + extensionPortalSlug = pname; + extensionUuid = uuid; + }; - meta = with lib; { - description = "Mext-gen GNOME Shell Clipboard Management Extension"; - homepage = "https://github.com/oae/gnome-shell-pano"; - license = licenses.gpl2Plus; - platforms = platforms.linux; - maintainers = ["maydayv7"]; - }; - } + meta = with lib; { + description = "Mext-gen GNOME Shell Clipboard Management Extension"; + homepage = "https://github.com/oae/gnome-shell-pano"; + license = licenses.gpl2Plus; + platforms = platforms.linux; + maintainers = [ "maydayv7" ]; + }; +} diff --git a/packages/hyprshellevents/default.nix b/packages/hyprshellevents/default.nix @@ -3,34 +3,40 @@ pkgs, ... }: -with pkgs; let +with pkgs; +let metadata = import ./metadata.nix; in - stdenvNoCC.mkDerivation (final: { - pname = "hyprshellevents"; - version = metadata.rev; - sourceRoot = "${final.src.name}/shellevents"; +stdenvNoCC.mkDerivation (final: { + pname = "hyprshellevents"; + version = metadata.rev; + sourceRoot = "${final.src.name}/shellevents"; - src = fetchFromGitHub { - owner = "hyprwm"; - repo = "contrib"; - inherit (metadata) rev sha256; - }; + src = fetchFromGitHub { + owner = "hyprwm"; + repo = "contrib"; + inherit (metadata) rev sha256; + }; - buildInputs = [bash]; - makeFlags = ["PREFIX=$(out)"]; - nativeBuildInputs = [makeWrapper]; - postInstall = '' - wrapProgram $out/bin/shellevents --prefix PATH ':' \ - "${lib.makeBinPath [coreutils hyprland]}" - ''; + buildInputs = [ bash ]; + makeFlags = [ "PREFIX=$(out)" ]; + nativeBuildInputs = [ makeWrapper ]; + postInstall = '' + wrapProgram $out/bin/shellevents --prefix PATH ':' \ + "${ + lib.makeBinPath [ + coreutils + hyprland + ] + }" + ''; - meta = with lib; { - mainProgram = "shellevents"; - description = "Run shell scripts in response to Hyprland events"; - homepage = metadata.repo; - license = licenses.mit; - platforms = platforms.unix; - maintainers = ["maydayv7"]; - }; - }) + meta = with lib; { + mainProgram = "shellevents"; + description = "Run shell scripts in response to Hyprland events"; + homepage = metadata.repo; + license = licenses.mit; + platforms = platforms.unix; + maintainers = [ "maydayv7" ]; + }; +}) diff --git a/packages/kebihelp/default.nix b/packages/kebihelp/default.nix @@ -4,34 +4,40 @@ ... }: with pkgs; -with python311Packages; let +with python311Packages; +let metadata = import ./metadata.nix; in - buildPythonPackage rec { - pname = "kebihelp"; - version = metadata.rev; +buildPythonPackage rec { + pname = "kebihelp"; + version = metadata.rev; - src = fetchFromGitHub { - owner = "juienpro"; - repo = pname; - inherit (metadata) rev sha256; - }; + src = fetchFromGitHub { + owner = "juienpro"; + repo = pname; + inherit (metadata) rev sha256; + }; - build-system = [setuptools-scm]; - nativeBuildInputs = [libsForQt5.qt5.wrapQtAppsHook]; - propagatedBuildInputs = [prettytable pyqt5 pyqt5-sip libsForQt5.qt5.qtwayland]; + build-system = [ setuptools-scm ]; + nativeBuildInputs = [ libsForQt5.qt5.wrapQtAppsHook ]; + propagatedBuildInputs = [ + prettytable + pyqt5 + pyqt5-sip + libsForQt5.qt5.qtwayland + ]; - format = "pyproject"; - dontWrapQtApps = true; - dontCheckRuntimeDeps = true; - preFixup = '' - makeWrapperArgs+=("''${qtWrapperArgs[@]}") - ''; + format = "pyproject"; + dontWrapQtApps = true; + dontCheckRuntimeDeps = true; + preFixup = '' + makeWrapperArgs+=("''${qtWrapperArgs[@]}") + ''; - meta = with lib; { - description = "Universal Keybinding helper written in Python and QT5"; - homepage = metadata.repo; - license = licenses.mit; - maintainers = ["maydayv7"]; - }; - } + meta = with lib; { + description = "Universal Keybinding helper written in Python and QT5"; + homepage = metadata.repo; + license = licenses.mit; + maintainers = [ "maydayv7" ]; + }; +} diff --git a/packages/kitty-search/default.nix b/packages/kitty-search/default.nix @@ -3,26 +3,27 @@ pkgs, ... }: -with pkgs; let +with pkgs; +let metadata = import ./metadata.nix; in - stdenv.mkDerivation rec { - pname = "kitty-kitten-search"; - version = metadata.rev; +stdenv.mkDerivation rec { + pname = "kitty-kitten-search"; + version = metadata.rev; - src = fetchFromGitHub { - owner = "trygveaa"; - repo = pname; - inherit (metadata) rev sha256; - }; + src = fetchFromGitHub { + owner = "trygveaa"; + repo = pname; + inherit (metadata) rev sha256; + }; - dontBuild = true; - installPhase = "mkdir -p $out/ && cp -r . $out/"; + dontBuild = true; + installPhase = "mkdir -p $out/ && cp -r . $out/"; - meta = with lib; { - description = " Kitten for searching in Kitty Terminal"; - homepage = metadata.repo; - license = licenses.gpl3Only; - maintainers = ["maydayv7"]; - }; - } + meta = with lib; { + description = " Kitten for searching in Kitty Terminal"; + homepage = metadata.repo; + license = licenses.gpl3Only; + maintainers = [ "maydayv7" ]; + }; +} diff --git a/packages/kvlibadwaita/default.nix b/packages/kvlibadwaita/default.nix @@ -3,29 +3,30 @@ pkgs, ... }: -with pkgs; let +with pkgs; +let metadata = import ./metadata.nix; in - stdenv.mkDerivation rec { - pname = "KvLibadwaita"; - version = metadata.rev; +stdenv.mkDerivation rec { + pname = "KvLibadwaita"; + version = metadata.rev; - src = fetchFromGitHub { - owner = "GabePoel"; - repo = pname; - inherit (metadata) rev sha256; - }; + src = fetchFromGitHub { + owner = "GabePoel"; + repo = pname; + inherit (metadata) rev sha256; + }; - dontBuild = true; - installPhase = '' - mkdir -p $out/share/Kvantum/ - cp -r ./src/. $out/share/Kvantum/ - ''; + dontBuild = true; + installPhase = '' + mkdir -p $out/share/Kvantum/ + cp -r ./src/. $out/share/Kvantum/ + ''; - meta = with lib; { - description = "Libadwaita style theme for Kvantum"; - homepage = metadata.repo; - license = licenses.gpl3Only; - maintainers = ["maydayv7"]; - }; - } + meta = with lib; { + description = "Libadwaita style theme for Kvantum"; + homepage = metadata.repo; + license = licenses.gpl3Only; + maintainers = [ "maydayv7" ]; + }; +} diff --git a/packages/wine/7zip.nix b/packages/wine/7zip.nix @@ -4,46 +4,65 @@ pkgs, wine, ... -}: let +}: +let inherit (builtins) concatLists map; inherit (pkgs) copyDesktopItems fetchurl makeDesktopItem; inherit (build) copyDesktopIcons makeDesktopIcon mkWindowsApp; in - mkWindowsApp rec { - inherit wine; - pname = "7zip"; - version = "2404"; - src = fetchurl { - url = "https://www.7-zip.org/a/7z${version}.exe"; - sha256 = "sha256-0Mj79dcm5B2F5RVZI0tbOUVSLoQgjfUjntJfAu9j7/M="; - }; +mkWindowsApp rec { + inherit wine; + pname = "7zip"; + version = "2404"; + src = fetchurl { + url = "https://www.7-zip.org/a/7z${version}.exe"; + sha256 = "sha256-0Mj79dcm5B2F5RVZI0tbOUVSLoQgjfUjntJfAu9j7/M="; + }; + + dontUnpack = true; + wineArch = "win32"; + fileMap = { }; + enableInstallNotification = false; + nativeBuildInputs = [ + copyDesktopItems + copyDesktopIcons + ]; - dontUnpack = true; - wineArch = "win32"; - fileMap = {}; - enableInstallNotification = false; - nativeBuildInputs = [copyDesktopItems copyDesktopIcons]; + winAppInstall = '' + $WINE start /unix ${src} /S + wineserver -w + ''; - winAppInstall = '' - $WINE start /unix ${src} /S - wineserver -w - ''; + winAppRun = '' + $WINE start /unix "$WINEPREFIX/drive_c/Program Files/7-Zip/7zFM.exe" "$ARGS" + ''; - winAppRun = '' - $WINE start /unix "$WINEPREFIX/drive_c/Program Files/7-Zip/7zFM.exe" "$ARGS" - ''; + installPhase = '' + runHook preInstall + ln -s $out/bin/.launcher $out/bin/${pname} + runHook postInstall + ''; - installPhase = '' - runHook preInstall - ln -s $out/bin/.launcher $out/bin/${pname} - runHook postInstall - ''; + desktopItems = + let + textTypes = map (n: "text/" + n) [ ]; + appTypes = map (n: "application/" + n) [ + "epub+zip" + "x-zip-compressed-fb2" + "x-cbt" + "x-cb7" + "x-7z-compressed" + "vnd.rar" + "x-tar" + "zip" + ]; - desktopItems = let - textTypes = map (n: "text/" + n) []; - appTypes = map (n: "application/" + n) ["epub+zip" "x-zip-compressed-fb2" "x-cbt" "x-cb7" "x-7z-compressed" "vnd.rar" "x-tar" "zip"]; - mimeTypes = concatLists [textTypes appTypes]; - in [ + mimeTypes = concatLists [ + textTypes + appTypes + ]; + in + [ (makeDesktopItem { inherit mimeTypes; name = pname; @@ -51,23 +70,26 @@ in icon = pname; desktopName = "7-Zip"; genericName = "Archive Manager"; - categories = ["Office" "Utility"]; + categories = [ + "Office" + "Utility" + ]; }) ]; - desktopIcon = makeDesktopIcon { - name = "7zip"; - src = fetchurl { - url = "https://www.7-zip.org/7ziplogo.png"; - sha256 = "1nkas4wy40ffsmcji1a3gq8a61d72zp4w65jjpmqjj9wyh0j5b7q"; - }; + desktopIcon = makeDesktopIcon { + name = "7zip"; + src = fetchurl { + url = "https://www.7-zip.org/7ziplogo.png"; + sha256 = "1nkas4wy40ffsmcji1a3gq8a61d72zp4w65jjpmqjj9wyh0j5b7q"; }; + }; - meta = with lib; { - description = "File Archiver with a High Compression Ratio"; - homepage = "https://www.7-zip.org/"; - license = licenses.bsd3; - platforms = platforms.linux; - maintainers = ["maydayv7"]; - }; - } + meta = with lib; { + description = "File Archiver with a High Compression Ratio"; + homepage = "https://www.7-zip.org/"; + license = licenses.bsd3; + platforms = platforms.linux; + maintainers = [ "maydayv7" ]; + }; +} diff --git a/packages/wine/notepad++.nix b/packages/wine/notepad++.nix @@ -4,48 +4,91 @@ pkgs, wine, ... -}: let +}: +let inherit (builtins) concatLists map; inherit (pkgs) copyDesktopItems fetchurl makeDesktopItem; inherit (build) copyDesktopIcons makeDesktopIcon mkWindowsAppNoCC; in - mkWindowsAppNoCC rec { - inherit wine; - pname = "notepad-plus-plus"; - version = "8.7.3"; - src = fetchurl { - url = "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v${version}/npp.${version}.Installer.exe"; - sha256 = "0qb8x7fy2840wvc0ypmqk0zn806va3zrpdz6cdzrqwcyn76j3ymf"; - }; +mkWindowsAppNoCC rec { + inherit wine; + pname = "notepad-plus-plus"; + version = "8.7.3"; + src = fetchurl { + url = "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v${version}/npp.${version}.Installer.exe"; + sha256 = "0qb8x7fy2840wvc0ypmqk0zn806va3zrpdz6cdzrqwcyn76j3ymf"; + }; + + dontUnpack = true; + wineArch = "win32"; + + fileMap = { + "$HOME/.config/Notepad++" = "drive_c/users/$USER/AppData/Roaming/Notepad++"; + }; + + enableMonoBootPrompt = false; + nativeBuildInputs = [ + copyDesktopItems + copyDesktopIcons + ]; - dontUnpack = true; - wineArch = "win32"; - fileMap = {"$HOME/.config/Notepad++" = "drive_c/users/$USER/AppData/Roaming/Notepad++";}; - enableMonoBootPrompt = false; - nativeBuildInputs = [copyDesktopItems copyDesktopIcons]; + winAppInstall = '' + $WINE start /unix ${src} /S + wineserver -w + rm -f "$WINEPREFIX/drive_c/Program Files/Notepad++/uninstall.exe" + rm -fR "$WINEPREFIX/drive_c/Program Files/Notepad++/updater" + ''; - winAppInstall = '' - $WINE start /unix ${src} /S - wineserver -w - rm -f "$WINEPREFIX/drive_c/Program Files/Notepad++/uninstall.exe" - rm -fR "$WINEPREFIX/drive_c/Program Files/Notepad++/updater" - ''; + winAppRun = '' + $WINE start /unix "$WINEPREFIX/drive_c/Program Files/Notepad++/notepad++.exe" "$ARGS" + ''; - winAppRun = '' - $WINE start /unix "$WINEPREFIX/drive_c/Program Files/Notepad++/notepad++.exe" "$ARGS" - ''; + installPhase = '' + runHook preInstall + ln -s $out/bin/.launcher $out/bin/${pname} + runHook postInstall + ''; - installPhase = '' - runHook preInstall - ln -s $out/bin/.launcher $out/bin/${pname} - runHook postInstall - ''; + desktopItems = + let + textTypes = map (s: "text/" + s) [ + "plain" + "html" + "rust" + "vbscript" + "x-cmake" + "x-changelog" + "x-cobol" + "x-common-lisp" + "x-csharp" + "x-c++src" + "x-csrc" + "x-erlang" + "x-fortran" + "x-haskell" + "x-java" + "x-log" + "x-makefile" + "x-objcsrc" + "x-python" + "x-readme" + "x-scheme" + "x-install" + ]; - desktopItems = let - textTypes = map (s: "text/" + s) ["plain" "html" "rust" "vbscript" "x-cmake" "x-changelog" "x-cobol" "x-common-lisp" "x-csharp" "x-c++src" "x-csrc" "x-erlang" "x-fortran" "x-haskell" "x-java" "x-log" "x-makefile" "x-objcsrc" "x-python" "x-readme" "x-scheme" "x-install"]; - appTypes = map (s: "application/" + s) ["json" "x-msi" "xml" "x-perl"]; - mimeTypes = concatLists [textTypes appTypes]; - in [ + appTypes = map (s: "application/" + s) [ + "json" + "x-msi" + "xml" + "x-perl" + ]; + + mimeTypes = concatLists [ + textTypes + appTypes + ]; + in + [ (makeDesktopItem { inherit mimeTypes; name = "Notepad++"; @@ -53,25 +96,31 @@ in icon = pname; desktopName = "Notepad++"; genericName = "Text Editor"; - categories = ["Utility" "TextEditor"]; + categories = [ + "Utility" + "TextEditor" + ]; }) ]; - desktopIcon = makeDesktopIcon { - name = pname; - icoIndex = 2; - src = fetchurl { - url = "https://notepad-plus-plus.org/favicon.ico"; - sha256 = "1av2m6m665ccfngnzqnbsnv2aky907p2c6ggvfxrwbp70szgj9vi"; - }; + desktopIcon = makeDesktopIcon { + name = pname; + icoIndex = 2; + src = fetchurl { + url = "https://notepad-plus-plus.org/favicon.ico"; + sha256 = "1av2m6m665ccfngnzqnbsnv2aky907p2c6ggvfxrwbp70szgj9vi"; }; + }; - meta = with lib; { - mainProgram = pname; - homepage = "https://notepad-plus-plus.org/"; - description = "A text and source code editor"; - license = licenses.gpl3Plus; - maintainers = ["maydayv7"]; - platforms = ["x86_64-linux" "i686-linux"]; - }; - } + meta = with lib; { + mainProgram = pname; + homepage = "https://notepad-plus-plus.org/"; + description = "A text and source code editor"; + license = licenses.gpl3Plus; + maintainers = [ "maydayv7" ]; + platforms = [ + "x86_64-linux" + "i686-linux" + ]; + }; +} diff --git a/scripts/hyprutils.nix b/scripts/hyprutils.nix @@ -3,7 +3,8 @@ pkgs, files, ... -}: let +}: +let inherit (lib) licenses recursiveUpdate; help = '' @@ -46,321 +47,325 @@ } ''; in - recursiveUpdate { +recursiveUpdate + { meta = { mainProgram = "hyprutils"; description = "Hyprland Utility Script"; homepage = files.path.repo; license = licenses.gpl3Only; - maintainers = ["maydayv7"]; + maintainers = [ "maydayv7" ]; }; - } (pkgs.writeShellApplication { - name = "hyprutils"; - runtimeInputs = with pkgs; [ - coreutils - gnugrep - socat - wget + } + ( + pkgs.writeShellApplication { + name = "hyprutils"; + runtimeInputs = with pkgs; [ + coreutils + gnugrep + socat + wget - dunst - zenity - hyprland - hyprshade - hyprsunset - custom.hyprshellevents + dunst + zenity + hyprland + hyprshade + hyprsunset + custom.hyprshellevents - alsa-utils - brightnessctl - brillo - libnotify - playerctl - systemd - ]; + alsa-utils + brightnessctl + brillo + libnotify + playerctl + systemd + ]; - text = '' - set +eu - ${files.scripts.commands} - show_album_art=true - show_music_in_volume_indicator=true + text = '' + set +eu + ${files.scripts.commands} + show_album_art=true + show_music_in_volume_indicator=true - notify() { - notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:"$1" "''${@:2}" - } + notify() { + notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:"$1" "''${@:2}" + } - hyprnotify() { - hyprctl notify "$1" 1500 0 " $2 " - } + hyprnotify() { + hyprctl notify "$1" 1500 0 " $2 " + } - fail() { - error "$1" "Try 'hyprutils help' for more information" - } + fail() { + error "$1" "Try 'hyprutils help' for more information" + } - get_media_icon() { - media_icon="audio-speakers" - if $show_album_art - then - temp media-icon 1 - url=$(playerctl -f "{{mpris:artUrl}}" metadata) - if [[ "$url" == "file://"* ]] + get_media_icon() { + media_icon="audio-speakers" + if $show_album_art then - media_icon="''${url/file:\/\//}" - elif [[ "$url" == "http://"* ]] || [[ "$url" == "https://"* ]] - then - filename="$(echo "$url" | sed "s/.*\///")" - if [ ! -f "$TEMP/$filename" ]; then wget -O "$TEMP/$filename" "$url"; fi - media_icon="$TEMP/$filename" + temp media-icon 1 + url=$(playerctl -f "{{mpris:artUrl}}" metadata) + if [[ "$url" == "file://"* ]] + then + media_icon="''${url/file:\/\//}" + elif [[ "$url" == "http://"* ]] || [[ "$url" == "https://"* ]] + then + filename="$(echo "$url" | sed "s/.*\///")" + if [ ! -f "$TEMP/$filename" ]; then wget -O "$TEMP/$filename" "$url"; fi + media_icon="$TEMP/$filename" + fi fi - fi - } + } - case "$1" in - "") error "Expected an Option" "${help}";; - "help") echo -e "## Hyprland Utility Script ##\n${help}";; - "daemon") - info "Monitoring Hyprland Socket..." - socat -u UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock EXEC:"shellevents ${daemon}",nofork - ;; - "brightness") - brightness_notification() { - brightness=$(brillo | grep -Po '[0-9]{1,3}' | head -n 1) - notify brightness -i "display" -h int:value:"$brightness" "🔅 $brightness%" - } - case "$2" in - "up") - brillo -u 300000 -A 5 - brightness_notification - ;; - "down") - brillo -u 300000 -U 5 - brightness_notification + case "$1" in + "") error "Expected an Option" "${help}";; + "help") echo -e "## Hyprland Utility Script ##\n${help}";; + "daemon") + info "Monitoring Hyprland Socket..." + socat -u UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock EXEC:"shellevents ${daemon}",nofork ;; - "") fail "Expected an Option" ;; - *) fail "Unexpected Option 'brightness $2'" ;; - esac - ;; - "backlight") - backlight_notification() { - backlight="$(cat /sys/class/leds/*::kbd_backlight/brightness)" - light=0; if [ "$backlight" -eq 1 ]; then light=33; fi - if [ "$backlight" -eq 2 ]; then light=67; fi - if [ "$backlight" -eq 3 ]; then light=100; fi - notify backlight -i "keyboard" -h int:value:"$light" "🔅 $light%" - } - case "$2" in - "up") - brightnessctl -d "*::kbd_backlight" set 33%+ - backlight_notification - ;; - "down") - brightnessctl -d "*::kbd_backlight" set 33%- - backlight_notification - ;; - "") fail "Expected an Option" ;; - *) fail "Unexpected Option 'brightness $2'" ;; - esac - ;; - "temperature") - temperature_notification() { - temperature=$(hyprctl hyprsunset temperature) - notify temperature -i "display" "🌡 $temperature K" - } - case "$2" in - "up") - hyprctl hyprsunset temperature +200 - temperature_notification + "brightness") + brightness_notification() { + brightness=$(brillo | grep -Po '[0-9]{1,3}' | head -n 1) + notify brightness -i "display" -h int:value:"$brightness" "🔅 $brightness%" + } + case "$2" in + "up") + brillo -u 300000 -A 5 + brightness_notification + ;; + "down") + brillo -u 300000 -U 5 + brightness_notification + ;; + "") fail "Expected an Option" ;; + *) fail "Unexpected Option 'brightness $2'" ;; + esac ;; - "down") - hyprctl hyprsunset temperature -200 - temperature_notification + "backlight") + backlight_notification() { + backlight="$(cat /sys/class/leds/*::kbd_backlight/brightness)" + light=0; if [ "$backlight" -eq 1 ]; then light=33; fi + if [ "$backlight" -eq 2 ]; then light=67; fi + if [ "$backlight" -eq 3 ]; then light=100; fi + notify backlight -i "keyboard" -h int:value:"$light" "🔅 $light%" + } + case "$2" in + "up") + brightnessctl -d "*::kbd_backlight" set 33%+ + backlight_notification + ;; + "down") + brightnessctl -d "*::kbd_backlight" set 33%- + backlight_notification + ;; + "") fail "Expected an Option" ;; + *) fail "Unexpected Option 'brightness $2'" ;; + esac ;; - "reset") - hyprctl hyprsunset temperature 6000 - hyprctl hyprsunset identity - notify temperature -i "display" "🌡 Reset" + "temperature") + temperature_notification() { + temperature=$(hyprctl hyprsunset temperature) + notify temperature -i "display" "🌡 $temperature K" + } + case "$2" in + "up") + hyprctl hyprsunset temperature +200 + temperature_notification + ;; + "down") + hyprctl hyprsunset temperature -200 + temperature_notification + ;; + "reset") + hyprctl hyprsunset temperature 6000 + hyprctl hyprsunset identity + notify temperature -i "display" "🌡 Reset" + ;; + "") fail "Expected an Option" ;; + *) fail "Unexpected Option 'temperature $2'" ;; + esac ;; - "") fail "Expected an Option" ;; - *) fail "Unexpected Option 'temperature $2'" ;; - esac - ;; - "volume") - volume_notification() { - volume=$(amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1) - mute=$(amixer get Master | grep '%' | grep -oE '[^ ]+$' | grep off | head -n1) - if [ "$volume" -eq 0 ] || [ "$mute" == "[off]" ] - then - volume_icon="🔇" - elif [ "$volume" -lt 50 ] - then - volume_icon="🔉" - else - volume_icon="🔊" - fi + "volume") + volume_notification() { + volume=$(amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1) + mute=$(amixer get Master | grep '%' | grep -oE '[^ ]+$' | grep off | head -n1) + if [ "$volume" -eq 0 ] || [ "$mute" == "[off]" ] + then + volume_icon="🔇" + elif [ "$volume" -lt 50 ] + then + volume_icon="🔉" + else + volume_icon="🔊" + fi - song_title=$(playerctl -f "{{title}}" metadata) - get_media_icon - if $show_music_in_volume_indicator && [ -n "$song_title" ] - then - song_artist=$(playerctl -f "{{artist}}" metadata) - if [ -z "$song_artist" ] + song_title=$(playerctl -f "{{title}}" metadata) + get_media_icon + if $show_music_in_volume_indicator && [ -n "$song_title" ] then - notify volume -h int:value:"$volume" -i "$media_icon" "$volume_icon $volume%" "$song_title" + song_artist=$(playerctl -f "{{artist}}" metadata) + if [ -z "$song_artist" ] + then + notify volume -h int:value:"$volume" -i "$media_icon" "$volume_icon $volume%" "$song_title" + else + notify volume -h int:value:"$volume" -i "$media_icon" "$volume_icon $volume%" "$song_title\nBy $song_artist" + fi else - notify volume -h int:value:"$volume" -i "$media_icon" "$volume_icon $volume%" "$song_title\nBy $song_artist" + notify volume -h int:value:"$volume" -i "$media_icon" "$volume_icon $volume%" fi - else - notify volume -h int:value:"$volume" -i "$media_icon" "$volume_icon $volume%" - fi - } - case "$2" in - "up") - amixer set Master on - amixer sset Master 5%+ - volume_notification - ;; - "down") - amixer set Master on - amixer sset Master 5%- - volume_notification - ;; - "mute") - amixer set Master 1+ toggle - volume_notification + } + case "$2" in + "up") + amixer set Master on + amixer sset Master 5%+ + volume_notification + ;; + "down") + amixer set Master on + amixer sset Master 5%- + volume_notification + ;; + "mute") + amixer set Master 1+ toggle + volume_notification + ;; + "") fail "Expected an Option" ;; + *) fail "Unexpected Option 'volume $2'" ;; + esac ;; - "") fail "Expected an Option" ;; - *) fail "Unexpected Option 'volume $2'" ;; - esac - ;; - "media") - music_notification() { - song_title=$(playerctl -f "{{title}}" metadata) - song_artist=$(playerctl -f "{{artist}}" metadata) - song_album=$(playerctl -f "{{album}}" metadata) - get_media_icon - if [ -z "$song_album" ] - then - if [ -z "$song_artist" ] + "media") + music_notification() { + song_title=$(playerctl -f "{{title}}" metadata) + song_artist=$(playerctl -f "{{artist}}" metadata) + song_album=$(playerctl -f "{{album}}" metadata) + get_media_icon + if [ -z "$song_album" ] then - notify music -i "$media_icon" "$song_title" + if [ -z "$song_artist" ] + then + notify music -i "$media_icon" "$song_title" + else + notify music -i "$media_icon" "$song_title" "By $song_artist" + fi else - notify music -i "$media_icon" "$song_title" "By $song_artist" + notify music -i "$media_icon" "$song_title" "By $song_artist from $song_album" fi - else - notify music -i "$media_icon" "$song_title" "By $song_artist from $song_album" - fi - } - case "$2" in - "next") - playerctl next - sleep 0.5 && music_notification - ;; - "previous") - playerctl previous - sleep 0.5 && music_notification + } + case "$2" in + "next") + playerctl next + sleep 0.5 && music_notification + ;; + "previous") + playerctl previous + sleep 0.5 && music_notification + ;; + "toggle") + playerctl play-pause + music_notification + ;; + "") fail "Expected an Option" ;; + *) fail "Unexpected Option 'media $2'" ;; + esac ;; "toggle") - playerctl play-pause - music_notification - ;; - "") fail "Expected an Option" ;; - *) fail "Unexpected Option 'media $2'" ;; - esac - ;; - "toggle") - case "$2" in - "fancy") - FANCY=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}') - if [ "$FANCY" = 1 ] - then - hyprnotify 1 "Compositor Effects Disabled" - hyprctl --batch "\ - keyword animations:enabled 0;\ - keyword decoration:shadow:enabled 0;\ - keyword decoration:blur:enabled 0;\ - keyword general:gaps_in 0;\ - keyword general:gaps_out 0;\ - keyword general:border_size 1;\ - keyword decoration:rounding 0" - exit - fi - hyprnotify 1 "Compositor Effects Enabled" - hyprctl reload - ;; - "float") - WORKSPACE=$(hyprctl activeworkspace | grep "workspace ID" | awk '{print $3}') - hyprnotify 1 "Toggled window floating on Workspace $WORKSPACE" - hyprctl dispatch workspaceopt allfloat - ;; - "minimized") - if hyprctl workspaces | grep "special:minimize" - then - hyprctl dispatch workspace special:minimized - else - hyprnotify 1 "No minimized windows present" - fi - ;; - "monitor") - if hyprctl monitors | grep "$3" - then - hyprctl keyword monitor "$3, disable" - else - hyprctl keyword monitor "$3, preferred, auto, 1" - fi - ;; - "service") - if [ -z "$3" ] - then - fail "Expected service name" - fi + case "$2" in + "fancy") + FANCY=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}') + if [ "$FANCY" = 1 ] + then + hyprnotify 1 "Compositor Effects Disabled" + hyprctl --batch "\ + keyword animations:enabled 0;\ + keyword decoration:shadow:enabled 0;\ + keyword decoration:blur:enabled 0;\ + keyword general:gaps_in 0;\ + keyword general:gaps_out 0;\ + keyword general:border_size 1;\ + keyword decoration:rounding 0" + exit + fi + hyprnotify 1 "Compositor Effects Enabled" + hyprctl reload + ;; + "float") + WORKSPACE=$(hyprctl activeworkspace | grep "workspace ID" | awk '{print $3}') + hyprnotify 1 "Toggled window floating on Workspace $WORKSPACE" + hyprctl dispatch workspaceopt allfloat + ;; + "minimized") + if hyprctl workspaces | grep "special:minimize" + then + hyprctl dispatch workspace special:minimized + else + hyprnotify 1 "No minimized windows present" + fi + ;; + "monitor") + if hyprctl monitors | grep "$3" + then + hyprctl keyword monitor "$3, disable" + else + hyprctl keyword monitor "$3, preferred, auto, 1" + fi + ;; + "service") + if [ -z "$3" ] + then + fail "Expected service name" + fi - if systemctl --user is-active "$3" - then - systemctl --user stop "$3" - notify service -i "system-config-services" "Stopped $3" - else - systemctl --user start "$3" - notify service -i "system-config-services" "Started $3" - fi - ;; - "shader") - hyprshade off - mapfile SHADERS < <(hyprshade ls) - SHADER=$(zenity --list --title="Compositor Shader Toggle" --column="Shaders" "''${SHADERS[@]}" | sed "s/^[ \t]*//") - hyprshade on "$SHADER" && hyprctl seterror "" - ;; - "touchpad") - temp touchpad 1 - STATUS="$TEMP/status" - touchpad=$(hyprctl devices | grep touchpad | xargs) + if systemctl --user is-active "$3" + then + systemctl --user stop "$3" + notify service -i "system-config-services" "Stopped $3" + else + systemctl --user start "$3" + notify service -i "system-config-services" "Started $3" + fi + ;; + "shader") + hyprshade off + mapfile SHADERS < <(hyprshade ls) + SHADER=$(zenity --list --title="Compositor Shader Toggle" --column="Shaders" "''${SHADERS[@]}" | sed "s/^[ \t]*//") + hyprshade on "$SHADER" && hyprctl seterror "" + ;; + "touchpad") + temp touchpad 1 + STATUS="$TEMP/status" + touchpad=$(hyprctl devices | grep touchpad | xargs) - enable() { - hyprctl keyword "device[$touchpad]:enabled" true - printf "true" >"$STATUS" - notify touchpad -i "touchpad" "Touchpad Enabled" - } + enable() { + hyprctl keyword "device[$touchpad]:enabled" true + printf "true" >"$STATUS" + notify touchpad -i "touchpad" "Touchpad Enabled" + } - disable() { - hyprctl keyword "device[$touchpad]:enabled" false - printf "false" >"$STATUS" - notify touchpad -i "touchpad" "Touchpad Disabled" - } + disable() { + hyprctl keyword "device[$touchpad]:enabled" false + printf "false" >"$STATUS" + notify touchpad -i "touchpad" "Touchpad Disabled" + } - if ! [ -f "$STATUS" ] - then - disable - else - if [ "$(cat "$STATUS")" = "true" ] + if ! [ -f "$STATUS" ] then disable - elif [ "$(cat "$STATUS")" = "false" ] - then - enable + else + if [ "$(cat "$STATUS")" = "true" ] + then + disable + elif [ "$(cat "$STATUS")" = "false" ] + then + enable + fi fi - fi + ;; + "") fail "Expected an Option" ;; + *) fail "Unexpected Option 'toggle $2'" ;; + esac ;; - "") fail "Expected an Option" ;; - *) fail "Unexpected Option 'toggle $2'" ;; - esac - ;; - esac - ''; - }) + esac + ''; + } + ) diff --git a/scripts/install.nix b/scripts/install.nix @@ -4,7 +4,8 @@ files, ... }: -with files.path; let +with files.path; +let inherit (lib) licenses recursiveUpdate; # File System Operations @@ -91,89 +92,93 @@ with files.path; let } ''; in - recursiveUpdate { +recursiveUpdate + { meta = { mainProgram = "os-install"; description = "System Install Script"; homepage = repo; license = licenses.gpl3Only; - maintainers = ["maydayv7"]; + maintainers = [ "maydayv7" ]; }; - } (pkgs.writeShellApplication { - name = "os-install"; - runtimeInputs = with pkgs; [ - coreutils - dosfstools - git - gparted - nixFlakes - ntfs3g - parted - util-linux - zfs - ]; - - text = '' - set +eu - ${files.scripts.commands} - ${partitions} - - internet - if [ "$EUID" -ne 0 ] - then - error "This Command must be Executed as 'root'" - fi + } + ( + pkgs.writeShellApplication { + name = "os-install"; + runtimeInputs = with pkgs; [ + coreutils + dosfstools + git + gparted + nixFlakes + ntfs3g + parted + util-linux + zfs + ]; + + text = '' + set +eu + ${files.scripts.commands} + ${partitions} + + internet + if [ "$EUID" -ne 0 ] + then + error "This Command must be Executed as 'root'" + fi + + warn "Disk will be Completely Wiped for Automatic Partitioning" + read -rp "Do you want to Automatically Create the Partitions? (Y/N): " choice + case $choice in + [Yy]*) partition_disk;; + *) warn "You must Create, Format and Label the Partitions on your own"; gparted &> /dev/null;; + esac + newline + read -rp "Select Filesystem to use for Disk (simple/advanced): " choice + case $choice in + 1|[Ss]*) + read -rp "Do you want to Create and Format the EXT4 Partitions? (Y/N): " choice + case $choice in + [Yy]*) create_ext4; mount_ext4;; + *) warn "Assuming that Required EXT4 Partition has already been Created"; mount_ext4;; + esac + ;; + 2|[Aa]*) + read -rp "Do you want to Create the ZFS Pool and Datasets? (Y/N): " choice + case $choice in + [Yy]*) create_zfs; mount_zfs;; + *) warn "Assuming that Required ZFS Pool and Datasets have already been Created"; mount_zfs;; + esac + ;; + *) error "Choose (1)simple or (2)advanced";; + esac + newline - warn "Disk will be Completely Wiped for Automatic Partitioning" - read -rp "Do you want to Automatically Create the Partitions? (Y/N): " choice - case $choice in - [Yy]*) partition_disk;; - *) warn "You must Create, Format and Label the Partitions on your own"; gparted &> /dev/null;; - esac - newline - read -rp "Select Filesystem to use for Disk (simple/advanced): " choice - case $choice in - 1|[Ss]*) - read -rp "Do you want to Create and Format the EXT4 Partitions? (Y/N): " choice - case $choice in - [Yy]*) create_ext4; mount_ext4;; - *) warn "Assuming that Required EXT4 Partition has already been Created"; mount_ext4;; - esac - ;; - 2|[Aa]*) - read -rp "Do you want to Create the ZFS Pool and Datasets? (Y/N): " choice - case $choice in - [Yy]*) create_zfs; mount_zfs;; - *) warn "Assuming that Required ZFS Pool and Datasets have already been Created"; mount_zfs;; - esac - ;; - *) error "Choose (1)simple or (2)advanced";; - esac - newline - - mount_other - systemd-machine-id-setup --root=/mnt - newline - - read -rp "Enter Name of Device to Install: " HOST - read -rp "Enter Path to Repository (path/URL): " URL - if [ -z "$URL" ] - then - URL=${flake} - fi - echo "Installing System from '$URL'..." - until nixos-install --no-root-passwd --root /mnt --flake "$URL"#"$HOST" - do + mount_other + systemd-machine-id-setup --root=/mnt newline - info "Couldn't finish installation. Trying again..." - done - newline - - unmount_all - newline - - info "Run 'nixos setup' after rebooting to finish the install" - info "Select the (Recovery) boot menu option and run the above script as the 'recovery' user" - restart - ''; - }) + + read -rp "Enter Name of Device to Install: " HOST + read -rp "Enter Path to Repository (path/URL): " URL + if [ -z "$URL" ] + then + URL=${flake} + fi + echo "Installing System from '$URL'..." + until nixos-install --no-root-passwd --root /mnt --flake "$URL"#"$HOST" + do + newline + info "Couldn't finish installation. Trying again..." + done + newline + + unmount_all + newline + + info "Run 'nixos setup' after rebooting to finish the install" + info "Select the (Recovery) boot menu option and run the above script as the 'recovery' user" + restart + ''; + } + ) diff --git a/scripts/nixos.nix b/scripts/nixos.nix @@ -7,7 +7,8 @@ files, ... }: -with files; let +with files; +let inherit (inputs) self; inherit (util.map) list; inherit (lib) licenses recursiveUpdate; @@ -76,431 +77,435 @@ with files; let ''; }; in - recursiveUpdate { +recursiveUpdate + { meta = { mainProgram = "nixos"; description = "System Management Script"; homepage = files.path.repo; license = licenses.gpl3Only; - maintainers = ["maydayv7"]; + maintainers = [ "maydayv7" ]; }; - } (pkgs.writeShellApplication { - name = "nixos"; - runtimeInputs = with pkgs; [ - cachix - coreutils - git - gnugrep - gnupg - gnused - jq - manix - nixFlakes - nvd - sops - tree - wine.mkwindowsapp-tools - ]; + } + ( + pkgs.writeShellApplication { + name = "nixos"; + runtimeInputs = with pkgs; [ + cachix + coreutils + git + gnugrep + gnupg + gnused + jq + manix + nixFlakes + nvd + sops + tree + wine.mkwindowsapp-tools + ]; - text = '' - set +eu - ${scripts.commands} + text = '' + set +eu + ${scripts.commands} - if [[ -n $IN_NIX_SHELL ]] - then - warn "You are in a Nix Developer Shell" "This script may not work here properly\n" - fi + if [[ -n $IN_NIX_SHELL ]] + then + warn "You are in a Nix Developer Shell" "This script may not work here properly\n" + fi - case $1 in - "") error "Expected an Option" "${usage.script}";; - help|--help|-h) echo -e "## Tool for NixOS System Management ##\n${usage.script}";; - "apply") - case $2 in - help|--help|-h) echo "${usage.apply}";; - "") - if [ -z "$NIXOS_SPECIALISATION" ] - then - echo "Applying Configuration..." - sudo nixos-rebuild switch --flake ${path.system}# - else - echo "Applying Configuration ($NIXOS_SPECIALISATION)..." - sudo nixos-rebuild switch --specialisation "$NIXOS_SPECIALISATION" - fi - ;; - "--activate") - case $3 in + case $1 in + "") error "Expected an Option" "${usage.script}";; + help|--help|-h) echo -e "## Tool for NixOS System Management ##\n${usage.script}";; + "apply") + case $2 in + help|--help|-h) echo "${usage.apply}";; "") if [ -z "$NIXOS_SPECIALISATION" ] then - echo "Activating Configuration..." - sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch + echo "Applying Configuration..." + sudo nixos-rebuild switch --flake ${path.system}# else - echo "Activating Configuration ($NIXOS_SPECIALISATION)..." - sudo /nix/var/nix/profiles/system/specialisation/"$NIXOS_SPECIALISATION"/bin/switch-to-configuration switch + echo "Applying Configuration ($NIXOS_SPECIALISATION)..." + sudo nixos-rebuild switch --specialisation "$NIXOS_SPECIALISATION" fi ;; - "home") - echo "Applying Home Configuration..." - sudo systemctl restart home-manager-"$USER" + "--activate") + case $3 in + "") + if [ -z "$NIXOS_SPECIALISATION" ] + then + echo "Activating Configuration..." + sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch + else + echo "Activating Configuration ($NIXOS_SPECIALISATION)..." + sudo /nix/var/nix/profiles/system/specialisation/"$NIXOS_SPECIALISATION"/bin/switch-to-configuration switch + fi + ;; + "home") + echo "Applying Home Configuration..." + sudo systemctl restart home-manager-"$USER" + ;; + *) error "Unknown Option '$3'";; + esac ;; - *) error "Unknown Option '$3'";; - esac - ;; - "--boot") - echo "Applying Configuration..." - if sudo nixos-rebuild boot --flake ${path.system}# - then - restart - else - error "Couldn't build generation successfully" - fi - ;; - "--delta") - temp nixos-build - pushd "$TEMP" &> /dev/null - echo "Building Configuration..." - if nixos-rebuild build --flake ${path.system}# - then - echo "Processing Delta..." - nvd diff /run/current-system result - else - error "Couldn't build generation successfully" - fi - popd &> /dev/null - ;; - "--test") - echo "Testing Configuration..." - sudo nixos-rebuild test --no-build-nix --show-trace --flake ${path.system}# - ;; - "--rollback") - case $3 in - "") - echo "Applying Rollback..." - sudo nixos-rebuild switch --rollback + "--boot") + echo "Applying Configuration..." + if sudo nixos-rebuild boot --flake ${path.system}# + then + restart + else + error "Couldn't build generation successfully" + fi ;; - "list") - echo "# System Generations #" - nixos-rebuild list-generations + "--delta") + temp nixos-build + pushd "$TEMP" &> /dev/null + echo "Building Configuration..." + if nixos-rebuild build --flake ${path.system}# + then + echo "Processing Delta..." + nvd diff /run/current-system result + else + error "Couldn't build generation successfully" + fi + popd &> /dev/null + ;; + "--test") + echo "Testing Configuration..." + sudo nixos-rebuild test --no-build-nix --show-trace --flake ${path.system}# + ;; + "--rollback") + case $3 in + "") + echo "Applying Rollback..." + sudo nixos-rebuild switch --rollback + ;; + "list") + echo "# System Generations #" + nixos-rebuild list-generations + ;; + *) + echo "Rolling Back to Generation '$3'..." + sudo nix-env --switch-generation "$3" -p "/nix/var/nix/profiles/system" && nixos apply --activate + ;; + esac ;; *) - echo "Rolling Back to Generation '$3'..." - sudo nix-env --switch-generation "$3" -p "/nix/var/nix/profiles/system" && nixos apply --activate + SPECIALISATIONS=$(ls -1 /nix/var/nix/profiles/system/specialisation) + if grep -wq "$2" <<<"$SPECIALISATIONS" &> /dev/null + then + sudo nixos-rebuild switch --specialisation "$2" + else + error "Unknown Option '$2'\n${usage.apply}" "# Available Specialisations #\n$SPECIALISATIONS" + fi ;; esac ;; - *) - SPECIALISATIONS=$(ls -1 /nix/var/nix/profiles/system/specialisation) - if grep -wq "$2" <<<"$SPECIALISATIONS" &> /dev/null - then - sudo nixos-rebuild switch --specialisation "$2" - else - error "Unknown Option '$2'\n${usage.apply}" "# Available Specialisations #\n$SPECIALISATIONS" + "cache") + if [ -z "$2" ] + then + error "Expected a Build Command" + else + echo "Executing Command '" "''${@:2}" "'..." + cachix authtoken "$(find ${path.system} -name cachix-token.secret -exec sops --config ${path.sops} -d {} \+)" + cachix watch-exec ${path.cache} "''${@:2}" fi ;; - esac - ;; - "cache") - if [ -z "$2" ] - then - error "Expected a Build Command" - else - echo "Executing Command '" "''${@:2}" "'..." - cachix authtoken "$(find ${path.system} -name cachix-token.secret -exec sops --config ${path.sops} -d {} \+)" - cachix watch-exec ${path.cache} "''${@:2}" - fi - ;; - "check") - echo "Formatting Code..." - pushd ${path.system} &> /dev/null; nix fmt; popd &> /dev/null - case $2 in - "") nix flake check ${path.system} --keep-going;; - "--trace") nix flake check ${path.system} --keep-going --show-trace;; - *) nix flake check "$2" --keep-going;; - esac - ;; - "clean") - echo "Running Garbage Collection..." - mkwindows-tools-gc - nix-collect-garbage -d - rm -rf /nix/var/nix/profiles/per-user/"$USER"/profile - if [ "$EUID" -ne 0 ] && [ "$2" != "--all" ] - then - warn "Run as 'root' or use Option '--all' to Clean System Generations" - else - sudo nix-collect-garbage -d - sudo rm -rf /run/secrets/* - sudo nix-env --delete-generations old --profile /nix/var/nix/profiles/system - nixos apply --activate - fi - newline - echo "Running De-Duplication..." - nix store optimise - ;; - "explore") - case $2 in - "") nix repl --arg host true --arg path ${path.system} --file ${repl};; - *) nix repl --arg path "$(readlink -f "$2" | sed 's|/flake.nix||')" --file ${repl};; - esac - ;; - "iso") - case $2 in - "") error "Expected a Variant of Install Media or Device";; - *) - if grep -wq "$2" <<<"${installMedia}" &> /dev/null - then - echo "Building '$2' Install Media Image..." - nix build ${path.system}#installMedia."$2".config.system.build.isoImage && echo "The Image is located at './result/iso/nixos.iso'" - elif grep -wq "$2" <<<"${nixosConfigurations}" &> /dev/null + "check") + echo "Formatting Code..." + pushd ${path.system} &> /dev/null; nix fmt; popd &> /dev/null + case $2 in + "") nix flake check ${path.system} --keep-going;; + "--trace") nix flake check ${path.system} --keep-going --show-trace;; + *) nix flake check "$2" --keep-going;; + esac + ;; + "clean") + echo "Running Garbage Collection..." + mkwindows-tools-gc + nix-collect-garbage -d + rm -rf /nix/var/nix/profiles/per-user/"$USER"/profile + if [ "$EUID" -ne 0 ] && [ "$2" != "--all" ] then - echo "Building '$2' Device Image..." - nix build ${path.system}#nixosConfigurations."$2".config.formats.iso + warn "Run as 'root' or use Option '--all' to Clean System Generations" else - error "Unknown Variant '$2'" "# Available Variants #\n Install Media: ${installMedia}\n Devices: ${nixosConfigurations}" + sudo nix-collect-garbage -d + sudo rm -rf /run/secrets/* + sudo nix-env --delete-generations old --profile /nix/var/nix/profiles/system + nixos apply --activate fi + newline + echo "Running De-Duplication..." + nix store optimise ;; - esac - case $3 in - "") echo "The '--burn' Option can be used to Flash the Image onto a USB";; - "--burn") - case $4 in - "") error "Expected a 'path' to USB Drive";; - *) sudo dd if=./result/iso/nixos.iso of="$4" status=progress bs=1M;; + "explore") + case $2 in + "") nix repl --arg host true --arg path ${path.system} --file ${repl};; + *) nix repl --arg path "$(readlink -f "$2" | sed 's|/flake.nix||')" --file ${repl};; esac ;; - *) error "Unknown Option '$3'";; - esac - ;; - "list") - case $2 in - "") nix-store -q -R /run/current-system | sed -n -e 's/\/nix\/store\/[0-9a-z]\{32\}-//p' | sort | uniq;; - *) find=$(nix-store -q -R /run/current-system | sed -n -e 's/\/nix\/store\/[0-9a-z]\{32\}-//p' | sort | uniq | grep "$2") - if [ -z "$find" ] - then - if nix search nixpkgs#"$2" &> /dev/null + "iso") + case $2 in + "") error "Expected a Variant of Install Media or Device";; + *) + if grep -wq "$2" <<<"${installMedia}" &> /dev/null + then + echo "Building '$2' Install Media Image..." + nix build ${path.system}#installMedia."$2".config.system.build.isoImage && echo "The Image is located at './result/iso/nixos.iso'" + elif grep -wq "$2" <<<"${nixosConfigurations}" &> /dev/null then - error "Package '$2' is not installed" + echo "Building '$2' Device Image..." + nix build ${path.system}#nixosConfigurations."$2".config.formats.iso else - error "Package '$2' not found" + error "Unknown Variant '$2'" "# Available Variants #\n Install Media: ${installMedia}\n Devices: ${nixosConfigurations}" fi - else - echo "$find" - fi + ;; + esac + case $3 in + "") echo "The '--burn' Option can be used to Flash the Image onto a USB";; + "--burn") + case $4 in + "") error "Expected a 'path' to USB Drive";; + *) sudo dd if=./result/iso/nixos.iso of="$4" status=progress bs=1M;; + esac + ;; + *) error "Unknown Option '$3'";; + esac ;; - esac - ;; - "locate") - case $2 in - "") error "Expected Package Name";; - *) - package=$(nix-store -q -R /run/current-system | sed -n -e 's/\/nix\/store\/[0-9a-z]\{32\}-//p' | sort | uniq | grep "$2") - if [ -z "$package" ] - then - location=$(find /nix/store -maxdepth 1 -type d -name "*$2*") - if [ -n "$location" ] + "list") + case $2 in + "") nix-store -q -R /run/current-system | sed -n -e 's/\/nix\/store\/[0-9a-z]\{32\}-//p' | sort | uniq;; + *) find=$(nix-store -q -R /run/current-system | sed -n -e 's/\/nix\/store\/[0-9a-z]\{32\}-//p' | sort | uniq | grep "$2") + if [ -z "$find" ] then - if (( $(grep -c . <<<"$location") > 1 )) - then - echo -e "Locations:\n$location" - else - echo -e "Location: $location" - fi - else if nix search nixpkgs#"$2" &> /dev/null then error "Package '$2' is not installed" else - error "Package '$2' is invalid" + error "Package '$2' not found" fi + else + echo "$find" fi - else - if (( $(grep -c . <<<"$package") > 1 )) + ;; + esac + ;; + "locate") + case $2 in + "") error "Expected Package Name";; + *) + package=$(nix-store -q -R /run/current-system | sed -n -e 's/\/nix\/store\/[0-9a-z]\{32\}-//p' | sort | uniq | grep "$2") + if [ -z "$package" ] then - locations=$(find /nix/store -maxdepth 1 -type d -name "*$2*") - echo -e "Locations:\n$locations" + location=$(find /nix/store -maxdepth 1 -type d -name "*$2*") + if [ -n "$location" ] + then + if (( $(grep -c . <<<"$location") > 1 )) + then + echo -e "Locations:\n$location" + else + echo -e "Location: $location" + fi + else + if nix search nixpkgs#"$2" &> /dev/null + then + error "Package '$2' is not installed" + else + error "Package '$2' is invalid" + fi + fi else - echo "Package $package found" - nix search nixpkgs#"$2" &> /dev/null && location=$(nix eval nixpkgs#"$2".outPath 2> /dev/null | sed 's/"//g') || location=$(find /nix/store -maxdepth 1 -type d -name "*$package") - echo "Location: $location" + if (( $(grep -c . <<<"$package") > 1 )) + then + locations=$(find /nix/store -maxdepth 1 -type d -name "*$2*") + echo -e "Locations:\n$locations" + else + echo "Package $package found" + nix search nixpkgs#"$2" &> /dev/null && location=$(nix eval nixpkgs#"$2".outPath 2> /dev/null | sed 's/"//g') || location=$(find /nix/store -maxdepth 1 -type d -name "*$package") + echo "Location: $location" + fi fi - fi - ;; - esac - ;; - "run") - export NIXPKGS_ALLOW_UNFREE=1 - if [[ "$2" == *[:/]* ]] || grep -wq "$2" <<<"${list inputs + "nixpkgs"}" - then - nix run "$2"#"$3" --impure -- "''${@:4}" - else - nix run ${path.system}#"$2" --impure -- "''${@:3}" - fi - ;; - "save") - echo "Saving Changes..." - pushd ${path.system} &> /dev/null - git stash - git pull --rebase - git branch save - git checkout save - git stash pop - git add . - git commit - git push --set-upstream origin save --force - popd &> /dev/null - ;; - "search") - case $2 in - "") error "Expected an Option" "${usage.search}";; - help|--help|-h) echo "${usage.search}";; - cmd.*) - command="''${2//cmd\./}" - echo "Searching for Package providing Command '$command'..." - output=$(nix-locate --whole-name --type x --type s --no-group --top-level --at-root "/bin/$command") - if [ -z "$output" ] - then - error "Command '$command' not found" - else - echo "$output" - fi + ;; + esac ;; - pkgs.*) - package="''${2//pkgs\./}" - echo "Searching for Package '$package'..." - if [ -z "$3" ] + "run") + export NIXPKGS_ALLOW_UNFREE=1 + if [[ "$2" == *[:/]* ]] || grep -wq "$2" <<<"${list inputs + "nixpkgs"}" then - nix search nixpkgs#"$package" + nix run "$2"#"$3" --impure -- "''${@:4}" else - nix search "$3"#"$package" + nix run ${path.system}#"$2" --impure -- "''${@:3}" fi ;; - *) - echo "Searching for Term '$2'..." - manix "$2" + "save") + echo "Saving Changes..." + pushd ${path.system} &> /dev/null + git stash + git pull --rebase + git branch save + git checkout save + git stash pop + git add . + git commit + git push --set-upstream origin save --force + popd &> /dev/null ;; - esac - ;; - "secret") - case $2 in - "") error "Expected an Option" "${usage.secret}";; - help|--help|-h) echo "${usage.secret}";; - "create") - case $3 in - "") error "Expected 'name' of Secret";; + "search") + case $2 in + "") error "Expected an Option" "${usage.search}";; + help|--help|-h) echo "${usage.search}";; + cmd.*) + command="''${2//cmd\./}" + echo "Searching for Package providing Command '$command'..." + output=$(nix-locate --whole-name --type x --type s --no-group --top-level --at-root "/bin/$command") + if [ -z "$output" ] + then + error "Command '$command' not found" + else + echo "$output" + fi + ;; + pkgs.*) + package="''${2//pkgs\./}" + echo "Searching for Package '$package'..." + if [ -z "$3" ] + then + nix search nixpkgs#"$package" + else + nix search "$3"#"$package" + fi + ;; *) - echo "Creating Secret '$3'..." - sops --config ${path.sops} -i ${path.system}/"$3".secret + echo "Searching for Term '$2'..." + manix "$2" ;; esac ;; - "edit") - case $3 in - "") error "Expected 'name' of Secret";; - *) + "secret") + case $2 in + "") error "Expected an Option" "${usage.secret}";; + help|--help|-h) echo "${usage.secret}";; + "create") + case $3 in + "") error "Expected 'name' of Secret";; + *) + echo "Creating Secret '$3'..." + sops --config ${path.sops} -i ${path.system}/"$3".secret + ;; + esac + ;; + "edit") + case $3 in + "") error "Expected 'name' of Secret";; + *) + if find ${path.system} -name "$3".secret | grep "secret" &> /dev/null + then + echo "Editing Secret '$3'..." + find ${path.system} -name "$3".secret -exec sops --config ${path.sops} -i {} \+ + else + error "Unknown Secret '$3'" + fi + ;; + esac + ;; + "list") + echo "## Secrets in ${path.system} ##" + grep / ${path.sops} | sed -e 's|- path_regex:||' -e 's/\/\.\*\$//' -e 's| |${path.system}/|' | xargs tree -C --noreport -P '*.secret' -I '_*' | sed 's/\.secret//' + ;; + "show") if find ${path.system} -name "$3".secret | grep "secret" &> /dev/null then - echo "Editing Secret '$3'..." - find ${path.system} -name "$3".secret -exec sops --config ${path.sops} -i {} \+ + echo "Showing Secret '$3'..." + find ${path.system} -name "$3".secret -exec sops --config ${path.sops} -d {} \+ else error "Unknown Secret '$3'" fi ;; + "update") + echo "Updating Secrets..." + find ${path.system} -name '*.secret' ! -name '_*' -exec sops --config ${path.sops} updatekeys {} \; + ;; + *) error "Unknown Option '$2'" "${usage.secret}";; esac ;; - "list") - echo "## Secrets in ${path.system} ##" - grep / ${path.sops} | sed -e 's|- path_regex:||' -e 's/\/\.\*\$//' -e 's| |${path.system}/|' | xargs tree -C --noreport -P '*.secret' -I '_*' | sed 's/\.secret//' - ;; - "show") - if find ${path.system} -name "$3".secret | grep "secret" &> /dev/null - then - echo "Showing Secret '$3'..." - find ${path.system} -name "$3".secret -exec sops --config ${path.sops} -d {} \+ + "setup") + if [ -d ${path.persist} ]; then + DIR=${path.persist}${path.system} else - error "Unknown Secret '$3'" + DIR=${path.system} fi - ;; - "update") - echo "Updating Secrets..." - find ${path.system} -name '*.secret' ! -name '_*' -exec sops --config ${path.sops} updatekeys {} \; - ;; - *) error "Unknown Option '$2'" "${usage.secret}";; - esac - ;; - "setup") - if [ -d ${path.persist} ]; then - DIR=${path.persist}${path.system} - else - DIR=${path.system} - fi - - echo "Cloning Repository..." - sudo git clone --recurse-submodules ${path.repo} "$DIR" - pushd "$DIR" &> /dev/null; sudo git config core.fileMode false; popd &> /dev/null - sudo chgrp -R keys "$DIR" - newline - read -rp "Enter Path to GPG Keys (path/.git): " KEY - LINK='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' - if [ -z "$KEY" ] - then - error "Path to GPG Keys cannot be empty" - elif [[ $KEY =~ $LINK ]] - then - echo "Cloning Keys..." - git clone "$KEY" keys --progress - else - cp -r "$KEY"/. ./keys - fi - echo "Importing Keys..." - find ./keys -name '*.gpg' -exec sudo gpg --homedir ${path.gpg} --import {} \+ - rm -rf ./keys - newline + echo "Cloning Repository..." + sudo git clone --recurse-submodules ${path.repo} "$DIR" + pushd "$DIR" &> /dev/null; sudo git config core.fileMode false; popd &> /dev/null + sudo chgrp -R keys "$DIR" + newline - nixos apply --activate - ;; - "shell") - case $2 in - "") nix develop ${path.system} --command "$SHELL";; - *) - if grep -wq "$2" <<<"${devShells}" &> /dev/null + read -rp "Enter Path to GPG Keys (path/.git): " KEY + LINK='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' + if [ -z "$KEY" ] + then + error "Path to GPG Keys cannot be empty" + elif [[ $KEY =~ $LINK ]] then - nix develop ${path.system}#"$2" --command "$SHELL" + echo "Cloning Keys..." + git clone "$KEY" keys --progress else - error "Unknown Shell '$2'" "# Available Shells #\n ${devShells}" + cp -r "$KEY"/. ./keys fi + echo "Importing Keys..." + find ./keys -name '*.gpg' -exec sudo gpg --homedir ${path.gpg} --import {} \+ + rm -rf ./keys + newline + + nixos apply --activate ;; - esac - ;; - "update") - case $2 in - help|--help|-h) echo "${usage.update}";; - "--pkgs") - echo "Updating Packages..." - pushd ${path.system}/packages &> /dev/null - bash ${./packages.sh} - popd &> /dev/null - ;; - "--commit") - echo "Updating Flake Inputs..." - nix flake update --flake ${path.system} --commit-lock-file - ;; - "") - echo "Updating Flake Inputs..." - nix flake update --flake ${path.system} + "shell") + case $2 in + "") nix develop ${path.system} --command "$SHELL";; + *) + if grep -wq "$2" <<<"${devShells}" &> /dev/null + then + nix develop ${path.system}#"$2" --command "$SHELL" + else + error "Unknown Shell '$2'" "# Available Shells #\n ${devShells}" + fi + ;; + esac ;; - *) - echo "Updating Flake Input '$2'..." - if [ -z "$3" ] - then - nix flake update --flake ${path.system} "$2" - else + "update") + case $2 in + help|--help|-h) echo "${usage.update}";; + "--pkgs") + echo "Updating Packages..." + pushd ${path.system}/packages &> /dev/null + bash ${./packages.sh} + popd &> /dev/null + ;; + "--commit") + echo "Updating Flake Inputs..." + nix flake update --flake ${path.system} --commit-lock-file + ;; + "") + echo "Updating Flake Inputs..." + nix flake update --flake ${path.system} + ;; + *) + echo "Updating Flake Input '$2'..." + if [ -z "$3" ] + then + nix flake update --flake ${path.system} "$2" + else - nix flake update --flake ${path.system} "$2" --override-input "$2" "$3" - fi + nix flake update --flake ${path.system} "$2" --override-input "$2" "$3" + fi + ;; + esac ;; + *) error "Unknown Option '$1'" "${usage.script}";; esac - ;; - *) error "Unknown Option '$1'" "${usage.script}";; - esac - ''; - }) + ''; + } + ) diff --git a/secrets/default.nix b/secrets/default.nix @@ -5,16 +5,18 @@ pkgs, files, ... -}: let +}: +let path = files.path.gpg; -in { - imports = [inputs.sops.nixosModules.sops]; +in +{ + imports = [ inputs.sops.nixosModules.sops ]; ## Authentication Credentials Management ## config = { environment = { - persist.directories = [path]; - systemPackages = [pkgs.sops]; + persist.directories = [ path ]; + systemPackages = [ pkgs.sops ]; }; sops = { @@ -22,15 +24,12 @@ in { gnupg.home = path; # Encrypted Secrets - secrets = let - directory = ./. + "/${config.networking.hostName}"; - in - util.map.secrets {directory = ./.;} - // ( - if (builtins.pathExists directory) - then util.map.secrets {inherit directory;} - else {} - ); + secrets = + let + directory = ./. + "/${config.networking.hostName}"; + in + util.map.secrets { directory = ./.; } + // (if (builtins.pathExists directory) then util.map.secrets { inherit directory; } else { }); }; }; } diff --git a/shells/cc.nix b/shells/cc.nix @@ -2,5 +2,12 @@ pkgs: { name = "C"; shellHook = ''echo "## C/C++ Development Shell ##"''; LIBCLANG_PATH = "${pkgs.llvmPackages.libclang}/lib"; - packages = with pkgs; [clang cmake gcc gdb bear llvmPackages.libcxx]; + packages = with pkgs; [ + clang + cmake + gcc + gdb + bear + llvmPackages.libcxx + ]; } diff --git a/shells/default.nix b/shells/default.nix @@ -1,10 +1,26 @@ -{pkgs ? import ../packages, ...}: +{ + pkgs ? import ../packages, + ... +}: with pkgs; - mkShell { - name = "devShell"; - packages = [git gnupg jq nixFlakes sops treefmt] ++ [figlet hyfetch]; - shellHook = '' - echo -e "\e[36m## Default Developer Shell ##" - echo -e "\e[34m Version: $(nix --version)" - ''; - } +mkShell { + name = "devShell"; + packages = + [ + git + gnupg + jq + nixFlakes + sops + treefmt + ] + ++ [ + figlet + hyfetch + ]; + + shellHook = '' + echo -e "\e[36m## Default Developer Shell ##" + echo -e "\e[34m Version: $(nix --version)" + ''; +} diff --git a/shells/flake.nix b/shells/flake.nix @@ -1,8 +1,11 @@ -{util, ...}: { +{ util, ... }: +{ ## Developer Shells ## - perSystem = {pkgs, ...}: { - devShells = - util.map.modules ./. (file: pkgs.mkShell (import file pkgs)) - // {default = import ./. {inherit pkgs;};}; - }; + perSystem = + { pkgs, ... }: + { + devShells = util.map.modules ./. (file: pkgs.mkShell (import file pkgs)) // { + default = import ./. { inherit pkgs; }; + }; + }; } diff --git a/shells/java.nix b/shells/java.nix @@ -1,9 +1,15 @@ pkgs: { name = "Java"; - packages = with pkgs; [jdk nodejs scala sbt yarn]; + packages = with pkgs; [ + jdk + nodejs + scala + sbt + yarn + ]; + shellHook = '' echo "## Java Development Shell ##" - NPM_DIR="$XDG_DATA_HOME/npm" mkdir "$NPM_DIR" echo -e "cache=$XDG_CACHE_HOME/npm\nprefix=$XDG_DATA_HOME/npm" > "$NPM_DIR/config" diff --git a/shells/lua.nix b/shells/lua.nix @@ -1,5 +1,8 @@ pkgs: { name = "Lua"; shellHook = ''echo "## Lua Development Shell ##"''; - packages = with pkgs; [lua luaPackages.moonscript]; + packages = with pkgs; [ + lua + luaPackages.moonscript + ]; } diff --git a/shells/python.nix b/shells/python.nix @@ -2,8 +2,8 @@ pkgs: { name = "Python"; packages = [ pkgs.python3 - (pkgs.python3.withPackages (p: - with p; [ + (pkgs.python3.withPackages ( + p: with p; [ pip autopep8 pylint @@ -14,7 +14,8 @@ pkgs: { matplotlib numpy pandas - ])) + ] + )) ]; shellHook = '' diff --git a/shells/rust.nix b/shells/rust.nix @@ -1,10 +1,9 @@ pkgs: { name = "Rust"; - packages = with pkgs; [rustup]; + packages = with pkgs; [ rustup ]; RUST_BACKTRACE = 1; shellHook = '' echo "## Rust Development Shell ##" - RUST_DIR="$XDG_DATA_HOME/rust" export RUSTUP_HOME="$RUST_DIR/rustup" export CARGO_HOME="$RUST_DIR/cargo" diff --git a/shells/sql.nix b/shells/sql.nix @@ -1,6 +1,6 @@ pkgs: { name = "SQL"; - buildInputs = [pkgs.mariadb]; + buildInputs = [ pkgs.mariadb ]; shellHook = '' MYSQL_BASEDIR=${pkgs.mariadb} MYSQL_HOME=$HOME/.mysql diff --git a/site/default.nix b/site/default.nix @@ -3,15 +3,11 @@ pkgs, }: with pkgs; - stdenvNoCC.mkDerivation { - pname = "website"; - version = "stable"; - src = ./.; - buildInputs = [zola]; - installPhase = "cp -r public $out"; - buildPhase = "zola build ${ - if (site != null) - then "--base-url " + site - else "" - }"; - } +stdenvNoCC.mkDerivation { + pname = "website"; + version = "stable"; + src = ./.; + buildInputs = [ zola ]; + installPhase = "cp -r public $out"; + buildPhase = "zola build ${if (site != null) then "--base-url " + site else ""}"; +} diff --git a/site/flake.nix b/site/flake.nix @@ -1,20 +1,22 @@ _: { ## Website Configuration ## - perSystem = {pkgs, ...}: { - # Package - packages.website = pkgs.callPackage ./. {inherit pkgs;}; + perSystem = + { pkgs, ... }: + { + # Package + packages.website = pkgs.callPackage ./. { inherit pkgs; }; - # Development Shell - devShells.website = import ./shell.nix {inherit pkgs;}; + # Development Shell + devShells.website = import ./shell.nix { inherit pkgs; }; - # Formatting Errors - treefmt.config.programs.prettier.excludes = [ - "site/templates/macros/edit.html" - "site/templates/macros/head.html" - "site/templates/macros/javascript.html" - "site/templates/macros/menu.html" - "site/templates/macros/posts.html" - "site/templates/tags/list.html" - ]; - }; + # Formatting Errors + treefmt.config.programs.prettier.excludes = [ + "site/templates/macros/edit.html" + "site/templates/macros/head.html" + "site/templates/macros/javascript.html" + "site/templates/macros/menu.html" + "site/templates/macros/posts.html" + "site/templates/tags/list.html" + ]; + }; } diff --git a/site/shell.nix b/site/shell.nix @@ -1,6 +1,13 @@ -{pkgs ? import ../., ...}: +{ + pkgs ? import ../., + ... +}: pkgs.mkShell { name = "Website"; - packages = with pkgs; [git zola lorri]; + packages = with pkgs; [ + git + zola + lorri + ]; shellHook = ''echo "## Website Builder Shell ##"''; } diff --git a/users/default.nix b/users/default.nix @@ -4,11 +4,20 @@ util, files, ... -}: let +}: +let inherit (builtins) attrValues map; - inherit (lib) mkBefore mkIf mkOption types; + inherit (lib) + mkBefore + mkIf + mkOption + types + ; + cfg = config.credentials.key; -in { + dir = config.home.homeDirectory; +in +{ options.credentials = { name = mkOption { description = "Work User Name"; @@ -39,9 +48,7 @@ in { ## Home Configuration ## config = { - home.file = let - dir = config.home.homeDirectory; - in { + home.file = { # Wallpapers ".local/share/backgrounds".source = files.wallpapers.path; @@ -66,13 +73,19 @@ in { }; publicKeys = - map (source: { - inherit source; - trust = "ultimate"; - }) (attrValues (util.map.files { - directory = ../secrets/keys; - extension = ".gpg"; - })); + map + (source: { + inherit source; + trust = "ultimate"; + }) + ( + attrValues ( + util.map.files { + directory = ../secrets/keys; + extension = ".gpg"; + } + ) + ); }; # XDG Configuration diff --git a/users/navya.nix b/users/navya.nix @@ -1,4 +1,5 @@ -{files, ...}: { +{ files, ... }: +{ # Personal Credentials credentials = { fullname = "Navya G"; diff --git a/users/v7/default.nix b/users/v7/default.nix @@ -4,7 +4,8 @@ pkgs, files, ... -}: { +}: +{ # Personal Credentials credentials = { name = "maydayv7"; @@ -15,7 +16,7 @@ # Home Configuration home = { - packages = [pkgs.home-manager]; + packages = [ pkgs.home-manager ]; # Directory Symlinks file = with files; { @@ -26,8 +27,7 @@ ".config/goa-1.0/accounts.conf".text = builtins.readFile ./accounts.conf; # Dotfiles - "Projects/dotfiles".source = - config.lib.file.mkOutOfStoreSymlink path.system; + "Projects/dotfiles".source = config.lib.file.mkOutOfStoreSymlink path.system; # GTK+ Bookmarks ".config/gtk-3.0/bookmarks".text = lib.mkBefore ''