Working on Emacs

This commit is contained in:
Andrea Ciceri 2021-10-11 13:55:12 +02:00
parent f4b2a68ba0
commit b4d239d34b
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
10 changed files with 186 additions and 116 deletions

View file

@ -3,10 +3,10 @@
A complete, declarative and reproducible configuration of my entire A complete, declarative and reproducible configuration of my entire
Nix fleet, this includes the following machines: Nix fleet, this includes the following machines:
- my main home workstation ~pc~ - [X] my main home workstation ~pc~
- homeserver (mainly a nas) ~hs~ *(to do, soon)* - [ ] homeserver (mainly a nas) ~hs~
- my arm based [[https://wiki.pine64.org/wiki/Pinebook_Pro][PineBook Pro]] ~pbp~, almost completely open hardware - [X] my arm based [[https://wiki.pine64.org/wiki/Pinebook_Pro][PineBook Pro]] ~pbp~, almost completely open hardware
- MacBook PRO that I use for work, for this I'll use [[https://github.com/LnL7/nix-darwin][nix-darwin]] keeping macOs 11 Big Sur *(to do, not soon)* - [X] MacBook PRO that I use for work, for this I'll use [[https://github.com/LnL7/nix-darwin][nix-darwin]] keeping macOs 11 Big Sur
The different confgurations share many profiles, in fact my original The different confgurations share many profiles, in fact my original
goal was to avoid to rewrite the same Nix derivations for my goal was to avoid to rewrite the same Nix derivations for my

220
flake.nix
View file

@ -63,132 +63,132 @@
, ... , ...
} @ inputs: } @ inputs:
digga.lib.mkFlake digga.lib.mkFlake
{ {
inherit self inputs; inherit self inputs;
channelsConfig = { allowUnfree = true; }; channelsConfig = { allowUnfree = true; };
channels = channels =
let let
commonOverlays = [ commonOverlays = [
digga.overlays.patchedNix digga.overlays.patchedNix
nur.overlay nur.overlay
emacs-overlay.overlay emacs-overlay.overlay
nvfetcher.overlay nvfetcher.overlay
deploy.overlay deploy.overlay
nixpkgs-wayland.overlay nixpkgs-wayland.overlay
./pkgs/default.nix ./pkgs/default.nix
]; ];
in in
{ {
stable = { stable = {
imports = [ (digga.lib.importOverlays ./overlays) ]; imports = [ (digga.lib.importOverlays ./overlays) ];
overlays = commonOverlays; overlays = commonOverlays;
}; };
unstable = { unstable = {
imports = [ (digga.lib.importOverlays ./overlays) ]; imports = [ (digga.lib.importOverlays ./overlays) ];
overlays = commonOverlays; overlays = commonOverlays;
}; };
}; };
lib = import ./lib { lib = digga.lib // nixos.lib; }; lib = import ./lib { lib = digga.lib // nixos.lib; };
sharedOverlays = [ sharedOverlays = [
( (
final: prev: { final: prev: {
__dontExport = true; __dontExport = true;
lib = prev.lib.extend ( lib = prev.lib.extend (
lfinal: lprev: { lfinal: lprev: {
our = self.lib; our = self.lib;
} }
); );
} }
) )
]; ];
nixos = { nixos = {
hostDefaults = { hostDefaults = {
channelName = "unstable"; channelName = "unstable";
imports = [ (digga.lib.importModules ./modules) ]; imports = [ (digga.lib.importModules ./modules) ];
externalModules = [ externalModules = [
{ lib.our = self.lib; } { lib.our = self.lib; }
digga.nixosModules.bootstrapIso digga.nixosModules.bootstrapIso
digga.nixosModules.nixConfig digga.nixosModules.nixConfig
home.nixosModules.home-manager home.nixosModules.home-manager
bud.nixosModules.bud bud.nixosModules.bud
];
};
hosts = {
# mbp is added bypassing Digga's mkFlake and adding a specific output to this flake
pc = {
system = "x86_64-linux";
imports = [{ modules = ./hosts/pc; }];
};
pbp = {
system = "aarch64-linux";
imports = [{ modules = ./hosts/pbp; }];
modules = [
"${pinebook-pro}/pinebook_pro.nix"
]; ];
}; };
}; hosts = {
# imports = [ (digga.lib.importHosts ./hosts) ]; # same reason as above # mbp is added bypassing Digga's mkFlake and adding a specific output to this flake
importables = rec { pc = {
profiles = digga.lib.rakeLeaves ./profiles // { system = "x86_64-linux";
users = digga.lib.rakeLeaves ./users; imports = [ { modules = ./hosts/pc; } ];
}; };
suites = with profiles; rec { pbp = {
base = [ core users.ccr users.root ];
};
pbpKernelLatest = (
import pinebook-pro-kernel-latest {
system = "aarch64-linux"; system = "aarch64-linux";
overlays = [ imports = [ { modules = ./hosts/pbp; } ];
(import "${pinebook-pro}/overlay.nix") modules = [
"${pinebook-pro}/pinebook_pro.nix"
]; ];
config.allowUnfree = true; };
} };
).pkgs.linuxPackages_pinebookpro_latest; # imports = [ (digga.lib.importHosts ./hosts) ]; # same reason as above
}; importables = rec {
}; profiles = digga.lib.rakeLeaves ./profiles // {
users = digga.lib.rakeLeaves ./users;
home = { };
imports = [ (digga.lib.importModules ./users/modules) ]; suites = with profiles; rec {
externalModules = [ ]; base = [ core users.ccr users.root ];
importables = rec { };
profiles = digga.lib.rakeLeaves ./users/profiles; pbpKernelLatest = (
suites = with profiles; rec { import pinebook-pro-kernel-latest {
base = [ direnv git zsh gpg password-store ]; system = "aarch64-linux";
shell = [ zsh exa fzf ]; overlays = [
gui = [ sway xdg gtk foot bat ]; (import "${pinebook-pro}/overlay.nix")
browser = [ firefox chromium qutebrowser ]; ];
multimedia = [ mpv zathura ]; config.allowUnfree = true;
dev = [ vim emacs vscode lorri direnv ]; }
).pkgs.linuxPackages_pinebookpro_latest;
}; };
}; };
};
devshell = ./shell; home = {
imports = [ (digga.lib.importModules ./users/modules) ];
externalModules = [];
importables = rec {
profiles = digga.lib.rakeLeaves ./users/profiles;
suites = with profiles; rec {
base = [ direnv git zsh gpg password-store ];
shell = [ zsh exa fzf ];
gui = [ sway xdg gtk foot bat ];
browser = [ firefox chromium qutebrowser ];
multimedia = [ mpv zathura ];
dev = [ vim emacs vscode lorri direnv ];
};
};
};
homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; devshell = ./shell;
deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations;
defaultTemplate = self.templates.bud; deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations {};
templates.bud.path = ./.;
templates.bud.description = "bud template";
defaultTemplate = self.templates.bud;
templates.bud.path = ./.;
templates.bud.description = "bud template";
}
// {
budModules = { devos = import ./bud; };
# checks.aarch64-linux = { }; # this line will be uncommented by Github Action in order since it can't build aarch64 derivations
} }
// { // {
budModules = { devos = import ./bud; }; darwinConfigurations."mbp" = darwin.lib.darwinSystem {
# checks.aarch64-linux = { }; # this line will be uncommented by Github Action in order since it can't build aarch64 derivations system = "x86_64-darwin";
} modules = [ home.darwinModules.home-manager ./hosts/mbp ];
// { inputs = { inherit darwin; };
darwinConfigurations."mbp" = darwin.lib.darwinSystem { };
system = "x86_64-darwin";
modules = [ home.darwinModules.home-manager ./hosts/mbp ];
inputs = { inherit darwin; };
}; };
};
} }

