Update from source

This commit is contained in:
Lillian Violet 2024-04-25 12:26:02 +02:00
parent c0a10971eb
commit 89ab4c3423
17 changed files with 321 additions and 146 deletions

View file

@ -28,18 +28,19 @@ Once your preferred template has been initialized, you can use the provided shel
## Available templates
| Language/framework/tool | Template |
| :----------------------- | :-----------------------------|
| :----------------------- | :---------------------------- |
| [Clojure] | [`clojure`](./clojure/) |
| [C#][csharp] | [`csharp`](./csharp/) |
| [Cue] | [`cue`](./cue/) |
| [Dhall] | [`dhall`](./dhall/) |
| [Elixir] | [`elixir`](./elixir/) |
| [Elm] | [`elm`](./elm/) |
| Empty (change at will) | [`empty`](./empty) |
| [Gleam] | [`gleam`](./gleam/) |
| [Go] | [`go`](./go/) |
| [Hashicorp] tools | [`hashi`](./hashi/) |
| [Haxe] | [`haxe`](./haxe/) |
| [Java] | [`java`](./java/) |
| [Jupyter] | [`jupyter`](./jupyter/) |
| [Kotlin] | [`kotlin`](./kotlin/) |
| [LaTeX] | [`latex`](./latex/) |
| [Nickel] | [`nickel`](./nickel/) |
@ -56,6 +57,7 @@ Once your preferred template has been initialized, you can use the provided shel
| [Rust] | [`rust`](./rust/) |
| [Scala] | [`scala`](./scala/) |
| [Shell] | [`shell`](./shell/) |
| [Vlang] | [`vlang`](./vlang/) |
| [Zig] | [`zig`](./zig/) |
## Template contents
@ -102,6 +104,10 @@ The sections below list what each template includes. In all cases, you're free t
- [Elm] 0.19.1
- [elm2nix]
### [Empty](./empty/)
A dev template that's fully customizable.
### [`gleam`](./gleam/)
- [Gleam] 0.30.0
@ -130,11 +136,16 @@ The sections below list what each template includes. In all cases, you're free t
- [GHC][haskell] 9.2.8
- [cabal] 3.10.1.0
### [`haxe`](./haxe/)
- [Haxe] 4.2.5
### [`java`](./java)
- [Java] 20.0.1+9
- [Maven] 3.9.2
- [Gradle] 9.0.1
- [jdtls] 1.31.0
### [`kotlin`](./kotlin/)
@ -217,7 +228,6 @@ The sections below list what each template includes. In all cases, you're free t
- [Python] 3.11.4
- [pip] 23.0.1
- [Virtualenv] 20.19.0
### [`ruby`](./ruby/)
@ -244,6 +254,10 @@ The sections below list what each template includes. In all cases, you're free t
- [shellcheck] 0.9.0
### [`Vlang`](./vlang/)
- [Vlang] 0.4.4
### [`zig`](./zig/)
- [Zig] 0.10.1
@ -292,8 +306,10 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[gradle]: https://gradle.org
[hashicorp]: https://hashicorp.com
[haskell]: https://haskell.org
[haxe]: https://haxe.org/
[iex]: https://hexdocs.pm/iex/IEx.html
[java]: https://java.com
[jdtls]: https://projects.eclipse.org/projects/eclipse.jdt.ls
[jq]: https://jqlang.github.io/jq
[kotlin]: https://kotlinlang.org
[latex]: https://www.latex-project.org/
@ -350,8 +366,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[texlive]: https://www.tug.org/texlive/
[tflint]: https://github.com/terraform-linters/tflint
[vault]: https://www.vaultproject.io
[virtualenv]: https://pypi.org/project/virtualenv
[vulnix]: https://github.com/flyingcircusio/vulnix
[yarn]: https://yarnpkg.com
[vlang]: https://vlang.io/
[zig]: https://ziglang.org

View file

@ -15,10 +15,12 @@
default = pkgs.mkShell {
packages = (with pkgs; [ elixir ]) ++
# Linux only
pkgs.lib.optionals (pkgs.stdenv.isLinux) (with pkgs; [ gigalixir inotify-tools libnotify ]) ++
(pkgs.lib.optionals (pkgs.stdenv.isLinux)
(with pkgs; [ gigalixir inotify-tools libnotify ])) ++
# macOS only
pkgs.lib.optionals (pkgs.stdenv.isDarwin) (with pkgs; [ terminal-notifier ]) ++
(with pkgs.darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]);
pkgs.lib.optionals (pkgs.stdenv.isDarwin)
((with pkgs; [ terminal-notifier ]) ++
(with pkgs.darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]));
};
});
};

