Skip to content

Instantly share code, notes, and snippets.

@jordansissel
Created July 13, 2026 05:56
Show Gist options
  • Select an option

  • Save jordansissel/e4a56c60daef061be3eaf77f4c077079 to your computer and use it in GitHub Desktop.

Select an option

Save jordansissel/e4a56c60daef061be3eaf77f4c077079 to your computer and use it in GitHub Desktop.
map of struct, lookup table using os.release()->id as a key
$osinfo = os.release()
# A rose by any other name... everybody likes to call packages by different names.
# And why not? Why shouldn't we all use slightly different names to refer to exactly the same item.
$rose struct { package struct { desktop map{str: str}; gdm str; ssh str }; service struct { ssh str }; paths struct { gdm_config str } } = {
"fedora" => struct {
package => struct {
desktop => {
"gnome" => "gnome-desktop4",
"kde" => "plasma-desktop",
"cosmic" => "cosmic-session",
},
gdm => "gdm",
ssh => "openssh-server",
},
service => struct {
ssh => "sshd",
},
paths => struct {
gdm_config => "/etc/gdm/custom.conf",
},
},
"ubuntu" => struct {
package => struct {
desktop => {
"gnome" => "ubuntu-gnome-desktop",
"kde" => "kde-plasma-desktop",
},
gdm => "gdm3",
ssh => "openssh-server",
},
service => struct {
ssh => "ssh",
},
paths => struct {
gdm_config => "/etc/gdm3/custom.conf",
},
},
"debian" => struct {
package => struct {
desktop => {
"gnome" => "gnome",
"kde" => "kde-plasma-desktop",
},
gdm => "gdm3",
ssh => "openssh-server",
},
service => struct {
ssh => "ssh",
},
paths => struct {
gdm_config => "/etc/gdm3/daemon.conf",
},
},
"arch" => struct {
package => struct {
desktop => {
"gnome" => "gnome-initial-setup",
"kde" => "plasma-meta",
"niri" => "niri",
},
gdm => "gdm",
ssh => "openssh",
},
service => struct {
ssh => "sshd",
},
paths => struct {
gdm_config => "/etc/gdm/custom.conf",
},
},
}[$osinfo->id]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment