summaryrefslogtreecommitdiff
path: root/accounts/gkleen@skadhi/zsh/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@skadhi/zsh/default.nix')
-rw-r--r--accounts/gkleen@skadhi/zsh/default.nix110
1 files changed, 110 insertions, 0 deletions
diff --git a/accounts/gkleen@skadhi/zsh/default.nix b/accounts/gkleen@skadhi/zsh/default.nix
new file mode 100644
index 00000000..d0046bc1
--- /dev/null
+++ b/accounts/gkleen@skadhi/zsh/default.nix
@@ -0,0 +1,110 @@
1{ pkgs, lib, config, sysConfig, flakeInputs, ... }:
2let
3 zshrc = pkgs.resholve.mkDerivation {
4 pname = "zshrc";
5 version = "0.0.0";
6
7 src = ./zshrc;
8
9 dontUnpack = true;
10 dontConfigure = true;
11 dontBuild = true;
12
13 installPhase = ''
14 mkdir -p $out/share
15 install "$src" $out/share/zshrc
16 '';
17
18 solutions = {
19 default = {
20 scripts = [ "share/zshrc" ];
21 interpreter = "none";
22 inputs = with pkgs; [
23 coreutils
24 rpm
25 binutils
26 squashfsTools
27 unzip
28 config.programs.git.package
29 magickWrapped
30 curl
31 file
32 gnutar
33 cpio
34 magic-wormhole
35 config.programs.zsh.package
36 util-linux
37 findutils
38 qrencode
39 tty-clock
40 config.programs.jq.package
41 eza
42 less
43 sysConfig.systemd.package
44 sysConfig.programs.ssh.package
45 gnused
46 p7zip
47 ];
48 execer = with pkgs; [
49 "cannot:${lib.getExe' rpm "rpm2cpio"}"
50 "cannot:${lib.getExe' squashfsTools "unsquashfs"}"
51 "cannot:${lib.getExe' unzip "unzip"}"
52 "cannot:${lib.getExe config.programs.git.package}"
53 "cannot:${lib.getExe cpio}"
54 "cannot:${lib.getExe' magic-wormhole "wormhole"}"
55 "cannot:${lib.getExe' fuse "fusermount"}"
56 "cannot:${lib.getExe less}"
57 "cannot:${lib.getExe' sysConfig.systemd.package "systemctl"}"
58 "cannot:${lib.getExe sysConfig.programs.ssh.package}"
59 "cannot:${lib.getExe' p7zip "7z"}"
60 ];
61 wrapper = with pkgs; [
62 "${lib.getExe' magickWrapped "magick"}:${lib.getExe' imagemagick "magick"}"
63 ];
64 fake = {
65 builtin = ["print"];
66 external = lib.mapAttrsToList (_: cfg: cfg.program) sysConfig.security.wrappers;
67 };
68 };
69 };
70 };
71 magickWrapped = pkgs.symlinkJoin {
72 inherit (pkgs.imagemagick) name;
73 paths = [ pkgs.imagemagick ];
74
75 buildInputs = with pkgs; [ makeWrapper ];
76 postBuild = ''
77 wrapProgram $out/bin/magick \
78 --prefix PATH : ${lib.makeBinPath (with pkgs; [ ghostscript ])}
79 '';
80 };
81in {
82 config = {
83 home.persistence."/persistent".files = [
84 (lib.removePrefix (config.home.homeDirectory + "/") config.programs.zsh.history.path)
85 ];
86 programs.zsh.history.path = "${config.xdg.stateHome}/zsh/history";
87 programs.zsh.initContent = ''
88 source ${zshrc}/share/zshrc
89 '';
90 programs.zsh.dirHashes = let
91 flakeHashes = lib.mapAttrs' (n: v: lib.nameValuePair (inputNames.${n} or n) (toString v)) flakeInputs;
92 inputNames = {
93 self = "nixos";
94 };
95 in flakeHashes // {
96 docs = "$HOME/documents";
97 dl = "$HOME/Downloads";
98 scrot = "$HOME/screenshots";
99 media = "$HOME/media";
100 flk = "$HOME/projects/machines";
101 };
102 programs.starship.settings = {
103 directory.substitutions = lib.mapAttrs' (name: value: let
104 value' = builtins.unsafeDiscardStringContext value;
105 value'' = if lib.hasPrefix "$HOME/" value' then "~" + lib.removePrefix "$HOME" value' else value';
106 in lib.nameValuePair value'' "~${name}"
107 ) config.programs.zsh.dirHashes;
108 };
109 };
110}