dconf: create generic module and use it
no more cringe function calling, yay
This commit is contained in:
parent
23bfb2d222
commit
8f15bf0e0c
4 changed files with 244 additions and 195 deletions
|
@ -1,9 +1,12 @@
|
|||
# This file is not a NixOS system module
|
||||
{config, lib, pkgs, ... }:
|
||||
selection:
|
||||
|
||||
let
|
||||
settings = with lib.gvariant; {
|
||||
{
|
||||
imports = [
|
||||
./generic/dconf.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
proot.dconf.rules = with lib.gvariant; {
|
||||
"org/gnome/desktop/background" = {
|
||||
picture-options = "zoom";
|
||||
picture-uri = "file://${../media/wallpaper.png}";
|
||||
|
@ -159,5 +162,5 @@ let
|
|||
name = "Terminal";
|
||||
} else null;
|
||||
};
|
||||
in
|
||||
lib.filterAttrs (n: v: builtins.elem n selection) settings
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
{pkgs, ... } @ moduleArgs:
|
||||
{pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../unstable-packages.nix
|
||||
../dconf-common.nix
|
||||
];
|
||||
config = {
|
||||
services.xserver.enable = true;
|
||||
|
@ -10,8 +11,7 @@
|
|||
|
||||
# environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
|
||||
programs.dconf.profiles.user.databases = [{
|
||||
settings = import ../dconf-common.nix moduleArgs [
|
||||
proot.dconf.profiles.user.rulesToApply = [
|
||||
"org/gnome/desktop/background"
|
||||
"org/gnome/desktop/interface"
|
||||
"org/gnome/desktop/media-handling"
|
||||
|
@ -33,7 +33,6 @@
|
|||
"org/gnome/settings-daemon/plugins/media-keys"
|
||||
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0"
|
||||
];
|
||||
}];
|
||||
|
||||
environment.gnome.excludePackages = with pkgs; with pkgs.gnome; [
|
||||
baobab
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{pkgs, ... } @ moduleArgs:
|
||||
{pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../dconf-common.nix
|
||||
];
|
||||
config = {
|
||||
services.xserver.displayManager.gdm = {
|
||||
enable = true;
|
||||
|
@ -8,15 +11,13 @@
|
|||
autoSuspend = false;
|
||||
};
|
||||
|
||||
programs.dconf.profiles.gdm.databases = [{
|
||||
settings = import ../dconf-common.nix moduleArgs [
|
||||
proot.dconf.profiles.gdm.rulesToApply = [
|
||||
"org/gnome/desktop/interface"
|
||||
"org/gnome/desktop/peripherals/mouse"
|
||||
"org/gnome/desktop/sound"
|
||||
"org/gnome/settings-daemon/plugins/power"
|
||||
"org/gnome/shell/keybindings"
|
||||
];
|
||||
}];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
google-cursor
|
||||
|
|
46
nix-os/generic/dconf.nix
Normal file
46
nix-os/generic/dconf.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{ config, lib, pkgs, options, ... }:
|
||||
|
||||
# proot.dconf.rules
|
||||
# proot.dconf.profiles.<profile>.rulesToApply
|
||||
# proot.dconf.profiles.<profile>.extraRules
|
||||
let
|
||||
cfg = config.proot.dconf;
|
||||
profileOpts = lib.types.submodule {
|
||||
options = {
|
||||
rulesToApply = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = lib.attrNames cfg.rules;
|
||||
description = lib.mdDoc "A list of rules keys to apply for profile";
|
||||
};
|
||||
extraRules = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = {};
|
||||
description = lib.mdDoc "An attrset of additional dconf rules to apply ontop of selected";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mapper = _: value: {
|
||||
databases = lib.singleton {
|
||||
settings = lib.filterAttrs (key: _: lib.elem key value.rulesToApply) cfg.rules // value.extraRules;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.proot.dconf = {
|
||||
rules = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = {};
|
||||
description = lib.mdDoc "An attrset of dconf rules to pull from";
|
||||
};
|
||||
profiles = lib.mkOption {
|
||||
type = lib.types.attrsOf profileOpts;
|
||||
default = {};
|
||||
description = lib.mdDoc "An attret of profiles to create, with pulled rules";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
programs.dconf.profiles = lib.mapAttrs mapper cfg.profiles;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue