commit ce4f79b0b081538417da674fdeccad625c713faf Author: Arne Weiss Date: Sun May 14 23:05:18 2023 +0200 initial release diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/README.md b/README.md new file mode 100644 index 0000000..f0990e7 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# Restart Quantum Go Bots + +This repository contains a Nix flake that defines a package to manage Quantum Go Bots. + +## Description + +The `restart-qgo-bots` package installs a bash script that stops and removes a running Docker container named `prodbots-malli`, and then runs a new one with the same name. The new Docker container is run using the `indeedael/qgo-ai:100.0` image, with specific flags and parameters. + +## Prerequisites + +- You need to have Nix with flakes support installed on your system. +- Docker should be installed and running. +- The user should have sufficient permissions to run Docker commands. + +## Usage + +After cloning the repository, you can build the package with the following command: + +nix build + +This will create a `result` symlink in the project directory that points to the built package in the Nix store. + +You can then run the installed script with the following command: + +./result/bin/restart-bots + +This will stop and remove the `prodbots-malli` Docker container if it's running, and start a new one. + +## Version + +The current version of the package is `0.0.1`. + +## License + +Please see the [LICENSE](./LICENSE) file for details. + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..43e1e31 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1683928319, + "narHash": "sha256-maz0DRKixJVcNRMiAMWlJniiF8IuQ+WbfmlJJ8D+jfM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9656e85a15a0fe67847ee8cdb99a20d8df499962", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..06a8dbd --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "A simple flake to restart the Quantum Go Bots"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; + + outputs = { self, nixpkgs }: { + + defaultPackage.x86_64-linux = with nixpkgs.legacyPackages.x86_64-linux; stdenv.mkDerivation rec { + pname = "restart-qgo-bots"; + version = "0.0.1"; + + src = null; + + phases = [ "installPhase" ]; + + installPhase = '' + mkdir -p $out/bin + cat > $out/bin/restart-bots <