[emacs] Modularize more and better pkg

Attempts to select the right emacs package based on whether the machine
is x11 only or not.
This commit is contained in:
2024-09-10 17:03:04 -07:00
parent 9ba6006fca
commit 18afc61e33
6 changed files with 101 additions and 70 deletions

View File

@@ -11,7 +11,7 @@
};
outputs = { self, nixpkgs, ... } @ inputs: {
nixosConfigurations.z790prors-nix = nixpkgs.lib.nixosSystem {
nixosConfigurations.z790prors-nix = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [
./roles
@@ -20,13 +20,15 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.johno = import ./home/home-z790prors.nix;
home-manager.extraSpecialArgs = {
customPkgs = nixpkgs.legacyPackages."${system}".callPackage ./packages {};
};
}
];
};
nixosConfigurations.nix-book = nixpkgs.lib.nixosSystem {
nixosConfigurations.nix-book = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [
./roles
@@ -35,13 +37,15 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.johno = import ./home/home-nix-book.nix;
home-manager.extraSpecialArgs = {
customPkgs = nixpkgs.legacyPackages."${system}".callPackage ./packages {};
};
}
];
};
nixosConfigurations.boxy = nixpkgs.lib.nixosSystem {
nixosConfigurations.boxy = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [
./roles
@@ -50,8 +54,10 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.johno = import ./home/home-default.nix;
home-manager.extraSpecialArgs = {
customPkgs = nixpkgs.legacyPackages."${system}".callPackage ./packages {};
};
}
];
};

View File

@@ -1,8 +1,5 @@
{ pkgs, ... }:
{ pkgs, customPkgs, ... }:
let
nextcloudTalkDesktop = pkgs.callPackage ./modules/nextcloud-talk-desktop/package.nix {};
in
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
@@ -62,7 +59,7 @@ in
pkgs.wofi
pkgs.vlc
nextcloudTalkDesktop
customPkgs.nextcloudTalkDesktop
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage

View File

@@ -1,14 +1,16 @@
{ config, lib, pkgs, ... }:
with lib;
let
emacs = pkgs.emacs29;
doomSync = (let
git = pkgs.git;
in ''
export PATH=${emacs}/bin:${git}/bin:$PATH
export PATH=${pkgs.emacs}/bin:${git}/bin:$PATH
${config.xdg.configHome}/emacs/bin/doom sync -u -j $((`nproc`/4*3))
'');
in {
config = {
home.packages = [
pkgs.emacs-all-the-icons-fonts
pkgs.fontconfig
@@ -56,14 +58,10 @@ in {
"${config.xdg.configHome}/emacs/bin"
];
programs.emacs = {
enable = true;
package = emacs;
};
xdg.configFile."doom" = {
source = ./doom;
# Sync doom if we updated the config
onChange = doomSync;
};
};
}

4
packages/default.nix Normal file
View File

@@ -0,0 +1,4 @@
{ pkgs, ... }:
{
nextcloudTalkDesktop = pkgs.callPackage ./nextcloud-talk-desktop {};
}

View File

@@ -4,6 +4,29 @@ with lib;
let
cfg = config.roles.desktop;
basePackages = with pkgs; [
];
x11BasePackages = with pkgs; [
];
x11OnlyPackages = with pkgs; [
emacs
];
waylandBasePackages = with pkgs; [
grim
slurp
wl-clipboard
mako
];
waylandOnlyPackages = with pkgs; [
emacs-gtk
];
in
{
options.roles.desktop = {
@@ -40,12 +63,6 @@ in
programs.dconf.enable = true;
services.gnome.gnome-keyring.enable = true;
environment.systemPackages = with pkgs; mkIf (!cfg.x11Only) [
grim
slurp
wl-clipboard
mako
];
programs.sway = mkIf (!cfg.x11Only) {
enable = true;
wrapperFeatures.gtk = true;
@@ -73,6 +90,15 @@ in
virtualisation.docker.enable = true;
users.extraGroups.docker.members = [ "johno" ];
environment.systemPackages = with pkgs; mkMerge [
basePackages
x11BasePackages
(mkIf cfg.x11Only x11OnlyPackages)
# TODO: Do we need a "wayland only" mode?
(mkIf (!cfg.x11Only) waylandBasePackages)
(mkIf (!cfg.x11Only) waylandOnlyPackages)
];
};
}