add nix tooling (default.nix and flake support)

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
2024-07-05 21:55:55 +02:00
parent 6b40ab3235
commit 4627a08a69
5 changed files with 141 additions and 1 deletions

3
.gitignore vendored
View File

@@ -12,3 +12,6 @@ config.ini
*.pfx *.pfx
*.crt *.crt
*.pem *.pem
# nix
result

31
default.nix Normal file
View File

@@ -0,0 +1,31 @@
{ pkgs ? import <nixpkgs> { }
, lib ? pkgs.lib
,
}:
pkgs.python3Packages.buildPythonPackage rec {
pname = "smtprd-ng";
version = "git";
pyproject = true;
src = lib.cleanSource ./.;
build-system = [ pkgs.python3Packages.setuptools ];
dependencies = with pkgs.python3Packages; [
aiosmtpd
aiosmtplib
m2crypto
cryptography
];
pythonImportsCheck = [ "smtprd_ng" ];
meta = {
description = "SMTP forwarding relay daemon with signing and encryption";
homepage = "https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z3gWc1qgaeZaoGwL4WTstLNoqjayM";
license = lib.licenses.agpl3Only;
maintainers = [ lib.maintainers.gador ];
};
}

60
flake.lock generated Normal file
View File

@@ -0,0 +1,60 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1720087678,
"narHash": "sha256-uOhYJU3ldDKXYV+mFaXcPtyjq/UIMh/6SCuoVNU9rxM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1afc5440469f94e7ed26e8648820971b102afdc3",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixpkgs-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

42
flake.nix Normal file
View File

@@ -0,0 +1,42 @@
{
description = "SMTP forwarding relay daemon with signing and encryption";
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self
, nixpkgs
, flake-utils
,
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-darwin"
];
in
{
overlays.default = import ./overlay.nix { inherit self; };
}
// flake-utils.lib.eachSystem supportedSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
packages = {
smtprd-ng = pkgs.callPackage ./. { };
};
packages.default = self.packages.${system}.smtprd-ng;
apps.default = {
type = "app";
program = "${self.packages.${system}.smtprd-ng}/bin/smtprd-ng";
};
}
);
}

4
overlay.nix Normal file
View File

@@ -0,0 +1,4 @@
{ self }:
_final: prev: {
smtprd-ng = self.packages.${prev.system}.smtprd-ng;
}