feat: nix build enabled
This commit is contained in:
parent
ef63cd474f
commit
e7594ef2eb
|
@ -10,3 +10,5 @@
|
||||||
*/project/.bloop
|
*/project/.bloop
|
||||||
*/project/target/
|
*/project/target/
|
||||||
*/target/
|
*/target/
|
||||||
|
|
||||||
|
*/result
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
.bsp/
|
||||||
|
.scala-build/
|
||||||
|
.metals/
|
||||||
|
.direnv
|
||||||
|
*/dist/
|
||||||
|
/11-single-price-grid-component/.bloop/
|
||||||
|
|
||||||
|
*/project/project/
|
||||||
|
*/project/metals.sbt
|
||||||
|
*/project/.bloop
|
||||||
|
*/project/target/
|
||||||
|
*/target/
|
|
@ -0,0 +1,39 @@
|
||||||
|
{ pkgs, sbt-derivation }:
|
||||||
|
|
||||||
|
let
|
||||||
|
package = sbt-derivation.lib.mkSbtDerivation {
|
||||||
|
inherit pkgs;
|
||||||
|
# ...and the rest of the arguments
|
||||||
|
pname = "price-grid-app";
|
||||||
|
version = "0.0.1";
|
||||||
|
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
|
||||||
|
nativeBuildInputs = [ pkgs.nodePackages.tailwindcss ];
|
||||||
|
buildPhase = ''
|
||||||
|
sbt assembly
|
||||||
|
tailwindcss -i ./src/input.css -o ./output.css
|
||||||
|
'';
|
||||||
|
# css path different from ordinary development,
|
||||||
|
# because .gitignore makes it unavailable during nix build
|
||||||
|
# anyway copied to correct place
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp target/scala-*/priceGrid-assembly-*.jar $out/bin/
|
||||||
|
mkdir -p $out/bin/dist
|
||||||
|
cp ./output.css $out/bin/dist/output.css
|
||||||
|
cp -r public $out/bin/public
|
||||||
|
'';
|
||||||
|
|
||||||
|
depsSha256 = "sha256-aWLqnPXvchtNqpSfXo5sWyK2QFNn1GqToy58cWrML3U=";
|
||||||
|
};
|
||||||
|
|
||||||
|
module = { config, pkgs, ... }: {
|
||||||
|
services.price-grid-app = {
|
||||||
|
enable = true;
|
||||||
|
package = package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
package = package;
|
||||||
|
module = module;
|
||||||
|
}
|
|
@ -33,10 +33,10 @@ case class AppRoutes()(implicit cc: castor.Context,
|
||||||
def index() = Page.wholePageMarkup
|
def index() = Page.wholePageMarkup
|
||||||
|
|
||||||
@cask.staticFiles("/dist") // this is what path gets matched
|
@cask.staticFiles("/dist") // this is what path gets matched
|
||||||
def distFiles() = "dist" // this is os path where files are looked up, for the generated files
|
def distFiles() = "dist"
|
||||||
|
|
||||||
@cask.staticFiles("/public") // this is what path gets matched
|
@cask.staticFiles("/public") // this is what path gets matched
|
||||||
def publicFiles() = "public" // this is os path where files are looked up, for the committed files
|
def publicFiles() = "public"
|
||||||
|
|
||||||
initialize()
|
initialize()
|
||||||
}
|
}
|
||||||
|
|
39
flake.lock
39
flake.lock
|
@ -18,6 +18,21 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1667395993,
|
||||||
|
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687695299,
|
"lastModified": 1687695299,
|
||||||
|
@ -36,7 +51,29 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"sbt-derivation": "sbt-derivation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sbt-derivation": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils_2",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1675083208,
|
||||||
|
"narHash": "sha256-+sSFhSpV2jckr1qYlX/SaxQ6IdpagD6o4rru/3HAl0I=",
|
||||||
|
"owner": "zaninime",
|
||||||
|
"repo": "sbt-derivation",
|
||||||
|
"rev": "92d6d6d825e3f6ae5642d1cce8ff571c3368aaf7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "zaninime",
|
||||||
|
"repo": "sbt-derivation",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
|
40
flake.nix
40
flake.nix
|
@ -2,22 +2,30 @@
|
||||||
description = "learning htmx";
|
description = "learning htmx";
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs";
|
inputs.nixpkgs.url = "github:nixos/nixpkgs";
|
||||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
# add this line
|
||||||
|
inputs.sbt-derivation.url = "github:zaninime/sbt-derivation";
|
||||||
|
# recommended for first style of usage documented below, but not necessary
|
||||||
|
inputs.sbt-derivation.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils }:
|
outputs = { self, nixpkgs, flake-utils, sbt-derivation }:
|
||||||
flake-utils.lib.eachDefaultSystem
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
(system:
|
let
|
||||||
let pkgs = nixpkgs.legacyPackages.${system}; in
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
{
|
price-grid = import ./11-single-price-grid-component/default.nix {
|
||||||
devShells.default = pkgs.mkShell {
|
inherit pkgs sbt-derivation;
|
||||||
buildInputs = [
|
};
|
||||||
pkgs.scala-cli
|
in {
|
||||||
pkgs.sbt
|
devShells.default = pkgs.mkShell {
|
||||||
pkgs.scalafmt
|
buildInputs = [
|
||||||
pkgs.nodePackages.tailwindcss
|
pkgs.scala-cli
|
||||||
pkgs.jdk
|
pkgs.sbt
|
||||||
];
|
pkgs.scalafmt
|
||||||
};
|
pkgs.nodePackages.tailwindcss
|
||||||
}
|
pkgs.jdk
|
||||||
);
|
];
|
||||||
|
};
|
||||||
|
packages.price-grid-app = price-grid.package;
|
||||||
|
nixosModules.price-grid-app = price-grid.module;
|
||||||
|
});
|
||||||
# see https://serokell.io/blog/practical-nix-flakes
|
# see https://serokell.io/blog/practical-nix-flakes
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue