123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- {
- description = "Elvish configuration";
- inputs = {
- nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
- flake-utils.url = "github:numtide/flake-utils";
- };
- outputs = { self, nixpkgs, flake-utils }:
- flake-utils.lib.eachDefaultSystem (system:
- with nixpkgs.legacyPackages.${system}; {
- packages.carapace-bin = buildGoModule rec {
- pname = "carapace-bin";
- version = "0.30.2";
- src = fetchFromGitHub {
- owner = "rsteube";
- repo = "carapace-bin";
- rev = "v${version}";
- hash = "sha256-gYYNwDUL00b9orq1suxa9VtHBLUgRgntQcYw24vgncg=";
- };
- ldflags = [ "-s" "-w" ];
- tags = [ "release" ];
- subPackages = [ "cmd/carapace" ];
- preBuild = ''
- go generate ./...
- '';
- vendorHash = "sha256-RML1al1XlONzeCCkz34Ij1I/WDQSTVrm3P6RaOdyWKI=";
- };
- packages.elvish =
- let
- carapace-bin = self.packages.${system}.carapace-bin;
- config = runCommand "elvish-config" {
- nativeBuildInputs = [ makeWrapper ];
- } ''
- mkdir -p $out/elvish
- cp -r ${./lib} $out/elvish/lib
- cat <<EOF > $out/elvish/rc.elv
- use config
- eval (carapace _carapace|slurp)
- EOF
- '';
- in
- writeScriptBin "elvish" ''
- #!/bin/sh
- export XDG_DATA_DIRS="${config}:$XDG_DATA_DIRS"
- export PATH="${carapace-bin}/bin:$PATH"
- if command -v keyctl > /dev/null && [ -z "$KEYCTL_INIT" ]; then
- export KEYCTL_INIT=1
- keyctl new_session >/dev/null
- fi
- if [ -z "$XDG_RUNTIME_DIR" ] && [ -n "$TMPDIR" ]; then
- export XDG_RUNTIME_DIR="$TMPDIR"
- fi
- exec ${elvish}/bin/elvish -rc "${config}/elvish/rc.elv" "$@"
- '';
- packages.default = self.packages.${system}.elvish;
- }
- );
- }
|