initial release

This commit is contained in:
Arne Weiss
2023-05-14 23:05:18 +02:00
commit ce4f79b0b0
4 changed files with 98 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
result

36
README.md Normal file
View File

@@ -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 <code>Nix</code> 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:
<code>nix build</code>
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:
<code>./result/bin/restart-bots</code>
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.

27
flake.lock generated Normal file
View File

@@ -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
}

34
flake.nix Normal file
View File

@@ -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 <<EOF
#!/bin/sh
docker stop prodbots-malli
docker rm prodbots-malli
docker run -d --name prodbots-malli --restart=always --network=host indeedael/qgo-ai:100.0 --fast 1 m
EOF
chmod +x $out/bin/restart-bots
'';
meta = {
description = "A script to restart the Quantum Go bots";
platforms = nixpkgs.lib.platforms.linux;
};
};
};
}