{"id":13631169,"url":"https://github.com/nix-community/dconf2nix","last_synced_at":"2025-04-07T07:11:27.637Z","repository":{"id":42424895,"uuid":"274249008","full_name":"nix-community/dconf2nix","owner":"nix-community","description":":feet: Convert dconf files (e.g. GNOME Shell) to Nix, as expected by Home Manager [maintainer=@jtojnar]","archived":false,"fork":false,"pushed_at":"2024-05-20T00:03:20.000Z","size":366,"stargazers_count":267,"open_issues_count":8,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-31T05:07:03.227Z","etag":null,"topics":["dconf","gnome","gnome-shell","home-manager","nix","nixos","nixos-configuration"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nix-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"nix-community"}},"created_at":"2020-06-22T21:47:19.000Z","updated_at":"2025-03-20T17:20:51.000Z","dependencies_parsed_at":"2023-01-20T02:50:19.444Z","dependency_job_id":"a5f0eeab-ebc6-46e4-b8de-ffb9e0b94de0","html_url":"https://github.com/nix-community/dconf2nix","commit_stats":{"total_commits":165,"total_committers":8,"mean_commits":20.625,"dds":"0.24242424242424243","last_synced_commit":"63c7eab37db1ebfa503d42b5fd558f0410cb933e"},"previous_names":["nix-community/dconf2nix","gvolpe/dconf2nix"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fdconf2nix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fdconf2nix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fdconf2nix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fdconf2nix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nix-community","download_url":"https://codeload.github.com/nix-community/dconf2nix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247518255,"owners_count":20951777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dconf","gnome","gnome-shell","home-manager","nix","nixos","nixos-configuration"],"created_at":"2024-08-01T22:02:13.539Z","updated_at":"2025-04-07T07:11:27.611Z","avatar_url":"https://github.com/nix-community.png","language":"Nix","funding_links":["https://opencollective.com/nix-community"],"categories":["Nix"],"sub_categories":[],"readme":"# dconf2nix\n\n[![CI Status](https://github.com/nix-commmunity/dconf2nix/workflows/Haskell%20CI/badge.svg)](https://github.com/nix-commmunity/dconf2nix/actions)\n\nA convenient converter of [dconf](https://gitlab.gnome.org/GNOME/dconf) files to Nix, as expected by [Home Manager's dconf settings](https://rycee.gitlab.io/home-manager/options.xhtml#opt-dconf.settings). So you can Nixify your [GNOME Shell](https://gitlab.gnome.org/GNOME/gnome-shell) configuration :wink:\n\n\u003c!--ts--\u003e\n* [Benchmarks](#benchmarks)\n* [Introduction](#introduction)\n* [Run](#run)\n  * [Custom root](#custom-root)\n* [Supported types](#supported-types)\n* [GNOME Shell configuration](#gnome-shell-configuration)\n* [Installation](#installation)\n* [Troubleshooting](#troubleshooting)\n* [Development](#development)\n\u003c!--te--\u003e\n\n---\n\n### Benchmarks\n\nTake 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.\n\n![benchmarks](img/benchmarks.png)\n\n### Introduction\n\nGiven the following `dconf` settings:\n\n```init\n[org/gnome/desktop/peripherals/mouse]\nnatural-scroll=false\nspeed=-0.5\n\n[org/gnome/desktop/peripherals/touchpad]\ntap-to-click=false\ntwo-finger-scrolling-enabled=true\n\n[org/gnome/desktop/input-sources]\ncurrent=uint32 0\nsources=[('xkb', 'us')]\nxkb-options=['terminate:ctrl_alt_bksp', 'lv3:ralt_switch', 'caps:ctrl_modifier']\n\n[org/gnome/desktop/screensaver]\npicture-uri='file:///home/gvolpe/Pictures/nixos.png'\n```\n\nYou will get the following output when running `dconf2nix`:\n\n```nix\n{ lib, ... }:\n\nwith lib.hm.gvariant;\n{\n  dconf.settings = {\n    \"org/gnome/desktop/peripherals/mouse\" = {\n      natural-scroll = false;\n      speed = -0.5;\n    };\n\n    \"org/gnome/desktop/peripherals/touchpad\" = {\n      tap-to-click = false;\n      two-finger-scrolling-enabled = true;\n    };\n\n    \"org/gnome/desktop/input-sources\" = {\n      current = mkUint32 0;\n      sources = [ (mkTuple [ \"xkb\" \"us\" ]) ];\n      xkb-options = [ \"terminate:ctrl_alt_bksp\" \"lv3:ralt_switch\" \"caps:ctrl_modifier\" ];\n    };\n\n    \"org/gnome/desktop/screensaver\" = {\n      picture-uri = \"file:///home/gvolpe/Pictures/nixos.png\";\n    };\n  };\n\n}\n```\n\nIt makes use of the Home Manager's [dconf.settings](https://rycee.gitlab.io/home-manager/options.html#opt-dconf.settings) key.\n\nYou 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:\n\n```shell\ndconf dump / \u003e dconf.settings\n```\n\n### Run\n\nThe easiest way is to pipe the standard input to `dconf2nix` and expect the result in the standard output:\n\n```shell\ndconf dump / | dconf2nix \u003e dconf.nix\n```\n\nIf you have an input file instead, you can run the following command:\n\n```shell\ndconf2nix -i data/dconf.settings -o output/dconf.nix\n```\n\nType `--help` for some more information.\n\n```shell\ndconf2nix - Nixify dconf configuration files\n\nUsage: dconf2nix [-v|--version] [-r|--root ARG] [--verbose]\n                 [(-i|--input ARG) (-o|--output ARG)]\n\n  Convert a dconf file into a Nix file, as expected by Home Manager.\n\nAvailable options:\n  -h,--help                Show this help text\n  -v,--version             Show the current version\n  -r,--root ARG            Custom root path. e.g.: system/locale/\n  --verbose                Verbose mode (debug)\n  -i,--input ARG           Path to the dconf file (input)\n  -o,--output ARG          Path to the Nix output file (to be created)\n```\n\n#### Custom root\n\nBy 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:\n\n```shell\ndconf dump /system/locale/ | dconf2nix --root system/locale \u003e dconf.nix\n```\n\nThis will generate an output similar to the one below.\n\n```nix\n{\n  dconf.settings = {\n    \"system/locale\" = {\n      region = \"en_US.UTF-8\";\n    };\n\n  };\n}\n```\n\n### Supported types\n\nWith some minor spots (e.g. hexadecimal floats), the complete [GVariant text format](https://docs.gtk.org/glib/gvariant-text-format.html) is supported. But because Nix and GVariant data models are quite different, the Nix format can be a bit verbose, relying on constructor functions.\n\n### GNOME Shell configuration\n\nOnce you have your `dconf.nix`, you can import it via Home Manager.\n\n```nix\n{\n  programs.home-manager.enable = true;\n\n  imports = [\n    ./dconf.nix\n  ];\n}\n```\n\nIf you are using the Home Manager module for NixOS you can import it like so:\n\n```nix\n{\n  home-manager.users.joe = { pkgs, ... }: {\n    imports = [ ./dconf.nix ];\n    # ...\n  };\n}\n```\n\n### Installation\n\n`dconf2nix` is available in [Nixpkgs](https://github.com/NixOS/nixpkgs) and can be installed as any other package. It can also be used without installing. For example, with flakes.\n\n```console \n$ nix run nixpkgs#dconf2nix -- --version\n\u003c\u003c\u003c DCONF2NIX \u003e\u003e\u003e\nVersion: 0.0.12\nMaintainers: Nix Community\nSource code: https://github.com/nix-commmunity/dconf2nix\n```\n\nTo build it from source, it is recommend to use [Cachix](https://app.cachix.org/cache/dconf2nix) to reduce the compilation time.\n\nHave a look at the [latest releases](https://github.com/nix-commmunity/dconf2nix/releases) for more information.\n\n### Troubleshooting\n\nDo consider the caveats mentioned above in the [Supported Types](#supported-types) section.\n\n### Development\n\nTo compile and run the tests locally.\n\n```shell\ncabal new-configure\ncabal new-run dconf2nix-tests\n```\n\nTo generate the static binary.\n\n```shell\ncabal new-configure --disable-executable-dynamic --ghc-option=-optl=-static --ghc-option=-optl=-pthread\nnix-build\n```\n\nIf everything goes well, the binary should be under `result/bin/`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnix-community%2Fdconf2nix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnix-community%2Fdconf2nix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnix-community%2Fdconf2nix/lists"}