.
This commit is contained in:
parent
0c7d1d1cb7
commit
3efe1dad0c
1 changed files with 83 additions and 86 deletions
169
flake.nix
169
flake.nix
|
|
@ -5,99 +5,96 @@
|
|||
inputs = {
|
||||
nixpkgs.url =
|
||||
"github:nixos/nixpkgs/nixos-unstable"; # Specify the version or channel as needed
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
outputs = { self, nixpkgs, ... }: {
|
||||
packages.x86_64-linux.default =
|
||||
nixpkgs.python3.pkgs.buildPythonApplication rec {
|
||||
pname = "calDAVtoCSV";
|
||||
version = "0.1.0";
|
||||
pyproject = true;
|
||||
|
||||
src = builtins.fetchGit {
|
||||
url = "git+https://git.stuce.ch/Stuce/calDAVtoCSV.git";
|
||||
# rev = "ca6bdb889085893cd4494cd1612a00f8e164ffac";
|
||||
};
|
||||
|
||||
build-system = with nixpkgs.python3.pkgs; [ setuptools ];
|
||||
|
||||
dependencies = with nixpkgs.python3.pkgs; [ caldav flask gunicorn ];
|
||||
|
||||
meta = {
|
||||
description =
|
||||
"middleman program between my radicale server and my esp32";
|
||||
license = nixpkgs.lib.licenses.mit;
|
||||
maintainers = with nixpkgs.lib.maintainers; [ stuce-bot ];
|
||||
};
|
||||
};
|
||||
nixosModules.default = { config, lib, pkgs, ... }:
|
||||
let cfg = config.services.deafault;
|
||||
in {
|
||||
packages.default = pkgs.python3.pkgs.buildPythonApplication rec {
|
||||
pname = "calDAVtoCSV";
|
||||
version = "0.1.0";
|
||||
pyproject = true;
|
||||
|
||||
src = builtins.fetchGit {
|
||||
url = "git+https://git.stuce.ch/Stuce/calDAVtoCSV.git";
|
||||
# rev = "ca6bdb889085893cd4494cd1612a00f8e164ffac";
|
||||
options.default = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable myService";
|
||||
};
|
||||
|
||||
build-system = with pkgs.python3.pkgs; [ setuptools ];
|
||||
|
||||
dependencies = with pkgs.python3.pkgs; [ caldav flask gunicorn ];
|
||||
|
||||
meta = {
|
||||
description =
|
||||
"middleman program between my radicale server and my esp32";
|
||||
license = pkgs.lib.licenses.mit;
|
||||
maintainers = with pkgs.lib.maintainers; [ stuce-bot ];
|
||||
};
|
||||
};
|
||||
});
|
||||
nixosModules.default = { config, lib, pkgs, ... }:
|
||||
let cfg = config.services.deafault;
|
||||
in {
|
||||
options.default = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable myService";
|
||||
};
|
||||
|
||||
config = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = {
|
||||
calDAV = {
|
||||
address = "localhost:5232";
|
||||
username = "username";
|
||||
password = "password";
|
||||
passwordFile = "/path/to/password";
|
||||
config = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = {
|
||||
calDAV = {
|
||||
address = "localhost:5232";
|
||||
username = "username";
|
||||
password = "password";
|
||||
passwordFile = "/path/to/password";
|
||||
};
|
||||
server = { port = 8000; };
|
||||
};
|
||||
server = { port = 8000; };
|
||||
description = "User-defined configuration for the service";
|
||||
};
|
||||
};
|
||||
# options.NixosModule = {
|
||||
# enable = lib.mkEnableOption "Enable calDAVtoCSV service";
|
||||
# port = lib.mkOption {
|
||||
# type = lib.types.int;
|
||||
# default = 8000;
|
||||
# description = "Port on which calDAVtoCSV will listen";
|
||||
# };
|
||||
# url = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
# description = "url of the calendar";
|
||||
# };
|
||||
# calendarUsername = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
# description = "username of the calendar account";
|
||||
# };
|
||||
# calendarName = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
# description =
|
||||
# "name of the calendar we will fetch the todo items from";
|
||||
# };
|
||||
# calendarPasswordFile = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
# description =
|
||||
# "file where we need to look for password to connect, needs to be readeable by the service user";
|
||||
# };
|
||||
# };
|
||||
config = lib.mkIf config.default.enable {
|
||||
environment.etc."config.ini".text = ''
|
||||
${lib.toIni config.default.config}
|
||||
'';
|
||||
systemd.services.default = {
|
||||
description = "calDAV to CSV Service";
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart =
|
||||
"${pkgs.python3.pkgs.gunicorn}/bin/gunicorn -w 1 -b 0.0.0.0:${cfg.port} main:app";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
description = "User-defined configuration for the service";
|
||||
};
|
||||
};
|
||||
# options.NixosModule = {
|
||||
# enable = lib.mkEnableOption "Enable calDAVtoCSV service";
|
||||
# port = lib.mkOption {
|
||||
# type = lib.types.int;
|
||||
# default = 8000;
|
||||
# description = "Port on which calDAVtoCSV will listen";
|
||||
# };
|
||||
# url = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
# description = "url of the calendar";
|
||||
# };
|
||||
# calendarUsername = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
# description = "username of the calendar account";
|
||||
# };
|
||||
# calendarName = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
# description =
|
||||
# "name of the calendar we will fetch the todo items from";
|
||||
# };
|
||||
# calendarPasswordFile = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
# description =
|
||||
# "file where we need to look for password to connect, needs to be readeable by the service user";
|
||||
# };
|
||||
# };
|
||||
config = lib.mkIf config.default.enable {
|
||||
environment.etc."config.ini".text = ''
|
||||
${lib.toIni config.default.config}
|
||||
'';
|
||||
systemd.services.default = {
|
||||
description = "calDAV to CSV Service";
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart =
|
||||
"${pkgs.python3.pkgs.gunicorn}/bin/gunicorn -w 1 -b 0.0.0.0:${cfg.port} main:app";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue