1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00
ladybird/flake.nix
NotAShelf c276cc43f0 Nix: Expose ladybird package in flake; reuse in shell
Add and expose a `ladybird` package in the Nix flake. Allows building
Ladybird only using Nix, and without relying on the dev shell. Other
users will be able to build Ladybird from source using nix3 CLI via
`nix build github:LadybirdBrowser/ladybird` or add it as a flake input
to consume the package.

We also re-use the package in the devshell, to keep dependencies in-sync
between the bleeding-edge source package, and the dev shell. This is an
upgrade to how we previously inferred dependencies to Nixpkgs package
for Ladybird, which had a chance to lack dependencies required to build
the latest commit.
2025-03-04 08:19:54 -07:00

54 lines
1.4 KiB
Nix

{
description = "Ladybird";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
};
outputs =
{
self,
systems,
nixpkgs,
...
}:
let
eachSystem = nixpkgs.lib.genAttrs (import systems);
in
{
packages = eachSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
# Default ladybird package built from source using current directory
# as the source. This is not cached.
ladybird = pkgs.callPackage ./Toolchain/Nix/package.nix { inherit self; };
# Alias for `nix run .` or `nix run github:LadybirdBrowser/ladybird`
default = self.packages.${system}.ladybird;
}
);
devShells = eachSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
# Override nixpkgs ladybird with the one provided
# by this flake. This will allow inputsFrom to
# remain in-sync with the package provided by the
# flake.
default = pkgs.callPackage ./Toolchain/Nix/shell.nix {
inherit (self.packages.${system}) ladybird;
};
}
);
# Provide a formatter for `nix fmt`
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
};
}