View file

@ -14,15 +14,20 @@ emacsWithPackages (
evil-collection evil-collection
helm helm
projectile projectile
helm-projectile
magit magit
company
helm-company
fira-code-mode fira-code-mode
org-superstar org-superstar
nix-mode nix-mode
lsp-python-ms
lispy lispy
lsp-mode lsp-mode
dap-mode dap-mode
which-key which-key
sudo-utils sudo-utils
rainbow-delimiters
treemacs treemacs
treemacs-evil treemacs-evil
treemacs-projectile treemacs-projectile

View file

@ -10,4 +10,12 @@
enable = true; enable = true;
package = pkgs.customEmacs; package = pkgs.customEmacs;
}; };
home.packages = with pkgs; [
python-language-server
fd
ag
nixpkgs-fmt
rnix-lsp
];
} }

View file

@ -23,6 +23,11 @@
(scroll-bar-mode -1) (scroll-bar-mode -1)
(fringe-mode 1) (fringe-mode 1)
(display-time-mode 1) (display-time-mode 1)
(global-hl-line-mode 1)
(add-hook 'prog-mode-hook #'display-line-numbers-mode)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(add-hook 'prog-mode-hook #'show-paren-mode)
(provide 'aesthetics) (provide 'aesthetics)

View file

@ -0,0 +1,35 @@
(use-package company
:init
(setq company-backends '(company-capf
company-keywords
company-semantic
company-files
company-etags
company-elisp
company-jedi
company-ispell
company-yasnippet)
company-tooltip-limit 20
company-show-numbers t
company-idle-delay 0
company-echo-delay 0)
:bind
(("C-c ." . company-complete)
("C-c C-." . company-complete)
("C-c s s" . company-yasnippet)
:map company-active-map
("C-n" . company-select-next)
("C-p" . company-select-previous)
("C-d" . company-show-doc-buffer)
("M-." . company-show-location)))
(use-package helm-company
:after (helm company)
:bind (("C-c C-;" . helm-company))
:commands (helm-company)
:init
(define-key company-mode-map (kbd "C-;") 'helm-company)
(define-key company-active-map (kbd "C-;") 'helm-company))
(provide 'config-company)

View file

@ -4,6 +4,7 @@
(setq lsp-keymap-prefix "C-c l") (setq lsp-keymap-prefix "C-c l")
:hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode) :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
(nix-mode . lsp) (nix-mode . lsp)
(python-mode . lsp)
;; if you want which-key integration ;; if you want which-key integration
(lsp-mode . lsp-enable-which-key-integration)) (lsp-mode . lsp-enable-which-key-integration))
(before-save . lsp-format-buffer) (before-save . lsp-format-buffer)

View file

@ -4,6 +4,9 @@
(projectile-mode +1) (projectile-mode +1)
:bind (:map projectile-mode-map :bind (:map projectile-mode-map
("s-p" . projectile-command-map) ("s-p" . projectile-command-map)
("C-c p" . projectile-command-map))) ("C-c p" . projectile-command-map))
:config
(helm-projectile-on))
(provide 'config-projectile) (provide 'config-projectile)

View file

@ -0,0 +1,9 @@
(use-package lsp-python-ms
:ensure t
:hook (python-mode . (lambda ()
(require 'lsp-python-ms)
(lsp)))
:init
(setq lsp-python-ms-executable (executable-find "python-language-server")))
(provide 'config-python)

View file

@ -7,7 +7,11 @@
(require 'config-emacs) (require 'config-emacs)
(require 'config-evil) (require 'config-evil)
(require 'config-helm) (require 'config-helm)
(require 'config-org)
(require 'config-projectile)
(require 'config-company)
(require 'config-magit) (require 'config-magit)
(require 'config-treemacs) (require 'config-treemacs)
(require 'config-lsp) (require 'config-lsp)
(require 'config-python)
(require 'nix) (require 'nix)