Skip to content

Commit

Permalink
init repo
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Dec 16, 2023
1 parent 28bd64a commit 20f5f27
Show file tree
Hide file tree
Showing 10 changed files with 238 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "CI"

on:
push:
branches:
- main
pull_request:

jobs:
check:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: Swatinem/rust-cache@v2
- run: nix flake check --all-systems
- run: nix develop -c cargo doc --workspace --all-features --no-deps --document-private-items
- run: nix develop -c cargo test --workspace --all-features

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: Swatinem/rust-cache@v2
- run: nix develop -c cargo clippy --fix --no-deps
- uses: EndBug/add-and-commit@v9
with:
message: "chore: lint"
default_author: github_actions

fmt:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: Swatinem/rust-cache@v2
- run: nix develop -c cargo fmt --all
- uses: EndBug/add-and-commit@v9
with:
message: "chore: format"
default_author: github_actions
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
result
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "dwn"
version = "0.0.0"
license = "GPL-3.0-or-later"
edition = "2021"

[profile.release]
lto = true
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# dwn
# dwn

[![Crates.io](https://img.shields.io/crates/v/dwn.svg)](https://crates.io/crates/dwn)
[![CI](https://github.com/unavi-xyz/dwn/actions/workflows/ci.yml/badge.svg)](https://github.com/unavi-xyz/dwn/actions/workflows/ci.yml)
![Crates.io](https://img.shields.io/crates/l/dwn)
[![Documentation](https://docs.rs/dwn/badge.svg)](https://docs.rs/dwn)

Rust implementation of a [Decentralized Web Node](https://identity.foundation/decentralized-web-node/spec/).
21 changes: 21 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{ lib, pkgs, system, build_inputs, native_build_inputs, makeRustPlatform }:
let
rustBin = pkgs.rust-bin.stable.latest.default;

rustPlatform = makeRustPlatform {
cargo = rustBin;
rustc = rustBin;
};

common = {
version = "0.0.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";

buildInputs = build_inputs;
nativeBuildInputs = native_build_inputs;

LD_LIBRARY_PATH = lib.makeLibraryPath build_inputs;
};
in { bin = rustPlatform.buildRustPackage (common // { pname = "dwn"; }); }
85 changes: 85 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
};

outputs = { self, flake-utils, nixpkgs, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };

rustBin = pkgs.rust-bin.stable.latest.default;

build_inputs = with pkgs; [ ];

native_build_inputs = with pkgs; [ cargo-auditable pkg-config ];

code = pkgs.callPackage ./. {
inherit pkgs system build_inputs native_build_inputs;
};
in rec {
packages = code // {
all = pkgs.symlinkJoin {
name = "all";
paths = with code; [ bin ];
};

default = packages.all;
override = packages.all;
overrideDerivation = packages.all;
};

devShells.default = pkgs.mkShell {
buildInputs = with pkgs;
[ cargo-watch rust-analyzer rustBin ] ++ build_inputs;
nativeBuildInputs = native_build_inputs;

LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath build_inputs;
};
});
}
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

0 comments on commit 20f5f27

Please sign in to comment.