This commit is contained in:
Guilhem Saurel 2024-03-09 00:13:00 +01:00
parent fedb5b649b
commit c2360cc128
5 changed files with 134 additions and 0 deletions

17
.github/workflows/nix.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: "Nix CI"
on: [pull_request, push]
jobs:
tests:
name: "Nix build on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}-latest"
strategy:
matrix:
os: [ubuntu, macos]
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main
- run: nix build

8
.nixignore Normal file
View File

@ -0,0 +1,8 @@
*.nix
.git*
.nixignore
.pre-commit-config.yaml
Dockerfile
docker-compose.yml
CHANGELOG.md
LICENSE

View File

@ -14,6 +14,7 @@ DATE=$(date +%Y-%m-%d)
sed -i "/^## \[Unreleased\]/a \\\n## [v$NEW] - $DATE" CHANGELOG.md sed -i "/^## \[Unreleased\]/a \\\n## [v$NEW] - $DATE" CHANGELOG.md
sed -i "/^\[Unreleased\]/s/$OLD/$NEW/" CHANGELOG.md sed -i "/^\[Unreleased\]/s/$OLD/$NEW/" CHANGELOG.md
sed -i "/^\[Unreleased\]/a [v$NEW]: https://github.com/nim65s/matrix-webhook/compare/v$OLD...v$NEW" CHANGELOG.md sed -i "/^\[Unreleased\]/a [v$NEW]: https://github.com/nim65s/matrix-webhook/compare/v$OLD...v$NEW" CHANGELOG.md
sed -i "/version/$OLD/$NEW/" flake.nix
git add pyproject.toml CHANGELOG.md git add pyproject.toml CHANGELOG.md
git commit -m "Release v$NEW" git commit -m "Release v$NEW"

61
flake.lock generated Normal file
View File

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1709126324,
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1709703039,
"narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"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
}

47
flake.nix Normal file
View File

@ -0,0 +1,47 @@
{
description = "Post a message to a matrix room with a simple HTTP POST";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
matrix-webhook =
with pkgs.python3Packages;
buildPythonApplication {
pname = "matrix-webhook";
version = "3.8.0";
src = pkgs.nix-gitignore.gitignoreSource [ ./.nixignore ] ./.;
pyproject = true;
buildInputs = [ poetry-core ];
propagatedBuildInputs = [
markdown
matrix-nio
];
};
in
{
packages.default = matrix-webhook;
apps.default = flake-utils.lib.mkApp { drv = matrix-webhook; };
devShells.default = pkgs.mkShell {
inputsFrom = [ matrix-webhook ];
packages = with pkgs; [
poetry
python3Packages.coverage
python3Packages.httpx
python3Packages.safety
];
};
}
);
}