|  | @@ -1,66 +1,69 @@
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  |    description = "Zsh configuration";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  outputs = { self, nixpkgs }:
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -      packages.x86_64-linux.zsh =
 | 
	
		
			
				|  |  | -        with import nixpkgs {
 | 
	
		
			
				|  |  | -          system = "x86_64-linux";
 | 
	
		
			
				|  |  | -        };
 | 
	
		
			
				|  |  | -        let
 | 
	
		
			
				|  |  | -          config = runCommand "zsh-config" {
 | 
	
		
			
				|  |  | -            nativeBuildInputs = [ makeWrapper ];
 | 
	
		
			
				|  |  | -          } ''
 | 
	
		
			
				|  |  | -            mkdir -p $out/share/zsh
 | 
	
		
			
				|  |  | +  inputs = {
 | 
	
		
			
				|  |  | +    flake-utils.url = "github:numtide/flake-utils";
 | 
	
		
			
				|  |  | +  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            cat <<EOF > $out/share/zsh/.zprofile
 | 
	
		
			
				|  |  | -            emulate sh -c 'source /etc/profile'
 | 
	
		
			
				|  |  | -            EOF
 | 
	
		
			
				|  |  | +  outputs = { self, nixpkgs, flake-utils }:
 | 
	
		
			
				|  |  | +    flake-utils.lib.eachDefaultSystem (system:
 | 
	
		
			
				|  |  | +      with nixpkgs.legacyPackages.${system}; {
 | 
	
		
			
				|  |  | +        packages.zsh =
 | 
	
		
			
				|  |  | +          let
 | 
	
		
			
				|  |  | +            config = runCommand "zsh-config" {
 | 
	
		
			
				|  |  | +              nativeBuildInputs = [ makeWrapper ];
 | 
	
		
			
				|  |  | +            } ''
 | 
	
		
			
				|  |  | +              mkdir -p $out/share/zsh
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            cat <<EOF > $out/share/zsh/.zshenv
 | 
	
		
			
				|  |  | -            unsetopt GLOBAL_RCS
 | 
	
		
			
				|  |  | -            EOF
 | 
	
		
			
				|  |  | +              cat <<EOF > $out/share/zsh/.zprofile
 | 
	
		
			
				|  |  | +              emulate sh -c 'source /etc/profile'
 | 
	
		
			
				|  |  | +              EOF
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            cat <<EOF > $out/share/zsh/.zshrc
 | 
	
		
			
				|  |  | -            source ${nix-zsh-completions}/share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh
 | 
	
		
			
				|  |  | -            fpath+=(${nix-zsh-completions}/share/zsh/site-functions)
 | 
	
		
			
				|  |  | +              cat <<EOF > $out/share/zsh/.zshenv
 | 
	
		
			
				|  |  | +              unsetopt GLOBAL_RCS
 | 
	
		
			
				|  |  | +              EOF
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            fpath+=(~/.nix-profile/share/zsh/site-functions)
 | 
	
		
			
				|  |  | +              cat <<EOF > $out/share/zsh/.zshrc
 | 
	
		
			
				|  |  | +              source ${nix-zsh-completions}/share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh
 | 
	
		
			
				|  |  | +              fpath+=(${nix-zsh-completions}/share/zsh/site-functions)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            autoload -U compinit && compinit
 | 
	
		
			
				|  |  | +              fpath+=(~/.nix-profile/share/zsh/site-functions)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            source ${zsh-bd}/share/zsh-bd/bd.plugin.zsh
 | 
	
		
			
				|  |  | -            source ${zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
 | 
	
		
			
				|  |  | +              autoload -U compinit && compinit
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            path+=(${lib.makeBinPath [ any-nix-shell ]})
 | 
	
		
			
				|  |  | +              source ${zsh-bd}/share/zsh-bd/bd.plugin.zsh
 | 
	
		
			
				|  |  | +              source ${zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            source ${./config/fzf/fzf.zsh}
 | 
	
		
			
				|  |  | -            source ${./config/config.zsh}
 | 
	
		
			
				|  |  | -            source ${./config/p10k.zsh}
 | 
	
		
			
				|  |  | -            source ${./config/title.zsh}
 | 
	
		
			
				|  |  | +              path+=(${lib.makeBinPath [ any-nix-shell ]})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if [ -f "\$HOME/.zsh/local.zsh" ]; then
 | 
	
		
			
				|  |  | -              source "\$HOME/.zsh/local.zsh"
 | 
	
		
			
				|  |  | -            fi
 | 
	
		
			
				|  |  | +              source ${./config/fzf/fzf.zsh}
 | 
	
		
			
				|  |  | +              source ${./config/config.zsh}
 | 
	
		
			
				|  |  | +              source ${./config/p10k.zsh}
 | 
	
		
			
				|  |  | +              source ${./config/title.zsh}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            # must be last
 | 
	
		
			
				|  |  | -            source ${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
 | 
	
		
			
				|  |  | -            EOF
 | 
	
		
			
				|  |  | +              if [ -f "\$HOME/.zsh/local.zsh" ]; then
 | 
	
		
			
				|  |  | +                source "\$HOME/.zsh/local.zsh"
 | 
	
		
			
				|  |  | +              fi
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +              # must be last
 | 
	
		
			
				|  |  | +              source ${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
 | 
	
		
			
				|  |  | +              EOF
 | 
	
		
			
				|  |  | +            '';
 | 
	
		
			
				|  |  | +          in
 | 
	
		
			
				|  |  | +          writeScriptBin "zsh" ''
 | 
	
		
			
				|  |  | +            #!/bin/sh
 | 
	
		
			
				|  |  | +            export ZDOTDIR=${config}/share/zsh
 | 
	
		
			
				|  |  | +            for zsh in $(which -a zsh); do
 | 
	
		
			
				|  |  | +              if [ "$0" = "$zsh" ]; then
 | 
	
		
			
				|  |  | +                continue
 | 
	
		
			
				|  |  | +              fi
 | 
	
		
			
				|  |  | +              exec "$zsh" "$@"
 | 
	
		
			
				|  |  | +            done
 | 
	
		
			
				|  |  | +            echo "Could not find system zsh"
 | 
	
		
			
				|  |  | +            exit 1
 | 
	
		
			
				|  |  |            '';
 | 
	
		
			
				|  |  | -        in
 | 
	
		
			
				|  |  | -        writeScriptBin "zsh" ''
 | 
	
		
			
				|  |  | -          #!/bin/sh
 | 
	
		
			
				|  |  | -          export ZDOTDIR=${config}/share/zsh
 | 
	
		
			
				|  |  | -          for zsh in $(which -a zsh); do
 | 
	
		
			
				|  |  | -            if [ "$0" = "$zsh" ]; then
 | 
	
		
			
				|  |  | -              continue
 | 
	
		
			
				|  |  | -            fi
 | 
	
		
			
				|  |  | -            exec "$zsh" "$@"
 | 
	
		
			
				|  |  | -          done
 | 
	
		
			
				|  |  | -          echo "Could not find system zsh"
 | 
	
		
			
				|  |  | -          exit 1
 | 
	
		
			
				|  |  | -        '';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -      packages.x86_64-linux.default = self.packages.x86_64-linux.zsh;
 | 
	
		
			
				|  |  | -    };
 | 
	
		
			
				|  |  | +        packages.default = self.packages.${system}.zsh;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    );
 | 
	
		
			
				|  |  |  }
 |