Reformat all projects; switch to overlay format

This commit is contained in:
Luc Perkins 2022-08-20 15:54:34 +03:00
parent bf45826289
commit fca8041d90
No known key found for this signature in database
GPG key ID: 4F102D0C16E232F2
30 changed files with 532 additions and 600 deletions

View file

@ -35,8 +35,7 @@ Once your preferred template has been initialized, you can use the provided shel
| [Elixir] | [`elixir`](./elixir/) |
| [Elm] | [`elm`](./elm/) |
| [Gleam] | [`gleam`](./gleam/) |
| [Go] 1.17 | [`go1_17`](./go1.17/) |
| [Go] 1.18 | [`go1_18`](./go1.18/) |
| [Go] | [`go`](./go/) |
| [Hashicorp] tools | [`hashi`](./hashi/) |
| [Java] | [`java`](./java/) |
| [Kotlin] | [`kotlin`](./kotlin/) |
@ -96,15 +95,9 @@ The sections below list what each template includes. In all cases, you're free t
- [Gleam] 0.22.1
### [`go1.17`](./go1.17/)
### [`go`](./go/)
- [Go] 1.17
- Standard Go tools ([goimports], [godoc], and others)
- [golangci-lint]
### [`go1.18`](./go1.18/)
- [Go] 1.18
- [Go] 1.19
- Standard Go tools ([goimports], [godoc], and others)
- [golangci-lint]

View file

@ -6,31 +6,38 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
jdk = "jdk17";
config = {
packageOverrides = p: {
boot = p.boot.override { jdk = p.${jdk}; };
clojure = p.clojure.override { jdk = p.${jdk}; };
leiningen = p.leiningen.override { jdk = p.${jdk}; };
javaVersion = 17;
overlays = [
(self: super: rec {
jdk = super."jdk${toString javaVersion}";
boot = super.boot.override {
inherit jdk;
};
clojure = super.clojure.override {
inherit jdk;
};
pkgs = import nixpkgs { inherit config system; };
inherit (pkgs) boot clojure leiningen mkShell;
leiningen = super.leiningen.override {
inherit jdk;
};
})
];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShells = {
default = mkShell {
buildInputs = [ boot clojure leiningen ];
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ boot clojure leiningen ];
shellHook = ''
${clojure}/bin/clj --version
${pkgs.clojure}/bin/clj --version
'';
};
};
});
}

View file

@ -6,21 +6,23 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) cue mkShell;
in
{
devShells = {
default = mkShell {
buildInputs = [ cue ];
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ cue ];
shellHook = ''
${cue}/bin/cue version
${pkgs.cue}/bin/cue version
'';
};
};
});
}

View file

@ -6,22 +6,21 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
dhall = pkgs.dhall;
inherit (pkgs) mkShell;
inherit (pkgs.lib) optionals;
inherit (pkgs.stdenv) isLinux;
# Helper function for building dhall-* tools
mkDhallTools = ls:
builtins.map (tool: pkgs.haskellPackages."dhall-${tool}") ls;
# dhall-* tools available only on all platforms
dhallToolsCommon = mkDhallTools [
dhallTools = mkDhallTools [
"bash"
"docs"
"json"
@ -31,22 +30,15 @@
"openapi"
"toml"
"yaml"
];
# dhall-* tools available only on Linux
dhallToolsLinux = optionals isLinux (mkDhallTools [ "csv" "text" ]);
dhallTools = dhallToolsCommon ++ dhallToolsLinux;
] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) (mkDhallTools [ "csv" "text" ]); # Linux only
in
{
devShells = {
default = mkShell {
buildInputs = [ dhall ] ++ dhallTools;
devShell = pkgs.mkShell {
buildInputs = (with pkgs; [ dhall ]) ++ dhallTools;
shellHook = ''
echo "dhall `${dhall}/bin/dhall --version`"
echo "dhall `${pkgs.dhall}/bin/dhall --version`"
'';
};
};
});
}

View file

