diff options
| author | Xe <me@christine.website> | 2022-04-27 03:01:34 +0000 |
|---|---|---|
| committer | Xe <me@christine.website> | 2022-04-27 03:01:34 +0000 |
| commit | e0a769832dc185e71efd9a37e67abb55b3f1488c (patch) | |
| tree | 9736e34e49fc0cbe4d352bad086bd776e15bae54 | |
| parent | 5a78922194b7416608b6b6ddc1f6c32c9d98e104 (diff) | |
| download | x-e0a769832dc185e71efd9a37e67abb55b3f1488c.tar.xz x-e0a769832dc185e71efd9a37e67abb55b3f1488c.zip | |
portable service for cadeybot
Signed-off-by: Xe <me@christine.website>
| -rw-r--r-- | flake.lock | 35 | ||||
| -rw-r--r-- | flake.nix | 56 | ||||
| -rw-r--r-- | run/robocadey.service.in | 10 |
3 files changed, 88 insertions, 13 deletions
@@ -50,10 +50,45 @@ "type": "indirect" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1650161686, + "narHash": "sha256-70ZWAlOQ9nAZ08OU6WY7n4Ij2kOO199dLfNlvO/+pf8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1ffba9f2f683063c2b14c9f4d12c55ad5f4ed887", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "portable-svc": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1650586426, + "narHash": "sha256-n/Q2IzITm8s5sej3l3D0rxJcd7vx4P7KF4hOkN9pOOg=", + "ref": "main", + "rev": "eb4b2c4754e5cd4a976a2941c27194526e8781de", + "revCount": 6, + "type": "git", + "url": "https://tulpa.dev/cadey/portable-svc.git" + }, + "original": { + "ref": "main", + "type": "git", + "url": "https://tulpa.dev/cadey/portable-svc.git" + } + }, "root": { "inputs": { "gomod2nix": "gomod2nix", "nixpkgs": "nixpkgs_2", + "portable-svc": "portable-svc", "utils": "utils_2" } }, @@ -5,9 +5,10 @@ nixpkgs.url = "nixpkgs/nixos-unstable"; utils.url = "github:numtide/flake-utils"; gomod2nix.url = "github:tweag/gomod2nix"; + portable-svc.url = "git+https://tulpa.dev/cadey/portable-svc.git?ref=main"; }; - outputs = { self, nixpkgs, utils, gomod2nix }: + outputs = { self, nixpkgs, utils, gomod2nix, portable-svc }: utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" @@ -23,6 +24,7 @@ buildGoModule = prev.buildGo118Module; }) gomod2nix.overlay + portable-svc.overlay ]; }; @@ -33,28 +35,56 @@ modules = ./gomod2nix.toml; }; - copyFile = { pname, path ? pname }: pkgs.stdenv.mkDerivation { - inherit pname; - inherit (everything) version; - src = everything; + copyFile = { pname, path ? pname }: + pkgs.stdenv.mkDerivation { + inherit pname; + inherit (everything) version; + src = everything; - installPhase = '' - mkdir -p $out/bin - cp $src/bin/$pname $out/bin/$path - ''; - }; + installPhase = '' + mkdir -p $out/bin + cp $src/bin/$pname $out/bin/$path + ''; + }; in { packages = rec { default = everything; - license = copyFile { pname = "license"; path = "xlicense"; }; - makeMastodonApp = copyFile { pname = "mkapp"; path = "make-mastodon-app"; }; + license = copyFile { + pname = "license"; + path = "xlicense"; + }; + makeMastodonApp = copyFile { + pname = "mkapp"; + path = "make-mastodon-app"; + }; prefix = copyFile { pname = "prefix"; }; quickserv = copyFile { pname = "quickserv"; }; within-website = copyFile { pname = "within.website"; }; johaus = copyFile { pname = "johaus"; }; cadeybot = copyFile { pname = "cadeybot"; }; mainsanow = copyFile { pname = "mainsanow"; }; - importer = copyFile { pname = "importer"; path = "cadeybot-importer"; }; + importer = copyFile { + pname = "importer"; + path = "cadeybot-importer"; + }; + + robocadey = copyFile { pname = "robocadey"; }; + robocadey-psvc = let + service = pkgs.substituteAll { + name = "robocadey.service"; + src = ./run/robocadey.service.in; + robocadey = self.packages.${system}.robocadey; + }; + in pkgs.portableService { + inherit (self.packages.${system}.robocadey) version; + name = "printerfacts"; + description = "Printer facts"; + units = [ service ]; + symlinks = [{ + object = "${pkgs.cacert}/etc/ssl"; + symlink = "/etc/ssl"; + }]; + }; }; devShells.default = pkgs.mkShell { diff --git a/run/robocadey.service.in b/run/robocadey.service.in new file mode 100644 index 0000000..9a7373c --- /dev/null +++ b/run/robocadey.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=Robo-Cadey + +[Service] +ExecStart=@robocadey@/bin/robocadey +StateDirectory=xeserv.robocadey +CacheDirectory=xeserv.robocadey + +[Install] +WantedBy=multi-user.target |
