diff --git a/flake.lock b/flake.lock index a8bd3d6..360d6ef 100644 --- a/flake.lock +++ b/flake.lock @@ -1,26 +1,29 @@ { "nodes": { - "flake-utils": { + "fenix": { "inputs": { - "systems": "systems" + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "lastModified": 1706595721, + "narHash": "sha256-nf5/lPawM20WO1gHAlsUwDEJ4v+InC3BYYV1EBsBJZk=", + "owner": "nix-community", + "repo": "fenix", + "rev": "46a368edf5f1cc16573157797e5acead834d5b2c", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "nix-community", + "repo": "fenix", "type": "github" } }, - "flake-utils_2": { + "flake-utils": { "inputs": { - "systems": "systems_2" + "systems": "systems" }, "locked": { "lastModified": 1705309234, @@ -54,29 +57,25 @@ }, "root": { "inputs": { + "fenix": "fenix", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" + "nixpkgs": "nixpkgs" } }, - "rust-overlay": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": [ - "nixpkgs" - ] - }, + "rust-analyzer-src": { + "flake": false, "locked": { - "lastModified": 1706634984, - "narHash": "sha256-xn7lGPE8gRGBe3Lt8ESoN/uUHm7IrbiV7siupwjHX1o=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "883b84c426107a8ec020e7124f263d7c35a5bb9f", + "lastModified": 1706540258, + "narHash": "sha256-6RTztJE21l0hfWHp0qMWBurWnoFmUxYEDCvaGTnQYcA=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "d13951f25c4cb880bff09a3c02a796ecc51f69ac", "type": "github" }, "original": { - "owner": "oxalica", - "repo": "rust-overlay", + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", "type": "github" } }, @@ -94,21 +93,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "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", diff --git a/flake.nix b/flake.nix index 69dea15..c34dfd1 100644 --- a/flake.nix +++ b/flake.nix @@ -3,35 +3,48 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - rust-overlay = { - url = "github:oxalica/rust-overlay"; + fenix = { + url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }: + outputs = { self, nixpkgs, fenix, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: let - overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { - inherit system overlays; + inherit system; }; - rust = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { - extensions = [ "rust-src" ]; - }); in with pkgs; { - devShells.default = mkShell rec { - buildInputs = [ rust ] ++ [ + packages.default = pkgs.rustPlatform.buildRustPackage rec { + pname = "ncpn"; + version = "0.1.0"; + + src = self; + + cargoSha256 = "sha256-SzblF7WU4SfqbwB2sk3uSzfd4OOi/z4/+NxzZhuiymI="; + + meta = with stdenv.lib; { + description = "Non-creative project name: Yet another link shortener, except this time in Rust!"; + homepage = "https://src.honbra.com/honbra/ncpn"; + }; + }; + + devShells.default = mkShell { + buildInputs = [ + cargo + rustc + fenix.packages.${system}.latest.rustfmt rust-analyzer pkg-config postgresql sqlfluff sqlx-cli ]; - LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}"; + # LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}"; # ssh -NL /home/honbra/.s.PGSQL.5432:/var/run/postgresql/.s.PGSQL.5432 @ # good luck setting up /home/honbra on your machine DATABASE_URL = "postgresql:///ncpn?host=/home/honbra&user=honbra"; diff --git a/src/main.rs b/src/main.rs index f970701..ebec4fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,7 +16,7 @@ use crate::config::Config; fn main() -> eyre::Result<()> { let filter = filter::Targets::new() - .with_target("honbra_api", Level::TRACE) + .with_target("ncpn", Level::TRACE) .with_target("tower_http::trace::on_response", Level::TRACE) .with_target("tower_http::trace::on_request", Level::TRACE) .with_default(Level::INFO);