25
empty/flake.lock Normal file
View file

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1712963716,
"narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=",
"rev": "cfd6b5fc90b15709b780a5a1619695a88505a176",
"revCount": 611350,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.611350%2Brev-cfd6b5fc90b15709b780a5a1619695a88505a176/018eddfc-e6d9-74bb-a823-20f2ae60079b/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

39
empty/flake.nix Normal file
View file

@ -0,0 +1,39 @@
{
description = "An empty flake template that you can adapt to your own environment";
# Flake inputs
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
# Flake outputs
outputs = { self, nixpkgs }:
let
# The systems supported for this flake
supportedSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
"x86_64-darwin" # 64-bit Intel macOS
"aarch64-darwin" # 64-bit ARM macOS
];
# Helper to provide system-specific attributes
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
# The Nix packages provided in the environment
# Add any you need here
packages = with pkgs; [ ];
# Set any environment variables for your dev shell
env = { };
# Add any shell logic you want executed any time the environment is activated
shellHook = ''
'';
};
});
};
}

114
flake.nix
View file

@ -3,18 +3,53 @@
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = {
self,
nixpkgs,
}: let
outputs = { self, nixpkgs }:
let
overlays = [
(final: prev: let
exec = pkg: "${prev.${pkg}}/bin/${pkg}";
in {
format = prev.writeScriptBin "format" ''
${exec "nixpkgs-fmt"} **/*.nix
(final: prev:
let
getSystem = "SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')";
forEachDir = exec: ''
for dir in */; do
(
cd "''${dir}"
${exec}
)
done
'';
dvt = prev.writeScriptBin "dvt" ''
in
{
format = final.writeShellApplication {
name = "format";
runtimeInputs = with final; [ nixpkgs-fmt ];
text = "nixpkgs-fmt '**/*.nix'";
};
# only run this locally, as Actions will run out of disk space
build = final.writeShellApplication {
name = "build";
text = ''
${getSystem}
${forEachDir ''
echo "building ''${dir}"
nix build ".#devShells.''${SYSTEM}.default"
''}
'';
};
check = final.writeShellApplication {
name = "check";
text = forEachDir ''
echo "checking ''${dir}"
nix flake check --all-systems --no-build
'';
};
dvt = final.writeShellApplication {
name = "dvt";
text = ''
if [ -z $1 ]; then
echo "no template specified"
exit 1
@ -22,43 +57,44 @@
TEMPLATE=$1
${exec "nix"} \
nix \
--experimental-features 'nix-command flakes' \
flake init \
--template \
"git+https://git.lillianviolet.dev/Lillian-Violet/dev-templates.git#''${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
};
update = final.writeShellApplication {
name = "update";
text = forEachDir ''
echo "updating ''${dir}"
nix flake update
'';
};
})
];
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;};
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; [ build check format update ];
};
});
packages = forEachSupportedSystem ({pkgs}: rec {
packages = forEachSupportedSystem ({ pkgs }: rec {
default = dvt;
inherit (pkgs) dvt;
});
}
// {
//
{
templates = rec {
clojure = {
path = ./clojure;
@ -90,6 +126,11 @@
description = "Elm development environment";
};
empty = {
path = ./empty;
description = "Empty dev template that you can customize at will";
};
gleam = {
path = ./gleam;
description = "Gleam development environment";
@ -115,11 +156,6 @@
description = "Java development environment";
};
jupyter = {
path = ./jupyter;
description = "Jupyter development environment";
};
kotlin = {
path = ./kotlin;
description = "Kotlin development environment";
@ -190,11 +226,6 @@
description = "Rust development environment";
};
rustpython = {
path = ./rustpython;
description = "Rustpython development environment";
};
rust-toolchain = {
path = ./rust-toolchain;
description = "Rust development environment with Rust version defined by a rust-toolchain.toml file";
@ -210,6 +241,11 @@
description = "Shell script development environment";
};
vlang = {
path = ./vlang;
description = "Vlang developent environment";
};
zig = {
path = ./zig;
description = "Zig development environment";

View file

@ -1,11 +1,11 @@
{
description = "A Nix-flake-based Go 1.17 development environment";
description = "A Nix-flake-based Go 1.22 development environment";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs = { self, nixpkgs }:
let
goVersion = 20; # Change this to update the whole stack
goVersion = 22; # Change this to update the whole stack
overlays = [ (final: prev: { go = prev."go_1_${toString goVersion}"; }) ];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
@ -16,8 +16,8 @@
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
# go 1.20 (specified by overlay)
go
# go 1.22 (specified by overlay)
go_1_22
# goimports, godoc, etc.
gotools

25
haxe/flake.lock Normal file
View file

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1712963716,
"narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=",
"rev": "cfd6b5fc90b15709b780a5a1619695a88505a176",
"revCount": 611350,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.611350%2Brev-cfd6b5fc90b15709b780a5a1619695a88505a176/018eddfc-e6d9-74bb-a823-20f2ae60079b/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

26
haxe/flake.nix Normal file
View file

@ -0,0 +1,26 @@
{
description = "A Nix-flake-based Haxe development environment";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs =
{ self
, nixpkgs
,
}:
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; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [ haxe ];
};
});
};
}

View file

@ -3,11 +3,7 @@
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs =
{ self
, nixpkgs
,
}:
outputs = { self, nixpkgs }:
let
javaVersion = 20; # Change this value to update the whole stack
overlays = [
@ -18,22 +14,14 @@
})
];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [ gradle jdk maven ];
programs.vscode = {
extensions = with pkgs.vscode-extensions; [
mkhl.direnv
redhat.java
];
};
packages = with pkgs; [ gradle jdk maven jdt-language-server ];
};
});
};

