Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/just - Add just command runner #1320

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
devcontainer.settings.customizations.vscode.extensions = [ "jnoortheen.nix-ide" ];
difftastic.enable = true;

#enable just.
just = {
enable = true;
recipes.convco.enable = true;
};

dotenv.enable = true;

processes = {
Expand All @@ -40,6 +46,7 @@

scripts.devenv-test-cli = {
description = "Test devenv CLI.";
just.enable = true;
exec = ''
set -xe
set -o pipefail
Expand Down Expand Up @@ -97,6 +104,7 @@
};
scripts."devenv-generate-doc-options" = {
description = "Generate option docs.";
just.enable = true;
exec = ''
set -e
output_file=docs/reference/options.md
Expand All @@ -110,6 +118,7 @@
};
scripts."devenv-generate-languages-example" = {
description = "Generate an example enabling every supported language.";
just.enable = true;
exec = ''
cat > examples/supported-languages/devenv.nix <<EOF
{ pkgs, ... }: {
Expand All @@ -124,6 +133,7 @@
};
scripts."devenv-generate-docs" = {
description = "Generate lists of all languages and services.";
just.enable = true;
exec = ''
cat > docs/services-all.md <<EOF
\`\`\`nix
Expand Down Expand Up @@ -152,7 +162,7 @@
MD034 = false;
};
generate-css = {
enable = true;
enable = false;
name = "generate-css";
entry = "${lib.getExe pkgs.tailwindcss} build docs/assets/extra.css -o docs/assets/output.css";
};
Expand Down
5 changes: 5 additions & 0 deletions devenv/init/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'just-flake.just'

# Display the list of recipes
default:
@just --list
2 changes: 1 addition & 1 deletion devenv/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl Default for GlobalOptions {

#[derive(Subcommand, Clone)]
pub(crate) enum Commands {
#[command(about = "Scaffold devenv.yaml, devenv.nix, .gitignore and .envrc.")]
#[command(about = "Scaffold devenv.yaml, devenv.nix, .gitignore .envrc and justfile.")]
Init {
target: Option<PathBuf>,
},
Expand Down
8 changes: 7 additions & 1 deletion devenv/src/devenv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ use std::{

// templates
const FLAKE_TMPL: &str = include_str!("flake.tmpl.nix");
const REQUIRED_FILES: [&str; 4] = ["devenv.nix", "devenv.yaml", ".envrc", ".gitignore"];
const REQUIRED_FILES: [&str; 5] = [
"devenv.nix",
"devenv.yaml",
".envrc",
".gitignore",
"justfile",
];
const EXISTING_REQUIRED_FILES: [&str; 1] = [".gitignore"];
const PROJECT_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/init");
// project vars
Expand Down
Loading