diff options
| author | Fuwn <[email protected]> | 2024-10-07 00:02:20 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-10-07 00:02:26 +0000 |
| commit | ac397302134eac2daaa3ac02662192c440ef9299 (patch) | |
| tree | dec18704d6946f8c65972601f36b217c273165cf | |
| parent | chore(cargo): bump tag (diff) | |
| download | september-ac397302134eac2daaa3ac02662192c440ef9299.tar.xz september-ac397302134eac2daaa3ac02662192c440ef9299.zip | |
chore(flake): add packages and apps attributes
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | flake.lock | 23 | ||||
| -rw-r--r-- | flake.nix | 83 |
3 files changed, 94 insertions, 15 deletions
@@ -15,3 +15,6 @@ fleet.toml # Visual Studio Code .vscode + +# Nix +result* @@ -1,8 +1,25 @@ { "nodes": { + "crane": { + "locked": { + "lastModified": 1727316705, + "narHash": "sha256-/mumx8AQ5xFuCJqxCIOFCHTVlxHkMT21idpbgbm/TIE=", + "owner": "ipetkov", + "repo": "crane", + "rev": "5b03654ce046b5167e7b0bccbd8244cb56c16f0e", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": [ + "systems" + ] }, "locked": { "lastModified": 1710146030, @@ -36,9 +53,11 @@ }, "root": { "inputs": { + "crane": "crane", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" + "rust-overlay": "rust-overlay", + "systems": "systems" } }, "rust-overlay": { @@ -1,7 +1,15 @@ { + description = "Simple & Efficient Gemini-to-HTTP Proxy"; + inputs = { + crane.url = "github:ipetkov/crane"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - flake-utils.url = "github:numtide/flake-utils"; + systems.url = "github:nix-systems/default"; + + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.systems.follows = "systems"; + }; rust-overlay = { url = "github:oxalica/rust-overlay"; @@ -11,46 +19,95 @@ outputs = { - nixpkgs, + crane, flake-utils, + nixpkgs, rust-overlay, + self, ... }: flake-utils.lib.eachDefaultSystem ( system: let - overlays = [ (import rust-overlay) ]; - pkgs = import nixpkgs { inherit system overlays; }; + pkgs = import nixpkgs { + inherit system; + + overlays = [ (import rust-overlay) ]; + }; + + craneLib = crane.mkLib pkgs; + + meta = with pkgs.lib; { + homepage = "https://github.com/gemrest/september"; + description = "Simple & Efficient Gemini-to-HTTP Proxy"; + license = licenses.gpl3Only; + maintainers = [ maintainers.Fuwn ]; + mainPackage = "september"; + platforms = platforms.linux; + }; + + september = craneLib.buildPackage { + inherit meta; + + strictDeps = true; + + src = pkgs.lib.cleanSourceWith { + src = ./.; + + filter = + path: type: + builtins.match ".*css$" path != null + || builtins.match ".*\\.git.*" path != null + || (craneLib.filterCargoSources path type); + }; + }; in { - devShells.${system} = + packages = { + inherit september; + + default = self.packages.${system}.september; + }; + + apps = { + september = { + inherit meta; + + type = "app"; + program = "${self.packages.${system}.september}/bin/september"; + }; + + default = self.apps.${system}.september; + }; + + devShells.default = with pkgs; mkShell.override { stdenv = stdenvAdapters.useMoldLinker clangStdenv; } { + RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; + buildInputs = [ - # https://github.com/oxalica/rust-overlay/issues/136#issuecomment-1716902831 + cargo-make + openssl + pkg-config + cargo-watch + (lib.hiPrio ( rust-bin.stable.latest.minimal.override { extensions = [ "rust-docs" ]; } )) + (rust-bin.selectLatestNightlyWith ( toolchain: toolchain.minimal.override { extensions = [ "rustfmt" ]; } )) - cargo-make - openssl - pkg-config - cargo-watch ]; - - # https://discourse.nixos.org/t/rust-src-not-found-and-other-misadventures-of-developing-rust-on-nixos/11570/5?u=fuwn - RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; }; } ); |