Skip to content

Commit

Permalink
Nix build
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Dec 7, 2023
1 parent 1446b71 commit e75c38d
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ front/build/
# Local Netlify folder
.netlify
.smithy.lsp.log
result
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ val app = crossProject(JVMPlatform, NativePlatform)
.nativeConfigure(
_.settings(
libraryDependencies ++= Seq(
"com.armanbilge" %%% "epollcat" % "0.1.1"
"com.armanbilge" %%% "epollcat" % "0.1.6"
)
)
)
Expand Down
26 changes: 26 additions & 0 deletions derivation.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ mkSbtDerivation, gitignore-source, which, clang, s2n-tls }:

let pname = "spotify-next"; in

mkSbtDerivation {
inherit pname;
version = "0.1.0";
depsSha256 = "sha256-nPDkvJR87D1iiXIpivZCEB+yx4pE04PtjFd8rcNH54Q=";

buildInputs = [ which clang ];
nativeBuildInputs = [ s2n-tls ];
depsWarmupCommand = ''
sbt compile
'';

src = gitignore-source.lib.gitignoreSource ./.;

buildPhase = ''
sbt nativeLink
'';

installPhase = ''
mkdir -p $out/bin
cp app/.native/target/scala-3.3.1/spotify-next-out $out/bin/$pname
'';
}
74 changes: 73 additions & 1 deletion flake.lock

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

11 changes: 9 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
{
inputs.nixpkgs.url = "github:nixos/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.sbt-derivation.url = "github:zaninime/sbt-derivation";
inputs.gitignore-source.url = "github:hercules-ci/gitignore.nix";
inputs.gitignore-source.inputs.nixpkgs.follows = "nixpkgs";

outputs = { self, nixpkgs, flake-utils, ... }@inputs:
outputs = { self, nixpkgs, flake-utils, sbt-derivation, ... }@inputs:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
pkgs = import nixpkgs {
inherit system;
overlays = [ sbt-derivation.overlays.default ];
};
in
{
devShells.default = pkgs.mkShell {
nativeBuildInputs = [ pkgs.s2n-tls ];
};
packages.default = pkgs.callPackage ./derivation.nix { inherit (inputs) gitignore-source; };
}
);
}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2")

addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.15")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")

addDependencyTreePlugin

0 comments on commit e75c38d

Please sign in to comment.