diff --git a/README.org b/README.org index 61e7539..604958b 100644 --- a/README.org +++ b/README.org @@ -3,10 +3,10 @@ A complete, declarative and reproducible configuration of my entire Nix fleet, this includes the following machines: - - my main home workstation ~pc~ - - homeserver (mainly a nas) ~hs~ *(to do, soon)* - - 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] my main home workstation ~pc~ + - [ ] homeserver (mainly a nas) ~hs~ + - [X] my arm based [[https://wiki.pine64.org/wiki/Pinebook_Pro][PineBook Pro]] ~pbp~, almost completely open hardware + - [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 goal was to avoid to rewrite the same Nix derivations for my diff --git a/flake.nix b/flake.nix index 159120c..986ff2a 100644 --- a/flake.nix +++ b/flake.nix @@ -63,132 +63,132 @@ , ... } @ inputs: - digga.lib.mkFlake - { - inherit self inputs; + digga.lib.mkFlake + { + inherit self inputs; - channelsConfig = { allowUnfree = true; }; + channelsConfig = { allowUnfree = true; }; - channels = - let - commonOverlays = [ - digga.overlays.patchedNix - nur.overlay - emacs-overlay.overlay - nvfetcher.overlay - deploy.overlay - nixpkgs-wayland.overlay - ./pkgs/default.nix - ]; - in - { - stable = { - imports = [ (digga.lib.importOverlays ./overlays) ]; - overlays = commonOverlays; - }; - unstable = { - imports = [ (digga.lib.importOverlays ./overlays) ]; - overlays = commonOverlays; - }; - }; + channels = + let + commonOverlays = [ + digga.overlays.patchedNix + nur.overlay + emacs-overlay.overlay + nvfetcher.overlay + deploy.overlay + nixpkgs-wayland.overlay + ./pkgs/default.nix + ]; + in + { + stable = { + imports = [ (digga.lib.importOverlays ./overlays) ]; + overlays = commonOverlays; + }; + unstable = { + imports = [ (digga.lib.importOverlays ./overlays) ]; + overlays = commonOverlays; + }; + }; - lib = import ./lib { lib = digga.lib // nixos.lib; }; + lib = import ./lib { lib = digga.lib // nixos.lib; }; - sharedOverlays = [ - ( - final: prev: { - __dontExport = true; - lib = prev.lib.extend ( - lfinal: lprev: { - our = self.lib; - } - ); - } - ) - ]; + sharedOverlays = [ + ( + final: prev: { + __dontExport = true; + lib = prev.lib.extend ( + lfinal: lprev: { + our = self.lib; + } + ); + } + ) + ]; - nixos = { - hostDefaults = { - channelName = "unstable"; - imports = [ (digga.lib.importModules ./modules) ]; - externalModules = [ - { lib.our = self.lib; } - digga.nixosModules.bootstrapIso - digga.nixosModules.nixConfig - home.nixosModules.home-manager - 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" + nixos = { + hostDefaults = { + channelName = "unstable"; + imports = [ (digga.lib.importModules ./modules) ]; + externalModules = [ + { lib.our = self.lib; } + digga.nixosModules.bootstrapIso + digga.nixosModules.nixConfig + home.nixosModules.home-manager + bud.nixosModules.bud ]; }; - }; - # imports = [ (digga.lib.importHosts ./hosts) ]; # same reason as above - importables = rec { - profiles = digga.lib.rakeLeaves ./profiles // { - users = digga.lib.rakeLeaves ./users; - }; - suites = with profiles; rec { - base = [ core users.ccr users.root ]; - }; - pbpKernelLatest = ( - import pinebook-pro-kernel-latest { + 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"; - overlays = [ - (import "${pinebook-pro}/overlay.nix") + imports = [ { modules = ./hosts/pbp; } ]; + modules = [ + "${pinebook-pro}/pinebook_pro.nix" ]; - config.allowUnfree = true; - } - ).pkgs.linuxPackages_pinebookpro_latest; - }; - }; - - 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 ]; + }; + }; + # imports = [ (digga.lib.importHosts ./hosts) ]; # same reason as above + importables = rec { + profiles = digga.lib.rakeLeaves ./profiles // { + users = digga.lib.rakeLeaves ./users; + }; + suites = with profiles; rec { + base = [ core users.ccr users.root ]; + }; + pbpKernelLatest = ( + import pinebook-pro-kernel-latest { + system = "aarch64-linux"; + overlays = [ + (import "${pinebook-pro}/overlay.nix") + ]; + config.allowUnfree = true; + } + ).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; - templates.bud.path = ./.; - templates.bud.description = "bud template"; + deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations {}; + 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; }; - # checks.aarch64-linux = { }; # this line will be uncommented by Github Action in order since it can't build aarch64 derivations - } - // { - darwinConfigurations."mbp" = darwin.lib.darwinSystem { - 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; }; + }; }; - }; } diff --git a/pkgs/emacs/default.nix b/pkgs/emacs/default.nix index 31bbf5a..6699e2a 100644 --- a/pkgs/emacs/default.nix +++ b/pkgs/emacs/default.nix @@ -14,15 +14,20 @@ emacsWithPackages ( evil-collection helm projectile + helm-projectile magit + company + helm-company fira-code-mode org-superstar nix-mode + lsp-python-ms lispy lsp-mode dap-mode which-key sudo-utils + rainbow-delimiters treemacs treemacs-evil treemacs-projectile diff --git a/users/profiles/emacs/default.nix b/users/profiles/emacs/default.nix index 5df3cbc..0ab17ea 100644 --- a/users/profiles/emacs/default.nix +++ b/users/profiles/emacs/default.nix @@ -10,4 +10,12 @@ enable = true; package = pkgs.customEmacs; }; + + home.packages = with pkgs; [ + python-language-server + fd + ag + nixpkgs-fmt + rnix-lsp + ]; } diff --git a/users/profiles/emacs/emacs.d/config/aesthetics.el b/users/profiles/emacs/emacs.d/config/aesthetics.el index 533f81f..3cdd1cd 100644 --- a/users/profiles/emacs/emacs.d/config/aesthetics.el +++ b/users/profiles/emacs/emacs.d/config/aesthetics.el @@ -23,6 +23,11 @@ (scroll-bar-mode -1) (fringe-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) \ No newline at end of file +(provide 'aesthetics) diff --git a/users/profiles/emacs/emacs.d/config/config-company.el b/users/profiles/emacs/emacs.d/config/config-company.el new file mode 100644 index 0000000..c2b9b88 --- /dev/null +++ b/users/profiles/emacs/emacs.d/config/config-company.el @@ -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) diff --git a/users/profiles/emacs/emacs.d/config/config-lsp.el b/users/profiles/emacs/emacs.d/config/config-lsp.el index 580053e..4c08863 100644 --- a/users/profiles/emacs/emacs.d/config/config-lsp.el +++ b/users/profiles/emacs/emacs.d/config/config-lsp.el @@ -4,6 +4,7 @@ (setq lsp-keymap-prefix "C-c l") :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode) (nix-mode . lsp) + (python-mode . lsp) ;; if you want which-key integration (lsp-mode . lsp-enable-which-key-integration)) (before-save . lsp-format-buffer) diff --git a/users/profiles/emacs/emacs.d/config/config-projectile.el b/users/profiles/emacs/emacs.d/config/config-projectile.el index dcc7cfd..0ce54d2 100644 --- a/users/profiles/emacs/emacs.d/config/config-projectile.el +++ b/users/profiles/emacs/emacs.d/config/config-projectile.el @@ -4,6 +4,9 @@ (projectile-mode +1) :bind (:map projectile-mode-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) diff --git a/users/profiles/emacs/emacs.d/config/config-python.el b/users/profiles/emacs/emacs.d/config/config-python.el new file mode 100644 index 0000000..aeb7090 --- /dev/null +++ b/users/profiles/emacs/emacs.d/config/config-python.el @@ -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) diff --git a/users/profiles/emacs/emacs.d/init.el b/users/profiles/emacs/emacs.d/init.el index e8726ec..a89a3cb 100644 --- a/users/profiles/emacs/emacs.d/init.el +++ b/users/profiles/emacs/emacs.d/init.el @@ -7,7 +7,11 @@ (require 'config-emacs) (require 'config-evil) (require 'config-helm) +(require 'config-org) +(require 'config-projectile) +(require 'config-company) (require 'config-magit) (require 'config-treemacs) (require 'config-lsp) +(require 'config-python) (require 'nix)