migrate to flake
This commit is contained in:
parent
18c875a2e4
commit
8807fb1a2a
22
default.nix
22
default.nix
@ -1,22 +0,0 @@
|
||||
{ pkgs ? import <nixpkgs> {}
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) python3;
|
||||
in
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
pname = "dogetipbot-telegram";
|
||||
version = "1.1-2";
|
||||
|
||||
src = ./.;
|
||||
|
||||
doCheck = false;
|
||||
|
||||
propagatedBuildInputs = with python3.pkgs; [
|
||||
python-telegram-bot
|
||||
requests
|
||||
pycoin
|
||||
sqlalchemy
|
||||
];
|
||||
}
|
26
flake.lock
generated
Normal file
26
flake.lock
generated
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1627805549,
|
||||
"narHash": "sha256-+LHhcpzw6vAxF6q0VSLkZSEGpDC02JN21KM8eUWz+is=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "16bf3980bfa0d8929639be93fa8491ebad9d61ec",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-21.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
52
flake.nix
Normal file
52
flake.nix
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
description = "A dogecoin Telegram tip bot";
|
||||
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-21.05";
|
||||
|
||||
outputs = { self, nixpkgs }: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system}.python3.pkgs;
|
||||
packageName = "dogetipbot-telegram";
|
||||
app = pkgs.buildPythonApplication rec {
|
||||
pname = packageName;
|
||||
|
||||
version = builtins.substring 0 8 self.lastModifiedDate;
|
||||
|
||||
src = ./.;
|
||||
|
||||
doCheck = false;
|
||||
|
||||
propagatedBuildInputs = with pkgs; [
|
||||
python-telegram-bot
|
||||
requests
|
||||
pycoin
|
||||
sqlalchemy
|
||||
];
|
||||
};
|
||||
module = ({ config, lib, pkgs, ... }: let
|
||||
cfg = config.${packageName};
|
||||
in {
|
||||
options.${packageName} = with lib.options; {
|
||||
enable = mkEnableOption packageName;
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.dogetipbot-telegram = {
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = "${app}/bin/dogetipbot-telegram --db-path $STATE_DIRECTORY/users.db";
|
||||
enable = true;
|
||||
serviceConfig = {
|
||||
EnvironmentFile = "/mnt/secrets/dogetipbot-telegram_env";
|
||||
DynamicUser = true;
|
||||
StateDirectory = "dogetipbot";
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
in {
|
||||
defaultPackage.${system} = app;
|
||||
nixosModules.${packageName} = module;
|
||||
nixosModule = self.nixosModules.${packageName};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user