forked from romkatv/powerlevel10k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
47 lines (46 loc) · 1.39 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
{
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.follows = "gs/nixpkgs"; # inherit same pkgs version as gitstatus
gs.url = "github:puqeko/gitstatus/nixify";
};
outputs = { self, nixpkgs, utils, gs, ... }@inputs: utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
gitstatus = gs.outputs.packages.${system}.default;
p10k = pkgs.stdenv.mkDerivation {
name = "p10k";
buildInputs = [ pkgs.zsh ];
propogatedBuildInputs = [ gitstatus ];
src = pkgs.lib.sourceFilesBySuffices ./. [ ".zsh" ".zsh-theme" ];
configurePhase = ''
ln -vs ${gitstatus}/share/gitstatus gitstatus
'';
buildPhase = ''
zsh -fc '
for f in *.zsh-theme internal/*.zsh; do
zcompile -R -- $f.zwc $f || exit;
done
';
'';
installPhase = ''
mkdir -p $out
cp -v *.zsh-theme $out
cp -v *.zwc $out
mkdir -p $out/internal
cp -v internal/*.zsh $out/internal
cp -v internal/*.zwc $out/internal
mkdir -p $out/config
cp -v config/*.zsh $out/config
ln -vs ${gitstatus}/share/gitstatus $out/gitstatus
'';
inherit system;
};
in {
packages.default = p10k;
devShell = pkgs.mkShell {
inputsFrom = [p10k];
};
}
);
}