Add nix shell aliases
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
user ? throw "user argument is required",
|
||||||
|
home ? throw "home argument is required",
|
||||||
|
}:
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
home-manager.users.${user}.programs.zsh.shellAliases.nc = "sudo nix-cleanup";
|
||||||
|
}
|
@@ -4,7 +4,10 @@
|
|||||||
}:
|
}:
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
home-manager.users.${user}.programs.zsh.initExtra = ''
|
home-manager.users.${user}.programs.zsh = {
|
||||||
|
shellAliases.nd = "nix-develop";
|
||||||
|
|
||||||
|
initExtra = ''
|
||||||
nix-develop() {
|
nix-develop() {
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Usage: nix-develop <shell>"
|
echo "Usage: nix-develop <shell>"
|
||||||
@@ -13,4 +16,5 @@
|
|||||||
nix develop self#"$1" -c "$SHELL"
|
nix develop self#"$1" -c "$SHELL"
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@@ -5,13 +5,31 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
{
|
{
|
||||||
home-manager.users.${user} = {
|
home-manager.users.${user} = {
|
||||||
programs.direnv = {
|
programs = {
|
||||||
|
direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
silent = true;
|
silent = true;
|
||||||
nix-direnv.enable = true;
|
nix-direnv.enable = true;
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
zsh = {
|
||||||
|
shellAliases.nde = "nix-direnv";
|
||||||
|
|
||||||
|
initExtra = ''
|
||||||
|
nix-direnv() {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: nix-direnv <shell>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "use $1" > .envrc
|
||||||
|
direnv allow
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# https://github.com/direnv/direnv/wiki/Customizing-cache-location
|
# https://github.com/direnv/direnv/wiki/Customizing-cache-location
|
||||||
xdg.configFile."direnv/direnvrc".text = ''
|
xdg.configFile."direnv/direnvrc".text = ''
|
||||||
declare -A direnv_layout_dirs
|
declare -A direnv_layout_dirs
|
||||||
|
11
hosts/common/configs/user/console/nix/default.nix
Normal file
11
hosts/common/configs/user/console/nix/default.nix
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
user ? throw "user argument is required",
|
||||||
|
home ? throw "home argument is required",
|
||||||
|
}:
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
home-manager.users.${user}.programs.zsh.shellAliases = {
|
||||||
|
nrs = "sudo nixos-rebuild switch --flake .#$(hostname) --show-trace";
|
||||||
|
nrb = "sudo nixos-rebuild boot --flake .#$(hostname) --show-trace";
|
||||||
|
};
|
||||||
|
}
|
@@ -23,6 +23,8 @@ in
|
|||||||
(import ../../../common/configs/user/console/libvirt { inherit user home; })
|
(import ../../../common/configs/user/console/libvirt { inherit user home; })
|
||||||
(import ../../../common/configs/user/console/ncdu { inherit user home; })
|
(import ../../../common/configs/user/console/ncdu { inherit user home; })
|
||||||
(import ../../../common/configs/user/console/neovim { inherit user home; })
|
(import ../../../common/configs/user/console/neovim { inherit user home; })
|
||||||
|
(import ../../../common/configs/user/console/nix { inherit user home; })
|
||||||
|
(import ../../../common/configs/user/console/nix-cleanup { inherit user home; })
|
||||||
(import ../../../common/configs/user/console/nix-develop { inherit user home; })
|
(import ../../../common/configs/user/console/nix-develop { inherit user home; })
|
||||||
(import ../../../common/configs/user/console/nix-direnv { inherit user home; })
|
(import ../../../common/configs/user/console/nix-direnv { inherit user home; })
|
||||||
(import ../../../common/configs/user/console/nixpkgs { inherit user home; })
|
(import ../../../common/configs/user/console/nixpkgs { inherit user home; })
|
||||||
|
@@ -21,6 +21,8 @@ in
|
|||||||
(import ../../../common/configs/user/console/libvirt { inherit user home; })
|
(import ../../../common/configs/user/console/libvirt { inherit user home; })
|
||||||
(import ../../../common/configs/user/console/ncdu { inherit user home; })
|
(import ../../../common/configs/user/console/ncdu { inherit user home; })
|
||||||
(import ../../../common/configs/user/console/neovim { inherit user home; })
|
(import ../../../common/configs/user/console/neovim { inherit user home; })
|
||||||
|
(import ../../../common/configs/user/console/nix { inherit user home; })
|
||||||
|
(import ../../../common/configs/user/console/nix-cleanup { inherit user home; })
|
||||||
(import ../../../common/configs/user/console/nix-develop { inherit user home; })
|
(import ../../../common/configs/user/console/nix-develop { inherit user home; })
|
||||||
(import ../../../common/configs/user/console/nix-direnv { inherit user home; })
|
(import ../../../common/configs/user/console/nix-direnv { inherit user home; })
|
||||||
(import ../../../common/configs/user/console/nixpkgs { inherit user home; })
|
(import ../../../common/configs/user/console/nixpkgs { inherit user home; })
|
||||||
|
Reference in New Issue
Block a user