@ -6,32 +6,27 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs)
darwin gigalixir inotify-tools libnotify mkShell terminal-notifier;
inherit (pkgs.beam.packages.erlangR25) elixir elixir_ls;
inherit (pkgs.darwin.apple_sdk.frameworks) CoreFoundation CoreServices;
inherit (pkgs.lib) optionals;
inherit (pkgs.stdenv) isDarwin isLinux;
linuxDeps = optionals isLinux [ gigalixir inotify-tools libnotify ];
darwinDeps = optionals isDarwin [ terminal-notifier ]
++ [ CoreFoundation CoreServices ];
in
{
devShells = {
default = mkShell {
buildInputs = [ elixir elixir_ls ] ++ linuxDeps ++ darwinDeps;
devShell = pkgs.mkShell {
buildInputs = (with pkgs; [ elixir ]) ++
pkgs.lib.optionals (pkgs.stdenv.isLinux) (with pkgs; [ gigalixir inotify-tools libnotify ]) ++ # Linux only
pkgs.lib.optionals (pkgs.stdenv.isDarwin) (with pkgs; [ terminal-notifier ]) ++ # macOS only
(with pkgs.darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]);
shellHook = ''
${elixir}/bin/mix --version
${elixir}/bin/iex --version
${pkgs.elixir}/bin/mix --version
${pkgs.elixir}/bin/iex --version
'';
};
};
});
}

View file

@ -6,23 +6,23 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) mkShell;
elm = pkgs.elmPackages.elm;
in
{
devShells = {
default = mkShell {
buildInputs = [ elm ] ++ (with pkgs; [ elm2nix ]);
devShell = pkgs.mkShell {
buildInputs = (with pkgs.elmPackages; [ elm ]) ++ (with pkgs; [ elm2nix ]);
shellHook = ''
shellHook = with pkgs.elmPackages; ''
echo "elm `${elm}/bin/elm --version`"
'';
};
};
});
}

View file

@ -6,23 +6,23 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
gleamPkg = pkgs.gleam;
inherit (pkgs) mkShell;
in
{
devShells = {
default = mkShell {
buildInputs = [ gleamPkg ];
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ gleam ];
shellHook = ''
${gleamPkg}/bin/gleam --version
${pkgs.gleam}/bin/gleam --version
'';
};
};
});
}

39
go/flake.nix Normal file
View file

@ -0,0 +1,39 @@
{
description = "A Nix-flake-based Go 1.17 development environment";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
goVersion = 19;
overlays = [ (self: super: { go = super."go_1_${toString goVersion}"; }) ];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShell = pkgs.mkShellNoCC {
buildInputs = with pkgs; [
# go 1.17.1 (specified by overlay)
go
# goimports, godoc, etc.
gotools
# https://github.com/golangci/golangci-lint
golangci-lint
];
shellHook = ''
${pkgs.go}/bin/go version
'';
};
});
}

View file

@ -1,42 +0,0 @@
{
description = "A Nix-flake-based Go 1.17 development environment";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
goPkg = pkgs.go_1_17;
inherit (pkgs) mkShellNoCC;
in
{
apps.default = {
type = "app";
program = "${goPkg}/bin/go";
};
devShells = {
default = mkShellNoCC {
buildInputs = with pkgs; [
# go 1.17.1
goPkg
# goimports, godoc, etc.
gotools
# https://github.com/golangci/golangci-lint
golangci-lint
];
shellHook = ''
${goPkg}/bin/go version
'';
};
};
});
}

View file

@ -1 +0,0 @@
use flake .

View file

@ -1,42 +0,0 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1660984654,
"narHash": "sha256-fDcsh8rm2o8cj+WFL8Y2cAqnsej0UGJa+Sy8U2nFg0Q=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "392c83491dcc21d17ab8ea1f809f8f7bd567a5a3",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,42 +0,0 @@
{
description = "A Nix-flake-based Go 1.18 development environment";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
goPkg = pkgs.go_1_18;
inherit (pkgs) mkShellNoCC;
in
{
apps.default = {
type = "app";
program = "${goPkg}/bin/go";
};
devShells = {
default = mkShellNoCC {
buildInputs = with pkgs; [
# go 1.18.3
goPkg
# goimports, godoc, etc.
gotools
# https://github.com/golangci/golangci-lint
golangci-lint
];
shellHook = ''
${goPkg}/bin/go version
'';
};
};
});
}

View file

@ -7,16 +7,19 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs)
damon levant mkShell nomad nomad-autoscaler nomad-pack packer
terraform vault;
hashiTools = [
in
{
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
packer
terraform
nomad
@ -25,22 +28,15 @@
nomad-pack
levant
damon
terragrunt
];
relatedTools = with pkgs; [ terragrunt ];
in
{
devShells = {
default = mkShell {
buildInputs = hashiTools ++ relatedTools;
shellHook = ''
shellHook = with pkgs; ''
echo "packer `${packer}/bin/packer --version`"
${terraform}/bin/terraform --version
${nomad}/bin/nomad --version
${vault}/bin/vault --version
'';
};
};
});
}

View file

