Compare commits

..

No commits in common. "df2efb728d8a4152c745d579c9ad14c2dfadeca1" and "3f945f8ae3e6954177f4ebde3785fb74f1919f61" have entirely different histories.

4 changed files with 102 additions and 175 deletions

View File

@ -23,9 +23,9 @@
# Mount tmpfs at /tmp # Mount tmpfs at /tmp
boot.tmp.useTmpfs = true; boot.tmp.useTmpfs = true;
me.bluetooth.enable = true;
me.emacs_flavor = "plainmacs";
me.graphical = true; me.graphical = true;
me.graphicsCardType = "intel"; me.graphicsCardType = "intel";
me.kodi.enable = true; me.kodi.enable = true;
me.bluetooth.enable = true;
} }

View File

@ -29,10 +29,9 @@
fw-ectool fw-ectool
]; ];
me.alacritty.enable = true;
me.ansible.enable = true;
me.emacs_flavor = "full";
me.graphical = true; me.graphical = true;
me.graphicsCardType = "amd"; me.graphicsCardType = "amd";
me.sway.enable = true; me.sway.enable = true;
me.ansible.enable = true;
} }

View File

@ -7,32 +7,18 @@
{ {
imports = [ ]; imports = [ ];
options.me = {
alacritty.enable = lib.mkOption { environment.systemPackages = with pkgs; [
type = lib.types.bool; alacritty
default = false; xdg-utils # for xdg-open
example = true; ];
description = "Whether we want to install alacritty.";
home-manager.users.talexander =
{ pkgs, ... }:
{
home.file.".config/alacritty/alacritty.toml" = {
source = ./files/alacritty.toml;
};
}; };
};
config = lib.mkIf config.me.alacritty.enable (
lib.mkMerge [
(lib.mkIf config.me.graphical {
environment.systemPackages = with pkgs; [
alacritty
xdg-utils # for xdg-open
];
home-manager.users.talexander =
{ pkgs, ... }:
{
home.file.".config/alacritty/alacritty.toml" = {
source = ./files/alacritty.toml;
};
};
})
]
);
} }

View File

