dotfiles

My PC Dotfiles & Website
commit b4253c28a151c0598ca2ae374fd2fcd525e42e47
parent a34d02b6ae96b05fc8fde054631d4b90d70158e4
Author: maydayv7 <maydayv7@gmail.com>
Date:   Thu, 26 Oct 2023 22:18:42 +0530

feat: Add `gui.{wallpaper,wayland}`

+ Fix XFCE Settings
+ Make `gui.desktop` optional

Diffstat:

MREADME.md | 4++++
Mconfiguration.nix | 11+++++------
Mdevices/Vortex/default.nix | 6+++++-
Mfiles/default.nix | 11++++-------
Mfiles/gnome/dconf.nix | 7++++---
Mfiles/xfce/settings/xfce4-desktop.xml | 5+----
Mmodules/README.md | 3+++
Mmodules/apps/firefox.nix | 6------
Mmodules/gui/default.nix | 9+++------
Mmodules/gui/desktop/gnome.nix | 58++++++++++++++++++++++++++--------------------------------
Mmodules/gui/desktop/xfce.nix | 36+++++++++++++++++++++++-------------
Mmodules/gui/theme.nix | 22++++++++++++++++------
Amodules/gui/wayland.nix | 22++++++++++++++++++++++
Mmodules/user/default.nix | 6++++--
14 files changed, 120 insertions(+), 86 deletions(-)

