Skip to content

Commit

Permalink
add nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelglass committed Mar 1, 2024
1 parent b9081e7 commit 185ac0a
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# this caches nix setup, making day-to-day nix usage much faster.
# see flake.nix for our nix setup
use flake
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ yarn.lock
.env
dist
lib

# used by the nix when nix is used to provide a development environment
.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 @@
# this flake installs all tools required for the dev env
{
description = "nlx SDK dev env";

inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";

outputs =
{ self
, nixpkgs
, flake-utils
}:
flake-utils.lib.eachDefaultSystem (system:
let
assertVersion = version: pkg: (
assert (pkgs.lib.assertMsg (builtins.toString pkg.version == version) ''
Expecting version of ${pkg.name} to be ${version} but got ${pkg.version};
'');
pkg
);
pkgs = import nixpkgs
{
system = system;
config.allowUnfree = true;
};

in
{
formatter = pkgs.nixpkgs-fmt;
devShells.default = pkgs.mkShell {
packages = with pkgs; [
(assertVersion (nixpkgs.lib.strings.fileContents "${self}/.node-version") nodejs_18)
];
};
});
}

0 comments on commit 185ac0a

Please sign in to comment.