View file

@ -17,11 +17,10 @@
cachix
lorri
niv
nixfmt
nixfmt-classic
statix
vulnix
haskellPackages.dhall-nix
rnix-lsp
];
};
});

View file

@ -25,7 +25,7 @@
python311
# Go SDK
go_1_20
go_1_22
# Node.js SDK
nodejs

View file

@ -9,17 +9,10 @@
};
};
outputs =
{ self
, nixpkgs
, easy-purescript-nix
,
}:
outputs = { self, nixpkgs, easy-purescript-nix }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; # "aarch64-linux" not supported
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
@ -30,9 +23,7 @@
easy-ps = import easy-purescript-nix { inherit pkgs; };
in
pkgs.mkShell {
packages =
(with pkgs; [ nodejs ])
++ (with easy-ps; [
packages = (with pkgs; [ nodejs ]) ++ (with easy-ps; [
purs
spago
purescript-language-server

View file

@ -3,25 +3,22 @@
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs =
{ self
, nixpkgs
,
}:
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs;
[ python312 virtualenv ]
++ (with pkgs.python312Packages; [ pip ]);
venvDir = "venv";
packages = with pkgs; [ python311 ] ++
(with pkgs.python311Packages; [
pip
venvShellHook
]);
};
});
};

View file

@ -9,12 +9,7 @@
};
};
outputs =
{ self
, nixpkgs
, rust-overlay
,
}:
outputs = { self, nixpkgs, rust-overlay }:
let
overlays = [
rust-overlay.overlays.default
@ -23,9 +18,7 @@
})
];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in

View file

@ -9,12 +9,7 @@
};
};
outputs =
{ self
, nixpkgs
, rust-overlay
,
}:
outputs = { self, nixpkgs, rust-overlay }:
let
overlays = [
rust-overlay.overlays.default
@ -23,10 +18,10 @@
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
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" ];
@ -34,9 +29,7 @@
})
];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
@ -45,7 +38,6 @@
default = pkgs.mkShell {
packages = with pkgs; [
rustToolchain
rustup
openssl
pkg-config
cargo-deny

25
vlang/flake.lock Normal file
View file

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1712963716,
"narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=",
"rev": "cfd6b5fc90b15709b780a5a1619695a88505a176",
"revCount": 611350,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.611350%2Brev-cfd6b5fc90b15709b780a5a1619695a88505a176/018eddfc-e6d9-74bb-a823-20f2ae60079b/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

22
vlang/flake.nix Normal file
View file

@ -0,0 +1,22 @@
{
description = "A Nix-flake-based Vlang development environment";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs = { self, nixpkgs }:
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; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
vlang
];
};
});
};
}