dotfiles

My PC Dotfiles & Website
commit 9a9c8fe03a8d7301a091a945e89edbc6f9312911
parent 5473ca350adb85ada16743310c86a4493eeca0dd
Author: maydayv7 <maydayv7@gmail.com>
Date:   Wed, 29 Nov 2023 22:32:16 +0530

refactor: Separate `hardware.laptop` module

+ Configure font sizes
+ Show system delta on rebuild

Diffstat:

MREADME.md | 4++--
Mdevices/Futura.nix | 1+
Mdevices/Vortex/default.nix | 4++--
Mfiles/gnome/dconf.nix | 15+++------------
Mfiles/gnome/menu.json | 15+++++++++++++++
Mflake.lock | 25++++++-------------------
Mflake.nix | 5++++-
Mmodules/README.md | 2+-
Mmodules/base/default.nix | 15++++++++++++++-
Mmodules/base/firmware.nix | 51+++++++++++++++++----------------------------------
Mmodules/gui/desktop/gnome.nix | 14+++-----------
Mmodules/gui/fonts.nix | 9+++++++++
Amodules/hardware/laptop.nix | 30++++++++++++++++++++++++++++++
Mmodules/hardware/mobile.nix | 9+++------
Mpackages/overlays/discord.nix | 1-
15 files changed, 110 insertions(+), 90 deletions(-)

diff --git a/README.md b/README.md @@ -419,7 +419,7 @@ You can navigate to the `README`s present in the various directories to know mor - Support declarative [Flatpak](https://flatpak.org/) application install - Allow patching Default Package Channel - Upgrade to GNOME 45 -- Separate `games` module +- Separate `games` and `laptop` module - Miscellaneous Updates ### v13 @@ -625,7 +625,7 @@ You can navigate to the `README`s present in the various directories to know mor - Secure Boot isn't supported yet - Home Configuration can't be decoupled from System - Lack of automatic script checking -- Currently using a workaround for CI due to [NixOS/nix#3978](https://github.com/NixOS/nix/issues/3978) +- Currently using a workaround for CI due to NixOS/nix#3978 #### Manually Managed Packages diff --git a/devices/Futura.nix b/devices/Futura.nix @@ -12,6 +12,7 @@ boot = "efi"; cores = 4; filesystem = "simple"; + support = ["laptop"]; modules = ["common-cpu-intel" "common-pc" "common-pc-laptop"]; }; diff --git a/devices/Vortex/default.nix b/devices/Vortex/default.nix @@ -16,14 +16,14 @@ cores = 8; filesystem = "advanced"; security = true; - support = ["mobile" "printer" "virtualisation"]; + support = ["laptop" "mobile" "printer" "virtualisation"]; modules = ["dell-inspiron-5509"]; vm.android.enable = true; }; gui = { desktop = "gnome"; - wallpaper = "Tomorrow"; + wallpaper = "Nix"; }; nix = { diff --git a/files/gnome/dconf.nix b/files/gnome/dconf.nix @@ -7,6 +7,7 @@ }: with lib.hm.gvariant; let inherit (builtins) head elem; + inherit (lib) mkBefore mkForce; homeDir = config.home.homeDirectory; fonts = sys.fonts.fontconfig.defaultFonts; inherit (sys.gui) wallpaper; @@ -17,7 +18,7 @@ in { ".local/share/backgrounds".source = files.wallpapers.path; # GTK+ Bookmarks - ".config/gtk-3.0/bookmarks".text = lib.mkBefore '' + ".config/gtk-3.0/bookmarks".text = mkBefore '' file://${homeDir}/Documents/TBD TBD ''; }; @@ -132,15 +133,12 @@ in { "org/gnome/desktop/interface" = { color-scheme = "prefer-dark"; clock-show-weekday = true; - document-font-name = "${head fonts.sansSerif} 11"; enable-animations = true; enable-hot-corners = true; font-antialiasing = "grayscale"; font-hinting = "slight"; - font-name = "${head fonts.sansSerif} Medium, Medium 11"; gtk-im-module = "gtk-im-context-simple"; locate-pointer = true; - monospace-font-name = "${head fonts.monospace} 11"; show-battery-percentage = true; toolkit-accessibility = false; }; @@ -188,13 +186,6 @@ in { theme-name = "__custom"; }; - "org/gnome/desktop/background" = { - color-shading-type = "solid"; - picture-options = "zoom"; - picture-uri = "file://${wallpaper}"; - picture-uri-dark = "file://${wallpaper}"; - }; - "org/gnome/desktop/screensaver" = { color-shading-type = "solid"; lock-delay = mkUint32 0; @@ -418,7 +409,7 @@ in { }; # Shell Extensions - "org/gnome/shell/extensions/user-theme".name = "Adwaita"; + "org/gnome/shell/extensions/user-theme".name = mkForce "Adwaita"; "com/ftpix/transparentbar".transparency = 0; "org/gnome/shell/extensions/alphabetical-app-grid".folder-order-position = "start"; "org/gnome/shell/extensions/lockkeys".style = "show-hide"; diff --git a/files/gnome/menu.json b/files/gnome/menu.json @@ -6,6 +6,21 @@ "menu": [ { "type": "submenu", + "title": "File Management", + "icon": "fileopen", + "items": [ + { + "type": "command", + "title": "iPhone", + "command": "systemctl restart usbmuxd.service", + "instancing": "singleInstance", + "icon": "smartphone-symbolic", + "killOnDisable": false + } + ] + }, + { + "type": "submenu", "title": "Virtualisation", "icon": "computer-symbolic", "items": [ diff --git a/flake.lock b/flake.lock @@ -440,21 +440,6 @@ "type": "github" } }, - "nixpkgs_4": { - "locked": { - "lastModified": 1696484316, - "narHash": "sha256-LE7F+Wrvo1B8OR3E1bITYAcfBaNKXLHqBrXoZEtqrTQ=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "47db6b44173e3360cb2339f5acda13db04f72ae9", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" - } - }, "nur": { "locked": { "lastModified": 1701068004, @@ -472,15 +457,17 @@ }, "proprietary": { "inputs": { - "nixpkgs": "nixpkgs_4", + "nixpkgs": [ + "nixpkgs" + ], "utils": "utils" }, "locked": { - "lastModified": 1697710837, - "narHash": "sha256-cqobLuhtRrxLe1E0n4ke4Frc7gxiIPD21qvrWpSzzy8=", + "lastModified": 1701185968, + "narHash": "sha256-/6mE9H8gcOauE8BzB2l4ajCipdMb4QcyQqAZhUXPANU=", "owner": "maydayv7", "repo": "proprietary", - "rev": "e69524e448c9cfe9e8008f5f496d9a29bcd1b010", + "rev": "7e971291c54c8ce2d78cce49c09b0a1f2990abf1", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix @@ -47,7 +47,10 @@ nur.url = "github:nix-community/NUR"; # Proprietary Software - proprietary.url = "github:maydayv7/proprietary"; + proprietary = { + url = "github:maydayv7/proprietary"; + inputs.nixpkgs.follows = "nixpkgs"; + }; # Packaged Games gaming = { diff --git a/modules/README.md b/modules/README.md @@ -38,7 +38,7 @@ The `modules` directory contains custom-made pure Flakes-compatible configuratio - `persist`: System Files to Preserve across Reboots (while using `advanced` File System Layout) - `modules`: List of Hardware Configuration Modules imported from [`inputs.hardware`](https://github.com/nixos/nixos-hardware) - Ex. `[ "common-pc" ]` - `security`: Enable Additional Security and Hardening Settings - `true / false` - - `support`: List of Additional Supported Hardware - `[ "mobile" "printer" "ssd" "virtualisation" ]` + - `support`: List of Additional Supported Hardware - `[ "laptop" "mobile" "printer" "virtualisation" ]` - `vm`: Configure Virtualisation Support - - `android`: Enable Android Virtualisation - `passthrough`: PCI Device IDs for VM Passthrough using VFI/O (Use [`scripts/pci.sh`](../scripts/pci.sh)) - Ex. `[ "00:02.0" "00:1c.0" ]` diff --git a/modules/base/default.nix b/modules/base/default.nix @@ -6,5 +6,18 @@ imports = util.map.module ./.; ## Base Configuration ## - config.documentation.nixos.enable = false; + config = { + # Documentation + documentation.nixos.enable = false; + + # Rebuild Delta + system.activationScripts.diff = { + supportsDryActivation = true; + text = '' + if [[ -e /run/current-system ]]; then + ${pkgs.nix}/bin/nix store diff-closures /run/current-system "$systemConfig" + fi + ''; + }; + }; } diff --git a/modules/base/firmware.nix b/modules/base/firmware.nix @@ -16,26 +16,8 @@ pulseaudio.enable = lib.mkForce false; }; - services = { - fwupd.enable = true; - logind.extraConfig = "HandleLidSwitch=ignore"; - }; - - # Touchpad - services.xserver.libinput = { - enable = true; - touchpad = { - tapping = true; - tappingDragLock = true; - middleEmulation = true; - naturalScrolling = false; - disableWhileTyping = true; - scrollMethod = "twofinger"; - accelSpeed = "0.7"; - }; - }; - # Driver Packages + services.fwupd.enable = true; hardware.opengl.extraPackages = with pkgs; [ intel-media-driver libvdpau-va-gl @@ -80,6 +62,22 @@ firewall.enable = true; }; + # Power Management + services.thermald.enable = true; + powerManagement = { + enable = true; + cpuFreqGovernor = "powersave"; + }; + + # Memory + systemd.oomd.enable = false; + services.earlyoom = { + enable = true; + enableNotifications = true; + freeMemThreshold = 5; + freeSwapThreshold = 15; + }; + ## Encryption # GPG programs.gnupg.agent = { @@ -109,20 +107,5 @@ } ]; }; - - # Power Management - services.thermald.enable = true; - powerManagement = { - enable = true; - cpuFreqGovernor = "powersave"; - }; - - systemd.oomd.enable = false; - services.earlyoom = { - enable = true; - enableNotifications = true; - freeMemThreshold = 5; - freeSwapThreshold = 15; - }; }; } diff --git a/modules/gui/desktop/gnome.nix b/modules/gui/desktop/gnome.nix @@ -68,6 +68,7 @@ in { imports = [gnome.dconf]; # GTK+ Theming + stylix.targets.gnome.enable = true; gtk = { enable = true; theme = { @@ -105,14 +106,6 @@ in { # Window Tiling Stylesheet ".config/forge/stylesheet/forge/stylesheet.css".source = gnome.tiling; - # Prevent Suspension on lid close - ".config/autostart/ignore-lid-switch-tweak.desktop".text = '' - [Desktop Entry] - Type=Application - Name=ignore-lid-switch-tweak - Exec=${pkgs.gnome.gnome-tweaks}/libexec/gnome-tweak-tool-lid-inhibitor - ''; - # Discord DNOME Theme ".config/BetterDiscord/data/stable/custom.css" = mkIf (exists pkgs.discord) @@ -122,7 +115,7 @@ in { ".mozilla/firefox/default/chrome/userChrome.css".text = ''@import "${pkgs.custom.firefox-gnome-theme}/userChrome.css";''; ".mozilla/firefox/default/chrome/userContent.css".text = firefox.theme; - # Workaround for https://github.com/NixOS/nixpkgs/issues/47340 + # Workaround for NixOS/nixpkgs/47340 ".mozilla/native-messaging-hosts/org.gnome.chrome_gnome_shell.json".source = "${pkgs.chrome-gnome-shell}/lib/mozilla/native-messaging-hosts/org.gnome.chrome_gnome_shell.json"; }; @@ -131,8 +124,7 @@ in { programs.vscode = mkIf (exists pkgs.vscode) { extensions = [pkgs.vscode-extensions.piousdeer.adwaita-theme]; userSettings = { - "workbench.preferredDarkColorTheme" = "Adwaita Dark"; - "workbench.preferredLightColorTheme" = "Adwaita Light"; + "workbench.colorTheme" = "Adwaita Dark"; "workbench.productIconTheme" = "adwaita"; "window.titleBarStyle" = "custom"; "terminal.external.linuxExec" = "blackbox"; diff --git a/modules/gui/fonts.nix b/modules/gui/fonts.nix @@ -39,6 +39,7 @@ }; stylix.fonts = { + # Default Fonts serif = { package = pkgs.noto-fonts; name = "Noto Serif"; @@ -58,6 +59,14 @@ package = pkgs.noto-fonts-color-emoji; name = "Noto Color Emoji"; }; + + # Font Size + sizes = { + applications = 11; + desktop = 11; + popups = 10; + terminal = 12; + }; }; # Font Packages diff --git a/modules/hardware/laptop.nix b/modules/hardware/laptop.nix @@ -0,0 +1,30 @@ +{ + config, + lib, + ... +}: let + enable = builtins.elem "laptop" config.hardware.support; +in { + ## Laptop Configuration ## + config = lib.mkIf enable { + # Lid + services.logind.extraConfig = '' + HandleLidSwitch=lock + HandleLidSwitchExternalPower=lock + ''; + + # Touchpad + services.xserver.libinput = { + enable = true; + touchpad = { + tapping = true; + tappingDragLock = true; + middleEmulation = true; + naturalScrolling = false; + disableWhileTyping = true; + scrollMethod = "twofinger"; + accelSpeed = "0.7"; + }; + }; + }; +} diff --git a/modules/hardware/mobile.nix b/modules/hardware/mobile.nix @@ -8,17 +8,14 @@ in { ## Device Firmware ## config = lib.mkIf enable { - ## Android Compatibilty Configuration ## + ## Android Compatibilty # Android Device Bridge user.groups = ["adbusers"]; programs.adb.enable = true; - ## iOS Compatibilty Configuration ## + ## iOS Compatibility # File Transfer - environment.systemPackages = [pkgs.libimobiledevice]; - - #!# Run the following command to start service: - #!# sudo systemctl restart usbmuxd.service services.usbmuxd.enable = true; + environment.systemPackages = [pkgs.libimobiledevice]; }; } diff --git a/packages/overlays/discord.nix b/packages/overlays/discord.nix @@ -2,7 +2,6 @@ final: prev: { # Update Discord to latest version discord = prev.discord.overrideAttrs (_: rec { version = "0.0.34"; - src = prev.fetchzip { url = "https://dl.discordapp.net/apps/linux/${version}/discord-${version}.tar.gz"; sha256 = "sha256-cLkc3ezMABO7y62HFyuxB0nTs0M0sg0S0oxiTsO2IYE=";