maomaowm/flake.nix

86 lines
2.2 KiB
Nix
Raw Normal View History

2025-02-25 22:05:29 +08:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2025-06-25 00:03:25 +08:00
scenefx = {
url = "github:wlrfx/scenefx";
inputs.nixpkgs.follows = "nixpkgs";
};
2025-02-25 22:05:29 +08:00
};
outputs = {
self,
2026-06-08 17:13:07 -06:00
nixpkgs,
scenefx,
}: let
inherit (nixpkgs.lib) genAttrs;
inherit (nixpkgs.lib.modules) importApply;
2025-02-25 22:05:29 +08:00
2026-06-08 17:13:07 -06:00
# Systems mangowm supports. Options that call `forEachSystem` will generate an attribute for each of these options.
systems = [
"x86_64-linux"
"aarch64-linux"
];
2025-02-25 22:05:29 +08:00
2026-06-08 17:13:07 -06:00
# Helper function that generates an attribute set by calling the provided `perSystem` function for each system in `systems` defined above.
forEachSystem = perSystem:
genAttrs systems (
system:
perSystem {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
}
);
in {
overlays.default = final: prev: {
inherit (self.packages.${final.stdenv.hostPlatform.system}) mango;
};
packages = forEachSystem (
{
pkgs,
2026-06-08 17:13:07 -06:00
system,
}: let
2026-06-08 17:13:07 -06:00
inherit (pkgs) callPackage;
mango = callPackage ./nix/package.nix {
2026-06-08 17:13:07 -06:00
inherit (scenefx.packages.${system}) scenefx;
};
generateOptions = callPackage (import ./nix/generate-options.nix self);
in {
2026-06-08 17:13:07 -06:00
inherit mango;
default = mango;
hm-options-json = generateOptions {
module = ./nix/hm-module.nix;
2026-06-08 17:13:07 -06:00
optionPrefix = "wayland.windowManager.mango.";
};
nixos-options-json = generateOptions {
module = ./nix/nixos-module.nix;
2026-06-08 17:13:07 -06:00
optionPrefix = "programs.mango.";
};
2026-06-08 17:13:07 -06:00
}
);
2026-06-08 18:07:31 -06:00
nixosModules.mango = {pkgs, ...}: {
imports = [
(importApply ./nix/nixos-module.nix self.packages.${pkgs.stdenv.hostPlatform.system}.default)
];
};
2026-06-08 18:07:31 -06:00
hmModules.mango = {pkgs, ...}: {
imports = [
(importApply ./nix/hm-module.nix self.packages.${pkgs.stdenv.hostPlatform.system}.default)
];
};
2026-06-08 17:13:07 -06:00
devShells = forEachSystem (
{system, ...}: {
default = self.packages.${system}.mango;
}
);
formatter = forEachSystem (
{pkgs, ...}: pkgs.alejandra
);
};
2025-02-25 22:05:29 +08:00
}