I'm trying to get a bit of a better grasp on the Nix language, rather than just as a vehicle for systems configuration.
As such, I have two configuration files that I'd like to take Nix sets/a list of sets to template out these files from.
I want to write a function that takes this:
{
inputs = {
"1:1:AT_Translated_Set_2_keyboard" = {
xkb_layout = "gb";
xkb_options = "ctrl:nocaps";
};
"1739:0:Synaptics_TM3381-002" = {
pointer_accel = "0.7";
tap = "enabled";
dwt = "enabled";
natural_scroll = "enabled";
};
};
}
And outputs this as a string:
input "1:1:AT_Translated_Set_2_keyboard" {
xkb_layout gb
xkb_options ctrl:nocaps
}
input "1739:0:Synaptics_TM3381-002" {
pointer_accel 0.7
tap enabled
dwt enabled
natural_scroll enabled
}
I'd like to write a function that takes this:
{
outputs = [
{ eDP1 = {};}
{
"DP-1" = {
position = "0,0";
transform = "270";
};
"HDMI-A-2" = { position = "1440,470"; };
"eDP-1" = { position = "1440,1910"; };
}
{
"DP-3" = { position = "450,0"; };
"DP-4" = { position = "0,1440"; };
"eDP-1" = { position = "800,2880"; };
}
];
}
And outputs this:
{
output eDP-1
}
{
output DP-1 position 0,0 transform 270
output HDMI-A-2 position 1440,470
output eDP-1 position 1440,1910
}
{
output DP-3 position 450,0
output DP-4 position 0,1440
output eDP-1 position 800,2880
}
Any pointers to functions that do something similar that I can read as a point of reference,
or any help in general on how to do this would be greatly appreciated!