Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Nix flake to pin Node and Rust versions #247

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 77 additions & 22 deletions flake.lock

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

42 changes: 23 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,55 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-node-18.url = "github:NixOS/nixpkgs/0cd51a933d91078775b300cf0f29aa3495231aa2";
utils.url = "github:numtide/flake-utils";
shardus-cli.url = "git+https://gitlab.com/shardus/tools/shardus-cli?ref=nix-flake";
naersk.url = "github:nix-community/naersk";
fenix.url = "github:nix-community/fenix";
};

outputs = {
self,
naersk,
nixpkgs,
shardus-cli,
nixpkgs-node-18,
utils,
shardus-cli,
fenix,
...
}: let
appName = "shardus-core";
out =
utils.lib.eachDefaultSystem
(system: let
pkgs = import nixpkgs {
inherit system;
};
buildNodeJs = pkgs.callPackage "${nixpkgs}/pkgs/development/web/nodejs/nodejs.nix" {python = pkgs.python3;};
pkgs-node-18 = import nixpkgs-node-18 {inherit system;};
pkgs = import nixpkgs {inherit system;};

# build a custom nodejs at version 18.16.1
buildNodeJs = pkgs-node-18.callPackage "${nixpkgs-node-18}/pkgs/development/web/nodejs/nodejs.nix" {python = pkgs-node-18.python3;};
custom-nodejs = buildNodeJs {
enableNpm = true;
version = "18.16.1";
sha256 = "0wp2xyz5yqcvb6949xaqpan73rfhdc3cdfsvx7vzvzc9in64yh78";
};

nativeBuildInputs = with pkgs; [
custom-nodejs
# also pin rust to 1.74.1
custom-rust = fenix.packages.${system}.toolchainOf {
channel = "1.74.1";
sha256 = "sha256-PjvuouwTsYfNKW5Vi5Ye7y+lL7SsWGBxCtBOOm2z14c=";
};

# rust dependencies for rust dependencies
cargo
];
buildInputs = with pkgs; [];
nativeBuildInputs = [custom-rust.toolchain];
buildInputs = [custom-nodejs];
in {
# `nix develop` or direnv
devShell = pkgs.mkShell {
packages =
nativeBuildInputs
++ buildInputs
++ (with pkgs; [
nodePackages.typescript-language-server
nodePackages.vscode-langservers-extracted
nodePackages.prettier

shardus-cli.packages.${system}.default
++ [shardus-cli.packages.${system}.default]
++ (with pkgs.nodePackages; [
typescript-language-server
vscode-langservers-extracted
prettier
]);
};
});
Expand Down
Loading