diff --git a/.config/hakari.toml b/.config/hakari.toml index ec38ea2..c773d50 100644 --- a/.config/hakari.toml +++ b/.config/hakari.toml @@ -1,7 +1,7 @@ # This file contains settings for `cargo hakari`. # See https://docs.rs/cargo-hakari/latest/cargo_hakari/config for a full list of options. -hakari-package = "my-workspace-hack" +hakari-package = "atpblog-workspace-hack" # Format version for hakari's output. Version 4 requires cargo-hakari 0.9.22 or above. dep-format-version = "4" diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.zed/settings.json b/.zed/settings.json new file mode 100644 index 0000000..79860b3 --- /dev/null +++ b/.zed/settings.json @@ -0,0 +1,5 @@ +// Folder-specific settings +// +// For a full list of overridable settings, and general information on folder-specific settings, +// see the documentation: https://zed.dev/docs/configuring-zed#settings-files +{} diff --git a/Cargo.lock b/Cargo.lock index e3e8ee0..1f2942d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,48 @@ dependencies = [ "syn", ] +[[package]] +name = "atpblog-cli" +version = "0.1.0" +dependencies = [ + "atpblog-common", + "atpblog-workspace-hack", + "tokio", +] + +[[package]] +name = "atpblog-common" +version = "0.1.0" +dependencies = [ + "atpblog-workspace-hack", + "tokio", +] + +[[package]] +name = "atpblog-renderer" +version = "0.1.0" + +[[package]] +name = "atpblog-server" +version = "0.1.0" +dependencies = [ + "atpblog-common", + "atpblog-workspace-hack", + "axum", + "tokio", +] + +[[package]] +name = "atpblog-workspace-hack" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "smallvec", + "syn", + "tokio", +] + [[package]] name = "autocfg" version = "1.4.0" @@ -323,44 +365,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "my-cli" -version = "0.1.0" -dependencies = [ - "my-common", - "my-workspace-hack", - "tokio", -] - -[[package]] -name = "my-common" -version = "0.1.0" -dependencies = [ - "my-workspace-hack", - "tokio", -] - -[[package]] -name = "my-server" -version = "0.1.0" -dependencies = [ - "axum", - "my-common", - "my-workspace-hack", - "tokio", -] - -[[package]] -name = "my-workspace-hack" -version = "0.1.0" -dependencies = [ - "proc-macro2", - "quote", - "smallvec", - "syn", - "tokio", -] - [[package]] name = "object" version = "0.36.5" diff --git a/Cargo.toml b/Cargo.toml index 7b8752d..6ec3641 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ members = ["crates/*"] [workspace.package] version = "0.1.0" edition = "2021" +license = "MPL-2.0" [workspace.metadata.crane] name = "atpblog-workspace" diff --git a/crates/atpblog-cli/Cargo.toml b/crates/atpblog-cli/Cargo.toml index aa36b55..1e9e7d7 100644 --- a/crates/atpblog-cli/Cargo.toml +++ b/crates/atpblog-cli/Cargo.toml @@ -2,6 +2,7 @@ name = "atpblog-cli" version.workspace = true edition.workspace = true +license.workspace = true publish = false [dependencies] diff --git a/crates/atpblog-cli/src/main.rs b/crates/atpblog-cli/src/main.rs index bc0be05..d1c848a 100644 --- a/crates/atpblog-cli/src/main.rs +++ b/crates/atpblog-cli/src/main.rs @@ -2,7 +2,7 @@ #[tokio::main] async fn main() { - let (tx, mut rx, fut) = my_common::echo_task(10, "echo".into()); + let (tx, mut rx, fut) = atpblog_common::echo_task(10, "echo".into()); let args = std::env::args().skip(1).collect::>(); tokio::spawn(fut); diff --git a/crates/atpblog-common/Cargo.toml b/crates/atpblog-common/Cargo.toml index 8b7314a..dede041 100644 --- a/crates/atpblog-common/Cargo.toml +++ b/crates/atpblog-common/Cargo.toml @@ -2,6 +2,7 @@ name = "atpblog-common" version.workspace = true edition.workspace = true +license.workspace = true publish = false [dependencies] diff --git a/crates/atpblog-renderer/Cargo.toml b/crates/atpblog-renderer/Cargo.toml index cc8933c..1f1ccf5 100644 --- a/crates/atpblog-renderer/Cargo.toml +++ b/crates/atpblog-renderer/Cargo.toml @@ -2,5 +2,7 @@ name = "atpblog-renderer" version.workspace = true edition.workspace = true +license.workspace = true +publish = false [dependencies] diff --git a/crates/atpblog-renderer/src/lib.rs b/crates/atpblog-renderer/src/lib.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/crates/atpblog-renderer/src/lib.rs @@ -0,0 +1 @@ + diff --git a/crates/atpblog-renderer/src/main.rs b/crates/atpblog-renderer/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/crates/atpblog-renderer/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/crates/atpblog-server/Cargo.toml b/crates/atpblog-server/Cargo.toml index 86b09bf..a190b56 100644 --- a/crates/atpblog-server/Cargo.toml +++ b/crates/atpblog-server/Cargo.toml @@ -2,6 +2,7 @@ name = "atpblog-server" version.workspace = true edition.workspace = true +license.workspace = true publish = false [dependencies] diff --git a/crates/atpblog-server/src/main.rs b/crates/atpblog-server/src/main.rs index 98082ec..07b6f7a 100644 --- a/crates/atpblog-server/src/main.rs +++ b/crates/atpblog-server/src/main.rs @@ -21,7 +21,7 @@ async fn handler() -> Html<&'static str> { } async fn ping(Query(params): Query>) -> Html { - let (tx, mut rx, fut) = my_common::echo_task(10, "ping".into()); + let (tx, mut rx, fut) = atpblog_common::echo_task(10, "ping".into()); tokio::spawn(fut); tokio::spawn(async move { for (k, v) in params { diff --git a/crates/atpblog-workspace-hack/Cargo.toml b/crates/atpblog-workspace-hack/Cargo.toml index 809675c..cc3fde8 100644 --- a/crates/atpblog-workspace-hack/Cargo.toml +++ b/crates/atpblog-workspace-hack/Cargo.toml @@ -6,6 +6,7 @@ name = "atpblog-workspace-hack" version = "0.1.0" description = "workspace-hack package, managed by hakari" +license.workspace = true # You can choose to publish this crate: see https://docs.rs/cargo-hakari/latest/cargo_hakari/publishing. publish = false diff --git a/deny.toml b/deny.toml index f32f29f..be2cf85 100644 --- a/deny.toml +++ b/deny.toml @@ -2,5 +2,5 @@ multiple-versions = 'allow' [licenses] +allow = ["Apache-2.0", "BSD-3-Clause", "MIT", "Unicode-3.0", "MPL-2.0"] private = { ignore = true } -allow = ["Apache-2.0", "BSD-3-Clause", "MIT", "Unicode-3.0"] diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e4723aa --- /dev/null +++ b/flake.lock @@ -0,0 +1,116 @@ +{ + "nodes": { + "advisory-db": { + "flake": false, + "locked": { + "lastModified": 1744288177, + "narHash": "sha256-HxYhdWc6YJ8Q8gOZtv7+teCucmDf6+Ntickvb62Au58=", + "owner": "rustsec", + "repo": "advisory-db", + "rev": "1273f0099ce6882659ff64b852c8fdb5f8cdd5b9", + "type": "github" + }, + "original": { + "owner": "rustsec", + "repo": "advisory-db", + "type": "github" + } + }, + "crane": { + "locked": { + "lastModified": 1745022865, + "narHash": "sha256-tXL4qUlyYZEGOHUKUWjmmcvJjjLQ+4U38lPWSc8Cgdo=", + "owner": "ipetkov", + "repo": "crane", + "rev": "25ca4c50039d91ad88cc0b8feacb9ad7f748dedf", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": [] + }, + "locked": { + "lastModified": 1745303921, + "narHash": "sha256-zYucemS2QvJUR5GKJ/u3eZAoe82AKhcxMtNVZDERXsw=", + "owner": "nix-community", + "repo": "fenix", + "rev": "14850d5984f3696a2972f85f19085e5fb46daa95", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1744868846, + "narHash": "sha256-5RJTdUHDmj12Qsv7XOhuospjAjATNiTMElplWnJE9Hs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ebe4301cbd8f81c4f8d3244b3632338bbeb6d49c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "advisory-db": "advisory-db", + "crane": "crane", + "fenix": "fenix", + "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 +} diff --git a/flake.nix b/flake.nix index d0f6586..f3a3e23 100644 --- a/flake.nix +++ b/flake.nix @@ -71,8 +71,8 @@ fileset = lib.fileset.unions [ ./Cargo.toml ./Cargo.lock - (craneLib.fileset.commonCargoSources ./crates/my-common) - (craneLib.fileset.commonCargoSources ./crates/my-workspace-hack) + (craneLib.fileset.commonCargoSources ./crates/atpblog-common) + (craneLib.fileset.commonCargoSources ./crates/atpblog-workspace-hack) (craneLib.fileset.commonCargoSources crate) ]; }; @@ -86,20 +86,25 @@ # otherwise, omitting a crate (like we do below) will result in errors since # cargo won't be able to find the sources for all members. atpblog-cli = craneLib.buildPackage (individualCrateArgs // { - pname = "my-cli"; - cargoExtraArgs = "-p my-cli"; - src = fileSetForCrate ./crates/my-cli; + pname = "atpblog-cli"; + cargoExtraArgs = "-p atpblog-cli"; + src = fileSetForCrate ./crates/atpblog-cli; }); atpblog-server = craneLib.buildPackage (individualCrateArgs // { - pname = "my-server"; - cargoExtraArgs = "-p my-server"; - src = fileSetForCrate ./crates/my-server; + pname = "atpblog-server"; + cargoExtraArgs = "-p atpblog-server"; + src = fileSetForCrate ./crates/atpblog-server; + }); + atpblog-renderer = craneLib.buildPackage (individualCrateArgs // { + pname = "atpblog-renderer"; + cargoExtraArgs = "-p atpblog-renderer"; + src = fileSetForCrate ./crates/atpblog-renderer; }); in { checks = { # Build the crates as part of `nix flake check` for convenience - inherit atpblog-cli atpblog-server; + inherit atpblog-cli atpblog-server atpblog-renderer; # Run clippy (and deny all warnings) on the workspace source, # again, reusing the dependency artifacts from above. @@ -191,8 +196,9 @@ # MY_CUSTOM_DEVELOPMENT_VAR = "something else"; # Extra inputs can be added here; cargo and rustc are provided by default. - packages = [ - pkgs.cargo-hakari + packages = with pkgs; [ + cargo-hakari + nixd ]; }; });