Want to contribute? Fork me on Codeberg.org!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.5 KiB

1 year ago
/*
TODO
1 year ago
1. Find and replace "discord-tts-bot" with your package name for **ALL FILES IN REPOSITORY**
1 year ago
2. Add a flake description that describes the workspace on line 27
3. Add a package description on line 70
4. (optional) uncomment `nativeBuildInputs` and `buildInputs` on lines 43 and 44 if you need openssl
5. (optional) set your project homepage, license, and maintainers list on lines 48-51
6. (optional) uncomment the NixOS module and update it for your needs
7. Delete this comment block
*/
/*
Some utility commands:
- `nix flake update --commit-lock-file`
- `nix flake lock update-input <input>`
1 year ago
- `nix build .#discord-tts-bot` or `nix build .`
- `nix run .#discord-tts-bot` or `nix run .`
1 year ago
*/
{
description = "";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, rust-overlay }:
let
overlays = [ (import rust-overlay) ];
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system overlays;
};
rustSettings = with pkgs; {
src = ./.;
1 year ago
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl alsa-lib ];
1 year ago
cargoHash = nixpkgs.lib.fakeHash;
};
meta = with nixpkgs.lib; {
#homepage = "https://example.com";
#license = [ licenses.gpl3 ];
platforms = [ system ];
#maintainers = with maintainers; [ ];
};
in {
devShells.${system}.default = with pkgs; mkShell {
packages = [
(pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
})
cargo-edit
bacon
];
1 year ago
inputsFrom = with self.packages.${system}; [ discord-tts-bot ];
1 year ago
};
packages.${system} = {
1 year ago
default = self.packages.${system}.discord-tts-bot;
discord-tts-bot = pkgs.rustPlatform.buildRustPackage (rustSettings // {
pname = "discord-tts-bot";
1 year ago
version = "0.1.0";
1 year ago
buildAndTestSubdir = "discord-tts-bot";
1 year ago
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
meta = meta // {
description = "";
};
});
};
/*
nixosModules.default = { config, ... }: let
lib = nixpkgs.lib;
in {
1 year ago
options.services.discord-tts-bot = {
enable = lib.mkEnableOption (lib.mdDoc "discord-tts-bot service");
1 year ago
package = lib.mkOption {
type = lib.types.package;
1 year ago
default = self.packages.${system}.discord-tts-bot;
defaultText = "pkgs.discord-tts-bot";
1 year ago
description = lib.mdDoc ''
1 year ago
The discord-tts-bot package that should be used.
1 year ago
'';
};
port = lib.mkOption {
type = lib.types.port;
default = 8000;
description = lib.mdDoc ''
The port at which to run.
'';
};
};
1 year ago
config.systemd.services.discord-tts-bot = let
cfg = config.services.discord-tts-bot;
pkg = self.packages.${system}.discord-tts-bot;
1 year ago
in lib.mkIf cfg.enable {
description = pkg.meta.description;
after = [ "network.target" ];
wantedBy = [ "network.target" ];
serviceConfig = {
ExecStart = ''
1 year ago
${cfg.package}/bin/discord-tts-bot --port ${builtins.toString cfg.port}
1 year ago
'';
Restart = "always";
DynamicUser = true;
};
};
};
*/
};
}