diff --git a/README.md b/README.md index d2f7ee6..c8fa69c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # flakes +A collection of flakes for various projects. +## Usage +nix flake init -t # \ No newline at end of file diff --git a/bun/.envrc b/bun/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/bun/.envrc @@ -0,0 +1 @@ +use flake diff --git a/bun/flake.nix b/bun/flake.nix new file mode 100644 index 0000000..8d6fb82 --- /dev/null +++ b/bun/flake.nix @@ -0,0 +1,35 @@ +{ + description = "Bun dev shell"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + }; + + outputs = { self, nixpkgs }: + let + allSystems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + devShells = forAllSystems ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ + bun + ]; + + shellHook = '' + echo "" + echo "Bun version: $(bun --version)" + ''; + }; + }); + }; +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..00e017c --- /dev/null +++ b/flake.nix @@ -0,0 +1,26 @@ +{ + description = "A collection of flake templates"; + + outputs = { self }: { + templates = { + node-pnpm = { + path = ./node-pnpm; + description = "Node.js with pnpm development environment"; + }; + go = { + path = ./go; + description = "Go development environment"; + }; + rust = { + path = ./rust; + description = "Rust development environment"; + }; + bun = { + path = ./bun; + description = "Bun development environment"; + }; + }; + + defaultTemplate = self.templates.node-pnpm; + }; +} diff --git a/go/.envrc b/go/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/go/.envrc @@ -0,0 +1 @@ +use flake diff --git a/go/flake.nix b/go/flake.nix new file mode 100644 index 0000000..20c3903 --- /dev/null +++ b/go/flake.nix @@ -0,0 +1,38 @@ +{ + description = "Go dev shell"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + }; + + outputs = { self, nixpkgs }: + let + allSystems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + devShells = forAllSystems ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ + go + gopls + gotools + go-tools + ]; + + shellHook = '' + echo "" + echo "Go version: $(go version)" + ''; + }; + }); + }; +} diff --git a/node-pnpm/.envrc b/node-pnpm/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/node-pnpm/.envrc @@ -0,0 +1 @@ +use flake diff --git a/node-pnpm/flake.nix b/node-pnpm/flake.nix new file mode 100644 index 0000000..a4f59d4 --- /dev/null +++ b/node-pnpm/flake.nix @@ -0,0 +1,37 @@ +{ + description = "Node.js with pnpm dev shell"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + }; + + outputs = { self, nixpkgs }: + let + allSystems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + devShells = forAllSystems ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ + nodejs_20 + nodePackages.pnpm + ]; + + shellHook = '' + echo "" + echo "Node version: $(node --version)" + echo "pnpm version: $(pnpm --version)" + ''; + }; + }); + }; +} diff --git a/rust/.envrc b/rust/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/rust/.envrc @@ -0,0 +1 @@ +use flake diff --git a/rust/flake.nix b/rust/flake.nix new file mode 100644 index 0000000..529a357 --- /dev/null +++ b/rust/flake.nix @@ -0,0 +1,40 @@ +{ + description = "Rust dev shell"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + }; + + outputs = { self, nixpkgs }: + let + allSystems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + devShells = forAllSystems ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ + cargo + rustc + rustfmt + rust-analyzer + clippy + ]; + + shellHook = '' + echo "" + echo "Cargo version: $(cargo --version)" + echo "Rustc version: $(rustc --version)" + ''; + }; + }); + }; +}