Skip to content

Commit

Permalink
Merge pull request #44 from gvolpe/fix/gvariant-mk-functions
Browse files Browse the repository at this point in the history
Use GVariant `mk` functions
  • Loading branch information
gvolpe authored Aug 13, 2021
2 parents 42940e9 + 3ae3f36 commit d96e369
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 29 deletions.
5 changes: 2 additions & 3 deletions output/clocks.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
{ lib, ... }:

let
mkTuple = lib.hm.gvariant.mkTuple;
in
with lib.hm.gvariant;

{
dconf.settings = {
"org/gnome/clocks" = {
Expand Down
5 changes: 2 additions & 3 deletions output/custom.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
{ lib, ... }:

let
mkTuple = lib.hm.gvariant.mkTuple;
in
with lib.hm.gvariant;

{
dconf.settings = {
"ca/desrt/dconf-editor" = {
Expand Down
11 changes: 5 additions & 6 deletions output/dconf.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
{ lib, ... }:

let
mkTuple = lib.hm.gvariant.mkTuple;
in
with lib.hm.gvariant;

{
dconf.settings = {
"org/virt-manager/virt-manager/urls" = {
Expand Down Expand Up @@ -97,7 +96,7 @@ in
};

"org/gnome/desktop/input-sources" = {
current = "uint32 0";
current = mkUint32 0;
sources = [ (mkTuple [ "xkb" "us" ]) ];
xkb-options = [ "terminate:ctrl_alt_bksp" "lv3:ralt_switch" "caps:ctrl_modifier" ];
};
Expand Down Expand Up @@ -173,7 +172,7 @@ in
};

"org/gnome/desktop/session" = {
idle-delay = "uint32 0";
idle-delay = mkUint32 0;
};

"org/gnome/desktop/sound" = {
Expand Down Expand Up @@ -339,7 +338,7 @@ in
};

"org/gnome/software" = {
check-timestamp = "int64 1592897410";
check-timestamp = mkInt64 1592897410;
};

"org/gnome/system/location" = {
Expand Down
5 changes: 2 additions & 3 deletions output/json.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
{ lib, ... }:

let
mkTuple = lib.hm.gvariant.mkTuple;
in
with lib.hm.gvariant;

{
dconf.settings = {
"org/gnome/shell/extensions/sound-output-device-chooser" = {
Expand Down
5 changes: 2 additions & 3 deletions output/negative.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
{ lib, ... }:

let
mkTuple = lib.hm.gvariant.mkTuple;
in
with lib.hm.gvariant;

{
dconf.settings = {
"org/gnome/settings-daemon/plugins/color" = {
Expand Down
5 changes: 2 additions & 3 deletions output/nested.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
{ lib, ... }:

let
mkTuple = lib.hm.gvariant.mkTuple;
in
with lib.hm.gvariant;

{
dconf.settings = {
"org/gnome/desktop/peripherals/mouse" = {
Expand Down
5 changes: 2 additions & 3 deletions output/quotes.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
{ lib, ... }:

let
mkTuple = lib.hm.gvariant.mkTuple;
in
with lib.hm.gvariant;

{
dconf.settings = {
"org/gnome/evince" = {
Expand Down
9 changes: 4 additions & 5 deletions src/Nix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ renderHeader = T.unlines
[ "# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix"
, "{ lib, ... }:"
, ""
, "let"
, " mkTuple = lib.hm.gvariant.mkTuple;"
, "in"
, "with lib.hm.gvariant;"
, ""
, "{"
, " dconf.settings = {"
]
Expand Down Expand Up @@ -55,8 +54,8 @@ renderValue raw = Nix $ renderValue' raw <> ";"
renderValue' (B v) = T.toLower . T.pack $ show v
renderValue' (I v) = T.pack $ show v
renderValue' (D v) = T.pack $ show v
renderValue' (I32 v) = "\"uint32 " <> T.pack (show v) <> "\""
renderValue' (I64 v) = "\"int64 " <> T.pack (show v) <> "\""
renderValue' (I32 v) = "mkUint32 " <> T.pack (show v)
renderValue' (I64 v) = "mkInt64 " <> T.pack (show v)
renderValue' (T x y) =
let wrapNegNumber x | x < 0 = "(" <> T.pack (show x) <> ")"
| otherwise = T.pack $ show x
Expand Down

0 comments on commit d96e369

Please sign in to comment.