Skip to content

Commit

Permalink
flake.nix/shell.nix merged
Browse files Browse the repository at this point in the history
  • Loading branch information
pshirshov committed Oct 26, 2024
1 parent aae58d1 commit 5f1dbaa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 32 deletions.
50 changes: 18 additions & 32 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,24 @@ import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations.*

ThisBuild / scalaVersion := "2.13.14"

val niOptionsCommon = Seq(
"-ENIX_BINTOOLS",
"-ENIX_CC",
"-ENIX_CFLAGS_COMPILE",
"-ENIX_LDFLAGS",
"-EbuildInputs",
"-EcmakeFlags",
"-EnativeBuildInputs",
"-EpropagatedBuildInputs",
"-EpropagatedNativeBuildInputs",
)

val niOptions = niOptionsCommon ++ (if (System
.getProperty("os.name")
.toLowerCase
.contains("mac") && System
.getProperty("os.arch") == "aarch64") {
Seq(
"-ENIX_CC_WRAPPER_TARGET_HOST_aarch64_apple_darwin",
"-ENIX_BINTOOLS_WRAPPER_TARGET_HOST_aarch64_apple_darwin",
)
} else if (System
.getProperty("os.name")
.toLowerCase
.contains("mac")) {
Seq(
"-ENIX_CC_WRAPPER_TARGET_HOST_x86_64_apple_darwin",
"-ENIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_apple_darwin",
)
} else {
Seq.empty
})
val niOptions =
Option(System.getenv("NIX_CC_SUFFIX_SALT"))
.map { suffix =>
Seq(
"-ENIX_BINTOOLS",
"-ENIX_CC",
"-ENIX_CFLAGS_COMPILE",
"-ENIX_LDFLAGS",
"-EbuildInputs",
"-EcmakeFlags",
"-EnativeBuildInputs",
"-EpropagatedBuildInputs",
"-EpropagatedNativeBuildInputs",
s"-ENIX_CC_WRAPPER_TARGET_HOST_${suffix}",
s"-ENIX_BINTOOLS_WRAPPER_TARGET_HOST_${suffix}",
)
}
.getOrElse(Seq.empty)

lazy val root = (project in file("."))
.settings(
Expand Down
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
sbt
dotnet-sdk_7
];

shellHook = ''
export NIX_CC_SUFFIX_SALT=${stdenv.cc.suffixSalt}
'';
};
}
);
Expand Down

0 comments on commit 5f1dbaa

Please sign in to comment.