From a5ebc87810e1d9be75d53dfba031a1fcc5e6ebdb Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Wed, 27 Oct 2021 11:36:44 -0400 Subject: [PATCH] move user settings to module --- modules/gnome.nix | 59 ++++++++++++++++++------------------ modules/profiles/desktop.nix | 10 +++--- modules/user-settings.nix | 16 ++++++++++ 3 files changed, 50 insertions(+), 35 deletions(-) create mode 100644 modules/user-settings.nix diff --git a/modules/gnome.nix b/modules/gnome.nix index 371c639..515df61 100644 --- a/modules/gnome.nix +++ b/modules/gnome.nix @@ -37,37 +37,36 @@ in echo "Nightlight: $x" gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled $x '') - - (writeShellScriptBin "gnome-my-settings" '' - gsettings set org.gnome.desktop.interface enable-hot-corners false - gsettings set org.gnome.desktop.interface show-battery-percentage true - gsettings set org.gnome.desktop.media-handling automount false - gsettings set org.gnome.desktop.media-handling autorun-never true - gsettings set org.gnome.desktop.notifications show-in-lock-screen false - gsettings set org.gnome.desktop.privacy recent-files-max-age 30 - gsettings set org.gnome.desktop.privacy remove-old-temp-files true - gsettings set org.gnome.desktop.privacy remove-old-trash-files true - gsettings set org.gnome.desktop.privacy report-technical-problems false - gsettings set org.gnome.desktop.privacy send-software-usage-stats false - gsettings set org.gnome.desktop.screensaver lock-enabled false - gsettings set org.gnome.desktop.search-providers disabled "['org.gnome.Epiphany.desktop']" - gsettings set org.gnome.desktop.wm.keybindings maximize-vertically "['w']" - gsettings set org.gnome.desktop.wm.keybindings switch-applications "['Tab']" - gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward "['Tab']" - gsettings set org.gnome.desktop.wm.keybindings switch-windows "['Tab']" - gsettings set org.gnome.desktop.wm.keybindings switch-windows-backward "['Tab']" - gsettings set org.gnome.desktop.wm.keybindings toggle-fullscreen "['f']" - gsettings set org.gnome.desktop.wm.preferences resize-with-right-button true - gsettings set org.gnome.settings-daemon.plugins.media-keys logout '[]' - gsettings set org.gnome.settings-daemon.plugins.media-keys volume-step 2 - gsettings set org.gnome.settings-daemon.plugins.power power-button-action 'interactive' - gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing' - - gsettings set org.gnome.desktop.interface icon-theme 'Numix' - sleep 1 - gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark' - '') ]; + sconfig.user-settings = '' + gsettings set org.gnome.desktop.interface enable-hot-corners false + gsettings set org.gnome.desktop.interface show-battery-percentage true + gsettings set org.gnome.desktop.media-handling automount false + gsettings set org.gnome.desktop.media-handling autorun-never true + gsettings set org.gnome.desktop.notifications show-in-lock-screen false + gsettings set org.gnome.desktop.privacy recent-files-max-age 30 + gsettings set org.gnome.desktop.privacy remove-old-temp-files true + gsettings set org.gnome.desktop.privacy remove-old-trash-files true + gsettings set org.gnome.desktop.privacy report-technical-problems false + gsettings set org.gnome.desktop.privacy send-software-usage-stats false + gsettings set org.gnome.desktop.screensaver lock-enabled false + gsettings set org.gnome.desktop.search-providers disabled "['org.gnome.Epiphany.desktop']" + gsettings set org.gnome.desktop.wm.keybindings maximize-vertically "['w']" + gsettings set org.gnome.desktop.wm.keybindings switch-applications "['Tab']" + gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward "['Tab']" + gsettings set org.gnome.desktop.wm.keybindings switch-windows "['Tab']" + gsettings set org.gnome.desktop.wm.keybindings switch-windows-backward "['Tab']" + gsettings set org.gnome.desktop.wm.keybindings toggle-fullscreen "['f']" + gsettings set org.gnome.desktop.wm.preferences resize-with-right-button true + gsettings set org.gnome.settings-daemon.plugins.media-keys logout '[]' + gsettings set org.gnome.settings-daemon.plugins.media-keys volume-step 2 + gsettings set org.gnome.settings-daemon.plugins.power power-button-action 'interactive' + gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing' + + gsettings set org.gnome.desktop.interface icon-theme 'Numix' + gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark' + ''; + }; } diff --git a/modules/profiles/desktop.nix b/modules/profiles/desktop.nix index 2e58c76..20fc778 100644 --- a/modules/profiles/desktop.nix +++ b/modules/profiles/desktop.nix @@ -77,13 +77,13 @@ in }; }) - (writeShellScriptBin "my-vscode-settings" '' - ln -sf /etc/vscode-settings.json ~/.config/VSCodium/User/settings.json - ln -sf /etc/vscode-keybindings.json ~/.config/VSCodium/User/keybindings.json - '') - ]; + sconfig.user-settings = '' + ln -sf /etc/vscode-settings.json ~/.config/VSCodium/User/settings.json + ln -sf /etc/vscode-keybindings.json ~/.config/VSCodium/User/keybindings.json + ''; + environment.etc."vscode-settings.json".text = builtins.toJSON { "editor.renderFinalNewline" = false; "editor.scrollBeyondLastLine" = false; diff --git a/modules/user-settings.nix b/modules/user-settings.nix new file mode 100644 index 0000000..5bc6ee2 --- /dev/null +++ b/modules/user-settings.nix @@ -0,0 +1,16 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.sconfig.user-settings; +in +{ + options.sconfig.user-settings = lib.mkOption { + type = lib.types.nullOr lib.types.lines; + default = null; + }; + + config = lib.mkIf (cfg != null) { + environment.systemPackages = [ + (pkgs.writeShellScriptBin "my-settings" cfg) + ]; + }; +}