Make Emacs flake standalone

This commit is contained in:
Tobias Ostner 2026-07-18 10:57:45 +02:00
parent bad1727674
commit bbd082947e
7 changed files with 293 additions and 126 deletions

View file

@ -1,15 +1,55 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
description = "Standalone Tobmacs package and NixOS integration";
outputs = inputs:
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 = {
aarch64-darwin = import ./home.nix;
x86_64-linux = import ./home.nix;
default = import ./home.nix { inherit self; };
aarch64-darwin = self.homeManagerModules.default;
aarch64-linux = self.homeManagerModules.default;
x86_64-linux = self.homeManagerModules.default;
};
};
}