From ddd3626c78c150ae371d0312ed7a9ab97891cfdf Mon Sep 17 00:00:00 2001 From: eveeifyeve Date: Sun, 7 Apr 2024 22:41:16 +1000 Subject: [PATCH] feat: nix&nixos flake --- flake.nix | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 flake.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..40ea9eb --- /dev/null +++ b/flake.nix @@ -0,0 +1,60 @@ +{ + description = "Node-Project Flake"; + + inputs = { + nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling"; + devenv.url = "github:cachix/devenv"; + nix2container.url = "github:nlewo/nix2container"; + nix2container.inputs.nixpkgs.follows = "nixpkgs"; + mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin"; + }; + + nixConfig = { + extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; + extra-substituters = "https://devenv.cachix.org"; + }; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + inputs.devenv.flakeModule + ]; + systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + perSystem = { config, self', inputs', pkgs, system, ... }: { + packages.devenv-up = self'.devShells.default.config.procfileScript; + + devenv.shells.default = { + name = "Node-Project"; + + # https://devenv.sh/guides/using-with-flake-parts/#import-a-devenv-module + imports = [ + ]; + + # https://devenv.sh/reference/options/ + packages = [ + config.packages.default + ]; + + languages.javascript = { + enable = true; + bun = { + enable = true; + install.enable = true; + }; + # PNPM If package needs PNPM but you should always try to use bun. + pnpm = { + enable = false; + install.enable = false; + }; + }; + }; + + }; + flake = { + # The usual flake attributes can be defined here, including system- + # agnostic ones like nixosModule and system-enumerating ones, although + # those are more easily expressed in perSystem. + + }; + }; +}