Skip to content

Commit

Permalink
Merge pull request #202 from replit/cad/replit-nixmodule
Browse files Browse the repository at this point in the history
initial replit module
  • Loading branch information
cdmistman authored Dec 11, 2023
2 parents 9c9bb04 + cf8d3df commit d42f43e
Show file tree
Hide file tree
Showing 6 changed files with 725 additions and 2 deletions.
4 changes: 4 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -954,5 +954,9 @@
"r-4.3:v1-20231201-3b22c78": {
"commit": "3b22c787fd20b13fe5afb868589c574068303b5e",
"path": "/nix/store/naz6n9b9fd8swy5yb2i9sn4haw4h3c48-replit-module-r-4.3"
},
"replit:v1-20231211-d5ddcff": {
"commit": "d5ddcff9419456ecf54d2582c4b1cc4242198ac0",
"path": "/nix/store/lljp25m1lvjs4kvz24rpdfifx4qn2jrj-replit-module-replit"
}
}
4 changes: 2 additions & 2 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ rec {
bundle-image-tarball = pkgs.callPackage ./bundle-image-tarball { inherit bundle-image revstring; };

bundle-squashfs = bundle-squashfs-fn {
moduleIds = [ "python-3.10" "nodejs-18" "nodejs-20" "docker" ];
moduleIds = [ "python-3.10" "nodejs-18" "nodejs-20" "docker" "replit" ];
diskName = "disk.sqsh";
};

Expand All @@ -75,7 +75,7 @@ rec {
# publish your feature branch first and make sure modules.json is current, then
# in goval dir (next to nixmodules), run `make custom-nixmodules-disk` to use this disk in conman
# There is no need to check in changes to this.
moduleIds = [ "python-3.10" "nodejs-18" "nodejs-20" "docker" ];
moduleIds = [ "python-3.10" "nodejs-18" "nodejs-20" "docker" "replit" ];
diskName = "disk.sqsh";
};

Expand Down
1 change: 1 addition & 0 deletions pkgs/modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ let
(import ./php)
(import ./qbasic)
(import ./R)
(import ./replit)
(import ./ruby {
ruby = pkgs.ruby_3_1;
rubyPackages = pkgs.rubyPackages_3_1;
Expand Down
51 changes: 51 additions & 0 deletions pkgs/modules/replit/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{ lib, pkgs, ... }:

let
# use changes from https://github.com/tamasfe/taplo/pull/510
# the above PR adds the `-c` flag to the `taplo lsp` command, which is
# necessary to support our schema. There are a couple of paths forward
# for replacing this derivation:
# option 1:
# - the above pr is merged
# - new taplo version is released https://github.com/tamasfe/taplo/pull/502 (with my change)
# - nixpkgs-unstable gets the updated version
# - we update to nixpkgs-unstable that contains the updated taplo version
# option 2:
# - given that taplo currently consumes >1 mb of memory, it'd be nice to have
# a custom bin that wraps taplo-lsp crate that *only* provides lsp for .replit
# files. this should reduce the amount of consumed memory by a good amount.
# - use the above custom bin
taplo = pkgs.rustPlatform.buildRustPackage rec {
pname = "taplo";
version = "0.patched";
src = pkgs.fetchFromGitHub {
owner = "cdmistman";
repo = "taplo";
rev = "22eff1f7775e48eee8b50518c67f992b4595ab61";
hash = "sha256-63fm8pH03TJd4QBuhIxtttoEAaBnc9TuHGKCMK4YGP0=";
};

cargoHash = "sha256-4OSCN2zCrlBHihZn7TCNZp4mCREpvrpKsfMSNP95GNc=";
buildFeatures = [ "lsp" ];
};

taplo-config = pkgs.writeText "taplo-config.toml" ''
include = ["**/.replit"]
[schema]
enabled = true
path = "${./dotreplit-schema.json}"
'';
in

{
id = "replit";
name = "Base Replit Tools";

replit.dev.languageServers.dotreplit-lsp = {
name = ".replit LSP";
language = "dotreplit";
start = "${taplo}/bin/taplo lsp -c ${taplo-config} stdio";
};
}

Loading

0 comments on commit d42f43e

Please sign in to comment.