dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
commit 816f467f4745c9740e6b48b269030d0657411408 parent 0ebd8139cfb8218c04ba657d35f8aed6fea9ff0b Author: maydayv7 <maydayv7@gmail.com> Date: Fri, 25 Oct 2024 00:53:55 +0530 feat: Refine Specialisations Also bring back Pano in GNOME
Diffstat:
| M | README.md | | | 3 | ++- |
| M | devices/README.md | | | 4 | ++-- |
| M | files/gnome/settings/extensions.nix | | | 54 | ++++++++++++++++++++++++++++++++---------------------- |
| M | modules/base/default.nix | | | 40 | ++++++++++++++++++++++------------------ |
| M | modules/configuration.nix | | | 7 | ++----- |
| M | modules/gui/desktop/gnome/default.nix | | | 2 | +- |
| M | modules/gui/xorg.nix | | | 2 | +- |
| M | modules/hardware/boot.nix | | | 2 | +- |
| M | modules/hardware/default.nix | | | 13 | +++++++++++-- |
| M | modules/hardware/virtualisation/vfio.nix | | | 10 | ++++++---- |
| A | packages/gnome-pano/default.nix | | | 44 | ++++++++++++++++++++++++++++++++++++++++++++ |
| A | packages/gnome-pano/imports.patch | | | 27 | +++++++++++++++++++++++++++ |
| R | packages/paperwm/default.nix -> packages/gnome-paperwm/default.nix | | | 0 | |
| R | packages/paperwm/metadata.nix -> packages/gnome-paperwm/metadata.nix | | | 0 | |
| M | scripts/nixos.nix | | | 20 | ++++++++++++++++---- |
15 files changed, 167 insertions(+), 61 deletions(-)
diff --git a/README.md b/README.md @@ -506,10 +506,11 @@ You can navigate to the `README`s present in the various directories to know mor ### v24.1 - GNOME Improvements - - Use [PaperWM](https://github.com/paperwm/PaperWM) + - Use [PaperWM](https://github.com/paperwm/PaperWM) and [Pano](https://github.com/oae/gnome-shell-pano) - Remove unneeded extensions - Add Looking Glass to VFIO Configuration - Remove needless `wfvm` Configuration +- Refine Specialisations ### v24 diff --git a/devices/README.md b/devices/README.md @@ -6,14 +6,14 @@ The `devices` directory contains the core definitions for multiple PCs and vario These are the options that can be used in addition to the ones exposed by the [`modules`](../modules/README.md): -- `description`: System Description (to add to `config.system.nixos.label`) +- `description`: System Description (to add to `config.system.name`) - `timezone`: System Time Zone - Ex. `"Asia/Kolkata"` - `locale`: Default Locale - Ex. `"IN"` - `kernel`: Linux Kernel to use (from `pkgs.linuxKernel.packages.linux_${kernel}`) - Ex. `zfs` - `kernelModules`: Additional Kernel Modules (to add to `config.boot.initrd.availableKernelModules`) - Ex. `[ "nvme" ]` - `imports`: Additional Configuration Files to import - Ex. `[ ./hardware-configuration.nix ]` - `format`: Generates Output for Specified Target Format (See [this](https://github.com/nix-community/nixos-generators#supported-formats) for the list of supported formats) -- `user` or `users` (---> `config.user.settings`): Used to specify Device User/Multiple Users per Device - Ex. `users = [ { name "1"; } { name = "2"; } ]` +- `user` or `users` (--> `config.user.settings`): Used to specify Device User/Multiple Users per Device - Ex. `users = [ { name "1"; } { name = "2"; } ]` - `update`: Enable Automatic System Upgrades - Ex. `weekly` - `channel`: Specify which Package Channel the system is built from - Ex. `unstable` diff --git a/files/gnome/settings/extensions.nix b/files/gnome/settings/extensions.nix @@ -1,12 +1,16 @@ { sys, + config, lib, pkgs, files, ... }: let - inherit (builtins) filter hasAttr map; + inherit (builtins) filter hasAttr head map; inherit (lib) foldr hm mapAttrs' mkForce nameValuePair optionals recursiveUpdate; + homeDir = config.home.homeDirectory; + font = head sys.fonts.fontconfig.defaultFonts.sansSerif; + latest = pkgs.unstable.gnomeExtensions; # Shell Extensions @@ -50,7 +54,7 @@ "a11y" "aggregateMenu" "drive-menu" - "clipboardIndicator" + "pano@elhan.io" "vitalsMenu" "dwellClick" "lockkeys" @@ -132,22 +136,6 @@ }; } { - package = clipboard-indicator; - settings = { - cache-size = 20; - clear-history = []; - disable-down-arrow = true; - history-size = 100; - keep-selected-on-clear = true; - move-item-first = true; - next-entry = []; - pinned-on-bottom = true; - prev-entry = []; - private-mode-binding = ["<Ctrl><Super>v"]; - toggle-menu = ["<Super>v"]; - }; - } - { package = wsp-windows-search-provider; name = "windows-search-provider"; settings = { @@ -158,7 +146,29 @@ }; } { - package = pkgs.custom.paperwm; + 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 = pkgs.custom.gnome-paperwm; settings = { animation-time = 0.25; @@ -297,8 +307,8 @@ favorites-notify = 1; highlighting-style = 1; hot-corner-action = 1; - hot-corner-fullscreen = true; - hot-corner-position = 3; + hot-corner-fullscreen = false; + hot-corner-position = 1; hot-corner-ripples = true; layout-module = true; message-tray-module = true; @@ -312,7 +322,7 @@ overlay-key-secondary = 1; overview-bg-blur-sigma = 50; overview-bg-brightness = 50; - overview-esc-behavior = 0; + overview-esc-behavior = 1; overview-mode = 0; panel-module = true; panel-position = 0; diff --git a/modules/base/default.nix b/modules/base/default.nix @@ -8,8 +8,9 @@ ... }: let inherit (builtins) attrNames map; - inherit (lib) removePrefix mkIf mkOption optionals types; + inherit (lib) hasPrefix mkIf mkOption optionals removePrefix types; cfg = config.base; + inherit (config.system.nixos) label; in { ## BASE Configuration ## imports = util.map.modules.list ./. ++ [inputs.generators.nixosModules.all-formats]; @@ -54,22 +55,25 @@ in { }; # Essential Utilities - environment.systemPackages = with pkgs; [ - cryptsetup - inxi - killall - man-pages - mkpasswd - ntfsprogs - parted - pciutils - rsync - sdparm - smartmontools - unrar - unzip - usbutils - wget - ]; + environment = { + variables."NIXOS_SPECIALISATION" = mkIf (hasPrefix "special." label) (removePrefix "special." label); + systemPackages = with pkgs; [ + cryptsetup + inxi + killall + man-pages + mkpasswd + ntfsprogs + parted + pciutils + rsync + sdparm + smartmontools + unrar + unzip + usbutils + wget + ]; + }; }; } diff --git a/modules/configuration.nix b/modules/configuration.nix @@ -127,6 +127,8 @@ in # Package Configuration nixpkgs = {inherit pkgs;}; system = { + name = "${name}-${replaceStrings [" "] ["_"] description}"; + # Updates autoUpgrade = { enable = mkIf (update != "") true; @@ -143,11 +145,6 @@ in stateVersion = fileContents "${inputs."${channel}"}/.version"; configurationRevision = if (self ? rev) - then self.rev - else null; - name = "${name}-${replaceStrings [" "] ["_"] description}"; - nixos.label = - if (self ? rev) then "${substring 0 8 self.lastModifiedDate}.${self.shortRev}" else if (self ? dirtyRev) then self.dirtyShortRev diff --git a/modules/gui/desktop/gnome/default.nix b/modules/gui/desktop/gnome/default.nix @@ -205,7 +205,7 @@ in { # Extensions ".config/paperwm" - ".cache/clipboard-indicator@tudmotu.com" + ".local/share/clipboard" ]; }) diff --git a/modules/gui/xorg.nix b/modules/gui/xorg.nix @@ -24,7 +24,7 @@ in { # System Specialisation specialisation.xorg.configuration = { - system.nixos.tags = ["xorg"]; + system.nixos.label = "special.xorg"; gui.wayland.enable = mkForce false; hardware.vm.android.enable = mkForce false; }; diff --git a/modules/hardware/boot.nix b/modules/hardware/boot.nix @@ -55,7 +55,7 @@ in { # Debug specialisation.recovery.configuration = { - system.nixos.tags = ["recovery"]; + system.nixos.label = "special.recovery"; boot = { initrd.verbose = mkForce true; plymouth.enable = mkForce false; diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix @@ -43,9 +43,18 @@ in { config = { powerManagement.cpuFreqGovernor = cfg.cpu.mode; nix.settings.max-jobs = cfg.cpu.cores; + specialisation = { - powersave.configuration.hardware.cpu.mode = mkForce "powersave"; - performance.configuration.hardware.cpu.mode = mkForce "performance"; + powersave.configuration = { + system.nixos.label = "special.powersave"; + gui.fancy = mkForce false; + hardware.cpu.mode = mkForce "powersave"; + }; + + performance.configuration = { + system.nixos.label = "special.performance"; + hardware.cpu.mode = mkForce "performance"; + }; }; }; } diff --git a/modules/hardware/virtualisation/vfio.nix b/modules/hardware/virtualisation/vfio.nix @@ -25,14 +25,16 @@ in { ## VFIO Configuration ## config = mkMerge [ (mkIf enable { - specialisation.vfio.configuration.hardware = { - vm.vfio = true; - cpu.mode = mkForce "performance"; + specialisation.vfio.configuration = { + system.nixos.label = "special.vfio"; + hardware = { + vm.vfio = true; + cpu.mode = mkForce "performance"; + }; }; }) (mkIf (enable && cfg.vfio) { - system.nixos.tags = ["vfio"]; boot = { kernelParams = [ "amd_iommu=pt" diff --git a/packages/gnome-pano/default.nix b/packages/gnome-pano/default.nix @@ -0,0 +1,44 @@ +{ + lib, + pkgs, + ... +}: +with pkgs; let + uuid = "pano@elhan.io"; +in + stdenv.mkDerivation rec { + pname = "pano"; + version = "v23-alpha2"; + src = fetchzip { + url = "https://github.com/oae/gnome-shell-pano/releases/download/${version}/${uuid}.zip"; + sha256 = "sha256-Y8WgVUHX094RUwYKdt7OROPZMl3dakK0zOU9OTdyqxc="; + stripRoot = false; + }; + + patches = [ + (substituteAll { + src = ./imports.patch; + inherit gsound libgda; + }) + ]; + + nativeBuildInputs = [wrapGAppsHook]; + buildInputs = [gnome.gnome-shell libgda gsound]; + installPhase = '' + mkdir -p $out/share/gnome-shell/extensions + cp -r -T . $out/share/gnome-shell/extensions/${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"]; + }; + } diff --git a/packages/gnome-pano/imports.patch b/packages/gnome-pano/imports.patch @@ -0,0 +1,27 @@ +diff --git a/__nix-prepend-search-paths.js b/__nix-prepend-search-paths.js +new file mode 100644 +index 0000000..bf3071b +--- /dev/null ++++ b/__nix-prepend-search-paths.js +@@ -0,0 +1,3 @@ ++import GIRepository from 'gi://GIRepository'; ++GIRepository.Repository.prepend_search_path('@gsound@/lib/girepository-1.0'); ++GIRepository.Repository.prepend_search_path('@libgda@/lib/girepository-1.0'); +diff --git a/extension.js b/extension.js +index a3d6741..6a38850 100644 +--- a/extension.js ++++ b/extension.js +@@ -1,3 +1,4 @@ ++import './__nix-prepend-search-paths.js'; + import Gio from 'gi://Gio'; + import GLib from 'gi://GLib'; + import Shell from 'gi://Shell'; +diff --git a/prefs.js b/prefs.js +index 5dd94eb..634b2ef 100644 +--- a/prefs.js ++++ b/prefs.js +@@ -1,3 +1,4 @@ ++import './__nix-prepend-search-paths.js'; + import Gdk from 'gi://Gdk'; + import Gtk from 'gi://Gtk'; + import { ExtensionPreferences } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; diff --git a/packages/paperwm/default.nix b/packages/gnome-paperwm/default.nix diff --git a/packages/paperwm/metadata.nix b/packages/gnome-paperwm/metadata.nix diff --git a/scripts/nixos.nix b/scripts/nixos.nix @@ -118,14 +118,26 @@ in case $2 in help|--help|-h) echo "${usage.apply}";; "") - echo "Applying Configuration..." - sudo nixos-rebuild switch --flake ${path.system}# + 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 "") - echo "Activating Configuration..." - sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch + 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..."