12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- {
- description = "Elvish configuration";
- inputs = {
- nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
- };
- outputs = { self, nixpkgs }:
- {
- packages.x86_64-linux.carapace-bin =
- with import nixpkgs {
- system = "x86_64-linux";
- };
- buildGoModule rec {
- pname = "carapace-bin";
- version = "0.19.0";
- src = fetchFromGitHub {
- owner = "rsteube";
- repo = "carapace-bin";
- rev = "v${version}";
- sha256 = "sha256-Bdtuehfp81fq1ZSV+7jwSmxViu8FzVbBGoZ2HfDda5g=";
- };
- ldflags = [ "-s" "-w" ];
- tags = [ "release" ];
- subPackages = [ "cmd/carapace" ];
- preBuild = ''
- go generate ./...
- '';
- vendorSha256 = "sha256-WXntyDbpGEXHkYgv21vN/JG/CVn6SqnMhmgXfFEQ9eM=";
- };
- packages.x86_64-linux.elvish =
- with import nixpkgs {
- system = "x86_64-linux";
- };
- let
- carapace-bin = self.packages.x86_64-linux.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 [ -z "$KEYCTL_INIT" ]; then
- export KEYCTL_INIT=1
- keyctl new_session >/dev/null
- fi
- exec ${elvish}/bin/elvish -rc "${config}/elvish/rc.elv" "$@"
- '';
- packages.x86_64-linux.default = self.packages.x86_64-linux.elvish;
- };
- }
|