Skip to content

Commit

Permalink
setup: add nix flake
Browse files Browse the repository at this point in the history
nix package manager users can setup a shell environnement based on a
flake.nix file that describes tools and versions needed to dev and run
the project, this flake contains:
- nodejs 20
- npm
- typescript language server
- angular language service

nix flakes combinated with direnv allow to open a project folder with
automatic setup launch, creates en .envrc file and a .direnv directory.
-> not every contributors use it and want to have those dotfiles, so it
should be ignored by git.

Co-authored-by: Uriel-Sautron <[email protected]>
  • Loading branch information
Yohh and Uriel-Sautron committed Mar 5, 2025
1 parent 95a8445 commit a859bc0
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ testem.log
Thumbs.db
src/environments/*.tmp
*.iml

# direnv
.envrc
.direnv
61 changes: 61 additions & 0 deletions flake.lock

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

36 changes: 36 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
description = "A flake for a TypeScript project";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs =
{ nixpkgs
, flake-utils
, ...
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
node = pkgs.nodejs_20;
nodePackages = pkgs.nodePackages.override {
nodejs = node;
};
angularLanguageServer = pkgs.angular-language-server;
in
{
devShell = pkgs.mkShell {
buildInputs = [
node
nodePackages.npm
nodePackages.typescript
nodePackages.typescript-language-server
angularLanguageServer
];
};
});
}

0 comments on commit a859bc0

Please sign in to comment.