dotfiles/flakes/emacs/flake.nix
2026-07-18 10:57:45 +02:00

55 lines
1.7 KiB
Nix

{
description = "Standalone Tobmacs package and NixOS integration";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in
{
packages = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfreePredicate = package:
builtins.elem (nixpkgs.lib.getName package) [
"copilot-language-server"
];
};
in
{
default = import ./package.nix { inherit pkgs; };
tobs-emacs = self.packages.${system}.default;
});
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/emacs";
meta.description = "Run Tobmacs";
};
});
# Importing this module selects Tobmacs as services.emacs.package. The
# caller still decides whether to enable or merely install the service.
nixosModules.default = { pkgs, ... }: {
services.emacs.package =
self.packages.${pkgs.stdenv.hostPlatform.system}.default;
};
# Optional compatibility integration for this dotfiles repository. The
# standalone package and NixOS module above do not depend on Home Manager.
homeManagerModules = {
default = import ./home.nix { inherit self; };
aarch64-darwin = self.homeManagerModules.default;
aarch64-linux = self.homeManagerModules.default;
x86_64-linux = self.homeManagerModules.default;
};
};
}