Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'default.nix')
| -rw-r--r-- | default.nix | 93 |
1 files changed, 7 insertions, 86 deletions
diff --git a/default.nix b/default.nix index 137dee5a..d2c51ec3 100644 --- a/default.nix +++ b/default.nix @@ -1,87 +1,8 @@ -{ - lib, - rustPlatform, - callPackage, - runCommand, - installShellFiles, - git, - gitRev ? null, - grammarOverlays ? [], - includeGrammarIf ? _: true, -}: let - fs = lib.fileset; - - src = fs.difference (fs.gitTracked ./.) (fs.unions [ - ./.envrc - ./rustfmt.toml - ./screenshot.png - ./book - ./docs - ./runtime - ./flake.lock - (fs.fileFilter (file: lib.strings.hasInfix ".git" file.name) ./.) - (fs.fileFilter (file: file.hasExt "svg") ./.) - (fs.fileFilter (file: file.hasExt "md") ./.) - (fs.fileFilter (file: file.hasExt "nix") ./.) - ]); - - # Next we actually need to build the grammars and the runtime directory - # that they reside in. It is built by calling the derivation in the - # grammars.nix file, then taking the runtime directory in the git repo - # and hooking symlinks up to it. - grammars = callPackage ./grammars.nix {inherit grammarOverlays includeGrammarIf;}; - runtimeDir = runCommand "helix-runtime" {} '' - mkdir -p $out - ln -s ${./runtime}/* $out - rm -r $out/grammars - ln -s ${grammars} $out/grammars - ''; +# Flake's default package for non-flake-enabled nix instances +let + compat = builtins.fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/b4a34015c698c7793d592d66adbab377907a2be8.tar.gz"; + sha256 = "sha256:1qc703yg0babixi6wshn5wm2kgl5y1drcswgszh4xxzbrwkk9sv7"; + }; in - rustPlatform.buildRustPackage (self: { - cargoLock = { - lockFile = ./Cargo.lock; - # This is not allowed in nixpkgs but is very convenient here: it allows us to - # avoid specifying `outputHashes` here for any git dependencies we might take - # on temporarily. - allowBuiltinFetchGit = true; - }; - - propagatedBuildInputs = [ runtimeDir ]; - - nativeBuildInputs = [ - installShellFiles - git - ]; - - buildType = "release"; - - name = with builtins; (fromTOML (readFile ./helix-term/Cargo.toml)).package.name; - src = fs.toSource { - root = ./.; - fileset = src; - }; - - # Helix attempts to reach out to the network and get the grammars. Nix doesn't allow this. - HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1"; - - # So Helix knows what rev it is. - HELIX_NIX_BUILD_REV = gitRev; - - doCheck = false; - strictDeps = true; - - # Sets the Helix runtime dir to the grammars - env.HELIX_DEFAULT_RUNTIME = "${runtimeDir}"; - - # Get all the application stuff in the output directory. - postInstall = '' - mkdir -p $out/lib - installShellCompletion ${./contrib/completion}/hx.{bash,fish,zsh} - mkdir -p $out/share/{applications,icons/hicolor/{256x256,scalable}/apps} - cp ${./contrib/Helix.desktop} $out/share/applications/Helix.desktop - cp ${./logo.svg} $out/share/icons/hicolor/scalable/apps/helix.svg - cp ${./contrib/helix.png} $out/share/icons/hicolor/256x256/apps/helix.png - ''; - - meta.mainProgram = "hx"; - }) + (import compat {src = ./.;}).defaultNix |