Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 12 additions & 39 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,56 +17,29 @@ jobs:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
ftd/target
fifthtry_content/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build-musl
run: |
echo "Building static binaries using ekidd/rust-musl-builder"
docker build -t fastn-build-image -f .github/Dockerfile .
docker run --name fastn-build fastn-build-image
mkdir -p out
docker cp fastn-build:/home/rust/src/target/x86_64-unknown-linux-musl/release/fastn out/
- uses: DeterminateSystems/nix-installer-action@v9
- uses: DeterminateSystems/magic-nix-cache-action@v3
- name: build linux-musl
run: nix build -L .#fastn
- name: run fastn
run: out/fastn --version
run: ./result/bin/fastn --version
- uses: actions/upload-artifact@v4
with:
name: linux_musl_x86_64
path: out/fastn
path: result/bin/fastn
release-windows:
name: Build for Windows
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
ftd/target
fifthtry_content/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run Build
id: build-windows
continue-on-error: false
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: run fastn
run: ./target/release/fastn.exe --version
- uses: DeterminateSystems/nix-installer-action@v9
- uses: DeterminateSystems/magic-nix-cache-action@v3
- name: build mingwW64
run: nix build -L .#fastn-win
- uses: actions/upload-artifact@v4
with:
name: windows_x64_latest
path: target/release/fastn.exe
path: result/bin/fastn.exe
- name: Download EnVar plugin for NSIS
uses: carlosperate/download-file-action@v1.0.3
with:
Expand Down
10 changes: 1 addition & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ prettify-js = "0.1.0"
indexmap = { version = "2", features = ["serde"] }
argon2 = "0.5"
lettre = { version = "0.11", features = ["serde", "tokio1", "tokio1-native-tls"]}
diesel = { version = "2.1", no_default_features = true, features = [ "chrono" ] }
diesel = { version = "2.1", features = ["chrono", "postgres_backend"]}
diesel-async = { version = "0.4", features = ["postgres", "deadpool", "async-connection-wrapper"]}
diesel_async_migrations = "0.12"
chrono = { version = "0.4", features = ["serde"]}
Expand Down Expand Up @@ -183,14 +183,6 @@ features = [
"column_decltype",
]

[workspace.dependencies.pq-sys]
version = "0.4"
features = [
# see workspace.dependencies.rusqlite
"bundled"
]


[workspace.dependencies.web-sys]
version = "0.3"
features = [
Expand Down
34 changes: 34 additions & 0 deletions fastn.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{ rustPlatform, stdenv, pkg-config, lib, windows, openssl }:
let
fastnCargo = builtins.fromTOML (builtins.readFile ./fastn/Cargo.toml);
version = fastnCargo.package.version;
in
rustPlatform.buildRustPackage {
name = "fastn";
inherit version;
src = lib.cleanSource ./.;

doCheck = false; # set this to true to run cargo test

nativeBuildInputs = [ pkg-config ];

buildInputs = lib.optional stdenv.targetPlatform.isWindows [
windows.mingw_w64_pthreads
windows.pthreads
];

# https://docs.rs/pkg-config/latest/pkg_config/
PKG_CONFIG_ALL_STATIC = "1";

PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig";

RUSTFLAGS = "-C target-feature=+crt-static";

buildFeatures = [ "auth" ];

cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
}

2 changes: 1 addition & 1 deletion fastn/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fastn"
version = "0.4.53"
version = "0.4.54"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
122 changes: 10 additions & 112 deletions flake.lock

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

51 changes: 19 additions & 32 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,47 @@
inputs = {
flake-utils.url = "github:numtide/flake-utils";

naersk.url = "github:nix-community/naersk";

rust-overlay.url = "github:oxalica/rust-overlay";

nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# TODO: use nixpkgs/unstable when this is merged:
# https://github.com/NixOS/nixpkgs/pull/282798
nixpkgs.url = "github:junjihashimoto/nixpkgs/feature/rust-dup";
};

outputs = { self, flake-utils, nixpkgs, rust-overlay, naersk }:
outputs = { self, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = (import nixpkgs) {
inherit system;

overlays = [
(import rust-overlay)
];
overlays = [ ];
};

toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain;

naersk' = pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
};

cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);

fastn = naersk'.buildPackage {
name = "fastn";
version = cargoToml.workspace.package.version;
src = pkgs.lib.cleanSource ./.;

nativeBuildInputs = with pkgs; [
pkg-config
openssl.dev
] ++ lib.optionals stdenv.isDarwin [ xcbuild ];

buildInputs = with pkgs; lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.SystemConfiguration
];
};
fastn = pkgs.pkgsStatic.callPackage ./fastn.nix { };
fastn-win = pkgs.pkgsStatic.pkgsCross.mingwW64.callPackage ./fastn.nix { };
in
rec {
# For `nix build` & `nix run`:
defaultPackage = fastn;

packages = {
inherit fastn;
inherit fastn-win;
};

# nix develop
devShell = pkgs.mkShell {
name = "fastn-shell";
nativeBuildInputs = with pkgs; [ toolchain pkg-config openssl.dev postgresql_14 rust-analyzer diesel-cli ];
nativeBuildInputs = with pkgs; [
rustc
rustfmt
clippy
cargo
pkg-config
openssl.dev
postgresql_14
diesel-cli
rust-analyzer
];

shellHook = ''
export PATH="$PATH:$HOME/.cargo/bin"
Expand Down
2 changes: 1 addition & 1 deletion ftd/src/executor/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn p(s: &str, t: &str, fix: bool, file_location: &std::path::PathBuf) {
let mut executor =
ftd::executor::ExecuteDoc::from_interpreter(doc).unwrap_or_else(|e| panic!("{:?}", e));
for thing in ftd::interpreter::default::get_default_bag().keys() {
executor.bag.remove(thing);
executor.bag.swap_remove(thing);
}
let expected_json = serde_json::to_string_pretty(&executor).unwrap();
if fix {
Expand Down
2 changes: 1 addition & 1 deletion ftd/src/interpreter/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn interpret_helper(
fn p(s: &str, t: &str, fix: bool, file_location: &std::path::PathBuf) {
let mut i = interpret_helper("foo", s).unwrap_or_else(|e| panic!("{:?}", e));
for thing in ftd::interpreter::default::get_default_bag().keys() {
i.data.remove(thing);
i.data.swap_remove(thing);
}
let expected_json = serde_json::to_string_pretty(&i).unwrap();
if fix {
Expand Down
Loading