{ 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.20.3"; src = fetchFromGitHub { owner = "rsteube"; repo = "carapace-bin"; rev = "v${version}"; hash = "sha256-oPTMStq8YOM+HWiWajbMJSxUuHowhMI3P0HR+Ns+CGI="; }; ldflags = [ "-s" "-w" ]; tags = [ "release" ]; subPackages = [ "cmd/carapace" ]; preBuild = '' go generate ./... ''; vendorSha256 = "sha256-IrdJDezB8fs2ypACY7Kn7FBfuh+T63yuEr5FA1Erfxw="; }; 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="${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; }; }