build: Add Nix/NixOS support#823
Conversation
|
How is it supposed to be used/built? Imagine that I'm a normal Nix user (which would be a bad example, since I have no clue about nix), who would like to start using script server. |
|
If you have Nix installed (see https://nixos.org/download/), If you are on NixOS system, you could (almost*) only add You can look at, e.g., https://wiki.nixos.org/wiki/Nginx to get a feeling for NixOS. You could think about it being a "wrapper" over everything Linux/packages that allows you to fully declaratively and reproducibly define your running system. If you decide later to not wanting a software/service anymore, you delete the lines from your config and everything is cleanly rebuild w/o the software/service from scratch. f you feel this is going in the right direction, I would love to add a little to the *) We currently also need to point the system to this repo, but let's see how far we come :-) |
bugy
left a comment
There was a problem hiding this comment.
In general looks fine to me (considering that I have no clue about nix ecosystem)
But I would highly prefer to put all these files into tools/nix folder
To avoid polluting the main folder
Also, I would rather put "demo" config (if possible) into wiki section of github
2b6112f to
5b58c19
Compare
|
Hey and thanks for the patience! I think this should be fine now (and would already help us very much.) I would propose to put a minimal (but still complete) example into the docs. Nix/NixOS users will know how to integrate it into their system config and use it. # flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/26.05";
script-server.url = "github:bugy/script-server";
};
outputs = { nixpkgs, script-server, ... }: {
nixosConfigurations = {
demo = nixpkgs.lib.nixosSystem {
modules = [
{
imports = [
script-server.nixosModules.default
];
nixpkgs = {
overlays = [ script-server.overlays.default ];
hostPlatform = "x86_64-linux";
};
networking.firewall.allowedTCPPorts = [ 5000 ];
services = {
script-server = {
enable = true;
settings = {
title = "Service Center";
};
configuration = "/var/lib/script-server/conf";
};
};
}
];
};
};
};
}My proposal would be to go with it as it is for a while and see how it works out. As soon as we get more experience and start to feel confident that everything works as we want, we could try to merge it into |
There was a problem hiding this comment.
I renamed script-server-web to script-server-dist and it now auto-generates the version.txt. This way, the version is also showed correctly.
Hello, and sorry for the delay!
Here comes the first version (where I avoided depending on a configurable
webfolder.) I've added a few comments inline.Why do we want it?
NixOS integration
With the files in place, NixOS users can (basically) add ...
... to their NixOS configuration and get a fully configured (systemd) script-server.
Linux VM demo
With the files in place, Nix users can start a live qemu VM demo with script-server preconfigured via ...
Linux image creation
With the files in place, Nix users can create {qemu,lxc,oci,...} images with script-server preinstalled and preconfigured by running ...
Especially LXC containers could make a lot of sense since they can be run natively on Proxmox.
Full list of supported images
NixOS test integration
With the files in place (and a little more effort), we could provide end-to-end integration tests where we automatically spawn a script-server via qemu and run all kinds of integration tests.