@ -6,22 +6,24 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) cabal-install ghc mkShell;
in
{
devShells = {
default = mkShell {
buildInputs = [ cabal-install ghc ];
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ cabal-install ghc ];
shellHook = ''
shellHook = with pkgs; ''
${ghc}/bin/ghc --version
${cabal-install}/bin/cabal --version
'';
};
};
});
}

View file

@ -6,31 +6,37 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
jdk = pkgs.jdk17;
javaVersion = 17;
config = {
packageOverrides = p: {
gradle = (p.gradle.override { java = jdk; });
};
};
pkgs = import nixpkgs { inherit config jdk system; };
overlays = [
(self: super: rec {
jdk = super."jdk${toString javaVersion}";
gradle = super.gradle.override {
java = jdk;
buildTools = with pkgs; [ ant gradle maven ];
inherit (pkgs) mkShell;
};
maven = super.maven.override {
inherit jdk;
};
})
];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShells = {
default = mkShell {
buildInputs = [ java ] ++ buildTools;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ gradle jdk maven ];
shellHook = ''
${java}/bin/java -version
${pkgs.jdk}/bin/java -version
'';
};
};
});
}

View file

@ -6,35 +6,37 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
jdk = pkgs.jdk17;
javaVersion = 17;
config = {
packageOverrides = p: {
gradle = (p.gradle.override { java = jdk; });
kotlin = (p.kotlin.override { jre = jdk; });
overlays = [
(self: super: rec {
jdk = pkgs."jdk${toString javaVersion}";
gradle = super.gradle.override {
java = jdk;
};
kotlin = super.kotlin.override {
jre = jdk;
};
})
];
pkgs = import nixpkgs { inherit config system; };
inherit (pkgs) mkShell;
kotlin = pkgs.kotlin;
buildTools = with pkgs; [ gradle ];
otherTools = with pkgs; [ gcc ncurses patchelf zlib ];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShells = {
default = mkShell {
buildInputs = [ kotlin ] ++ buildTools ++ otherTools;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ kotlin gradle gcc ncurses patchelf zlib ];
shellHook = ''
${kotlin}/bin/kotlin -version
${pkgs.kotlin}/bin/kotlin -version
'';
};
};
});
}

View file

@ -6,21 +6,23 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) mkShell nickel;
in
{
devShells = {
default = mkShell {
buildInputs = [ nickel ];
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ nickel ];
shellHook = ''
${nickel}/bin/nickel --version
${pkgs.nickel}/bin/nickel --version
'';
};
};
});
}

View file

@ -6,21 +6,23 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) mkShell nim;
in
{
devShells = {
default = mkShell {
buildInputs = [ nim ];
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ nim ];
shellHook = ''
${nim}/bin/nim --version
${pkgs.nim}/bin/nim --version
'';
};
};
});
}

View file

@ -6,26 +6,27 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
dhallNix = pkgs.haskellPackages.dhall-nix;
nixRelatedTools = with pkgs; [
in
{
devShell = {
buildInputs = with pkgs; [
cachix
dhallNix
lorri
niv
nixfmt
statix
vulnix
haskellPackages.dhall-nix
];
inherit (pkgs) mkShell;
in
{
devShells = { default = mkShell { buildInputs = nixRelatedTools; }; };
};
});
}

View file

@ -6,26 +6,30 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
nodeOverlay = self: super: rec {
overlays = [
(self: super: rec {
nodejs = super.nodejs-18_x;
pnpm = super.nodePackages.pnpm;
yarn = (super.yarn.override { inherit nodejs; });
};
overlays = [ nodeOverlay ];
})
];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShells = {
default = pkgs.mkShell {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ node2nix nodejs pnpm yarn ];
shellHook = ''
echo "node `${pkgs.nodejs}/bin/node --version`"
'';
};
};
});
}

View file

@ -6,24 +6,24 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) mkShell;
ocaml = pkgs.ocamlPackages.ocaml;
ocamlTools = with pkgs.ocamlPackages;
[ dune_3 odoc ] ++ (with pkgs; [ ocamlformat ]);
in
{
devShells = {
default = mkShell {
buildInputs = [ ocaml ] ++ ocamlTools;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ ocaml ocamlformat ] ++
(with pkgs.ocamlPackages; [ dune_3 odoc ]);
shellHook = ''
${ocaml}/bin/ocaml --version
${pkgs.ocaml}/bin/ocaml --version
'';
};
};
});
}

View file

@ -6,23 +6,23 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) conftest mkShell open-policy-agent;
opaTools = [ conftest open-policy-agent ];
in
{
devShells = {
default = mkShell {
buildInputs = opaTools;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ open-policy-agent conftest ];
shellHook = ''
${open-policy-agent}/bin/opa version
${pkgs.open-policy-agent}/bin/opa version
'';
};
};
});
}

