literate-config

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 13dc1dfb1c63b5cbdba1246bed80ed7b6a0e2d64
parent a8d5bbab5312593b875bf2390d442b6a5ead00b0
Author: Crazazy <crazazy@tilde.cafe>
Date:   Sun, 30 Jan 2022 23:49:32 +0100

added noweb-ref stuff everywhere

Diffstat:
Memacs.org | 48++++++++++++++++--------------------------------
Mnixos.org | 46++++++++++++++++++++++------------------------
2 files changed, 38 insertions(+), 56 deletions(-)

diff --git a/emacs.org b/emacs.org @@ -9,8 +9,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto * Before we start lisping This emacs config's dependencies are mostly managed by [[https://nixos.org][nix]], therefore we have to make a nix file before we do any emacs configuring by ourselves - #+name: emacs.nix - #+begin_src nix + #+begin_src nix :tangle emacs.nix let sources = import ./nix/sources.nix in @@ -26,15 +25,13 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto ** The bases This is only better-defaults. It comes with ido-mode and some other defaults that I forgot to set in my init file that I stole from [[https://github.com/editor-bootstrap/emacs-bootstrap][emacs-bootstrap]] months ago - #+name: emacsconfig/base.el - #+begin_src elisp :mkdirp yes + #+begin_src elisp :mkdirp yes :tangle emacsconfig/base.el (use-package better-defaults) #+end_src ** Generally nice emacs tools *** Magit Simple. Nice. default config. (almost) - #+name emacsconfig/extras.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/extras.el (use-package magit :defer t :config @@ -50,8 +47,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto *** IRC I use IRC in emacs, with ERC. There is even a small macro so that I can easily join new servers with my preferred nickname - #+name: emacsconfig/extras.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/extras.el (use-package erc :custom (erc-server-reconnect-attempts 10) @@ -73,8 +69,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto #+end_src *** Dashboard Gives me access to the most recent files I edited, and some other stuff that I don't really care about - #+name: emacsconfig/extras.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/extras.el (use-package dashboard :config (dashboard-setup-startup-hook)) #+end_src @@ -82,8 +77,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto I don't use elfeed in emacs that much anymore, as I have switched to [[https://www.seamonkey-project.org/][seamonkey]] for my RSS needs. Here is my old config anyways. If you want to browse through some default news feel free to remove the last =:custom= option - #+name: emacsconfig/extras.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/extras.el (use-package elfeed :bind ("C-x w" . elfeed) @@ -160,8 +154,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto #+end_src *** Which-key Has god-mode support - #+name: emacsconfig/extras.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/extras.el (use-package which-key :after god-mode :config @@ -174,8 +167,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto *** Company Generally nice for auto-completion anywhere. I think here is also the place to note that I am not a huge fan of language-servers, as I've had bad experiences with them when I was still using vim - #+name: emacsconfig/extras.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/extras.el (use-package company :bind ("C-SPC" . company-complete)) @@ -183,8 +175,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto *** Matching of parentheses and other stuff "ERROR: Unmatched parenteses/braces/whatever" is really a thing I would prefer to never see again It has nix and lisp support, but other langages are fairly standards so not much configuration needed there - #+name: emacsconfig/extras.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/extras.el (use-package smartparens :hook (emacs-lisp-mode . smartparens-mode) @@ -208,8 +199,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto ***** Nix mode This config is just part of editing nix config. It is supposed to come with company support, but the auto-completion backend turns out to not be that great. We'll see what I do with it - #+name: emacsconfig/nix.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/nix.el (use-package nix-mode :mode "\\.nix\\'" :hook @@ -228,8 +218,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto ***** Nix package management I use nix-sandbox for managing nix package for other languages. One of the functions doesn't work that well for me so I replaced it with something that does - #+name: emacsconfig/nix.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/nix.el (use-package nix-sandbox :config (defun nix-executable-find (sandbox executable) @@ -239,8 +228,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto #+end_src Beyond that, there is a helper function that makes it easy to quickly define environments with the required packages for a programming language - #+name: emacsconfig/nix.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/nix.el (defun nix-env-from-packages (name &rest packages) "create a nix environment from nix packages. returns the location of the environment" (interactive (append @@ -268,8 +256,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto #+end_src First we set an interpreter with nix, it comes with all the python autocompletion tools we need - #+name: el-python-config - #+begin_src elisp + #+begin_src elisp :tangle el-python-config (setq python-shell-interpreter (nix-executable-find (nix-env-from-packages "python" "(python3.withPackages (p: with p; [pygame virtualenvwrapper pip sqlite jedi flake8 yapf autopep8 black]))") @@ -277,8 +264,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto #+end_src Then we introduce elpy with so that it can use all the tools immidiately without downloading them - #+name: el-python-config-2 - #+begin_src elisp + #+begin_src elisp :tangle el-python-config-2 (use-package elpy :config (elpy-enable) @@ -290,8 +276,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto might expand later, but so far this is what I have ***** Web mode General xml stuff editing. Fairly standard - #+name: emacsconfig/web.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/web.el (use-package web-mode :mode (("\\.x?html?\\'" . web-mode) ("\\.x[sm]l\\'" . web-mode) @@ -309,8 +294,7 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto #+end_src ***** Emmet mode for quickly inserting a whole XML tree - #+name: emacsconfig/web.el - #+begin_src elisp + #+begin_src elisp :tangle emacsconfig/web.el (use-package emmet-mode :hook (sgml-mode . emmet-mode) diff --git a/nixos.org b/nixos.org @@ -10,7 +10,7 @@ stuff The nixos config is going to consist of a bunch of "imports" which are just a bunch of configs in the imports part of the main configuration. Then we can put each part of said config on its own source block This does require a bit of a prefix, that lets us access packages, existing configuration and library functions - #+begin_src nix :tangle configuration.nix + #+begin_src nix :tangle configuration.nix :noweb yes { config, lib, pkgs, ... }: let sources = import ./nix/sources.nix; @@ -19,17 +19,20 @@ stuff in { imports = [ + <<nixos-config>> + ]; + } #+end_src * Configuration ** Hardware Normal nixos installation comes with a hardware-configuration file. we are not going to add the contents of that file here ourself, but instead add it as an external module. This is the only place where we'll do this - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config ./hardware-configuration.nix #+end_src ** personal stuff First, some personal stuff, so that I can tel people my computer is mine - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { options.mainUser = with lib; mkOption { type = types.str; @@ -39,7 +42,7 @@ stuff #+end_src and then the actual info: - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { mainUser = "erik"; networking.hostName = "RACEMONSTER"; @@ -48,7 +51,7 @@ stuff #+end_src ** Init system nixos is started with systemd-boot, since we don't run any other distros - #+begin_src nix + #+begin_src nix :noweb-ref nixos-config { boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -56,7 +59,7 @@ stuff #+end_src ** Networking Some default network settings for my laptop - #+begin_src nix + #+begin_src nix :noweb-ref nixos-config { networking.networkmanager.enable = true; # Enables wireless support via wpa_supplicant. networking.useDHCP = false; @@ -66,7 +69,7 @@ stuff #+end_src ** nixpkgs setup not much info here right now. emacs itself now refers to emacsng - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { nix.package = pkgs.nixFlakes; nixpkgs.config.allowUnfree = true; @@ -80,7 +83,7 @@ stuff *** cachix Cachix and other substitute servers allow you to not have to compile things as much as you are supposed to We will create a small module for cachix before we put in the rest declaratively - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { options.nix.cacheAttrs = with lib; mkOption { type = with types; attrsOf str; @@ -94,7 +97,7 @@ stuff } #+end_src With the config in hand, we can now quickly and easily declare our substitute servers - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { nix.cacheAttrs = { "https://crazazy.cachix.org" = "crazazy.cachix.org-1:3KaIHK26pkvd5palJH5A4Re1Hn2+GDV+aXYnftMYAm4="; @@ -112,7 +115,7 @@ stuff *** The config This part is quite advanced. It makes entries for filesystems and then makes a systemd service to re-assign generated temporary directories to the owner of the home folder - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { options = with lib; { homebinds = mkoption { @@ -143,7 +146,7 @@ stuff #+end_src *** The binds These are the binds themselves, they change frequently - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { homeBinds = [ ".config/keybase" @@ -164,7 +167,7 @@ stuff ** packages *** Core packages These are the normal packages that I use for core maintenance - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config environment.systemPackages = with pkgs; [ gitFull curl @@ -175,7 +178,7 @@ stuff #+end_src *** Steam I like to play videogames sometimes, however steam also requires a little more special attention - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { imports = [ nurModules.repos.crazazy.private.steam-config @@ -187,7 +190,7 @@ stuff #+end_src *** Emacs Emacs needs to be integrated into the rest of the system. We are going to do that via a emacs daemon - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { services.emacs = { package = import ./emacsconfig.nix; @@ -199,7 +202,7 @@ stuff I also sometimes run qemu vms. The qemu's ** Main user config This sets up a (secret) default password for the main user and also sets some default groups - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { users.mutableUsers = false; # Define a user account. Don't forget to set a password with ‘passwd’. @@ -208,13 +211,14 @@ stuff isNormalUser = true; extraGroups = [ "video" "wheel" "NetworkManager" ]; # Enable ‘sudo’ for the user. # shell = pkgs.nushell; - } + }; + } #+end_src ** Visual stuff I don't acutally literally live in the terminal. So we have to implement some xorg and other stuff *** Basics Enable printing, sound and a good keyboard, along with x11 itself - #+begin_src nix :tangle configuration.nix + #+begin_src nix :noweb-ref nixos-config { # Enable CUPS to print documents. services.printing.enable = true; @@ -234,15 +238,9 @@ stuff #+end_src *** XFCE I have decided to be lazy and not install a fancy window manager or whatever into the system. Thats headache - #+begin_src nix :tangle configration.nix + #+begin_src nix :noweb-ref nixos-config { services.xserver.displayManager.lightdm.enable = true; services.xserver.desktopManager.xfce.enable = true; } #+end_src -* Postfix - We need to remember to close our main module that we started off with - #+begin_src nix :tangle configuration.nix - ]; - } - #+end_src