editing messageEdit logs to be clearer.
Co-authored-by: PineappleFan <pineapplefanyt@gmail.com>
Co-authored-by: Skyler <skyler3665@gmail.com>
diff --git a/flake.nix b/flake.nix
index 741a2bd..fd6cfb6 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,17 +1,63 @@
{
description = "A basic flake with a shell";
- inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
+ inputs.nixpkgs.follows = "clicks-server/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
+ inputs.clicks-server.url = "github:clicksminuteper/nixfiles";
+ inputs.pnpm2nix.url = "github:clicksminuteper/pnpm2nix";
- outputs = { self, nixpkgs, flake-utils }:
+ inputs.pnpm2nix.inputs.nixpkgs.follows = "nixpkgs";
+
+ outputs = { self, nixpkgs, flake-utils, clicks-server, pnpm2nix }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
- in {
+ nodejs = pkgs.nodejs-19_x;
+ nodePackages = pkgs.nodePackages_latest;
+ lib = pkgs.lib;
+ in rec {
devShells.default = pkgs.mkShell {
- packages = [ pkgs.nodejs-19_x pkgs.nodePackages_latest.yarn ];
+ packages = [ nodejs nodePackages.pnpm ];
shellHook = ''
unset name
'';
};
+
+ packages.env = lib.pipe {
+ src = ./.;
+ packageJSON = ./package.json;
+ } [
+ pnpm2nix.mkPnpmPackage
+ pnpm2nix.mkPnpmEnv
+ ];
+
+ packages.default = let
+ packageJSON = (builtins.fromJSON (builtins.readFile ./package.json));
+ in pkgs.stdenv.mkDerivation {
+ pname = "nucleus";
+ version = packageJSON.version;
+
+ src = ./.;
+
+ buildInputs = [ packages.env nodejs nodePackages.pnpm ];
+ nativeBuildInputs = [ packages.env nodePackages.pnpm ];
+
+ buildPhase = ''
+ pnpm run build
+ '';
+
+ installPhase = ''
+ cp dist $out
+ mkdir -p $out/bin
+ echo "#!/usr/bin/env bash\ncd $out\n${packageJSON.scripts.start}" > $out/bin/nucleus
+ '';
+ };
+
+ dockerImage = let
+ nucleus = packages.default;
+ in pkgs.dockerTools.streamLayeredImage {
+ name = "nucleus";
+ tag = "latest";
+ contents = [ nucleus ];
+ config.Cmd = [ "${nucleus}/bin/nucleus" ];
+ };
});
}
\ No newline at end of file