diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c8424ee --- /dev/null +++ b/flake.nix @@ -0,0 +1,26 @@ +{ + description = "A collection of flake templates"; + + outputs = { self }: { + + templates = { + + simplePython = { + path = ./python; + description = "Python template"; + }; + + rust = { + path = ./rust; + description = "Simple rust template"; + }; + + vlang = { + path = ./vlang; + description = "Simple vlang template"; + }; + + }; + + }; +} diff --git a/python/flake.nix b/python/flake.nix new file mode 100644 index 0000000..1978eae --- /dev/null +++ b/python/flake.nix @@ -0,0 +1,17 @@ +{ + description = "A small file sorter using tkinter and python"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + outputs = { self, nixpkgs }: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + in + { + devShells = forAllSystems (system: { + default = pkgs.${system}.callPackage ./shell.nix {} ; + }); + }; +} diff --git a/python/shell.nix b/python/shell.nix new file mode 100644 index 0000000..35878d7 --- /dev/null +++ b/python/shell.nix @@ -0,0 +1,19 @@ +{ pkgs ? import {} }: + +let + my-python = pkgs.python310; + python-with-packages = my-python.withPackages ( p: with p; [ + pip + jedi-language-server + ]); +in +pkgs.mkShell { + buildInputs = [ + python-with-packages + ]; + shellHook='' + export PIP_PREFIX=$(pwd)/_build/pip_packages + export PYTHONPATH="$PIP_PREFIX/${pkgs.python3.sitePackages}:$PYTHONPATH" + export PATH="$PIP_PREFIX/bin:$PATH" + ''; +} diff --git a/rust/flake.nix b/rust/flake.nix new file mode 100644 index 0000000..ee27dcc --- /dev/null +++ b/rust/flake.nix @@ -0,0 +1,19 @@ +{ + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + outputs = { self, nixpkgs }: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + in + { + devShells = forAllSystems (system :{ + default = pkgs.${system}.callPackage ./shell.nix {}; + }); + }; + +} diff --git a/rust/shell.nix b/rust/shell.nix new file mode 100644 index 0000000..443585d --- /dev/null +++ b/rust/shell.nix @@ -0,0 +1,10 @@ +{pkgs ? import {}}: + +pkgs.mkShell { + buildInputs = with pkgs; [ + cargo + rustc + pkg-config + openssl + ]; + } diff --git a/vlang/flake.nix b/vlang/flake.nix new file mode 100644 index 0000000..95c278d --- /dev/null +++ b/vlang/flake.nix @@ -0,0 +1,19 @@ +{ + description = "A very basic Vlang flake"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + + outputs = { self, nixpkgs, ...}: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + in + { + devShells = forAllSystems (system: { + default = pkgs.${system}.callPackage ./shell.nix {}; + }); + }; +} diff --git a/vlang/shell.nix b/vlang/shell.nix new file mode 100644 index 0000000..a1453fd --- /dev/null +++ b/vlang/shell.nix @@ -0,0 +1,21 @@ + +{ pkgs ? import {}}: + +pkgs.mkShell rec { + buildInputs = with pkgs; [ + vlang + python3 + python3Packages.pip + gcc + hdf5 + gfortran + liblapack + openblas + openmpi + metis + #mesa + ]; + shellHook = '' + unalias v + ''; +}