Skip to content

Commit

Permalink
feat!: migrate devShells
Browse files Browse the repository at this point in the history
  • Loading branch information
r17x committed May 22, 2024
1 parent 3e81ac8 commit 1b9edef
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 65 deletions.
141 changes: 76 additions & 65 deletions devShells.nix
Original file line number Diff line number Diff line change
@@ -1,77 +1,88 @@
##################################################################
# Development shells
##################################################################
{ pkgs, precommit }:
{ self, ... }:

{
#
#
# $ nix develop github:r17x/nixpkgs
#
#
default = pkgs.mkShell {
description = "r17x/nixpkgs development environment";
shellHook = precommit.shellHook or '''';
buildInputs = precommit.buildInputs or [ ];
packages = precommit.packages or [ ];
};
perSystem = { pkgs, ... }:
{
pre-commit.check.enable = true;
pre-commit.devShell = self.devShells.default;
pre-commit.settings.hooks = {
actionlint.enable = true;
shellcheck.enable = true;
stylua.enable = true;
# TODO https://github.com/cachix/pre-commit-hooks.nix/issues/196
# make override and pass configuration
luacheck.enable = false;

#
#
# $ nix develop github:r17x/nixpkgs#node18
#
#
node18 = pkgs.mkShell {
description = "Node.js 18 Development Environment";
buildInputs = with pkgs; [
nodejs_18
(nodePackages.yarn.override { nodejs = nodejs_18; })
];
};
# .nix related
deadnix.enable = true;
nixpkgs-fmt.enable = true;
};

#
#
# $ nix develop github:r17x/nixpkgs#ocamlorg
#
#
ocamlorg =
let ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14; in
pkgs.mkShell {
description = "OCaml.org development environment";
buildInputs = with ocamlPackages; [ ocaml merlin ];
nativeBuildInputs = with pkgs; [
opam
pkg-config
libev
oniguruma
openssl
gmp
];
};

#
#
# $ nix develop github:r17x/nixpkgs#pnpm
#
#
pnpm = pkgs.mkShell {
description = "Nodejs with PNPM";
devShells = {
default = pkgs.mkShell { };
#
#
# $ nix develop github:r17x/nixpkgs#node18
#
#
node18 = pkgs.mkShell {
description = "Node.js 18 Development Environment";
buildInputs = with pkgs; [
nodejs_18
(nodePackages.yarn.override { nodejs = nodejs_18; })
];
};

#
#
# $ nix develop github:r17x/nixpkgs#ocamlorg
#
#
ocamlorg =
let ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14; in
pkgs.mkShell {
description = "OCaml.org development environment";
buildInputs = with ocamlPackages; [ ocaml merlin ];
nativeBuildInputs = with pkgs; [
opam
pkg-config
libev
oniguruma
openssl
gmp
];
};

#
#
# $ nix develop github:r17x/nixpkgs#pnpm
#
#
pnpm = pkgs.mkShell {
description = "Nodejs with PNPM";

buildInputs = with pkgs; [
nodejs_18
(nodePackages.pnpm.override { nodejs = nodejs_18; })
];
};
buildInputs = with pkgs; [
nodejs_18
(nodePackages.pnpm.override { nodejs = nodejs_18; })
];
};

#
#
# $ nix develop github:r17x/nixpkgs#rust-wasm
#
#
rust-wasm = pkgs.mkShell {
# declared ENV variables when starting shell
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
#
#
# $ nix develop github:r17x/nixpkgs#rust-wasm
#
#
rust-wasm = pkgs.mkShell {
# declared ENV variables when starting shell
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";

nativeBuildInputs = with pkgs; [ rustc cargo gcc rustfmt clippy ];
};
nativeBuildInputs = with pkgs; [ rustc cargo gcc rustfmt clippy ];
};
};

};
}
77 changes: 77 additions & 0 deletions flake.lock

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

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
];

imports = [
inputs.precommit.flakeModule
./devShells.nix
./overlays
./modules/parts
./hosts
Expand Down Expand Up @@ -48,6 +50,10 @@
sops.inputs.nixpkgs.follows = "nixpkgs";
sops.inputs.nixpkgs-stable.follows = "stable";

# utilities
precommit.url = "github:cachix/pre-commit-hooks.nix";
precommit.inputs.nixpkgs.follows = "nixpkgs";

# vimPlugins from flake inputs
# prefix "vimPlugins_"
# e.g: rescript-nvim to be vimPlugins_rescript-nvim
Expand Down

0 comments on commit 1b9edef

Please sign in to comment.