{ 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 < $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="$PATH:${carapace-bin}/bin" 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; }; }