From 28cd26078f1c5561e2c562a45a3ba1c857791f3b Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Sat, 20 Jul 2024 11:19:20 -0700 Subject: [PATCH] Fix shells --- clojure/flake.nix | 19 ++++++++++--------- elixir/flake.nix | 5 +---- go/flake.nix | 11 +++++++++-- java/flake.nix | 19 ++++++++++--------- kotlin/flake.nix | 15 ++++++++------- node/flake.nix | 16 +++++++--------- r/flake.nix | 15 +++++++-------- rust-toolchain/flake.nix | 15 ++++++++------- rust/flake.nix | 37 +++++++++++++++++++------------------ scala/flake.nix | 16 ++++++++-------- 10 files changed, 87 insertions(+), 81 deletions(-) diff --git a/clojure/flake.nix b/clojure/flake.nix index 12f8dff..2972ea6 100644 --- a/clojure/flake.nix +++ b/clojure/flake.nix @@ -7,20 +7,21 @@ let javaVersion = 22; # Change this value to update the whole stack - overlays = [ - (final: prev: rec { - jdk = prev."jdk${toString javaVersion}"; - boot = prev.boot.override { inherit jdk; }; - clojure = prev.clojure.override { inherit jdk; }; - leiningen = prev.leiningen.override { inherit jdk; }; - }) - ]; + 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; }; + pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; }; }); in { + overlays.default = + final: prev: rec { + jdk = prev."jdk${toString javaVersion}"; + boot = prev.boot.override { inherit jdk; }; + clojure = prev.clojure.override { inherit jdk; }; + leiningen = prev.leiningen.override { inherit jdk; }; + }; + devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { packages = with pkgs; [ boot clojure leiningen ]; diff --git a/elixir/flake.nix b/elixir/flake.nix index aa48cc1..a2279e0 100644 --- a/elixir/flake.nix +++ b/elixir/flake.nix @@ -7,10 +7,7 @@ let supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import nixpkgs { - inherit system; - overlays = [ self.overlays.default ]; - }; + pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; }; }); in { diff --git a/go/flake.nix b/go/flake.nix index 278dae1..597acb5 100644 --- a/go/flake.nix +++ b/go/flake.nix @@ -6,13 +6,20 @@ outputs = { self, nixpkgs }: let goVersion = 22; # Change this to update the whole stack - overlays = [ (final: prev: { go = final."go_1_${toString goVersion}"; }) ]; + 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; }; + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlays.default ]; + }; }); in { + overlays.default = final: prev: { + go = final."go_1_${toString goVersion}"; + }; + devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { packages = with pkgs; [ diff --git a/java/flake.nix b/java/flake.nix index 633ec71..2137a3a 100644 --- a/java/flake.nix +++ b/java/flake.nix @@ -6,22 +6,23 @@ outputs = { self, nixpkgs }: let javaVersion = 22; # Change this value to update the whole stack - overlays = [ - (final: prev: rec { - jdk = prev."jdk${toString javaVersion}"; - gradle = prev.gradle.override { java = jdk; }; - maven = prev.maven.override { inherit jdk; }; - }) - ]; + 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; }; + pkgs = import nixpkgs { inherit system; }; }); in { + overlays.default = + final: prev: rec { + jdk = prev."jdk${toString javaVersion}"; + maven = prev.maven.override { jre = jdk; }; + gradle = prev.gradle.override { java = jdk; }; + }; + devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { - packages = with pkgs; [ jdk gradle maven jdt-language-server ]; + packages = with pkgs; [ maven gradle gcc ncurses patchelf zlib ]; }; }); }; diff --git a/kotlin/flake.nix b/kotlin/flake.nix index 11b022a..f5b408d 100644 --- a/kotlin/flake.nix +++ b/kotlin/flake.nix @@ -6,19 +6,20 @@ outputs = { self, nixpkgs }: let javaVersion = 22; # Change this value to update the whole stack - overlays = [ - (final: prev: rec { - jdk = prev."jdk${toString javaVersion}"; - gradle = prev.gradle.override { java = jdk; }; - kotlin = prev.kotlin.override { jre = jdk; }; - }) - ]; + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { pkgs = import nixpkgs { inherit system; }; }); in { + overlays.default = + final: prev: rec { + jdk = prev."jdk${toString javaVersion}"; + gradle = prev.gradle.override { java = jdk; }; + kotlin = prev.kotlin.override { jre = jdk; }; + }; + devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { packages = with pkgs; [ kotlin gradle gcc ncurses patchelf zlib ]; diff --git a/node/flake.nix b/node/flake.nix index d258e18..1154860 100644 --- a/node/flake.nix +++ b/node/flake.nix @@ -5,22 +5,20 @@ outputs = { self, nixpkgs }: let - overlays = [ - (final: prev: rec { - nodejs = prev.nodejs_latest; - pnpm = prev.nodePackages.pnpm; - yarn = (prev.yarn.override { inherit nodejs; }); - }) - ]; 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; }; + pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; }; }); in { + overlays.default = final: prev: rec { + nodejs = prev.nodejs; + yarn = (prev.yarn.override { inherit nodejs; }); + }; + devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { - packages = with pkgs; [ node2nix nodejs pnpm yarn ]; + packages = with pkgs; [ node2nix nodejs nodePackages.pnpm yarn ]; }; }); }; diff --git a/r/flake.nix b/r/flake.nix index 01bb4b9..878d871 100644 --- a/r/flake.nix +++ b/r/flake.nix @@ -5,19 +5,18 @@ outputs = { self, nixpkgs }: let - overlays = [ - (final: prev: rec { - rEnv = final.rWrapper.override { - packages = with final.rPackages; [ knitr ]; - }; - }) - ]; 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; }; + pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; }; }); in { + overlays.default = final: prev: rec { + rEnv = final.rWrapper.override { + packages = with final.rPackages; [ knitr ]; + }; + }; + devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { packages = with pkgs; diff --git a/rust-toolchain/flake.nix b/rust-toolchain/flake.nix index 682fa0c..f8f1957 100644 --- a/rust-toolchain/flake.nix +++ b/rust-toolchain/flake.nix @@ -11,18 +11,19 @@ outputs = { self, nixpkgs, rust-overlay }: let - overlays = [ - rust-overlay.overlays.default - (final: prev: { - rustToolchain = final.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; - }) - ]; 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; }; + pkgs = import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlays.default self.overlays.default ]; + }; }); in { + overlays.default = final: prev: { + rustToolchain = final.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + }; + devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { packages = with pkgs; [ diff --git a/rust/flake.nix b/rust/flake.nix index 5107813..a2e518e 100644 --- a/rust/flake.nix +++ b/rust/flake.nix @@ -11,29 +11,30 @@ outputs = { self, nixpkgs, rust-overlay }: let - overlays = [ - rust-overlay.overlays.default - (final: prev: { - rustToolchain = - let - rust = prev.rust-bin; - in - if builtins.pathExists ./rust-toolchain.toml then - rust.fromRustupToolchainFile ./rust-toolchain.toml - else if builtins.pathExists ./rust-toolchain then - rust.fromRustupToolchainFile ./rust-toolchain - else - rust.stable.latest.default.override { - extensions = [ "rust-src" "rustfmt" ]; - }; - }) - ]; 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; }; + pkgs = import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlays.default self.overlays.default ]; + }; }); in { + overlays.default = final: prev: { + rustToolchain = + let + rust = prev.rust-bin; + in + if builtins.pathExists ./rust-toolchain.toml then + rust.fromRustupToolchainFile ./rust-toolchain.toml + else if builtins.pathExists ./rust-toolchain then + rust.fromRustupToolchainFile ./rust-toolchain + else + rust.stable.latest.default.override { + extensions = [ "rust-src" "rustfmt" ]; + }; + }; + devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { packages = with pkgs; [ diff --git a/scala/flake.nix b/scala/flake.nix index 24f23ba..4f0e7af 100644 --- a/scala/flake.nix +++ b/scala/flake.nix @@ -6,19 +6,19 @@ outputs = { self, nixpkgs }: let javaVersion = 22; # Change this value to update the whole stack - overlays = [ - (final: prev: rec { - jdk = prev."jdk${toString javaVersion}"; - sbt = prev.sbt.override { jre = jdk; }; - scala = prev.scala_3.override { jre = jdk; }; - }) - ]; + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import nixpkgs { inherit system; }; + pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; }; }); in { + overlays.default = final: prev: rec { + jdk = prev."jdk${toString javaVersion}"; + sbt = prev.sbt.override { jre = jdk; }; + scala = prev.scala_3.override { jre = jdk; }; + }; + devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { packages = with pkgs; [ scala sbt coursier ];