99 lines
2.7 KiB
Nix
99 lines
2.7 KiB
Nix
# NOTE: Wishlist service fails on nix because of readonly file system
|
|
# and it can't find a config file for itself, it needs to write that
|
|
# itself I suppose :(
|
|
# So:
|
|
# 1. Get it to write that file, and
|
|
# 2. Allow it to inherit profiles from configured ssh
|
|
{
|
|
self,
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
}: let
|
|
cfg = config.services.wishlist;
|
|
in {
|
|
options = {
|
|
services.wishlist = with lib; {
|
|
enable = mkEnableOption "wishlist";
|
|
|
|
name = mkOption {
|
|
type = types.str;
|
|
default =
|
|
};
|
|
|
|
port = mkOption {
|
|
type = types.port;
|
|
default = 2222;
|
|
description = "Port to listen on";
|
|
};
|
|
|
|
#configPath = mkOption {
|
|
# type = types.path;
|
|
# default = ;
|
|
# description = "Path to config file";
|
|
#};
|
|
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = self.packages.${nixpkgs.system}.default;
|
|
description = "Package to use";
|
|
};
|
|
};
|
|
};
|
|
|
|
# define a systemd service for wishlist ^_^
|
|
config = lib.mkIf cfg.enable {
|
|
systemd.services.wishlist = {
|
|
description = "Single entrypoint for multiple SSH endpoints";
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
serviceConfig = let
|
|
wishlistServiceConfig = pkgs.writeText "config.yaml" ''
|
|
hello world!
|
|
'';
|
|
in {
|
|
DynamicUser = "yes";
|
|
ExecStart = "${pkgs.wishlist}/bin/wishlist serve --config ${wishlistServiceConfig}";
|
|
Restart = "always";
|
|
RestartSec = "2s";
|
|
};
|
|
};
|
|
};
|
|
|
|
/*
|
|
packages = flake-utils.lib.eachSystem supportedSystems (
|
|
system: let
|
|
version = "0.15.1";
|
|
#pkgs = nixpkgs.legacyPackages.${system};
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config.allowUnfree = false;
|
|
};
|
|
#lib = pkgs.lib;
|
|
in rec {
|
|
defaultPackage = self.packages.${system}.wishlist;
|
|
wishlist = pkgs.buildGoModule {
|
|
pname = "wishlist";
|
|
inherit version;
|
|
meta = with lib; {
|
|
description = "Single entrypoint for multiple SSH endpoints";
|
|
homepage = "https://github.com/charmbracelet/wishlist";
|
|
changelog = "https://github.com/charmbracelet/wishlist/releases/tag/v${version}";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [caarlos0 penguwin];
|
|
mainProgram = "wishlist";
|
|
};
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "charmbracelet";
|
|
repo = "wishlist";
|
|
rev = "v${version}";
|
|
# rev = "d7f058e115a8b4a4131406d01dde84fb4a8e93c4";
|
|
hash = "53fojA+gdvpSVNjx6QncH16F8/x+lpY5SkNs7obW2XQ=";
|
|
};
|
|
vendorSha256 = "0x6rss3fwv2398wrd5kyzkrqaphzvh4ykwfqai9glxm01y6fhxz7";
|
|
};
|
|
}
|
|
);
|
|
*/
|
|
}
|