From 160a800c26a657eb38023b3c2d1936fdbb40fa9d Mon Sep 17 00:00:00 2001 From: Song Jeyeong <46372718+hooreique@users.noreply.github.com> Date: Sun, 20 Sep 2026 09:14:45 +0900 Subject: [PATCH] Extract Nix package and expose default overlay --- docs/installation.md | 5 ++++- flake.nix | 49 ++++++++------------------------------------ package.nix | 46 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 41 deletions(-) create mode 100644 package.nix diff --git a/docs/installation.md b/docs/installation.md index 3d6f6ea..8813479 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -33,6 +33,9 @@ nix profile install github:hooreique/fall ## Home Manager flake example +The `overlays.default` overlay provides `pkgs.fall`, using dependencies from +the package set it is applied to. + Add `fall` to your flake: ```nix @@ -49,7 +52,7 @@ Add `fall` to your flake: pkgs = import inputs.nixpkgs { inherit system; overlays = [ - (final: prev: { fall = inputs.fall.packages.${system}.default; }) + inputs.fall.overlays.default ]; }; in { diff --git a/flake.nix b/flake.nix index 1b86114..2f5ebfb 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,15 @@ ); in { + overlays.default = final: prev: { + fall = final.callPackage ./package.nix { }; + }; + + packages = forAllSys (pkgs: { + fall = pkgs.callPackage ./package.nix { }; + default = pkgs.callPackage ./package.nix { }; + }); + devShells = forAllSys (pkgs: { default = pkgs.mkShell { packages = [ @@ -22,45 +31,5 @@ ]; }; }); - - packages = forAllSys (pkgs: { - default = pkgs.stdenvNoCC.mkDerivation { - pname = "fall"; - version = "1.0.0"; - src = ./.; - - dontUnpack = true; - nativeBuildInputs = [ pkgs.makeWrapper ]; - - installPhase = '' - runHook preInstall - - mkdir -p "$out/bin" "$out/share/fall" - cp "$src/fall.nu" "$src/codec.nu" "$out/share/fall/" - - makeWrapper "${pkgs.nushell}/bin/nu" "$out/bin/fall" \ - --prefix PATH : "${pkgs.lib.makeBinPath [ pkgs.gitMinimal ]}" \ - --set FALL_GIT_SSH_COMMAND "${pkgs.openssh}/bin/ssh" \ - --add-flags "$out/share/fall/fall.nu" - - runHook postInstall - ''; - - meta = { - mainProgram = "fall"; - description = "Shell helper to fetch and show status of many Git repositories"; - longDescription = '' - **fall — Fetch ALL** - - *fall* runs `git fetch` and `git status` over every repository path - listed in `~/.config/fall/repos.conf`, using parallel jobs for speed. - With `fall .`, it can instead work from a project-local `.repos.conf` - discovered by walking up the directory tree. - ''; - homepage = "https://github.com/hooreique/fall"; - license = pkgs.lib.licenses.mit; - }; - }; - }); }; } diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..1ff531a --- /dev/null +++ b/package.nix @@ -0,0 +1,46 @@ +{ + lib, + stdenvNoCC, + makeWrapper, + nushell, + gitMinimal, + openssh, +}: + +stdenvNoCC.mkDerivation { + pname = "fall"; + version = "1.0.0"; + src = ./.; + + dontUnpack = true; + nativeBuildInputs = [ makeWrapper ]; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/bin" "$out/share/fall" + cp "$src/fall.nu" "$src/codec.nu" "$out/share/fall/" + + makeWrapper "${nushell}/bin/nu" "$out/bin/fall" \ + --prefix PATH : "${lib.makeBinPath [ gitMinimal ]}" \ + --set FALL_GIT_SSH_COMMAND "${openssh}/bin/ssh" \ + --add-flags "$out/share/fall/fall.nu" + + runHook postInstall + ''; + + meta = { + mainProgram = "fall"; + description = "Shell helper to fetch and show status of many Git repositories"; + longDescription = '' + **fall — Fetch ALL** + + *fall* runs `git fetch` and `git status` over every repository path + listed in `~/.config/fall/repos.conf`, using parallel jobs for speed. + With `fall .`, it can instead work from a project-local `.repos.conf` + discovered by walking up the directory tree. + ''; + homepage = "https://github.com/hooreique/fall"; + license = lib.licenses.mit; + }; +}