Skip to content

Commit

Permalink
chore(nix): Build all crates, for now
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Jul 13, 2024
1 parent aa66c34 commit 1a68a53
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 70 deletions.
7 changes: 3 additions & 4 deletions flake.lock

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

15 changes: 13 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
systems.url = "github:nix-systems/default";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
haskell-flake.url = "github:srid/haskell-flake";
rust-flake.url = "github:juspay/rust-flake/autoWire";
rust-flake.url = "github:juspay/rust-flake";
};

outputs = inputs:
Expand All @@ -20,11 +20,22 @@
inputs.pre-commit-hooks.flakeModule
./nix/pre-commit.nix
./clients/haskell
./rust.nix
./nix/rust.nix
];

perSystem = { pkgs, self', config, ... }: {
formatter = pkgs.nixpkgs-fmt;
packages.remote = pkgs.writeShellApplication {
name = "nix-build-remote";
meta.description = ''
Run `nixci build` on a remote machine.
'';
text = ''
set -x
nix copy --to ssh://"$1" ${inputs.self}
ssh -t "$1" nixci build ${inputs.self}
'';
};
devShells.default = pkgs.mkShell {
inputsFrom = [
self'.devShells.rust
Expand Down
158 changes: 158 additions & 0 deletions nix/rust.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
{ inputs, ... }:
{
perSystem = { config, self', pkgs, lib, system, ... }:
let
inherit (pkgs.stdenv) isDarwin;
inherit (pkgs.darwin) apple_sdk;
in
{
rust-project = {
# NOTE: It may be possible to obviate much of these buildInputs using
# https://github.com/juspay/rust-flake/issues/14
# TODO(CI time): autoWire only necessary crates (i.e., those with binaries)
# https://github.com/juspay/rust-flake/pull/13#issuecomment-2226992061
crates = {
"cac_client" = {
crane = {
args = {
buildInputs = lib.optionals isDarwin
(with apple_sdk.frameworks; [
Security
]) ++ [
pkgs.postgresql_12
pkgs.openssl
];
};
};
};
"experimentation_client" = {
crane = {
args = {
buildInputs = lib.optionals isDarwin
([
apple_sdk.frameworks.Security
]) ++ [
pkgs.postgresql_12
pkgs.openssl
];
};
};
};
"experimentation_example" = {
crane = {
args = {
buildInputs = lib.optionals isDarwin
([
apple_sdk.frameworks.Security
]) ++ [
pkgs.openssl
];
};
};
};
"experimentation_platform" = {
crane = {
args = {
buildInputs = lib.optionals isDarwin
([
apple_sdk.frameworks.Security
]) ++ [
pkgs.openssl
pkgs.postgresql_12
];
};
};
};
"frontend" = {
crane = {
args = {
buildInputs = lib.optionals isDarwin
([
apple_sdk.frameworks.Security
]) ++ [
pkgs.openssl
];
};
};
};
"service_utils" = {
crane = {
args = {
buildInputs = lib.optionals isDarwin
([
apple_sdk.frameworks.Security
]) ++ [
pkgs.openssl
pkgs.postgresql_12
];
};
};
};
"cac_client_integration_example" = {
crane = {
args = {
buildInputs = lib.optionals isDarwin
([
apple_sdk.frameworks.Security
]) ++ [
pkgs.openssl
pkgs.postgresql_12
];
};
};
};
"context_aware_config" = {
crane = {
args = {
buildInputs = lib.optionals isDarwin
([
apple_sdk.frameworks.Security
]) ++ [
pkgs.openssl
pkgs.postgresql_12
];
};
};
};
"superposition_types" = {
crane = {
args = {
buildInputs = lib.optionals isDarwin
([
# apple_sdk.frameworks.Security
]) ++ [
pkgs.postgresql_12
];
};
};
};
"superposition" = {
crane = {
clippy.enable = false; # https://github.com/juspay/superposition/issues/19
args = {
buildInputs = lib.optionals isDarwin
([
apple_sdk.frameworks.Security
apple_sdk.frameworks.SystemConfiguration
pkgs.fixDarwinDylibNames
]) ++ [
pkgs.libiconv
pkgs.openssl
pkgs.postgresql_12
];
nativeBuildInputs = with pkgs; [
pkg-config
];
};
extraBuildArgs = {
# https://discourse.nixos.org/t/how-to-use-install-name-tool-on-darwin/9931/2
postInstall = ''
${if isDarwin then "fixDarwinDylibNames" else ""}
'';
};
};
};
};
};
};
}
64 changes: 0 additions & 64 deletions rust.nix

This file was deleted.

0 comments on commit 1a68a53

Please sign in to comment.