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
boot.tmp.useTmpfs = true;
me.bluetooth.enable = true;
me.emacs_flavor = "plainmacs";
me.graphical = true;
me.graphicsCardType = "intel";
me.kodi.enable = true;
me.bluetooth.enable = true;
}

View File

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

View File

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

View File

@ -6,9 +6,7 @@
}:
let
plainmacs =
emacs_package:
pkgs.writeShellScriptBin "plainmacs" ''
plainmacs = pkgs.writeShellScriptBin "plainmacs" ''
INIT_SCRIPT=$(cat <<EOF
(progn
(setq make-backup-files nil auto-save-default nil create-lockfiles nil)
@ -36,38 +34,57 @@ let
EOF
)
exec ${emacs_package}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}"
exec ${pkgs.emacs29-pgtk}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}"
'';
e_shorthand =
emacs_package:
pkgs.writeShellScriptBin "e" ''
exec ${emacs_package}/bin/emacs "''${@}"
e_shorthand = pkgs.writeShellScriptBin "e" ''
exec ${pkgs.emacs_full}/bin/emacs "''${@}"
'';
in
{
imports = [ ];
options.me.emacs_flavor = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"full"
"plainmacs"
]
);
default = null;
example = "full";
description = "What flavor of emacs to set up.";
};
config = lib.mkIf (config.me.emacs_flavor != null) (
lib.mkMerge [
config = lib.mkMerge [
{
environment.systemPackages = with pkgs; [
my_emacs
(plainmacs my_emacs)
(e_shorthand my_emacs)
plainmacs
e_shorthand
emacs_full
];
nixpkgs.overlays = [
(final: prev: {
emacs_full = pkgs.symlinkJoin {
name = "emacs_full";
paths = [ pkgs.emacs29-pgtk ];
buildInputs = [ pkgs.makeWrapper ];
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
]
}
'';
};
})
];
home-manager.users.talexander =
{ pkgs, ... }:
{
home.file.".config/emacs" = {
source = ./files/emacs;
recursive = true;
};
};
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
hideMounts = true;
users.talexander = {
@ -84,82 +101,7 @@ in
};
};
environment.variables.EDITOR = "${pkgs.my_emacs}/bin/plainmacs";
environment.variables.EDITOR = "${plainmacs}/bin/plainmacs";
}
(lib.mkIf (config.me.graphical) {
nixpkgs.overlays = [
(final: prev: {
my_emacs = final.emacs29-pgtk;
})
];
})
(lib.mkIf (!config.me.graphical) {
nixpkgs.overlays = [
(final: prev: {
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 =
{ 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"
];
};
})
];
})
]
);
}