Skip to content

Commit

Permalink
hi
Browse files Browse the repository at this point in the history
  • Loading branch information
shayne committed Mar 25, 2024
0 parents commit 670ec21
Show file tree
Hide file tree
Showing 10 changed files with 437 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Automatically sets up your devbox environment whenever you cd into this
# directory via our direnv integration:

eval "$(devbox generate direnv --print-envrc)"

# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
# for more details
105 changes: 105 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# This file is autogenerated by maturin v1.4.0
# To update, run
#
# maturin generate-ci github
#
name: CI

on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing *
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

.rustup/
16 changes: 16 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "nixserver-rust-bindings"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rnix = "0.11.0"
rowan = "0.15.15"
pyo3 = { version = "0.21.0-beta.0", features = ["extension-module"] }


[lib]
name = "nixserver_rust_bindings"
crate-type = ["cdylib"]
7 changes: 7 additions & 0 deletions conf/set-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
echo "project dir is ${PROJECT_DIR}"

rustupHomeDir="${PROJECT_DIR}/.rustup"
mkdir -p "${rustupHomeDir}"
export RUSTUP_HOME="${rustupHomeDir}"
export LIBRARY_PATH="${LIBRARY_PATH}:${PROJECT_DIR}/nix/profile/default/lib"
. $VENV_DIR/bin/activate
17 changes: 17 additions & 0 deletions configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
services.sonarr.enable = true;
services.sabnzbd = {
pkg = pkgs.unstable.sabnzbd;
enable = true;
};
services = {
radarr = {
enable = true;
port = 8080;
};
};

systemd.services."sonarr" = {
enable = true;
};
}
25 changes: 25 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"packages": [
"rustup@latest",
"libiconv@latest",
"maturin@latest",
"python3@latest"
],
"env": {
"PROJECT_DIR": "$PWD"
},
"shell": {
"init_hook": [
". conf/set-env.sh",
"rustup default stable",
"cargo fetch"
],
"scripts": {
"build-docs": "cargo doc",
"start": "cargo run",
"run_test": [
"cargo test -- --show-output"
]
}
}
}
79 changes: 79 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"lockfile_version": "1",
"packages": {
"libiconv@latest": {
"last_modified": "2024-03-08T13:51:52Z",
"resolved": "github:NixOS/nixpkgs/a343533bccc62400e8a9560423486a3b6c11a23b#libiconv",
"source": "devbox-search",
"version": "2.38",
"systems": {
"aarch64-linux": {
"store_path": "/nix/store/8a4v6l5wav9kc672ws0mj4i40w39dr10-glibc-iconv-2.38"
},
"x86_64-linux": {
"store_path": "/nix/store/bijjhvx3wgz22cz0c6fx5g138d1zn89v-glibc-iconv-2.38"
}
}
},
"maturin@latest": {
"last_modified": "2024-03-19T05:49:19Z",
"resolved": "github:NixOS/nixpkgs/5710127d9693421e78cca4f74fac2db6d67162b1#maturin",
"source": "devbox-search",
"version": "1.4.0",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/6ic50jfwa2a84aqdi75s8lddkl9wv4f4-maturin-1.4.0"
},
"aarch64-linux": {
"store_path": "/nix/store/qzs1lldld39abx7vn5ayqnnnhzdkczfi-maturin-1.4.0"
},
"x86_64-darwin": {
"store_path": "/nix/store/zkjy1wa8p80xvdwsl8dvvv8dz89xslf4-maturin-1.4.0"
},
"x86_64-linux": {
"store_path": "/nix/store/1p709j1f4glp5m7b9ydns7za6i8jvmdl-maturin-1.4.0"
}
}
},
"python3@latest": {
"last_modified": "2024-03-08T13:51:52Z",
"resolved": "github:NixOS/nixpkgs/a343533bccc62400e8a9560423486a3b6c11a23b#python3",
"source": "devbox-search",
"version": "3.11.8",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/83q23q0drz3xjc0dks7k7hci923kd7s1-python3-3.11.8"
},
"aarch64-linux": {
"store_path": "/nix/store/xyzvnwgbzxin3ks0qnb8w6c3xqsifalh-python3-3.11.8"
},
"x86_64-darwin": {
"store_path": "/nix/store/3d6vir7gpf5k179fqdq2ji6lhgpfhxg4-python3-3.11.8"
},
"x86_64-linux": {
"store_path": "/nix/store/3v2ch16fkl50i85n05h5ckss8pxx6836-python3-3.11.8"
}
}
},
"rustup@latest": {
"last_modified": "2024-03-08T13:51:52Z",
"resolved": "github:NixOS/nixpkgs/a343533bccc62400e8a9560423486a3b6c11a23b#rustup",
"source": "devbox-search",
"version": "1.26.0",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/hgzyfdwvy68mp3xpbniwavizcpd67s2y-rustup-1.26.0"
},
"aarch64-linux": {
"store_path": "/nix/store/2pn6r28vj0lf62shzwj3i8r3mg2njdvh-rustup-1.26.0"
},
"x86_64-darwin": {
"store_path": "/nix/store/xwf6zn2y28655864c3m5453m02ig9id4-rustup-1.26.0"
},
"x86_64-linux": {
"store_path": "/nix/store/49kaqs594l0i29b0dgzm3mvjz9blsdlj-rustup-1.26.0"
}
}
}
}
}
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[build-system]
requires = ["maturin>=1,<2"]
build-backend = "maturin"

[project]
name = "nixserver_rust_bindings"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
Loading

0 comments on commit 670ec21

Please sign in to comment.