From d83ca312078554d98a483969cf9dc7ed5b93da21 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 14 Dec 2023 03:34:51 +0100 Subject: [PATCH 1/4] Gnome: use dconf and add alot of default values --- desktop/gnome.nix | 151 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 146 insertions(+), 5 deletions(-) diff --git a/desktop/gnome.nix b/desktop/gnome.nix index 6da6bc5..fc06d8a 100644 --- a/desktop/gnome.nix +++ b/desktop/gnome.nix @@ -4,7 +4,7 @@ let unstable = import {}; in { - config = { + config = rec { services.xserver.enable = true; services.xserver.desktopManager.gnome.enable = true; services.xserver.displayManager.gdm = { @@ -15,10 +15,151 @@ in # environment.sessionVariables.NIXOS_OZONE_WL = "1"; - services.xserver.desktopManager.gnome.extraGSettingsOverrides = '' - [org.gnome.SessionManager] - logout-prompt=false - ''; + programs.dconf.profiles.user.databases = [{ + settings = with lib.gvariant; { + "org/gnome/desktop/interface" = { + clock-show-date=true; + clock-show-seconds=true; + clock-show-weekday=true; + color-scheme="prefer-dark"; + }; + + "org/gnome/desktop/media-handling" = { + automount=false; + }; + + "org/gnome/desktop/peripherals/mouse" = { + accel-profile="flat"; + }; + + "org/gnome/desktop/sound" = { + allow-volume-above-100-percent=true; + }; + + "org/gnome/mutter" = { + dynamic-workspaces=true; + workspaces-only-on-primary=true; + }; + + "org/gnome/SessionManager" = { + logout-prompt=false; + }; + + "org/gnome/settings-daemon/plugins/power" = { + power-button-action="notning"; + sleep-inactive-ac-type="nothing"; + }; + + "org/gnome/shell" = { + enabled-extensions=[ + "drive-menu@gnome-shell-extensions.gcampax.github.com" + "pop-shell@system76.com" + "workspace-indicator@gnome-shell-extensions.gcampax.github.com" + "Vitals@CoreCoding.com" + "trayIconsReloaded@selfmade.pl" + "places-menu@gnome-shell-extensions.gcampax.github.com" + "apps-menu@gnome-shell-extensions.gcampax.github.com" + "top-bar-organizer@julian.gse.jsts.xyz" + "color-picker@tuberry" + ]; + }; + + "org/gnome/shell/app-switcher" = { + current-workspace-only=false; + }; + + "org/gnome/shell/extensions/color-picker" = { + color-picker-shortcut=["c"]; + enable-shortcut=true; + enable-systray=false; + menu-key=""; + notify-style=mkUint32 1; + preview-style=mkUint32 0; + }; + + "org/gnome/shell/extensions/pop-shell" = { + active-hint=true; + active-hint-border-radius=mkUint32 1; + gap-inner=mkUint32 2; + gap-outer=mkUint32 1; + show-skip-taskbar=true; + show-title=true; + smart-gaps=false; + snap-to-grid=false; + tile-by-default=true; + }; + + "org/gnome/shell/extensions/top-bar-organizer" = { + center-box-order=["dateMenu"]; + left-box-order=["activities" "apps-menu" "places-menu" "vitalsMenu"]; + right-box-order=["TrayIconsReloaded" "workspace-indicator" "pop-shell" "color-picker@tuberry" "drive-menu" "screenRecording" "screenSharing" "dwellClick" "a11y" "keyboard" "quickSettings"]; + }; + + "org/gnome/shell/extensions/trayIconsReloaded" = { + icon-brightness=mkInt32 0; + icon-contrast=mkInt32 0; + icon-margin-horizontal=mkInt32 0; + icon-margin-vertical=mkInt32 0; + icon-padding-horizontal=mkInt32 4; + icon-padding-vertical=mkInt32 0; + icon-saturation=mkInt32 0; + icon-size=mkInt32 16; + icons-limit=mkInt32 5; + invoke-to-workspace=true; + position-weight=mkInt32 0; + tray-margin-left=mkInt32 0; + tray-margin-right=mkInt32 0; + }; + + "org/gnome/shell/extensions/vitals" = { + hide-icons=false; + hot-sensors=["_processor_usage_" "_memory_allocated_"]; + memory-measurement=mkInt32 1; + update-time=mkInt32 2; + use-higher-precision=true; + }; + + "org/gnome/shell/keybindings" = { + show-screenshot-ui=["Print" "S"]; + }; + + "org/gnome/desktop/default-applications/terminal" = + if builtins.elem pkgs.kitty config.environment.systemPackages then { + exec = "kitty"; + exec-arg = ""; + } else null; + + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = [ + ( + if builtins.elem pkgs.kitty config.environment.systemPackages then + "org/gnome/settings-daemon/plugins/media-keys/custom-keybinding/custom0" + else null + ) + ]; + help = mkEmptyArray "s"; + screensaver = ["l"]; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybinding/custom0" = + if builtins.elem pkgs.kitty config.environment.systemPackages then { + binding="t"; + command="kitty"; + name="Terminal"; + } else null; + + }; + }]; + + programs.dconf.profiles.gdm.databases = with builtins.elemAt programs.dconf.profiles.user.databases 0; [{ + settings = { + "org/gnome/desktop/interface" = settings."org/gnome/desktop/interface"; + "org/gnome/desktop/peripherals/mouse" = settings."org/gnome/desktop/peripherals/mouse"; + "org/gnome/desktop/sound" = settings."org/gnome/desktop/sound"; + "org/gnome/settings-daemon/plugins/power" = settings."org/gnome/settings-daemon/plugins/power"; + "org/gnome/shell/keybindings" = settings."org/gnome/shell/keybindings"; + }; + }]; environment.systemPackages = with pkgs; [ gnomeExtensions.pop-shell From e0441d161bdf39f3246de311445c52006e147b3e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 22 Dec 2023 00:54:10 +0100 Subject: [PATCH 2/4] add vm helper script this script builds and launches vm with configuration, and removes the img after closing vm note that you shulre remove from configuration.nix device specific entries (like hdds, network adapters) --- .gitignore | 1 + vm.sh | 1 + 2 files changed, 2 insertions(+) create mode 100755 vm.sh diff --git a/.gitignore b/.gitignore index c93fdee..456ec08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ device-configuration.nix hardware-configuration.nix result +*.qcow2 \ No newline at end of file diff --git a/vm.sh b/vm.sh new file mode 100755 index 0000000..d8edd01 --- /dev/null +++ b/vm.sh @@ -0,0 +1 @@ +nix-build '' -A vm -I nixpkgs=channel:nixos-23.11 -I nixos-config=./configuration.nix && $(ls ./result/bin/run-*) && rm *.qcow2 From 0f06442b4085d1c6b3464a8e865a8b749fb0ac73 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 22 Dec 2023 00:54:32 +0100 Subject: [PATCH 3/4] Fix the nixos-rebuild script so it doesn't build the config from /etc/nixos --- nixos-rebuild.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nixos-rebuild.sh b/nixos-rebuild.sh index 997a6d2..801d203 100755 --- a/nixos-rebuild.sh +++ b/nixos-rebuild.sh @@ -1,2 +1 @@ -NIXOS_CONFIG="$(pwd)/configuration.nix" -nixos-rebuild $@ +NIXOS_CONFIG="$(pwd)/configuration.nix" nixos-rebuild $@ From f449490474b36c47acf162c97a538453c97be812 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 22 Dec 2023 00:54:40 +0100 Subject: [PATCH 4/4] Use the latest kernel --- configuration.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configuration.nix b/configuration.nix index f9f0c62..c706846 100644 --- a/configuration.nix +++ b/configuration.nix @@ -28,6 +28,9 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + # kernel + boot.kernelPackages = pkgs.linuxPackages_latest; + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Enable networking