@ -6,160 +6,102 @@
}: }:
let let
plainmacs = plainmacs = pkgs.writeShellScriptBin "plainmacs" ''
emacs_package: INIT_SCRIPT=$(cat <<EOF
pkgs.writeShellScriptBin "plainmacs" '' (progn
INIT_SCRIPT=$(cat <<EOF (setq make-backup-files nil auto-save-default nil create-lockfiles nil)
(progn (load-theme 'tango-dark t)
(setq make-backup-files nil auto-save-default nil create-lockfiles nil) (set-face-attribute 'default nil :background "black")
(load-theme 'tango-dark t) ;; Bright yellow highlighting for selected region
(set-face-attribute 'default nil :background "black") (set-face-attribute 'region nil :background "#ffff50" :foreground "black")
;; Bright yellow highlighting for selected region ;; Bright green cursor to distinguish from yellow region
(set-face-attribute 'region nil :background "#ffff50" :foreground "black") (set-cursor-color "#ccff66")
;; Bright green cursor to distinguish from yellow region ;; Hightlight the current line
(set-cursor-color "#ccff66") (set-face-attribute 'line-number-current-line nil :foreground "white")
;; Hightlight the current line ;; Set default font
(set-face-attribute 'line-number-current-line nil :foreground "white") (set-face-attribute 'default nil :height 100 :width 'regular :weight 'regular :family "Cascadia Mono")
;; Set default font ;; Set fallback font for unicode glyphs
(set-face-attribute 'default nil :height 100 :width 'regular :weight 'regular :family "Cascadia Mono") (when (display-graphic-p)
;; Set fallback font for unicode glyphs (set-fontset-font "fontset-default" nil (font-spec :name "Noto Color Emoji")))
(when (display-graphic-p) (menu-bar-mode -1)
(set-fontset-font "fontset-default" nil (font-spec :name "Noto Color Emoji"))) (when (fboundp 'tool-bar-mode)
(menu-bar-mode -1) (tool-bar-mode -1))
(when (fboundp 'tool-bar-mode) (when ( fboundp 'scroll-bar-mode)
(tool-bar-mode -1)) (scroll-bar-mode -1))
(when ( fboundp 'scroll-bar-mode) (pixel-scroll-precision-mode)
(scroll-bar-mode -1)) (setq frame-resize-pixelwise t)
(pixel-scroll-precision-mode)
(setq frame-resize-pixelwise t)
)
EOF
) )
EOF
)
exec ${emacs_package}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}" exec ${pkgs.emacs29-pgtk}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}"
''; '';
e_shorthand = e_shorthand = pkgs.writeShellScriptBin "e" ''
emacs_package: exec ${pkgs.emacs_full}/bin/emacs "''${@}"
pkgs.writeShellScriptBin "e" '' '';
exec ${emacs_package}/bin/emacs "''${@}"
'';
in in
{ {
imports = [ ]; imports = [ ];
options.me.emacs_flavor = lib.mkOption { config = lib.mkMerge [
type = lib.types.nullOr ( {
lib.types.enum [ environment.systemPackages = with pkgs; [
"full" plainmacs
"plainmacs" e_shorthand
] emacs_full
); ];
default = null;
example = "full";
description = "What flavor of emacs to set up.";
};
config = lib.mkIf (config.me.emacs_flavor != null) ( nixpkgs.overlays = [
lib.mkMerge [ (final: prev: {
{ emacs_full = pkgs.symlinkJoin {
environment.systemPackages = with pkgs; [ name = "emacs_full";
my_emacs paths = [ pkgs.emacs29-pgtk ];
(plainmacs my_emacs) buildInputs = [ pkgs.makeWrapper ];
(e_shorthand my_emacs) postBuild = ''
]; wrapProgram $out/bin/emacs --prefix PATH : ${
lib.makeBinPath [
(pkgs.aspellWithDicts (
dicts: with dicts; [
en
en-computers
]
))
pkgs.nixd # nix language server
pkgs.nixfmt-rfc-style # auto-formatting nix files through nixd
pkgs.clang # To compile tree-sitter grammars
]
}
'';
};
})
];
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { home-manager.users.talexander =
hideMounts = true; { pkgs, ... }:
users.talexander = { {
directories = [ home.file.".config/emacs" = {
".config/emacs/eln-cache" # Installed packages source = ./files/emacs;
".config/emacs/elpa" # Installed packages recursive = true;
".config/emacs/private" # For recentf
".config/emacs/tree-sitter" # Compiled tree-sitter grammars
];
files = [
".config/emacs/history" # For savehist
".config/emacs/.last-package-update-day" # For use-package
];
}; };
}; };
environment.variables.EDITOR = "${pkgs.my_emacs}/bin/plainmacs"; environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
} hideMounts = true;
(lib.mkIf (config.me.graphical) { users.talexander = {
nixpkgs.overlays = [ directories = [
(final: prev: { ".config/emacs/eln-cache" # Installed packages
my_emacs = final.emacs29-pgtk; ".config/emacs/elpa" # Installed packages
}) ".config/emacs/private" # For recentf
]; ".config/emacs/tree-sitter" # Compiled tree-sitter grammars
}) ];
(lib.mkIf (!config.me.graphical) { files = [
nixpkgs.overlays = [ ".config/emacs/history" # For savehist
(final: prev: { ".config/emacs/.last-package-update-day" # For use-package
my_emacs = final.emacs-nox; ];
}) };
]; };
})
(lib.mkIf (config.me.emacs_flavor == "full") {
nixpkgs.overlays = [
(final: prev: {
my_emacs = pkgs.buildEnv {
name = prev.my_emacs.name;
paths = with prev; [
my_emacs
];
extraOutputsToInstall = [
"man"
"doc"
"info"
];
buildInputs = [ final.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/emacs --prefix PATH : ${
lib.makeBinPath [
(final.aspellWithDicts (
dicts: with dicts; [
en
en-computers
]
))
final.nixd # nix language server
final.nixfmt-rfc-style # auto-formatting nix files through nixd
final.clang # To compile tree-sitter grammars
final.shellcheck
]
}
'';
};
})
];
home-manager.users.talexander = environment.variables.EDITOR = "${plainmacs}/bin/plainmacs";
{ pkgs, ... }: }
{ ];
home.file.".config/emacs" = {
source = ./files/emacs;
recursive = true;
};
};
})
(lib.mkIf (config.me.emacs_flavor == "plainmacs") {
nixpkgs.overlays = [
(final: prev: {
my_emacs = pkgs.buildEnv {
name = prev.my_emacs.name;
paths = with prev; [
my_emacs
];
extraOutputsToInstall = [
"man"
"doc"
"info"
];
};
})
];
})
]
);
} }