Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ereslibre committed Feb 14, 2024
1 parent efc4f7a commit b6c697d
Show file tree
Hide file tree
Showing 18 changed files with 87 additions and 13 deletions.
2 changes: 1 addition & 1 deletion devenv/templates/elm/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
packages =
# We require these binaries to interact with their CLI
(with pkgs.elmPackages; [elm-land elm-review elm-test])
++ (with pkgs; [just tailwindcss tailwindcss-language-server parallel]);
++ (with pkgs; [alejandra just tailwindcss tailwindcss-language-server parallel]);
pre-commit.hooks = {
elm-format.enable = true;
elm-review.enable = false;
Expand Down
5 changes: 4 additions & 1 deletion devenv/templates/elm/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
all: build
all: fmt build

fmt:
find . -name "*.nix" | xargs alejandra

build:
elm-land build
Expand Down
1 change: 1 addition & 0 deletions devenv/templates/go/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake . --impure
3 changes: 3 additions & 0 deletions devenv/templates/go/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.devenv
/.direnv
/.pre-commit-config.yaml
43 changes: 43 additions & 0 deletions devenv/templates/go/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
description = "Rust nixity";

inputs = {
devenv.url = "github:cachix/devenv";
nixities.url = "github:ereslibre/nixities";
systems.url = "github:nix-systems/default";
};

outputs = {
self,
devenv,
nixities,
systems,
...
} @ inputs: let
eachSystem = nixities.nixpkgs.lib.genAttrs (import systems);
in {
devShells = eachSystem (system: let
pkgs = import nixities.nixpkgs {inherit system;};
in {
# The default devShell
default = devenv.lib.mkShell {
inherit pkgs;
inputs.nixpkgs = nixities.nixpkgs;
modules = [
({
pkgs,
lib,
...
}: {
languages.go.enable = true;
packages = with pkgs; [alejandra just openssl pkg-config];
pre-commit.hooks.gofmt.enable = true;
})
];
};
# Example of another devShell directly forwarded from the
# devShells that nixities exposes
# inherit (nixities.devShells.${system}) wasm;
});
};
}
11 changes: 11 additions & 0 deletions devenv/templates/go/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
all: fmt build test

fmt:
find . -name "*.nix" | xargs alejandra
go fmt ./...

build:
go build ./...

test:
go test ./...
2 changes: 1 addition & 1 deletion devenv/templates/jupyter/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
inputs.nixpkgs = nixities.nixpkgs;
modules = [
({pkgs, ...}: {
packages = with pkgs; [just];
packages = with pkgs; [alejandra just];
scripts = {
start-notebook.exec = "nix run . -- --ip 0.0.0.0";
};
Expand Down
2 changes: 1 addition & 1 deletion devenv/templates/microvm/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
inputs.nixpkgs = nixities.nixpkgs;
modules = [
({pkgs, ...}: {
packages = with pkgs; [just];
packages = with pkgs; [alejandra just];
})
];
};
Expand Down
5 changes: 4 additions & 1 deletion devenv/templates/microvm/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ run: (run-arch "$(nix eval --impure --raw --expr 'builtins.currentSystem')")
run-aarch64: (run-arch "aarch64-linux")

run-arch guest:
nix run .#microvms.$(nix eval --impure --raw --expr 'builtins.currentSystem').{{guest}}.microvm.config.microvm.declaredRunner
nix run .#microvms.$(nix eval --impure --raw --expr 'builtins.currentSystem').{{guest}}.microvm.config.microvm.declaredRunner

fmt:
find . -name "*.nix" | xargs alejandra
2 changes: 1 addition & 1 deletion devenv/templates/nixity/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
modules = [
({pkgs, ...}: {
# https://devenv.sh/reference/options/
packages = with pkgs; [just];
packages = with pkgs; [alejandra just];
# languages.cplusplus.enable = true;
# pre-commit.hooks = {
# clang-format.enable = true;
Expand Down
2 changes: 1 addition & 1 deletion devenv/templates/nixos-container/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
inputs.nixpkgs = nixities.nixpkgs;
modules = [
({pkgs, ...}: {
packages = with pkgs; [just];
packages = with pkgs; [alejandra just];
enterShell = ''
cat <<"EOF" | ${pkgs.bat}/bin/bat --decorations=never --language=markdown
# Instructions
Expand Down
5 changes: 4 additions & 1 deletion devenv/templates/nixos-container/justfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
build target:
nix build .#nixosConfigurations.container.{{target}}.config.system.build.toplevel
nix build .#nixosConfigurations.container.{{target}}.config.system.build.toplevel

fmt:
find . -name "*.nix" | xargs alejandra
2 changes: 1 addition & 1 deletion devenv/templates/oci-container/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
inputs.nixpkgs = nixities.nixpkgs;
modules = [
({pkgs, ...}: {
packages = with pkgs; [just];
packages = with pkgs; [alejandra just];
})
];
};
Expand Down
5 changes: 4 additions & 1 deletion devenv/templates/oci-container/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ load: build
docker load < ./result

build-for target:
nix build .#packages.{{target}}.default
nix build .#packages.{{target}}.default

fmt:
find . -name "*.nix" | xargs alejandra
2 changes: 1 addition & 1 deletion devenv/templates/python-venv/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
package = pythonPackages.python;
};
packages =
(with pkgs; [just stdenv.cc.cc.lib])
(with pkgs; [alejandra just stdenv.cc.cc.lib])
++ (with pythonPackages; [
pip
venvShellHook
Expand Down
2 changes: 1 addition & 1 deletion devenv/templates/python/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
package = pythonPackages.python;
};
packages =
(with pkgs; [just stdenv.cc.cc.lib])
(with pkgs; [alejandra just stdenv.cc.cc.lib])
++ (with pythonPackages; [
pip
]);
Expand Down
2 changes: 1 addition & 1 deletion devenv/templates/rust/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
c.enable = true;
rust.enable = true;
};
packages = with pkgs; [just openssl pkg-config];
packages = with pkgs; [alejandra just openssl pkg-config];
pre-commit.hooks = {
rustfmt.enable = true;
clippy.enable = true;
Expand Down
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@
path = ./devenv/templates/elm;
description = "Elm project";
};
go = {
path = ./devenv/templates/go;
description = "Go project";
};
haskell = {
path = ./devenv/templates/haskell;
description = "Haskell project";
Expand Down

0 comments on commit b6c697d

Please sign in to comment.