First working doom emacs config

This commit is contained in:
marc
2022-11-13 17:46:29 +01:00
parent 4577adc53f
commit f2f5227384
10 changed files with 232 additions and 74 deletions

View File

@@ -7,72 +7,72 @@
nix-shell -p git nix-shell -p git
#+END_SRC #+END_SRC
1. Clone the flake 2. Clone the flake
#+BEGIN_SRC bash #+BEGIN_SRC bash
git clone https://git.lajuntament.space/marc/samfelag.git git clone https://git.lajuntament.space/marc/samfelag.git
#+END_SRC #+END_SRC
1. Partition the disk 3. Partition the disk
1. Locate the disk 1. Locate the disk
#+BEGIN_SRC bash #+BEGIN_SRC bash
lsblk lsblk
#+END_SRC #+END_SRC
1. Create a GPT partition table 2. Create a GPT partition table
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo parted /dev/nvme0n1 -- mklabel gpt sudo parted /dev/nvme0n1 -- mklabel gpt
#+END_SRC #+END_SRC
1. Create the root partition 3. Create the root partition
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo parted /dev/nvme0n1 -- mkpart primary 512MB -8GB sudo parted /dev/nvme0n1 -- mkpart primary 512MB -8GB
#+END_SRC #+END_SRC
1. Create the swap partition 4. Create the swap partition
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo parted /dev/nvme0n1 -- mkpart primary linux-swap -8GB 100% sudo parted /dev/nvme0n1 -- mkpart primary linux-swap -8GB 100%
#+END_SRC #+END_SRC
1. Create the boot partition 5. Create the boot partition
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB sudo parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB
sudo parted /dev/nvme0n1 -- set 3 esp on sudo parted /dev/nvme0n1 -- set 3 esp on
#+END_SRC #+END_SRC
1. Format the partitions 4. Format the partitions
1. Root partition 1. Root partition
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo mkfs.ext4 -L nixos /dev/nvme0n1p1 sudo mkfs.ext4 -L nixos /dev/nvme0n1p1
#+END_SRC #+END_SRC
1. Swap partition 2. Swap partition
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo mkswap -L swap /dev/nvme0n1p2 sudo mkswap -L swap /dev/nvme0n1p2
#+END_SRC #+END_SRC
1. Boot partition 3. Boot partition
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo mkfs.fat -F 32 -n BOOT /dev/nvme0n1p3 sudo mkfs.fat -F 32 -n BOOT /dev/nvme0n1p3
#+END_SRC #+END_SRC
1. Mount the filesystems 5. Mount the filesystems
1. Root partition 1. Root partition
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo mount /dev/disk/by-label/nixos /mnt sudo mount /dev/disk/by-label/nixos /mnt
#+END_SRC #+END_SRC
1. Boot partition 2. Boot partition
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo mkdir -p /mnt/boot sudo mkdir -p /mnt/boot
sudo mount /dev/disk/by-label/BOOT /mnt/boot sudo mount /dev/disk/by-label/BOOT /mnt/boot
#+END_SRC #+END_SRC
1. Swap partition (if needed) 3. Swap partition (if needed)
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo swapon /dev/disk/by-label/swap sudo swapon /dev/disk/by-label/swap
#+END_SRC #+END_SRC
1. Create the host nix configuration 6. Create the host nix configuration
If the host is not present under system/hosts, create a new folder for the host. If the host is not present under system/hosts, create a new folder for the host.
Generate the hardware configuration file, you can use nixos-generate-config as a base: Generate the hardware configuration file, you can use nixos-generate-config as a base:
@@ -80,13 +80,12 @@ Generate the hardware configuration file, you can use nixos-generate-config as a
nixos-generate-config --dir <<host directory>> --no-filesystems nixos-generate-config --dir <<host directory>> --no-filesystems
#+END_SRC #+END_SRC
1. Install nixos! 7. Install nixos!
#+BEGIN_SRC bash #+BEGIN_SRC bash
sudo nixos-install --impure --root /mnt --flake .#reykjavik sudo nixos-install --impure --root /mnt --flake .#reykjavik
#+END_SRC #+END_SRC
1. Set up the user 8. Set up the user
You'll set the root password during the installation. You can then reboot and use the installed OS. First thing you'll have to do is log in as root and set the password for your user: You'll set the root password during the installation. You can then reboot and use the installed OS. First thing you'll have to do is log in as root and set the password for your user:
#+BEGIN_SRC bash #+BEGIN_SRC bash
passwd marc passwd marc

17
flake.lock generated
View File

