add shell/run/rebuild to generic.nix

This commit is contained in:
Your Name 2024-02-26 21:18:46 +03:00
parent d7dedcfb07
commit a9cbae2889
2 changed files with 23 additions and 39 deletions

View file

@ -137,39 +137,9 @@
programs.fish = { programs.fish = {
enable = true; enable = true;
shellAliases = {
rebuild = "nh os switch";
rollback = "sudo nixos-rebuild switch --rollback --flake ~/Documents/dotfiles/";
shell = "~/.local/share/shell";
};
shellInit = '' shellInit = ''
any-nix-shell fish --info-right | source any-nix-shell fish --info-right | source
''; '';
}; };
xdg.dataFile."run" = {
enable = true;
executable = true;
text = ''
#!/bin/sh
if [[ $# -eq 0 ]]; then
echo "Error: Missing argument."
else
nix run nixpkgs#"$1" -- "''${@:2}"
fi
'';
};
xdg.dataFile."shell" = {
enable = true;
executable = true;
text = ''
#!/bin/sh
if [[ $# -eq 0 ]]; then
echo "Error: Missing argument."
else
nix shell nixpkgs#"$1" -- "''${@:2}"
fi
'';
};
} }

View file

@ -8,6 +8,14 @@ let
NIXPKGS_ALLOW_UNFREE=1 nix run --impure nixpkgs#"$1" -- "''${@:2}" NIXPKGS_ALLOW_UNFREE=1 nix run --impure nixpkgs#"$1" -- "''${@:2}"
fi fi
''; '';
shell = pkgs.writeScriptBin "shell" ''
#!/usr/bin/env bash
if [[ $# -eq 0 ]]; then
echo "Error: Missing argument."
else
nix shell nixpkgs#"$1" -- "''${@:2}"
fi
'';
in { in {
environment.sessionVariables = { environment.sessionVariables = {
FLAKE = "/home/delta/Documents/dotfiles"; FLAKE = "/home/delta/Documents/dotfiles";
@ -42,6 +50,7 @@ in {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
run run
shell
git git
micro micro
nano nano
@ -50,14 +59,19 @@ in {
]; ];
programs.command-not-found.enable = false; programs.command-not-found.enable = false;
programs.fish.enable = true; programs.fish = {
programs.fish.promptInit = '' enable = true;
set TERM "xterm-256color" shellAliases = {
set fish_greeting rebuild = "nh os switch";
any-nix-shell fish --info-right | source rollback = "sudo nixos-rebuild switch --rollback --flake ~/Documents/dotfiles/";
''; shell = "~/.local/share/shell";
};
promptInit = ''
set TERM "xterm-256color"
set fish_greeting
any-nix-shell fish --info-right | source
'';
};
users.defaultUserShell = pkgs.fish; users.defaultUserShell = pkgs.fish;
programs.tmux.enable = true; programs.tmux.enable = true;
} }