move user settings to module

This commit is contained in:
Sean Buckley 2021-10-27 11:36:44 -04:00
parent 43daf5af38
commit a5ebc87810
3 changed files with 50 additions and 35 deletions

View file

@ -37,8 +37,9 @@ in
echo "Nightlight: $x"
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled $x
'')
];
(writeShellScriptBin "gnome-my-settings" ''
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
@ -64,10 +65,8 @@ in
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'
'')
];
'';
};
}

View file

@ -77,12 +77,12 @@ in
};
})
(writeShellScriptBin "my-vscode-settings" ''
];
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;

16
modules/user-settings.nix Normal file
View file

@ -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)
];
};
}