From 1d6bdf6187de886974e5f05d80898ca7eb97db6c Mon Sep 17 00:00:00 2001 From: cswimr Date: Mon, 13 Jan 2025 15:43:30 -0600 Subject: [PATCH] move `create-devenv` alias to an exec alias --- config/xonsh/aliases.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config/xonsh/aliases.py b/config/xonsh/aliases.py index 90a6f93..f1b7409 100644 --- a/config/xonsh/aliases.py +++ b/config/xonsh/aliases.py @@ -96,6 +96,15 @@ def _edit(args): return ["$EDITOR", *args] return ["$VISUAL", *args] +@aliases.register +def _create_devenv(args): + if not args: + template = "simple" + else: + template = args[0] + run(["nix", "flake", "init", "--template", f"github:cswimr/dev-flakes#{template}"], cwd=Path.cwd(), exit_on_error=False) + run(["direnv", "allow"], cwd=Path.cwd()) + alias_dictionary = { "ff": "fastfetch", @@ -118,7 +127,6 @@ alias_dictionary = { "lsa": "eza -lah --time-style=long-iso --icons=auto --hyperlink", "tree": "eza --tree --git-ignore --time-style=long-iso --icons=auto --hyperlink", - "create-devenv": "nix flake init --template github:cachix/devenv and direnv allow", "nixpkgs-update": "nix run --option extra-substituters 'https://nix-community.cachix.org/' --option extra-trusted-public-keys 'nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' github:ryantm/nixpkgs-update --", "nixrc": "edit /etc/nixos",