Currently object merging only takes the immediate children into account.
There may be utility in changing this, or adding additional syntax, to perform a 'deep merge', running the merge against every child object.
Issue originates from the below discussion, which compares the feature to Nix's 'attrset merge':
Originally posted by fbewivpjsbsby November 6, 2023
- What version of corn are you using?
corn-cli 0.9.2
- What is your operating system?
Windows 10
Description
It is like nixos module, config will merge when you imports config, use // operators or use mkMerge.
Corn is override attrsets now.
Steps to reproduce
- Write this in corn file:
let {
$preferences_user_enable = {
Value = true
Status = "user"
}
// telemetry
$policies_disable_telemetry = {
DisableTelemetry = true
DisableFirefoxStudies = true
}
// #TODO 'raw data' need git version corn
// theme
$policies_theme = {
Preferences = {
'toolkit.legacyUserProfileCustomizations.stylesheets' = $preferences_user_enable
'layout.css.backdrop-filter.enabled' = $preferences_user_enable
'widget.non-native-theme.use-theme-accent' = $preferences_user_enable
}
}
$policies_ech = {
// ech need enable DNS over HTTPS
DNSOverHTTPS = {
Enabled = true
ProviderURL = "https://1.1.1.1/dns-query"
Locked = false
ExcludedDomains = [""]
}
Preferences = {
'network.dns.echconfig.enabled' = $preferences_user_enable
'network.dns.http3_echconfig.enabled' = $preferences_user_enable
}
}
} in
{
policies = {
// telemetry
..$policies_disable_telemetry
// ech
..$policies_ech
// theme
..$policies_theme
}
}
- run
corn [your corn file name].corn -t json It is override by $policies_theme:
{
"policies": {
"DisableTelemetry": true,
"DisableFirefoxStudies": true,
"DNSOverHTTPS": {
"Enabled": true,
"ProviderURL": "https://1.1.1.1/dns-query",
"Locked": false,
"ExcludedDomains": [
""
]
},
"Preferences": {
"toolkit.legacyUserProfileCustomizations.stylesheets": {
"Value": true,
"Status": "user"
},
"layout.css.backdrop-filter.enabled": {
"Value": true,
"Status": "user"
},
"widget.non-native-theme.use-theme-accent": {
"Value": true,
"Status": "user"
}
}
}
}
Currently object merging only takes the immediate children into account.
There may be utility in changing this, or adding additional syntax, to perform a 'deep merge', running the merge against every child object.
Issue originates from the below discussion, which compares the feature to Nix's 'attrset merge':
Discussed in https://github.com/orgs/corn-config/discussions/29
Originally posted by fbewivpjsbsby November 6, 2023
corn-cli 0.9.2
Windows 10
Description
It is like nixos module, config will merge when you imports config, use
//operators or use mkMerge.Corn is override attrsets now.
Steps to reproduce
corn [your corn file name].corn -t jsonIt is override by $policies_theme:{ "policies": { "DisableTelemetry": true, "DisableFirefoxStudies": true, "DNSOverHTTPS": { "Enabled": true, "ProviderURL": "https://1.1.1.1/dns-query", "Locked": false, "ExcludedDomains": [ "" ] }, "Preferences": { "toolkit.legacyUserProfileCustomizations.stylesheets": { "Value": true, "Status": "user" }, "layout.css.backdrop-filter.enabled": { "Value": true, "Status": "user" }, "widget.non-native-theme.use-theme-accent": { "Value": true, "Status": "user" } } } }