Initial Commit
This commit is contained in:
60
flake.nix
Normal file
60
flake.nix
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
crane-flake-parts = {
|
||||
url = "github:bluepython508/crane-flake-parts";
|
||||
inputs.rust-overlay.follows = "rust-overlay";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
flake-parts,
|
||||
crane-flake-parts,
|
||||
...
|
||||
}:
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
imports = [
|
||||
crane-flake-parts.flakeModules.default
|
||||
];
|
||||
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
|
||||
crane.source = ./.;
|
||||
flake.nixosModules.default = {
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
pkg = self.packages.${pkgs.system}.default;
|
||||
cfg = config.bluepython508.kunordaterano;
|
||||
in {
|
||||
options.bluepython508.kunordaterano = with lib; {
|
||||
enable = mkEnableOption "kunordaterano";
|
||||
tokenFile = mkOption {
|
||||
type = types.path;
|
||||
};
|
||||
};
|
||||
config.systemd.services.kunordaterano = lib.mkIf cfg.enable {
|
||||
description = "kunordaterano";
|
||||
environment = {
|
||||
DISCORD_TOKEN_FILE = "%d/discord-token";
|
||||
RUST_BACKTRACE = "1";
|
||||
};
|
||||
wantedBy = ["multi-user.target"];
|
||||
script = "${pkg}/bin/kunordaterano";
|
||||
|
||||
serviceConfig = {
|
||||
LoadCredential = ["discord-token:${cfg.tokenFile}"];
|
||||
DynamicUser = true;
|
||||
StateDirectory = "kunordaterano";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user