From 39d5d0536e2acbd4d8073e0d66dbe590b959eb77 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 5 Jul 2024 14:09:35 -0500 Subject: [PATCH] making nix build the api --- flake.lock | 37 ++++++++++++++++++++++++++++- flake.nix | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 103 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 9ee5ba4..20fb2bc 100644 --- a/flake.lock +++ b/flake.lock @@ -49,11 +49,46 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1718428119, + "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "cl-nix-lite": "cl-nix-lite", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1720145907, + "narHash": "sha256-mNO3vfM43+w4Bp+zMC8Dkf4ktLpYYRpk9tAOp4iumio=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "5ad2d5884b9b16319c9c5ca4e80a5b8606b083ae", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } }, "systems": { diff --git a/flake.nix b/flake.nix index 6b069ea..3fde1fa 100644 --- a/flake.nix +++ b/flake.nix @@ -5,18 +5,82 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; cl-nix-lite.url = "github:hraban/cl-nix-lite"; + rust-overlay.url = "github:oxalica/rust-overlay"; }; - outputs = { self, nixpkgs, flake-utils, cl-nix-lite }: + outputs = inputs: with inputs; flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}.extend cl-nix-lite.overlays.default; + pkgs = nixpkgs.legacyPackages.${system}; src = ./.; + + sbcl' = pkgs.sbcl.withPackages (ps: with ps; [ + hunchentoot + dexador + jzon + serapeum + deploy + spinneret + lass + cl-smtp + log4cl + cl_plus_ssl + fiveam + slite + pkgs.openssl + pkgs.openssl.out + pkgs.openssl.dev + ]); + nbi = with pkgs; [ + gcc + stdenv + gnumake + gdb + pkg-config + makeWrapper + openssl + openssl.out + openssl.dev + ]; + + bi = with pkgs; [ + hugo + go + nodejs + sbcl' + clippy + rustc + cargo + rustfmt + rust-analyzer + just + openssl + openssl.out + openssl.dev + ]; + + nativeLibs = with pkgs; [ + openssl + openssl.out + openssl.dev + ]; + in { devShell = import ./shell.nix { inherit pkgs; }; - packages.default = pkgs.callPackage ./default.nix { }; + packages.default = pkgs.rustPlatform.buildRustPackage { + pname = "api"; + version = "0.0.1"; + src = src; + cargoBuildFlags = ""; + + cargoLock = { + lockFile = ./Cargo.lock; + }; + nativeBuildInputs = nbi; + buildInputs = bi; + }; } ); }