Skip to content

Commit

Permalink
feat(nix-on-droid): use nice bash prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
kmein committed Jul 22, 2023
1 parent 915695c commit f36a7a2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions configs/bash.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
{pkgs, ...}: {
programs.bash = {
promptInit = ''
PS1="$(tput bold)\w \$([[ \$? == 0 ]] && echo \"\[\033[1;32m\]\" || echo \"\[\033[1;31m\]\")\$$(tput sgr0) "'';
PS1="$(${pkgs.ncurses}/bin/tput bold)\w \$([[ \$? == 0 ]] && echo \"\[\033[1;32m\]\" || echo \"\[\033[1;31m\]\")\$$(${pkgs.ncurses}/bin/tput sgr0) "'';
interactiveShellInit = ''
set -o vi
'';
Expand Down
7 changes: 6 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,13 @@
};

nixOnDroidConfigurations = {
motoG5 = nix-on-droid.lib.nixOnDroidConfiguration {
moto-g5 = nix-on-droid.lib.nixOnDroidConfiguration {
modules = [systems/moto-g5/configuration.nix];
pkgs = import nixpkgs {
system = "aarch64-linux";
overlays = [nix-on-droid.overlays.default];
};
home-manager-path = home-manager.outPath;
};
};

Expand Down
17 changes: 17 additions & 0 deletions systems/moto-g5/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ in {
openssh
curl
findutils
coreutils
utillinux
gnugrep
gnused
Expand All @@ -27,6 +28,22 @@ in {
'')
];

home-manager = {
useGlobalPkgs = true;
backupFileExtension = "hm-bak";
config = {pkgs, ...}: {
home.stateVersion = "23.05";
programs.bash = {
enable = true;
profileExtra = ''
${(import ../../configs/bash.nix {inherit pkgs;}).programs.bash.promptInit}
'';
};
};
};

user.shell = "${pkgs.bash}/bin/bash";

environment.etcBackupExtension = ".bak";

system.stateVersion = "23.05";
Expand Down

0 comments on commit f36a7a2

Please sign in to comment.