diff --git a/flake.lock b/flake.lock
index f28ec884..cfa227e3 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,22 @@
 {
   "nodes": {
+    "all-cabal-json": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1665552503,
+        "narHash": "sha256-r14RmRSwzv5c+bWKUDaze6pXM7nOsiz1H8nvFHJvufc=",
+        "owner": "nix-community",
+        "repo": "all-cabal-json",
+        "rev": "d7c0434eebffb305071404edcf9d5cd99703878e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-community",
+        "ref": "hackage",
+        "repo": "all-cabal-json",
+        "type": "github"
+      }
+    },
     "crane": {
       "flake": false,
       "locked": {
@@ -19,11 +36,11 @@
     "devshell": {
       "flake": false,
       "locked": {
-        "lastModified": 1660811669,
-        "narHash": "sha256-V6lmsaLNFz41myppL0yxglta92ijkSvpZ+XVygAh+bU=",
+        "lastModified": 1666548262,
+        "narHash": "sha256-4DyN4KXqQQsCw0vCXkMThw4b5Q4/q87ZZgRb4st8COc=",
         "owner": "numtide",
         "repo": "devshell",
-        "rev": "c2feacb46ee69949124c835419861143c4016fb5",
+        "rev": "c8ce8ed81726079c398f5f29c4b68a7d6a3c2fa2",
         "type": "github"
       },
       "original": {
@@ -38,6 +55,7 @@
           "nci",
           "nixpkgs"
         ],
+        "all-cabal-json": "all-cabal-json",
         "crane": "crane",
         "devshell": [
           "nci",
@@ -47,6 +65,7 @@
           "nci",
           "nixpkgs"
         ],
+        "ghc-utils": "ghc-utils",
         "gomod2nix": [
           "nci",
           "nixpkgs"
@@ -69,11 +88,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1662176993,
-        "narHash": "sha256-Sy7DsGAveDUFBb6YDsUSYZd/AcXfP/MOMIwMt/NgY84=",
+        "lastModified": 1666993587,
+        "narHash": "sha256-4cLrs+CwWnceYXnCpL5gO3bybS9CjLxUoTEKjB2QFtg=",
         "owner": "nix-community",
         "repo": "dream2nix",
-        "rev": "809bc5940214744eb29778a9a0b03f161979c1b2",
+        "rev": "2b7456e3d2f0053bc2474fb0c461dd468545277f",
         "type": "github"
       },
       "original": {
@@ -84,11 +103,11 @@
     },
     "flake-utils": {
       "locked": {
-        "lastModified": 1656928814,
-        "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
+        "lastModified": 1659877975,
+        "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
         "owner": "numtide",
         "repo": "flake-utils",
-        "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
+        "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
         "type": "github"
       },
       "original": {
@@ -97,6 +116,22 @@
         "type": "github"
       }
     },
+    "ghc-utils": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1662774800,
+        "narHash": "sha256-1Rd2eohGUw/s1tfvkepeYpg8kCEXiIot0RijapUjAkE=",
+        "ref": "refs/heads/master",
+        "rev": "bb3a2d3dc52ff0253fb9c2812bd7aa2da03e0fea",
+        "revCount": 1072,
+        "type": "git",
+        "url": "https://gitlab.haskell.org/bgamari/ghc-utils"
+      },
+      "original": {
+        "type": "git",
+        "url": "https://gitlab.haskell.org/bgamari/ghc-utils"
+      }
+    },
     "nci": {
       "inputs": {
         "devshell": "devshell",
@@ -109,11 +144,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1662177071,
-        "narHash": "sha256-x6XF//RdZlw81tFAYM1TkjY+iQIpyMCWZ46r9o4wVQY=",
+        "lastModified": 1667232647,
+        "narHash": "sha256-cFo7G8BqYShgL9m7yD6p+SHAZ+aIt2guuF69LV235n8=",
         "owner": "yusdacra",
         "repo": "nix-cargo-integration",
-        "rev": "65270dea87bb82fc02102a15221677eea237680e",
+        "rev": "16082f7b4e42ce140a562fa630bcf8e96eadeb59",
         "type": "github"
       },
       "original": {
@@ -124,11 +159,11 @@
     },
     "nixpkgs": {
       "locked": {
-        "lastModified": 1662019588,
-        "narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=",
+        "lastModified": 1667142599,
+        "narHash": "sha256-OLJxsg9VqfKjFkerOxWtNIkibsCvxsv5A8wNWO1MeWk=",
         "owner": "nixos",
         "repo": "nixpkgs",
-        "rev": "2da64a81275b68fdad38af669afeda43d401e94b",
+        "rev": "412b9917cea092f3d39f9cd5dead4effd5bc4053",
         "type": "github"
       },
       "original": {
@@ -153,11 +188,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1662087605,
-        "narHash": "sha256-Gpf2gp2JenKGf+TylX/YJpttY2bzsnvAMLdLaxoZRyU=",
+        "lastModified": 1667184938,
+        "narHash": "sha256-/kuCiXuAxiD0c0zrfDvJ1Yba3FuVdRk/ROfb393AeX4=",
         "owner": "oxalica",
         "repo": "rust-overlay",
-        "rev": "60c2cfaa8b90ed8cebd18b214fac8682dcf222dd",
+        "rev": "8f81faec35508647ced65c44fd3e8648a5518afb",
         "type": "github"
       },
       "original": {
diff --git a/flake.nix b/flake.nix
index 8cb4b663..b1d3f01e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -21,57 +21,124 @@
     ...
   }: let
     lib = nixpkgs.lib;
+    ncl = nci.lib.nci-lib;
     mkRootPath = rel:
       builtins.path {
         path = "${toString ./.}/${rel}";
         name = rel;
       };
+    filteredSource = let
+      pathsToIgnore = [
+        ".envrc"
+        ".ignore"
+        ".github"
+        "runtime"
+        "screenshot.png"
+        "book"
+        "contrib"
+        "docs"
+        "README.md"
+        "CHANGELOG.md"
+        "shell.nix"
+        "default.nix"
+        "grammars.nix"
+        "flake.nix"
+        "flake.lock"
+      ];
+      ignorePaths = path: type: let
+        # split the nix store path into its components
+        components = lib.splitString "/" path;
+        # drop off the `/nix/hash-source` section from the path
+        relPathComponents = lib.drop 4 components;
+        # reassemble the path components
+        relPath = lib.concatStringsSep "/" relPathComponents;
+      in
+        lib.all (p: ! (lib.hasPrefix p relPath)) pathsToIgnore;
+    in
+      builtins.path {
+        name = "helix-source";
+        path = toString ./.;
+        # filter out unnecessary paths
+        filter = ignorePaths;
+      };
     outputs = nci.lib.makeOutputs {
       root = ./.;
-      renameOutputs = {"helix-term" = "helix";};
-      # Set default app to hx (binary is from helix-term release build)
-      # Set default package to helix-term release build
-      defaultOutputs = {
-        app = "hx";
-        package = "helix";
+      config = common: {
+        outputs = {
+          # rename helix-term to helix since it's our main package
+          rename = {"helix-term" = "helix";};
+          # Set default app to hx (binary is from helix-term release build)
+          # Set default package to helix-term release build
+          defaults = {
+            app = "hx";
+            package = "helix";
+          };
+        };
+        cCompiler.package = with common.pkgs;
+          if stdenv.isLinux
+          then gcc
+          else clang;
+        shell = {
+          packages = with common.pkgs;
+            [lld_13 cargo-flamegraph rust-analyzer]
+            ++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin)
+            ++ (lib.optional stdenv.isLinux lldb);
+          env = [
+            {
+              name = "HELIX_RUNTIME";
+              eval = "$PWD/runtime";
+            }
+            {
+              name = "RUST_BACKTRACE";
+              value = "1";
+            }
+            {
+              name = "RUSTFLAGS";
+              value =
+                if common.pkgs.stdenv.isLinux
+                then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment"
+                else "";
+            }
+          ];
+        };
       };
-      overrides = {
-        cCompiler = common:
-          with common.pkgs;
-            if stdenv.isLinux
-            then gcc
-            else clang;
-        crateOverrides = common: _: {
-          helix-term = prev: {
-            src = builtins.path {
-              name = "helix-source";
-              path = toString ./.;
-              # filter out unneeded stuff that cause rebuilds
-              filter = path: type:
-                lib.all
-                (n: builtins.baseNameOf path != n)
-                [
-                  ".envrc"
-                  ".ignore"
-                  ".github"
-                  "runtime"
-                  "screenshot.png"
-                  "book"
-                  "contrib"
-                  "docs"
-                  "README.md"
-                  "shell.nix"
-                  "default.nix"
-                  "grammars.nix"
-                  "flake.nix"
-                  "flake.lock"
-                ];
-            };
+      pkgConfig = common: {
+        helix-term = {
+          # Wrap helix with runtime
+          wrapper = _: old: let
+            inherit (common) pkgs;
+            makeOverridableHelix = old: config: let
+              grammars = pkgs.callPackage ./grammars.nix config;
+              runtimeDir = pkgs.runCommand "helix-runtime" {} ''
+                mkdir -p $out
+                ln -s ${mkRootPath "runtime"}/* $out
+                rm -r $out/grammars
+                ln -s ${grammars} $out/grammars
+              '';
+              helix-wrapped =
+                common.internal.pkgsSet.utils.wrapDerivation old
+                {
+                  nativeBuildInputs = [pkgs.makeWrapper];
+                  makeWrapperArgs = config.makeWrapperArgs or [];
+                }
+                ''
+                  rm -rf $out/bin
+                  mkdir -p $out/bin
+                  ln -sf ${old}/bin/* $out/bin/
+                  wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}"
+                '';
+            in
+              helix-wrapped
+              // {override = makeOverridableHelix old;};
+          in
+            makeOverridableHelix old {};
+          overrides.fix-build.overrideAttrs = prev: {
+            src = filteredSource;
 
             # disable fetching and building of tree-sitter grammars in the helix-term build.rs
             HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
 
-            buildInputs = (prev.buildInputs or []) ++ [common.cCompiler.cc.lib];
+            buildInputs = ncl.addBuildInputs prev [common.config.cCompiler.package.cc.lib];
 
             # link languages and theme toml files since helix-term expects them (for tests)
             preConfigure = ''
@@ -87,88 +154,20 @@
             meta.mainProgram = "hx";
           };
         };
-        shell = common: prev: {
-          packages =
-            prev.packages
-            ++ (
-              with common.pkgs;
-                [lld_13 cargo-flamegraph rust-analyzer]
-                ++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin)
-                ++ (lib.optional stdenv.isLinux lldb)
-            );
-          env =
-            prev.env
-            ++ [
-              {
-                name = "HELIX_RUNTIME";
-                eval = "$PWD/runtime";
-              }
-              {
-                name = "RUST_BACKTRACE";
-                value = "1";
-              }
-              {
-                name = "RUSTFLAGS";
-                value =
-                  if common.pkgs.stdenv.isLinux
-                  then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment"
-                  else "";
-              }
-            ];
-        };
       };
     };
-    makeOverridableHelix = system: old: config: let
-      pkgs = nixpkgs.legacyPackages.${system};
-      grammars = pkgs.callPackage ./grammars.nix config;
-      runtimeDir = pkgs.runCommand "helix-runtime" {} ''
-        mkdir -p $out
-        ln -s ${mkRootPath "runtime"}/* $out
-        rm -r $out/grammars
-        ln -s ${grammars} $out/grammars
-      '';
-      helix-wrapped =
-        pkgs.runCommand "${old.name}-wrapped"
-        {
-          inherit (old) pname version meta;
-
-          nativeBuildInputs = [pkgs.makeWrapper];
-          makeWrapperArgs = config.makeWrapperArgs or [];
-        }
-        ''
-          mkdir -p $out
-          cp -r --no-preserve=mode,ownership ${old}/* $out/
-          chmod +x $out/bin/*
-          wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}"
-        '';
-    in
-      helix-wrapped
-      // {override = makeOverridableHelix system old;};
   in
     outputs
     // {
-      apps =
-        lib.mapAttrs
-        (
-          system: apps: rec {
-            default = hx;
-            hx = {
-              type = "app";
-              program = lib.getExe self.${system}.packages.helix;
-            };
-          }
-        )
-        outputs.apps;
       packages =
         lib.mapAttrs
         (
-          system: packages: rec {
-            default = helix;
-            helix = makeOverridableHelix system helix-unwrapped {};
-            helix-debug = makeOverridableHelix system helix-unwrapped-debug {};
-            helix-unwrapped = packages.helix;
-            helix-unwrapped-debug = packages.helix-debug;
-          }
+          system: packages:
+            packages
+            // {
+              helix-unwrapped = packages.helix.passthru.unwrapped;
+              helix-unwrapped-debug = packages.helix-debug.passthru.unwrapped;
+            }
         )
         outputs.packages;
     };