this post was submitted on 10 Dec 2024
61 points (100.0% liked)

Linux

5455 readers
127 users here now

A community for everything relating to the linux operating system

Also check out [email protected]

Original icon base courtesy of [email protected] and The GIMP

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 37 points 2 days ago* (last edited 2 days ago) (13 children)

They have an example service on the website:

(define sshd
  (service
    '(sshd ssh-daemon)                ;the secure shell daemon
    #:start (make-inetd-constructor   ;start on demand
             '("/usr/sbin/sshd" "-D" "-i")
             (list (endpoint
                    (make-socket-address AF_INET INADDR_ANY 22))
                   (endpoint
                    (make-socket-address AF_INET6 IN6ADDR_ANY 22)))
             #:max-connections 10)
    #:stop (make-inetd-destructor)
    #:respawn? #t))

(register-services (list sshd))
(start-in-the-background '(sshd))

Let's see how the same service looks like with systemd:

[Unit]
Description=OpenSSH Daemon
Wants=sshdgenkeys.service
After=sshdgenkeys.service
After=network.target

[Service]
Type=notify-reload
ExecStart=/usr/bin/sshd -D
KillMode=process
Restart=always

[Install]
WantedBy=multi-user.target

I have some lisp knowledge, so the scheme version doesn't look frightening to me, but I guess for sysadmins, who should write these kind of files frequently systemd's TOML like language is much more easier to understand.

Some differences I see: Shepherd does some firewall management with ports, and I don't see the services it depends on.

Why this kind of files should be written in a programming language at all? I guess it's a remnant from the old times, but I like when tools abstract away the programming parts, and users shouldn't have to deal with that. I like the same thing in docker-compose: I can configure a program whatever language it's written, I don't have to deal with what's happening under the hood.

I guess there is some usefulness with defining services as code, if you need more complex situations, but it should the more rare case nowadays.

[–] devfuuu 10 points 1 day ago* (last edited 1 day ago) (1 children)

For as much as I want to like and learn guix, guile and all that stuff, it's very very ugly and confusing. I even have a book around for scheme and the parentheses and ' and # in a bunch of places scare me too much and make no sense.

It's a system and language that doesn't work well with more basic editors and tooling and unfortunately for how cool it is I don't guess it will ever catch on for multiple reasons.

[–] [email protected] 6 points 1 day ago* (last edited 1 day ago)

Scheme is just lisp with blackjack and hookers. It has some huge advantages, that's why it's called God's own programming language

It's older than C, that's why it doesn't have C-like syntax like otger common languages

load more comments (11 replies)