diff --git a/README.md b/README.md @@ -391,6 +391,7 @@ _Thanks a lot! ;)_ - [cole-h](https://github.com/cole-h/nixos-config/) - [colemickens](https://github.com/cole-mickens/nixcfg) - [davidtwco](https://github.com/davidtwco/veritas) + - [fufexan](https://github.com/fufexan/dotfiles) - [gvolpe](https://github.com/gvolpe/nix-config) - [hlissner](https://github.com/hlissner/dotfiles) - [jordanisaacs](https://github.com/jordanisaacs/dotfiles) @@ -399,6 +400,7 @@ _Thanks a lot! ;)_ - [lucasew](https://github.com/lucasew/nixcfg) - [nobbz](https://github.com/NobbZ/nixos-config) - [rasendubi](https://github.com/rasendubi/dotfiles) + - [tejing1](https://github.com/tejing1/nixos-config) - [vlaci](https://github.com/vlaci/nixos-config) - [wiltaylor](https://github.com/wiltaylor/dotfiles) @@ -419,6 +421,8 @@ You can navigate to the `README`s present in the various directories to know mor - Remove `inputs` patching Support - Fix first boot installation - Add conditional to `lib.map.files` +- Add `gui.{wallpaper,wayland}` +- Enable `firefox` by default ### 23.05 (v12) diff --git a/configuration.nix b/configuration.nix @@ -67,9 +67,7 @@ in // {default = self.packages."${system}".dotfiles;} // inputs.proprietary.packages."${system}"; }) - // (let - defaultPkgs = self.legacyPackages."${builtins.head systems}"; - in { + // { # Overrides overlays = map.modules ./packages/overlays import; @@ -82,7 +80,7 @@ in }; ## Program Configuration and 'dotfiles' ## - files = import ./files lib inputs defaultPkgs; + files = import ./files lib inputs; ## Custom Configuration Modules ## nixosModules = @@ -97,7 +95,8 @@ in ## Virtual Machines ## vmConfigurations = - map.modules ./devices/vm (name: import name inputs.windows.lib defaultPkgs); + map.modules ./devices/vm + (name: import name inputs.windows.lib self.legacyPackages."${builtins.head systems}"); ## Install Media Configuration ## installMedia = { @@ -117,4 +116,4 @@ in gui.desktop = "xfce"; }; }; - }) + } diff --git a/devices/Vortex/default.nix b/devices/Vortex/default.nix @@ -21,7 +21,11 @@ vm.android.enable = true; }; - gui.desktop = "gnome"; + gui = { + desktop = "gnome"; + wallpaper = "Sunrise"; + }; + shell.utilities = true; apps.list = ["discord" "git" "office" "vscode" "wine"]; diff --git a/files/default.nix b/files/default.nix @@ -1,6 +1,6 @@ -lib: inputs: pkgs: let +lib: inputs: let inherit (lib.util) build map; - inherit (builtins) fromJSON readFile replaceStrings; + inherit (builtins) fromJSON readFile; in rec { ## Dotfiles ## # File Paths @@ -58,6 +58,7 @@ in rec { # Custom Proprietary Files proprietary = inputs.proprietary.files; + inherit (proprietary) wallpapers; # Nano Text Editor nano = readFile ./nano/nanorc; @@ -85,11 +86,7 @@ in rec { css = readFile ./xfce/gtk.css; panel = ./xfce/panel; terminal = readFile ./xfce/terminalrc; - settings = - map.files ./xfce/settings - (file: - replaceStrings ["@system" "@desktop"] - [path.system pkgs.xfce.xfdesktop.outPath] (readFile file)) ".xml"; + settings = ./xfce/settings; }; # My Personal Website diff --git a/files/gnome/dconf.nix b/files/gnome/dconf.nix @@ -9,11 +9,12 @@ with lib.hm.gvariant; let inherit (builtins) head elem; homeDir = config.home.homeDirectory; fonts = sys.fonts.fontconfig.defaultFonts; + inherit (sys.gui) wallpaper; in { # Home Directory home.file = { # Wallpapers - ".local/share/backgrounds".source = files.proprietary.wallpapers.path; + ".local/share/backgrounds".source = files.wallpapers.path; # GTK+ Bookmarks ".config/gtk-3.0/bookmarks".text = lib.mkBefore '' @@ -191,8 +192,8 @@ in { "org/gnome/desktop/background" = { color-shading-type = "solid"; picture-options = "zoom"; - primary-color = "#000000000000"; - secondary-color = "#000000000000"; + picture-uri = "file://${wallpaper}"; + picture-uri-dark = "file://${wallpaper}"; }; "org/gnome/desktop/screensaver" = { diff --git a/files/xfce/settings/xfce4-desktop.xml b/files/xfce/settings/xfce4-desktop.xml @@ -7,22 +7,19 @@ <property name="workspace0" type="empty"> <property name="color-style" type="int" value="0"/> <property name="image-style" type="int" value="4"/> - <property name="last-image" type="string" value="@system/files/images/wallpapers/Sunset.jpg"/> + <property name="last-image" type="string" value="@wallpaper"/> </property> <property name="workspace1" type="empty"> <property name="color-style" type="int" value="0"/> <property name="image-style" type="int" value="5"/> - <property name="last-image" type="string" value="@desktop/share/backgrounds/xfce/xfce-verticals.png"/> </property> <property name="workspace2" type="empty"> <property name="color-style" type="int" value="0"/> <property name="image-style" type="int" value="5"/> - <property name="last-image" type="string" value="@desktop/share/backgrounds/xfce/xfce-verticals.png"/> </property> <property name="workspace3" type="empty"> <property name="color-style" type="int" value="0"/> <property name="image-style" type="int" value="5"/> - <property name="last-image" type="string" value="@desktop/share/backgrounds/xfce/xfce-verticals.png"/> </property> </property> </property> diff --git a/modules/README.md b/modules/README.md @@ -22,9 +22,12 @@ The `modules` directory contains custom-made pure Flakes-compatible configuratio - [`gui`](./gui): Module that configures GUI Desktops/Environments and the like - - `desktop`: Choice of GUI Desktop - `"gnome" / "xfce"` + - `wallpaper`: Desktop Wallpaper Choice (taken from `files.wallpapers`) - `fonts` - - `enable`: Enable Fonts Configuration - `true / false` - `usrshare`: Create`/usr/share/fonts` and fill it with the system fonts - `true / false` + - `wayland` - + - `enable`: Enable Wayland Configuration - `true / false` - [`hardware`](./hardware): Module that configures device and additional hardware - diff --git a/modules/apps/firefox.nix b/modules/apps/firefox.nix @@ -12,12 +12,6 @@ sessionVariables.MOZ_USE_XINPUT2 = "1"; }; - # Desktop Integration - xdg.portal = { - enable = true; - extraPortals = [pkgs.xdg-desktop-portal-wlr]; - }; - user = { persist.directories = [".cache/mozilla/firefox" ".mozilla/firefox"]; home = { diff --git a/modules/gui/default.nix b/modules/gui/default.nix @@ -16,10 +16,7 @@ in { default = ""; }; - config.assertions = [ - { - assertion = config.gui.desktop != ""; - message = options.gui.desktop.description + " must be set"; - } - ]; + config.warnings = + optional (config.gui.desktop == "") + (options.gui.desktop.description + " is unset"); } diff --git a/modules/gui/desktop/gnome.nix b/modules/gui/desktop/gnome.nix @@ -33,12 +33,13 @@ in { # Full-Fledged GNOME Desktop Configuration (mkIf (desktop == "gnome") { # Desktop Integration - gui.fonts.enable = true; - xdg.portal.enable = true; + gui = { + fonts.enable = true; + wayland.enable = true; + }; programs = { dconf.enable = true; - xwayland.enable = true; gnupg.agent.pinentryFlavor = mkIf config.programs.gnupg.agent.enable "gnome3"; }; @@ -153,11 +154,9 @@ in { # GNOME Apps gnome-boxes gnome-dictionary - gnome-notes gnome-sound-recorder gnome-text-editor gnome-tweaks - polari # GNOME Games gnome-chess @@ -173,7 +172,6 @@ in { drawing fractal fragments - giara gimp gradience gnome-podcasts @@ -228,32 +226,28 @@ in { }; # Persisted Files - user.persist = { - files = [".config/org.gabmus.giara.json"]; - directories = [ - ".config/dconf" - ".config/gnome-boxes" - ".config/gnome-builder" - ".config/GIMP" - ".config/gtk-3.0" - ".config/gtk-4.0" - ".config/pitivi" - ".local/share/clipboard" - ".local/share/epiphany" - ".local/share/evolution" - ".local/share/geary" - ".local/share/gnome-boxes" - ".local/share/gnome-builder" - ".local/share/lollypop" - ".local/share/nautilus" - ".local/share/polari" - ".local/share/telepathy" - ".local/share/webkitgtk" - ".cache/fractal" - ".cache/gnome-builder" - ".cache/timepp_gnome_shell_extension" - ]; - }; + user.persist.directories = [ + ".config/dconf" + ".config/gnome-boxes" + ".config/gnome-builder" + ".config/GIMP" + ".config/gtk-3.0" + ".config/gtk-4.0" + ".config/pitivi" + ".local/share/clipboard" + ".local/share/epiphany" + ".local/share/evolution" + ".local/share/geary" + ".local/share/gnome-boxes" + ".local/share/gnome-builder" + ".local/share/lollypop" + ".local/share/nautilus" + ".local/share/telepathy" + ".local/share/webkitgtk" + ".cache/fractal" + ".cache/gnome-builder" + ".cache/timepp_gnome_shell_extension" + ]; }) # Minimal GNOME Desktop Configuration diff --git a/modules/gui/desktop/xfce.nix b/modules/gui/desktop/xfce.nix @@ -6,10 +6,10 @@ ... }: with files; let - inherit (builtins) elem; - inherit (config.gui) desktop; + inherit (builtins) elem readFile; + inherit (config.gui) desktop wallpaper; apps = config.environment.systemPackages; - inherit (lib) mapAttrs' mkIf mkForce mkMerge nameValuePair util; + inherit (lib) mapAttrs' mkIf mkForce mkMerge nameValuePair replaceStrings util; # GTK+ Theme theme = { @@ -66,11 +66,14 @@ in { # Plugins programs = { xfconf.enable = true; - thunar.plugins = with pkgs.xfce; [ - thunar-archive-plugin - thunar-dropbox-plugin - thunar-volman - ]; + thunar = { + enable = true; + plugins = with pkgs.xfce; [ + thunar-archive-plugin + thunar-dropbox-plugin + thunar-volman + ]; + }; }; # Utilities @@ -105,15 +108,19 @@ in { }; # Color Scheme - stylix = { - image = proprietary.wallpapers.Sunset; - base16Scheme = colors.arc; + stylix.base16Scheme = colors.arc; + + # QT Theme + qt = { + enable = true; + platformTheme = "gtk2"; + style = "gtk2"; }; # User Configuration user.home = { # GTK+ Theming - stylix.targets.xfce.enable = true; + stylix.targets.xfce.enable = false; gtk = { enable = true; @@ -152,7 +159,10 @@ in { // mapAttrs' (name: value: nameValuePair ".config/xfce4/xfconf/xfce-perchannel-xml/${name}.xml" {text = value;}) - xfce.settings; + (util.map.files xfce.settings + (file: + replaceStrings ["@system" "@wallpaper"] + [path.system wallpaper] (readFile file)) ".xml"); # Code Editor Settings programs.vscode = mkIf (elem pkgs.vscode apps) { diff --git a/modules/gui/theme.nix b/modules/gui/theme.nix @@ -4,24 +4,34 @@ inputs, files, ... -}: -with files.proprietary.wallpapers; { +}: let + inherit (lib) attrNames hasSuffix mkOption types; + cfg = config.gui; +in { imports = [inputs.stylix.nixosModules.stylix]; + options.gui.wallpaper = mkOption { + description = "Desktop Wallpaper Choice"; + type = types.enum (attrNames files.wallpapers); + default = "Beauty"; + apply = image: files.wallpapers."${image}"; + }; + ## Base16 Color Theming ## config = { stylix = - {autoEnable = false;} + { + autoEnable = false; + image = cfg.wallpaper; + } // ( - if (lib.hasSuffix "-minimal" config.gui.desktop) + if (cfg.desktop == "" || hasSuffix "-minimal" cfg.desktop) then { homeManagerIntegration.autoImport = false; - image = Beauty; } else { homeManagerIntegration.autoImport = true; polarity = "dark"; - image = lib.mkDefault Sunrise; targets = { console.enable = true; kmscon.enable = true; diff --git a/modules/gui/wayland.nix b/modules/gui/wayland.nix @@ -0,0 +1,22 @@ +{ + lib, + pkgs, + ... +}: { + options.gui.wayland.enable = lib.mkEnableOption "Enable Wayland Configuration"; + + ## Wayland Configuration ## + config = { + # Environment Setup + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + # Legacy Programs Support + programs.xwayland.enable = true; + + # Desktop Integration + xdg.portal = { + enable = true; + wlr.enable = true; + }; + }; +} diff --git a/modules/user/default.nix b/modules/user/default.nix @@ -128,16 +128,18 @@ in { find = findSingle (value: value.autologin || value.minimal) "0" "1" (attrValues settings); - in { + in rec { enable = if (find == "0") then false + else if (config.services.xserver.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 config.services.xserver.displayManager.autoLogin.enable + mkIf enable (findFirst (name: with settings."${name}"; autologin || minimal) "nixos" (attrNames settings)); };