mastodon.ar.al is one of the many independent Mastodon servers you can use to participate in the fediverse.
This is my personal fediverse server.

Administered by:

Server stats:

1
active users

Nix-shell shebangs are really handy.

Today, I needed to write a quick and dirty Python script to do some web page parsing and regexery, so just popped in python311 and python311Packages.

No pyproject.toml, no containers, no Docker, no venv. Run it, use result, then Nix's garbage collector will throwaway the dependencies when we're done.

nixos.wiki/wiki/Nix-shell_sheb

nixos.wikiNix-shell shebang - NixOS Wiki

Also 24 lines of Python with httpx and bs4 that took about 20 minutes just saved me multiple hours of time-consuming work.

@tommorris Hey Tom, do you happen to know a good getting started guide for Nix/NixOS written for mere mortals? I really feel I should be using Nix but every time I look into I get frustrated trying to set up a working system and leave it at that.

@aral @tommorris What stuff do you want setting up? I daily drive it and would be happy to help. I'm relatively new myself, but I know enough to do most things except building/creating packages, overlays, and flakes. Your average desktop or server config, no problem for me.

@destructatron @tommorris Thanks for the offer. I more wanted to evaluate it as a basis for the deployment of Small Web servers so I was trying to grok how it worked and there’s a huge learning curve. I was just trying to get a taste for it to see if it would be right to base this system I’m building on but it feels a bit too much like Arch Linux in its culture (at least from the outside) and I’m just not smart enough for such things :)

@aral @tommorris I use Nix as a server, and deploying web servers is actually very easy and so is automatic SSL cert generation with lets encrypt. A few lines in configuration.nix, and it just, works. Virtual hosts, reverse proxies, PHP, and all that aren't too hard to configure. I can paste in the nginx block from my config if you'd like to take a look.

@destructatron @tommorris Sure, if it’s no trouble, I’d appreciate that, thank you :)

@aral @tommorris security.acme.acceptTerms = true;
security.acme.defaults.email = "email goes here";
services.nginx = {
enable = true;
virtualHosts = {
"destructatron.net" = {
forceSSL = true;
enableACME = true;
locations."/" = {
root = "/sites/main";
};
};
"code.destructatron.net" = {
forceSSL = true;
enableACME = true;
locations."/" = {
root = "/sites/code";
};
};
};
};
You can do certs via certbot, but the module is experimental and acme is the recommended option. We have 2 virtual hosts defined here, my main site and the code subdomain. The location is set to /, so where browsers go for index.html. The root is the absolute path to where the site's files are. The braces define blocks. If we didn't have these, we'd be doing services.nginx.virtualHosts.domain.locations.root for example, which is kind of annoying to keep writing out.