From 3fc5284ec8a4bfe0acacd5fc3f128645ff6180ee Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 19 May 2024 23:38:49 +0200 Subject: [PATCH] working emacs? --- hosts/vali/mars/programs.nix | 3 --- lib/default.nix | 0 lib/options.nix | 17 +++++++++++++++++ modules/editors/emacs.nix | 30 +++++++++++++----------------- modules/gui/stylix.nix | 4 ++-- modules/other/xdg.nix | 2 +- 6 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 lib/default.nix create mode 100644 lib/options.nix diff --git a/hosts/vali/mars/programs.nix b/hosts/vali/mars/programs.nix index c554946..abb3b42 100644 --- a/hosts/vali/mars/programs.nix +++ b/hosts/vali/mars/programs.nix @@ -15,11 +15,9 @@ in { dig easyeffects element-desktop - emacs evince eza fastfetch - fd feh (fenix.complete.withComponents [ "cargo" @@ -75,7 +73,6 @@ in { polkit python3 qbittorrent - ripgrep rustdesk scc scummvm diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/lib/options.nix b/lib/options.nix new file mode 100644 index 0000000..94b8c5c --- /dev/null +++ b/lib/options.nix @@ -0,0 +1,17 @@ +# Taken from: https://github.com/hlissner/dotfiles/blob/master/lib/options.nix +{ lib, ... }: + +let inherit (lib) mkOption types; +in { + mkOpt = type: default: mkOption { inherit type default; }; + + mkOpt' = type: default: description: + mkOption { inherit type default description; }; + + mkBoolOpt = default: + mkOption { + inherit default; + type = types.bool; + example = true; + }; +} diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 40d489b..e68b2ee 100644 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -1,27 +1,26 @@ -{ config, lib, pkgs, inputs, ... }: +# Taken from: https://github.com/hlissner/dotfiles/blob/master/modules/editors/emacs.nix +{ config, lib, pkgs, ... }: with lib; # with lib.my; let cfg = config.modules.editors.emacs; - configDir = config.dotfiles.configDir; + forgeUrl = "https://github.com"; + repoUrl = "${forgeUrl}/doomemacs/doomemacs"; + configRepoUrl = "${forgeUrl}/bloxx12/doom-emacs-config"; in { options.modules.editors.emacs = { - enable = mkBoolOpt false; - doom = rec { - enable = mkBoolOpt false; - forgeUrl = "https://github.com"; - repoUrl = "${forgeUrl}/doomemacs/doomemacs"; - configRepoUrl = "${forgeUrl}/bloxx12/doom-emacs-private"; - }; + enable = mkEnableOption "emacs"; + doom.enable = mkEnableOption "doom"; }; config = mkIf cfg.enable { # Why is this needed? # nixpkgs.overlays = [ inputs.emacs-overlay.overlay ]; - user.packages = with pkgs; [ + environment.systemPackages = with pkgs; [ ## Emacs itself + emacs binutils # native-comp needs 'as', provided by this # 28.2 + native-comp ((emacsPackagesFor emacsNativeComp).emacsWithPackages @@ -35,8 +34,6 @@ in { ## Optional dependencies fd # faster projectile indexing imagemagick # for image-dired - (mkIf (config.programs.gnupg.agent.enable) - pinentry_emacs) # in-emacs gnupg prompts zstd # for undo-fu-session/undo-tree compression ## Module dependencies @@ -50,20 +47,19 @@ in { texlive.combined.scheme-medium # :lang beancount beancount - unstable.fava # HACK Momentarily broken on nixos-unstable ]; - env.PATH = [ "$XDG_CONFIG_HOME/emacs/bin" ]; + environment.sessionVariables.PATH = [ "$XDG_CONFIG_HOME/emacs/bin" ]; - modules.shell.zsh.rcFiles = [ "${configDir}/emacs/aliases.zsh" ]; + # modules.shell.zsh.rcFiles = [ "${configDir}/emacs/aliases.zsh" ]; fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ]; system.userActivationScripts = mkIf cfg.doom.enable { installDoomEmacs = '' if [ ! -d "$XDG_CONFIG_HOME/emacs" ]; then - git clone --depth=1 --single-branch "${cfg.doom.repoUrl}" "$XDG_CONFIG_HOME/emacs" - git clone "${cfg.doom.configRepoUrl}" "$XDG_CONFIG_HOME/doom" + git clone --depth=1 --single-branch "${repoUrl}" "$XDG_CONFIG_HOME/emacs" + git clone "${configRepoUrl}" "$XDG_CONFIG_HOME/doom" fi ''; }; diff --git a/modules/gui/stylix.nix b/modules/gui/stylix.nix index 2422ce2..9ea9b00 100644 --- a/modules/gui/stylix.nix +++ b/modules/gui/stylix.nix @@ -10,7 +10,7 @@ in { home-manager.users.${username} = { stylix = { polarity = "dark"; - image = ../../lib/wallpapers/mafu_trad_wall.png; + image = ../../assets/wallpapers/mafu_trad_wall.png; base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; autoEnable = true; @@ -71,7 +71,7 @@ in { }; }; stylix = { - image = ../../lib/wallpapers/FreeBSD.png; + image = ../../assets/wallpapers/FreeBSD.png; polarity = "dark"; targets.plymouth.enable = false; }; diff --git a/modules/other/xdg.nix b/modules/other/xdg.nix index 1fa02df..1232f27 100644 --- a/modules/other/xdg.nix +++ b/modules/other/xdg.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ config, ... }: let username = config.modules.other.system.username; hmCfg = config.home-manager.users.${username};