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,18 +7,7 @@
{ {
imports = [ ]; 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; [ environment.systemPackages = with pkgs; [
alacritty alacritty
xdg-utils # for xdg-open xdg-utils # for xdg-open
@ -31,8 +20,5 @@
source = ./files/alacritty.toml; source = ./files/alacritty.toml;
}; };
}; };
})
]
);
} }

View File

@ -6,9 +6,7 @@
}: }:
let let
plainmacs = plainmacs = pkgs.writeShellScriptBin "plainmacs" ''
emacs_package:
pkgs.writeShellScriptBin "plainmacs" ''
INIT_SCRIPT=$(cat <<EOF INIT_SCRIPT=$(cat <<EOF
(progn (progn
(setq make-backup-files nil auto-save-default nil create-lockfiles nil) (setq make-backup-files nil auto-save-default nil create-lockfiles nil)
@ -36,38 +34,57 @@ let
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 [
"full"
"plainmacs"
]
);
default = null;
example = "full";
description = "What flavor of emacs to set up.";
};
config = lib.mkIf (config.me.emacs_flavor != null) (
lib.mkMerge [
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
my_emacs plainmacs
(plainmacs my_emacs) e_shorthand
(e_shorthand my_emacs) 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) { environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
hideMounts = true; hideMounts = true;
users.talexander = { 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"
];
};
})
];
})
]
);
} }