@@ -1,5 +1,21 @@
{ {
"nodes": { "nodes": {
"doom-emacs": {
"flake": false,
"locked": {
"lastModified": 1667229496,
"narHash": "sha256-SURAFrtblyvkflQz1cEQogfo31UzSvKd+UOgczUyJ8k=",
"owner": "doomemacs",
"repo": "doomemacs",
"rev": "9d4d5b756a8598c4b5c842e9f1f33148af2af8fd",
"type": "github"
},
"original": {
"owner": "doomemacs",
"repo": "doomemacs",
"type": "github"
}
},
"emacs-overlay": { "emacs-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
@@ -87,6 +103,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"doom-emacs": "doom-emacs",
"emacs-overlay": "emacs-overlay", "emacs-overlay": "emacs-overlay",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"

View File

@@ -10,9 +10,12 @@
emacs-overlay.url = "github:nix-community/emacs-overlay"; emacs-overlay.url = "github:nix-community/emacs-overlay";
doom-emacs.url = "github:doomemacs/doomemacs";
doom-emacs.flake = false;
}; };
outputs = { self, nixpkgs, home-manager, ... }: outputs = inputs @ { self, nixpkgs, home-manager, ... }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs { pkgs = import nixpkgs {
@@ -53,6 +56,7 @@
reykjavik = lib.nixosSystem { reykjavik = lib.nixosSystem {
inherit system; inherit system;
inherit pkgs; inherit pkgs;
specialArgs = { inherit inputs; };
modules = [ modules = [
./system/modules ./system/modules
@@ -60,6 +64,7 @@
./system/hosts/reykjavik ./system/hosts/reykjavik
home-manager.nixosModules.home-manager { home-manager.nixosModules.home-manager {
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.marc = { home-manager.users.marc = {

View File

@@ -9,6 +9,7 @@
discord.enable = true; discord.enable = true;
spotify.enable = true; spotify.enable = true;
}; };
editors.emacs.enable = true;
}; };
profiles = { profiles = {
desktop.enable = true; desktop.enable = true;

View File

@@ -2,5 +2,6 @@
{ {
imports = [ imports = [
./emacs.nix
]; ];
} }

View File

@@ -0,0 +1,14 @@
{ config, inputs, lib, options, pkgs, ... }:
with lib;
let
cfg = config.samfelag.modules.editors.emacs;
in {
options.samfelag.modules.editors.emacs = {
enable = mkEnableOption "emacs";
};
config = mkIf cfg.enable {
# xdg.configFile."doom".src = ../../../config/doom;
};
}

View File

@@ -17,6 +17,7 @@
samfelag.modules = { samfelag.modules = {
user.name = "marc"; user.name = "marc";
bluetooth.enable = true; bluetooth.enable = true;
editors.emacs.enable = true;
}; };

View File

@@ -2,5 +2,6 @@
{ {
imports = [ imports = [
./emacs.nix
]; ];
} }

View File

@@ -0,0 +1,119 @@
{ config, inputs, lib, options, pkgs, ... }:
with lib;
let
cfg = config.samfelag.modules.editors.emacs;
in {
options.samfelag.modules.editors.emacs = {
enable = mkEnableOption "emacs";
};
config = mkIf cfg.enable {
nixpkgs.overlays = [ inputs.emacs-overlay.overlay ];
# home.file.doom-emacs = {
# source = ./doom-emacs;
# target = ".config/doom";
# recursive = true;
# # onChange = "doom upgrade";
# };
# home.programs.emacs = {
# enable = true;
# # package = pkgs.emacsPgtkGcc;
# extraPackages = epkgs: [ epkgs.vterm ];
# };
# home.services.emacs = {
# enable = true;
# client.enable = true;
# socketActivation.enable = true;
# };
environment.systemPackages = with pkgs; [
## Emacs itself
binutils
emacs
# emacsPgtkGcc
## Doom dependencies
git
(ripgrep.override { withPCRE2 = true; })
gnutls
## Opt deps
fd
imagemagick
pinentry_emacs
zstd
# ## Modules deps
# # :lang cc
# ccls
# cmake
# gcc
# glslang
# # :lang haskell
# stack
# haskellPackages.ghcide
# haskellPackages.hoogle
# # :lang latex && :lang org (latex preview)
# (texlive.combine { inherit (texlive) scheme-full; })
# # biber
# # :lang nix
# nixfmt
# # :lang python
# black
# python3
# python3Packages.isort
# # python3Packages.python-language-server
# python3Packages.pytest
# python3Packages.setuptools
# nodePackages.pyright
# # :tools lookup & :lang org +roam
# sqlite
# # :tools direnv
# direnv
# # :tools vterm
# gcc
# gnumake
# libtool
# Fonts
emacs-all-the-icons-fonts
# fira-code
# fira-code-symbols
graphviz
];
fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ];
# env.PATH = [ "$XDG_CONFIG_HOME/emacs/bin" ];
environment.sessionVariables = rec {
XDG_CACHE_HOME = "$HOME/.cache";
XDG_CONFIG_HOME = "$HOME/.config";
XDG_BIN_HOME = "$HOME/.local/bin";
XDG_DATA_HOME = "$HOME/.local/share";
PATH = [
"$HOME/.config/emacs/bin"
];
};
home-manager.users.marc.xdg.configFile."doom".source = ../../../config/doom;
system.userActivationScripts = {
installDoomEmacs = ''
EMACS_FOLDER="$HOME/.config/emacs"
echo $XDG_CONFIG_HOME
echo $EMACS_FOLDER
if [ ! -d "$EMACS_FOLDER" ]; then
${pkgs.git}/bin/git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "$EMACS_FOLDER"
fi
'';
};
};
}

View File

@@ -12,7 +12,7 @@
gc = { gc = {
automatic = true; automatic = true;
dates = "weekly"; dates = "weekly";
options = "--delete-older-than 30d"; options = "--delete-older-than 14d";
}; };
}; };