View file

@ -6,22 +6,23 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) buf mkShell protobuf;
in
{
devShells = {
default = mkShell {
buildInputs = [ buf protobuf ];
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ buf protobuf ];
shellHook = ''
shellHook = with pkgs; ''
echo "buf `${buf}/bin/buf --version`"
${protobuf}/bin/protoc --version
'';
};
};
});
}

View file

@ -7,29 +7,31 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, mach-nix, nixpkgs }:
outputs =
{ self
, flake-utils
, mach-nix
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) mkShell;
python = pkgs.python311;
overlays = [
(self: super: {
machNix = mach-nix.defaultPackage.${system};
python = super.python311;
})
];
pythonTools = with pkgs;
[ virtualenv ] ++ (with pkgs.python311Packages; [ pip ]);
nixTools = [ machNix ];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShells = {
default = mkShell {
buildInputs = [ python ] ++ pythonTools ++ nixTools;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ python machNix virtualenv ] ++
(with pkgs.python311Packages; [ pip ]);
shellHook = ''
${python}/bin/python --version
${pkgs.python}/bin/python --version
'';
};
};
});
}

View file

@ -6,23 +6,27 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) mkShell;
ruby = pkgs.ruby_3_1;
overlays = [
(self: super: {
ruby = super.ruby_3_1;
})
];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShells = {
default = mkShell {
buildInputs = [ ruby ];
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ ruby ];
shellHook = ''
${ruby}/bin/ruby --version
${pkgs.ruby}/bin/ruby --version
'';
};
};
});
}

View file

@ -7,41 +7,48 @@
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, flake-utils, nixpkgs, rust-overlay }:
outputs =
{ self
, flake-utils
, nixpkgs
, rust-overlay
}:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
overlays = [
(import rust-overlay)
(self: super: {
rustToolchain =
let
rust = super.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;
})
];
pkgs = import nixpkgs { inherit system overlays; };
inherit (pkgs) mkShell rust-bin;
inherit (pkgs.lib) optionals;
inherit (pkgs.stdenv) isLinux;
rust =
if builtins.pathExists ./rust-toolchain.toml then
rust-bin.fromRustupToolchainFile ./rust-toolchain.toml
else if builtins.pathExists ./rust-toolchain then
rust-bin.fromRustupToolchainFile ./rust-toolchain
else
rust-bin.stable.latest.default;
deps = with pkgs; [ openssl pkgconfig ];
rustTools = with pkgs;
[ cargo-audit cargo-deny cargo-cross rust-analyzer ]
++ optionals isLinux (with pkgs; [ cargo-watch ]);
in
{
packages.default = rust;
devShells = {
default = mkShell {
nativeBuildInputs = [ rust ] ++ deps ++ rustTools;
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustToolchain
openssl
pkg-config
cargo-audit
cargo-deny
cargo-cross
rust-analyzer
] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) (with pkgs; [ cargo-watch ]); # Currently broken on macOS
shellHook = ''
${rust}/bin/cargo --version
${pkgs.rustToolchain}/bin/cargo --version
'';
};
};
});
}

View file

@ -6,35 +6,37 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
jdk = "jdk17";
javaVersion = 17;
config = {
packageOverrides = p: {
sbt = p.sbt.override { jre = p.${jdk}; };
scala_3 = p.scala_3.override { jre = p.${jdk}; };
overlays = [
(self: super: rec {
jdk = super."jdk${toString javaVersion}";
sbt = super.sbt.override {
jre = jdk;
};
scala = super.scala_3.override {
jre = jdk;
};
})
];
pkgs = import nixpkgs { inherit config jdk system; };
inherit (pkgs) mkShell;
scala = pkgs.scala_3;
buildTools = with pkgs; [ sbt ];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShells = {
default = mkShell {
buildInputs = [ scala ] ++ buildTools;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ scala sbt coursier ];
shellHook = ''
${scala}/bin/scala -version
${pkgs.scala}/bin/scala -version
'';
};
};
});
}

View file

@ -6,23 +6,23 @@
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
zigPkg = pkgs.zig;
inherit (pkgs) mkShell;
in
{
devShells = {
default = mkShell {
buildInputs = [ zigPkg ];
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ zig ];
shellHook = ''
echo "zig `${zigPkg}/bin/zig version`"
echo "zig `${pkgs.zig}/bin/zig version`"
'';
};
};
});
}