Skip to content

Commit

Permalink
chore(flake): add packages and apps attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuwn committed Oct 7, 2024
1 parent 4ece67b commit 4bfd31c
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ fleet.toml

# Visual Studio Code
.vscode

# Nix
result*
23 changes: 21 additions & 2 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 70 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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}";
};
}
);
Expand Down

0 comments on commit 4bfd31c

Please sign in to comment.