-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
65 lines (59 loc) · 2.36 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
description = "pxalarm";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
};
outputs = {
self,
nixpkgs,
...
} @ inputs: let
systems = [
"aarch64-darwin"
"aarch64-linux"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
in rec {
formatter = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.alejandra);
packages = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
pkgs-pxalarm = pkgs.writeShellScriptBin "pxalarm" (builtins.readFile ./pxalarm);
in rec {
pxalarm = pkgs-pxalarm;
default = pxalarm;
});
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
pkgs-pxalarm = packages.${system}.default;
in rec {
default = pxalarm;
pxalarm =
pkgs.mkShell
{
shellHook = ''
# prompt
COLOR_RESET="$({ exists tput && tput sgr0; } 2>/dev/null || printf '\033[0m')"
COLOR_BRED="$({ exists tput && tput bold && tput setaf 1; } 2>/dev/null || printf '\033[1;31m')"
COLOR_BGREEN="$({ exists tput && tput bold && tput setaf 2; } 2>/dev/null || printf '\033[1;32m')"
COLOR_BYELLOW="$({ exists tput && tput bold && tput setaf 3; } 2>/dev/null || printf '\033[1;33m')"
COLOR_BBLUE="$({ exists tput && tput bold && tput setaf 6; } 2>/dev/null || printf '\033[1;34m')"
COLOR_BCYAN="$({ exists tput && tput bold && tput setaf 6; } 2>/dev/null || printf '\033[1;36m')"
gitrepo() {
echo "$(git remote -v 2>/dev/null | grep "(fetch)" | awk -F'\t' '{print $1}')"/"$(git branch 2>/dev/null | grep -e '\* ' | sed 's/^..\(.*\)/\1/')"
}
# PS1=$(echo "\n$COLOR_BBLUE\$(git status -s 2> /dev/null)$COLOR_RESET\n $COLOR_BGREEN·$COLOR_RESET$COLOR_BYELLOW aws-shell $COLOR_RESET$COLOR_BRED\$(gitrepo)$COLOR_RESET$COLOR_BCYAN \$(pwd | sed "s:\$\{HOME}:~:g")$COLOR_RESET\n · ")
PS1=$(echo "\n $COLOR_BGREEN·$COLOR_RESET$COLOR_BYELLOW pxalarm-shell $COLOR_RESET$COLOR_BRED\$(gitrepo)$COLOR_RESET$COLOR_BCYAN \$(pwd | sed "s:\$\{HOME}:~:g")$COLOR_RESET\n · ")
'';
buildInputs = [
pkgs-pxalarm
];
};
});
};
}