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 /flake.nix | |
| parent | chore(cargo): bump tag (diff) | |
| download | september-ac397302134eac2daaa3ac02662192c440ef9299.tar.xz september-ac397302134eac2daaa3ac02662192c440ef9299.zip | |
chore(flake): add packages and apps attributes
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 83 |
1 files changed, 70 insertions, 13 deletions
@@ -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}"; }; } ); |