From 709ae72897043a9ee904dc905337b7683e958a13 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Thu, 18 Jan 2024 14:48:41 +0100 Subject: [PATCH] Ah yeah add it as an entry point haha --- flake.nix | 96 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/flake.nix b/flake.nix index 100df82..97f2220 100644 --- a/flake.nix +++ b/flake.nix @@ -3,63 +3,62 @@ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - outputs = { self, nixpkgs }: - let - overlays = [ - (final: prev: - let - exec = pkg: "${prev.${pkg}}/bin/${pkg}"; - in - { - format = prev.writeScriptBin "format" '' - ${exec "nixpkgs-fmt"} **/*.nix - ''; - dvt = prev.writeScriptBin "dvt" '' - if [ -z $1 ]; then - echo "no template specified" - exit 1 - fi + outputs = { + self, + nixpkgs, + }: let + overlays = [ + (final: prev: let + exec = pkg: "${prev.${pkg}}/bin/${pkg}"; + in { + format = prev.writeScriptBin "format" '' + ${exec "nixpkgs-fmt"} **/*.nix + ''; + dvt = prev.writeScriptBin "dvt" '' + if [ -z $1 ]; then + echo "no template specified" + exit 1 + fi - TEMPLATE=$1 + TEMPLATE=$1 - ${exec "nix"} \ - --experimental-features 'nix-command flakes' \ - flake init \ - --template \ - "github:the-nix-way/dev-templates#''${TEMPLATE}" - ''; - update = prev.writeScriptBin "update" '' - for dir in `ls -d */`; do # Iterate through all the templates - ( - cd $dir - ${exec "nix"} flake update # Update flake.lock - ${exec "nix"} flake check # Make sure things work after the update - ) - done - ''; - }) - ]; - supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import nixpkgs { inherit overlays system; }; - }); - in + ${exec "nix"} \ + --experimental-features 'nix-command flakes' \ + flake init \ + --template \ + "github:the-nix-way/dev-templates#''${TEMPLATE}" + ''; + update = prev.writeScriptBin "update" '' + for dir in `ls -d */`; do # Iterate through all the templates + ( + cd $dir + ${exec "nix"} flake update # Update flake.lock + ${exec "nix"} flake check # Make sure things work after the update + ) + done + ''; + }) + ]; + supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; + forEachSupportedSystem = f: + nixpkgs.lib.genAttrs supportedSystems (system: + f { + pkgs = import nixpkgs {inherit overlays system;}; + }); + in { - devShells = forEachSupportedSystem ({ pkgs }: { + devShells = forEachSupportedSystem ({pkgs}: { default = pkgs.mkShell { - packages = with pkgs; [ format update ]; + packages = with pkgs; [format update]; }; }); - packages = forEachSupportedSystem ({ pkgs }: rec { + packages = forEachSupportedSystem ({pkgs}: rec { default = dvt; inherit (pkgs) dvt; }); } - - // - - { + // { templates = rec { clojure = { path = ./clojure; @@ -116,6 +115,11 @@ description = "Java development environment"; }; + jupyter = { + path = ./jupyter; + description = "Jupyter development environment"; + }; + kotlin = { path = ./kotlin; description = "Kotlin development environment";