Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


CI Status

A convenient converter of DConf files to Nix, as expected by Home Manager's dconf settings. So you can Nixify your Gnome Shell configuration 😉


Take it with a grain of salt but on my machine it takes an average of 7.1ms to process a 349 lines configuration and generate a Nix file with 433 lines.



Given the following dconf settings:



current=uint32 0
sources=[('xkb', 'us')]
xkb-options=[' terminate:ctrl_alt_bksp ', ' lv3:ralt_switch ', ' caps:ctrl_modifier ']

picture-uri=' file:///home/gvolpe/Pictures/nixos.png '

You will get the following output when running dconf2nix:

{ lib, ... }:

  mkTuple =;
  dconf.settings = {
    "org/gnome/desktop/peripherals/mouse" = {
      natural-scroll = false;
      speed = -0.5;

    "org/gnome/desktop/peripherals/touchpad" = {
      tap-to-click = false;
      two-finger-scrolling-enabled = true;

    "org/gnome/desktop/input-sources" = {
      current = "uint32 0";
      sources = [ (mkTuple [ "xkb" "us" ]) ];
      xkb-options = [ "terminate:ctrl_alt_bksp" "lv3:ralt_switch" "caps:ctrl_modifier" ];

    "org/gnome/desktop/screensaver" = {
      picture-uri = "file:///home/gvolpe/Pictures/nixos.png";


It makes use of the Home Manager's dconf.settings key.

You can make changes in the UI and create a dump of your dconf file at any time, which you can Nixify so Home Manager can restore the next time you run home-manager switch. To create a dump, run the following command:

dconf dump / > dconf.settings


The easiest way is to pipe the standard input to dconf2nix and expect the result in the standard output:

dconf dump / | dconf2nix > dconf.nix

If you have an input file instead, you can run the following command:

dconf2nix -i data/dconf.settings -o output/dconf.nix

Type --help for some more information.

dconf2nix - Nixify dconf configuration files

Usage: dconf2nix [-v|--version]
                 [[-r|--root ARG] [-t|--timeout ARG] [-e|--emoji] [--verbose] |
                   (-i|--input ARG) (-o|--output ARG) [-r|--root ARG]
                   [-t|--timeout ARG] [-e|--emoji] [--verbose]]
  Convert a dconf file into a Nix file, as expected by Home Manager.

Available options:
  -h,--help                Show this help text
  -v,--version             Show the current version
  -r,--root ARG            Custom root path. e.g.: system/locale/
  -t,--timeout ARG         Timeout in seconds for the conversion
                           process (default: 5)
  -e,--emoji               Enable emoji support (adds a bit of overhead)
  --verbose                Verbose mode (debug)
  -i,--input ARG           Path to the dconf file (input)
  -o,--output ARG          Path to the Nix output file (to be created)
  -r,--root ARG            Custom root path. e.g.: system/locale/
  -t,--timeout ARG         Timeout in seconds for the conversion
                           process (default: 5)
  -e,--emoji               Enable emoji support (adds a bit of overhead)
  --verbose                Verbose mode (debug)

Custom root

By default, dconf2nix expects the root to be /. If you want to create a dump of a custom root, you can use the --root flag. For example:

dconf dump /system/locale/ | dconf2nix --root system/locale > dconf.nix

This will generate an output similar to the one below.

  dconf.settings = {
    "system/locale" = {
      region = "en_US.UTF-8";


Emoji support

Emojis are supported since version 0.0.12, and it needs to be explicitly enabled, as these add a little parsing overhead via the emojis package.

The following dconf input.

[ org/gnome/Characters ]

Can be parsed as follows.

$ dconf2nix -i data/emoji.settings -o output/emoji.nix --emoji

Failing to pass the --emoji flag will result in a timeout error.

Supported types

For now, only types supported by Home Manager as specified here are supported. If there's enough interest, we might be able to work on supporting the full specification.

Due to the lack of support, dconf2nix parses dictionaries and list of variants as simple strings to avoid failing to parse a file and retain most of the information.

Gnome Shell configuration

Once you have your dconf.nix, you can import it via Home Manager.

  programs.home-manager.enable = true;

  imports = [

If you are using the Home Manager module for NixOS you can import it like so:

  home-manager.users.joe = { pkgs, ... }: {
    imports = [ ./dconf.nix ];
	# ...


dconf2nix is available on nixpkgs and can be installed as any other package. It can also be used without installing. For example, with flakes.

$ nix run nixpkgs#dconf2nix -- --version
<<< DCONF2NIX >>>
Version: 0.0.12
Maintainer: Gabriel Volpe (
Source code:

To build it from source, it is recommend to use Cachix to reduce the compilation time.

Have a look at the latest releases for more information.



The default timeout is of 5 seconds. You can see it by running dconf2nix --help.

To find which section caused the error you can download (made by Broccoli):

curl > && chmod +x

You can then run: dconf dump / | ./ -t to create the sections and automatically test them. When creating a issue include both, the sections which failed the test and the errors from "d2n.log". For more options run ./ -h

Do also consider the caveats mentioned above in the Supported Types section.


To compile and run the tests locally.

cabal new-configure
cabal new-run dconf2nix-tests

To generate the static binary.

cabal new-configure --disable-executable-dynamic --ghc-option=-optl=-static --ghc-option=-optl=-pthread

If everything goes well, the binary should be under result/bin/.