Skip to main content

Installation with Flakes

Mango provides both a NixOS module and a Home Manager module for declarative configuration.
1

Add Mango to flake inputs

Add the Mango flake to your flake.nix inputs:
flake.nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    mango = {
      url = "github:mangowm/mango";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  # ...
}
2

Enable NixOS module

Add the Mango NixOS module to your system configuration:
configuration.nix
{
  imports = [
    inputs.mango.nixosModules.mango
  ];
  
  programs.mango.enable = true;
}
This installs Mango and sets up necessary Wayland environment components.
3

Configure with Home Manager

Add the Home Manager module for user-specific configuration:
home.nix
{
  imports = [
    inputs.mango.hmModules.mango
  ];
  
  wayland.windowManager.mango = {
    enable = true;
    settings = ''
      # Your Mango configuration
      # See config.conf documentation
      
      # Example keybindings
      bind = alt,return,exec,foot
      bind = alt,space,exec,rofi -show drun
      bind = alt,q,killclient
    '';
    autostart_sh = ''
      # Autostart applications
      # No shebang needed
      
      waybar &
      swaybg -i ~/wallpaper.png &
      mako &
    '';
  };
}
4

Rebuild your system

Apply the configuration:
sudo nixos-rebuild switch --flake .#your-hostname

Complete Flake Example

Here’s a complete example using flake-parts:
flake.nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    flake-parts.url = "github:hercules-ci/flake-parts";
    mango = {
      url = "github:mangowm/mango";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  
  outputs = inputs@{ self, flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      debug = true;
      systems = [ "x86_64-linux" ];
      
      flake = {
        nixosConfigurations = {
          hostname = inputs.nixpkgs.lib.nixosSystem {
            system = "x86_64-linux";
            modules = [
              inputs.home-manager.nixosModules.home-manager
              
              # Add mango nixos module
              inputs.mango.nixosModules.mango
              {
                programs.mango.enable = true;
              }
              
              {
                home-manager = {
                  useGlobalPkgs = true;
                  useUserPackages = true;
                  backupFileExtension = "backup";
                  users."username".imports = [
                    # Add mango hm module
                    inputs.mango.hmModules.mango
                    
                    ({ ... }: {
                      wayland.windowManager.mango = {
                        enable = true;
                        settings = ''
                          # see config.conf
                        '';
                        autostart_sh = ''
                          # see autostart.sh
                          # Note: here no need to add shebang
                        '';
                      };
                    })
                  ];
                };
              }
            ];
          };
        };
      };
    };
}

Build Inputs

The Nix package automatically includes these dependencies: Build-time dependencies:
  • meson
  • ninja
  • pkg-config
  • wayland-scanner
Runtime dependencies:
  • libinput (>=1.27.1)
  • libxcb
  • libxkbcommon
  • pcre2
  • pixman
  • wayland (>=1.23.1)
  • wayland-protocols
  • wlroots_0_19 (>=0.19.0)
  • scenefx (>=0.4.1)
  • libGL
XWayland support (enabled by default):
  • libX11
  • libxcb-wm
  • xwayland

Configuration Options

programs.mango.enable
boolean
default:"false"
Enable Mango compositor system-wide
wayland.windowManager.mango.enable
boolean
default:"false"
Enable Mango for the current user
wayland.windowManager.mango.settings
string
default:""
Mango configuration content (equivalent to config.conf)
wayland.windowManager.mango.autostart_sh
string
default:""
Autostart script content (no shebang needed)

Suggested Packages

Add these packages to your configuration for a complete environment:
{ pkgs, ... }:
{
  home.packages = with pkgs; [
    # Terminal
    foot
    
    # Launcher
    rofi-wayland
    
    # Status bar
    waybar
    
    # Wallpaper
    swaybg
    
    # Clipboard
    wl-clipboard
    wl-clip-persist
    cliphist
    
    # Screenshots
    grim
    slurp
    satty
    
    # Notifications
    mako
    # or
    # swaync
    
    # Night light
    wlsunset
    # or
    # gammastep
    
    # Authentication
    xfce.xfce4-settings  # for xfce-polkit
  ];
}

Next Steps

Configuration

Configure Mango to your preferences

Keybindings

Learn default keybindings and create custom ones

Build docs developers (and LLMs) love