11 ms·
GNU Shepherd
- georgyo 9y agoA service file looks like this: (register-services (make <service> #:provides '(apache-2.0 apache httpd) #:requires '() #:start (...) #:stop (...) #:actions (make-actions (reload-modules (...)) (restart (...))))) It not horrible, but I'm Not a huge fan of that, but maybe it will get much better as it matures.
- rurban 9y agoMuch better than XML. A proper and simple language, not just a stupid bloated datastructure, with the ability to naturally define logic in the deps.
- agumonkey 9y agoreminds me of emacs config file, john wiegley made a tiny dsl called use-package that made everything cuter by a few simplification here and there. A few iteration it became extremely nice to write and read.
- rbanffy 9y agoRemember the Emacs config file is not a configuration file: it is actually a program that's run as Emacs starts. You can do all sorts of interesting stuff (like installing missing packages, setting font size according to the screen, etc) on it.
- agumonkey 9y agoWell config vs program is a deep debate. Now J.Wiegley extension brings some resemblance of semantics because it has a few concepts and steps instead of free form imperative (setq ...)
- mitchty 9y agoI love use-package, has made my emacs init.el config file sooooo much more maintainable from its prior... lets just say mess.
- agumonkey 9y agoSome people, smart and famous, still use vanilla emacs config/loading mechanisms (ensuring lazy loading). I now use req-package so I don't even have to download anything. I do miss the old style of one file per "kind" though. Doesn't mean use-package is bad but somehow I like having a FS-level idea of my emacs config.
- mitchty 9y agoI'm one of those weirdos that sticks my config into org mode files too. https://github.com/mitchty/dotfiles/blob/master/emacs.org https://github.com/mitchty/dotfiles/blob/master/emacs.org (actually i use org mode to compile all of my dot files based on predicates, i'm double plus weird here >.<) I really rather like this way of working with things as it just sticks stuff into ~/.emacs.d/elpa. I can rsync that around if i need/want. And it even bootstraps itself if i'm opening things on a new system. I just like keeping each package in its own use-package declaration so I can have config+setup all in one spot.
- agumonkey 9y agoI planned to do that too. Having a readable.. even story tellable code instead of a too succint result of brain sweat. I might try to make one from scratch using yours as an inspiration. Just to see how my mindset evolved along the years.
- mitchty 9y agoGo for it, its mostly inspired from nix in how I set it up. I can just run make and create dot files for whatever I need then rsync it over to where I need it. Aka I can customize my dot files based on if i'm going to a bsd/mac/linux box with(out)/nix/perl/haskell/git/whatever and have an easy way to copy things over the top of things or not. I declared dot file bankruptcy a few years ago and this is my "perpetual penultimate dot file solution" (yes I'm making a joke at my own expense with penultimate here). But this new setup is easily the most sane I've found so far. Most dot file management uses softlinks which sucks for rsyncing, or some hokey templating language. All mine amounts to is just a stupid .el file that holds predicate definitions that just controls via stupid elisp when an org babel block gets tangled out into a file. Its pretty simple and straightforward. Wonder if I should do some sort of show and tell for it or not. Good luck! Hope it helps or inspires something better.
- snakeanus 9y agoI find it quite comfortable actually. Same goes for all of Guix.
- tmalsburg2 9y agoI'm curious. Why are you not a huge fan of it?
- _wmd 9y agoMy first thought is how I'd parse, modify and write it back without losing user's comments, formatting, changes and suchlike. Is this some well understood format with libraries for common programming languages? If not, it is just likely to proliferate more crappy config management with chunks of regexes and suchlike Elsewhere people are saying it's just Scheme. I'm sure I could find a parser for that in Python, and maybe if I'm really lucky that parser will record whitespace and comment nodes, and have a reverse transformation, but do I really want to be writing error prone 20-line AST visitors just to tweak an integer setting? (No, I most certainly do not, and I consider design decisions like this a massive code smell that'd ward me off any further investigation of a system) edit: downvotes? Is this really such a difficult concept? edit 2: so apparently the big whoopsie was insulting the religion that is LISP. Yes, using a turing complete language for config syntax causes pain. Nobody does this stuff in the real world for a reason. Deal with it, meanwhile go back to obsessing over novelty code-is-data academic exercises on your obsolete Symbolics machines, you'll cause less damage that way.
- brians 9y agoIt's Guile s-expressions, so at least there's a good C reader and writer?
- hashkb 9y agoYou would just use Guile. That's the magic of the Lisp family. Edit: downvotes are because you're sort of insulting Lisp (which is older than you and all your "best practices") with an ignorant complaint.
- phkahler 9y ago>> downvotes are because you're sort of insulting Lisp (which is older than you and all your "best practices") with an ignorant complaint. I recognized it as lisp right away, but I share the complaint about the format. If you want to write a lisp program then do so. If you want to format something for human readability it's probably a good idea to do it differently. This is just a opinion of course, but I suspect it's not an uncommon one.
- rnhmjoj 9y agoIt may be stupid but that syntax makes me feel a little uneasy. The unmatched single quotes reminds me of TemplateHaskell.
- brianon99 9y agoSingle quote denotes a symbol in scheme. But this snippest is not strictly scheme. Perhaps it is SXML but I am not familiar with it.
- cyphar 9y agoWhile I don't write Scheme, I believe it is Scheme -- one of the goals of the GNU project is to have every GNU tool be configurable with Scheme (which is why GNU has a Scheme implementation as opposed to a Common LISP implementation).
- brians 9y agoWell, they have GCL and CLisp too!
- the_why_of_y 9y agoNot only does GNU have a Common Lisp implementation, in fact there are two: GCL: https://www.gnu.org/software/gcl/ https://www.gnu.org/software/gcl/ CLISP: http://clisp.org/ http://clisp.org/
- cyphar 9y agoI've installed CLISP before, why didn't I know it was a GNU project? Fair enough, I stand corrected. :D
- rekado 9y agoThis is just Scheme. It's nothing to do with SXML. #:foo is a keyword argument and '(apache httpd) is a quoted list containing the symbols apache and httpd. Angled brackets have no special meaning, they are just part of the identifier.
- gkya 9y agoThat's a mere function call in a complete, standards based language.
- ymse 9y agoHere is a complete (and simpler) example, taken from my ~/.config/shepherd/init.scm: (define xscreensaver (make <service> #:provides '(xscreensaver) #:start (make-forkexec-constructor (list "/run/setuid-programs/xscreensaver" "-nosplash")) #:stop (make-kill-destructor))) (register-services xscreensaver)
- coldtea 9y agoAny reason for the fugly #: syntax? That's mandated by Guile?
- Avshalom 9y agoThey're keyword arguments, I suspect the #: prefix was chose precisely because it is ugly so it'll almost never conflict with a name a programmer might actually want to give as an argument, Racket uses it too. http://docs.racket-lang.org/guide/keywords.html http://docs.racket-lang.org/guide/keywords.html
- rekado 9y agoThe # is extensible reader syntax. You can install your own readers for characters following the #. #\ is for the character reader, #: for keywords, etc. Guix uses #~ for G-expressions, for example.
- reirob 9y agoThanks for providing the link to the documentation in Racket. For people like me who don't know how to program in Scheme, this quote from the documentation might make it click (it is at the end of the page): Despite their similarities, keywords are used in a different way than identifiers or symbols. Keywords are intended for use (unquoted) as special markers in argument lists and in certain syntactic forms. For run-time flags and enumerations, use symbols instead of keywords. The example below illustrates the distinct roles of keywords and symbols. Examples: > (define dir (find-system-path 'temp-dir)) ; not '#:temp-dir > (with-output-to-file (build-path dir "stuff.txt") (lambda () (printf "example\n")) ; optional #:mode argument can be 'text or 'binary #:mode 'text ; optional #:exists argument can be 'replace, 'truncate, ... #:exists 'replace)
- sigzero 9y agoIt's pretty close to "horrible" though.
- rsync 9y ago"A service file looks like this:" Am I correct that the equivalent to this service file, in the world of systemd, is a binary file ?
- subway 9y agoYou are incorrect. Systems uses plaintext 'ini'-ish files.
- to3m 9y agoNo; the format is text: http://0pointer.de/public/systemd-man/systemd.unit.html http://0pointer.de/public/systemd-man/systemd.unit.html
- majewsky 9y agoMaybe an example is easier to read than a manpage. Here's nginx.service from Arch Linux: https://git.archlinux.org/svntogit/packages.git/tree/trunk/service?h=packages/nginx https://git.archlinux.org/svntogit/packages.git/tree/trunk/s...
- BenjiWiebe 9y agoAnd I personally love it. When writing my own servers/daemons I can very quickly and easily write a new service file for it.
- bostand 9y agoIt will be interesting to see if we can use this in linux with minimal changes to the test if the system (I am looking at you systemd)
- klez 9y agoIt's already used in Guix, that is a GNU/Linux distribution, so why not?
- rekado 9y agoActually, it's used in GuixSD, the GNU system variant built on top of Guix.
- tgjsrkghruksd 9y agoOh come on. And what's the kernel for GuixSD? Linux. We all know RMS is bitter that he can't take credit for a functional kernel, but it's still there.
- rekado 9y agoI don't know what exasperates you so much to justify a comment like this. My point is that it's "GuixSD", not "Guix" that uses the Shepherd. I happen to call the system I work with and hack on "GNU", not "Linux". That's just a different perspective. And I'm not RMS, nor am I bitter. I find your comment very confusing and confused.
- chriswarbo 9y agoThe difference between Guix and GuixSD isn't about alternative names for the same thing (like whether e.g. Ubuntu is "Linux" or "GNU/Linux"). Instead these names describe two distinct, but related, software projects. Guix is a collection of programs for building, installing and distributing software (or other digital artefacts). It is specifically designed to work alongside alternatives, like apt, yum, etc. on many operating systems. GuixSD is a particular OS distro, which uses Guix for all of its packaging, etc. If you use GuixSD, you're going all-in on Guix for everything. The distinction between these projects is important, since Guix might be a good engineering choice for some project (say, a Web site backend, requiring particular versions of Apache, Python, various modules, etc.), whilst it may be a bad idea to switch the whole underlying OS to GuixSD. As a concrete example, I've not used Guix or GuixSD myself, but exactly the same distinction exists between Nix and NixOS. I personally use NixOS, and I include Nix configurations in my own projects, so others can use Nix to install them with all of the right dependencies, etc. They don't need to switch distro to NixOS though; Nix will work on whatever system they already use (e.g. Ubuntu, OSX, etc. Though not yet Windows).
- MrF3ynmann 9y agoSo is this GNU/systemd?
- cyphar 9y agoIt's the exact opposite, it's an init system for the GNU project.
- falcolas 9y agoMuch closer to a GNU/Upstart. Doesn't try to do much more than manage services, from the looks of it.
- gkya 9y agoThis is init, with the exceptional property that you write your scripts in Guile Scheme (an implementation of a standardised Lisp dialect). That should allow for a more robust and debuggable way to write init scripts. GuixSD is kind of immature at the moment, and I have driver issues with linux-libre, but in the coming weeks I'll have the time to try to run it with a custom kernel that supports my hardware. If I succeed, as an Emacs user it'll become turtles all the way for me, which is very exciting (GuixSD is Guix + Shepherd + GNU + Linux Libre).
- rekado 9y ago"kind of immature" is a bit vague, but I disagree. I'm using GuixSD on almost all of my machines (a server, two laptops, an audio workstation) without problems. It is quite easy to overwrite the kernel package to use in a system configuration (e.g. to use a kernel with the RT patches applied), but I should say that I use the default kernel on all but one machine.
- Zardoz84 9y agohow compares against SystemD kraken ?
- amq 9y agoWould it be a suitable replacement for supervisord in containers?
- cyphar 9y agoMost likely. It can even run as an unprivileged user (and users can manage their own daemons with it). Though in most cases I find that people just want the "zombie problem" to go away. I wrote a simple init[1] that implements all of the key pieces of an init and signal forwarder. [1]: https://github.com/cyphar/initrs https://github.com/cyphar/initrs
- majewsky 9y agoI see you mentioned tini (another such init) in the README as being "not as simple as it should be". We're using https://github.com/Yelp/dumb-init https://github.com/Yelp/dumb-init at work; if you know it, what do you think of it?
- cyphar 9y agodumb-init is better, but they don't use socketfd which means they might drop signals in certain cases (in the race between consecutive sigwaits). I will concede this is a minor point, and I still have to finish implementing all of the necessary signal semantics in initrs, but it is kinda important. Also I'm learning Rust and it was a good opportunity to practice by implementing something I already knew how to easily do in C.
- talideon 9y agoAny reason you didn't go with something like dumb-init[1]? [1] https://github.com/Yelp/dumb-init https://github.com/Yelp/dumb-init
- cyphar 9y agoSee https://news.ycombinator.com/item?id=14478725 https://news.ycombinator.com/item?id=14478725
- satai 9y agoHow do they keep eye on all the processes for a service. They don't seem to use namespaces.
- SolarNet 9y agoIn what way don't they use namespaces? It's object oriented using a lisp system (hence arbitrary macro support for lexical and dynamic scoping). Each service object would track its own processes.
- cyphar 9y agoI'm trying to read the code now. I'm not sure whether I do or don't want them to use cgroups. Anything is better than using ptrace.
- deleted 9y ago[deleted]
- giancarlostoro 9y agoKinda odd they ever called it dmd at all considering that's the name of the official D compiler.
- rekado 9y agoNot so odd considering that Shepherd was started in the year 2002 and the D language appeared at the end of 2001.
- giancarlostoro 9y agoThat makes more sense to me, I was not aware of the history of Shepherd. Funnily enough they changed the name to avoid this very confusion in 2016.
- rekado 9y agoThat's because the D language people asked for a name change then. The Shepherd was actually a dormant project for many years until it was revived for GuixSD.
- _wmd 9y ago> XSLT > one of the best programming languages in existence Every reply just adds to the already extreme comedy value of this exchange, and only serves to further increase my disdain. XSLT? Oh my God, the lengths you people will go to. There is already enough bad science in here to fill a book.
- mcguire 9y agoXSLT has nothing to do with either Scheme or Shepard (which I have nothing to do with, either). XSLT is a very good tree-transformation language, once you look past the atrocious XML syntax, and tree transformations are a much better alternative to writing visitors. "Bad science"?
- mintplant 9y ago> one of the best programming languages in existence, Scheme Come on, this is basic reading comprehension.
- sctb 9y agoWe detached this subthread from https://news.ycombinator.com/item?id=14476639 https://news.ycombinator.com/item?id=14476639 and marked it off-topic.
- _wmd 9y agoI was accused of being ignorant for asking a very basic, highly fundamental question, which apparently nobody has yet to answer sensibly. Honestly I have zero respect for these people. Sycophants, could someone please address my question? - I work in Python as does 80% of the infrastructure world. - I want to tweak a config setting in your precious config file. - I want to do it without linking against a compiler - I want to do it without XML/XSLT (what the actual fuck, someone really suggested using another more practical data format to tweak/introspect code?) - I want to do it without writing a tree-walking routine - I want to do it without writing regexes - I want to do it while preserving whitespace and comments and similar user edits. Come on, this should be easy and practical, right? After all, you're obviously correct. Note I can do all this with XML, not that I'd use it, but it's still a better solution than config-as-code.
- blowski 9y agoI'd suggest that you remove all the name-calling and sarcasm because it seriously undermines what seems to be a good argument. It's only programming syntax, there's no reason to get personal.
- m-j-fox 9y agoSince most any language can be lowered to Scheme, Guile is not married to any particular syntax: https://www.gnu.org/software/guile/manual/html_node/Other-Languages.html#Other-Languages https://www.gnu.org/software/guile/manual/html_node/Other-La... If someone wants to write a python frontend maybe that would make _wmd happy. (It's hard to tell.)
- sctb 9y agoName-calling and trashing others is not part of the kind of discussions we're trying to have here, and it violates the guidelines. Please stop doing this. We detached this subthread from https://news.ycombinator.com/item?id=14476683 https://news.ycombinator.com/item?id=14476683 and marked it off-topic.
- _wmd 9y ago
- gens 9y agoThere are many amazing GNU projects. Just yesterday I found out about GNU radio. I also remember reading the initial commit for Gneural and thinking "wow, this code is really nice". I think GNU deserves much more support then it's getting.
- thearn4 9y agoHow does something become an official project under the umbrella of GNU, other than adopting a GPL? I'm guessing the FSF somehow curates and leads the individual efforts, before it can be called "GNU $THING"?
- timClicks 9y agoHappened to come across a thread discussing this when OpenCobol transitioned to GNU Cobol (https://sourceforge.net/p/open-cobol/discussion/cobol/thread/7dc2941f/#1cb1 https://sourceforge.net/p/open-cobol/discussion/cobol/thread...) It appears that you write to FSF and write out an evaluation proposal.
- quadrangle 9y agohttps://www.gnu.org/help/evaluation.html https://www.gnu.org/help/evaluation.html ← how to add your project to GNU
- cyphar 9y agoAs others have said, you have to apply to the FSF to become a GNU project. And while being under GPLv3-or-later is one of the requirements, I just want to clarify something on this point: > other than adopting a GPL Despite it's name, the GNU General Public License is a license for any software written by anyone. Licensing something under the GPL doesn't make your project a member of the GNU project, any more than licensing something with the MIT/X11 license make your project part of FreeDesktop, or BSD making your project one of Berkley's projects.
- cyphar 9y agoThere are so many awesome projects, but one that I recently learned about is GNU Taler. Basically it's an attempt to make "socially responsible digital cash", where all customers' transactions are private (you cannot tell who bought what or link their purchase history) but you can audit vendors and mints to verify that they pay taxes. It's quite an elegant system and strikes the right balance (in my mind) between privacy and accountability for corporations. Also it piggy-backs on existing systems (operating through exchanges) and doesn't require proof-of-work. And the browser extensions are super easy to use (even easier than Flattr in some ways). > I think GNU deserves much more support then it's getting. I would recommend donating money to the FSF (if you have the means) and becoming a member. They are an incredible project doing awesome work and deserve the support. You also get free access to LibrePlanet conferences and a few other perks.
- josteink 9y agoFor those too lazy to click the link > The GNU Daemon Shepherd or GNU Shepherd, formerly known as GNU dmd dmd was short for "daemon management daemon". Basically, it's what powers all services running on GNU Guix instead of something else, like systemd. I think this new name may sound "friendlier", but at the cost of precision. I immediately realized what dmd would be, but I had no idea what GNU Shepherd would be about.
- cygx 9y agoDaemon managing daemons, actually. Also note that Guix is technically just the package manager - the distro is called GuixSD.
- jonaf 9y agoI can appreciate how holistic the GNU ecosystem seems to be. I'm a lover and user of Nix, so whenever something about Guix comes up, I draw the contrast. In this case, GuixSD is using Shepherd, which uses Guile for configuration and feels like natural continuity within the system. NixOS, on the other hand, provides systemd (and only systemd). In the case of nix, it's smart to leverage existing technologies, for velocity, yes, but also as a sort of proof that the core principles behind nix can apply even over systems and tools that are completely unaware of nix concepts; on the other hand, GNU really makes me a believer in the fact that Guix is very pure.