From 69ad8d41af6ea7e7d31614123ae768c1cc3f8f13 Mon Sep 17 00:00:00 2001 From: lucy Date: Mon, 31 Aug 2026 01:01:05 +0200 Subject: [PATCH] i fucking hate this shit already --- flake.lock | 96 +++++++++++++++++++ flake.nix | 28 ++++++ modules/hosts/nerv/configuration.nix | 61 ++++++++++++ modules/hosts/nerv/hardware-configuration.nix | 31 ++++++ modules/programs/emacs/emacs.nix | 79 +++++++++++++++ 5 files changed, 295 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 modules/hosts/nerv/configuration.nix create mode 100644 modules/hosts/nerv/hardware-configuration.nix create mode 100644 modules/programs/emacs/emacs.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..322ef55 --- /dev/null +++ b/flake.lock @@ -0,0 +1,96 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1787559586, + "narHash": "sha256-onL0VLf9vPllmT0H/OlURIU5r5t5WIEl7t4tVNKT0Nw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9d0d87172c374f89da73c1cfe6d81ae62feac1f1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1788039129, + "narHash": "sha256-pa4Q0qErvCvzCaaUph7Sm37RhR4xvPrYI8Lgz6k85+A=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d2f67949798825fe853f7c5d0492b8bf016d3f88", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1785031560, + "narHash": "sha256-OmshNvn2vupOFpYinLUu+1Dnpu4n7Q5N3ggGVNHpkUI=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "0e79af5e3d4dcfcd676ab5ba3f95d2e3352e078c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1786719841, + "narHash": "sha256-QcpQOT0NQEFkI77t+YXPZqDJc35iIodG7zinieOwFUg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8be7bd0c83f12e2e3bbba07c9044d6fed9e66f7f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "wrappers": "wrappers" + } + }, + "wrappers": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1787722691, + "narHash": "sha256-bWBt7v2FhgG6WTLgSi8nYGi1zXaTdA+vTdCRdvR2vcw=", + "owner": "BirdeeHub", + "repo": "nix-wrapper-modules", + "rev": "04ef216559b18214853879df862f493a9e6bb8cf", + "type": "github" + }, + "original": { + "owner": "BirdeeHub", + "repo": "nix-wrapper-modules", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1f7a52f --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + wrappers.url = "github:BirdeeHub/nix-wrapper-modules"; + flake-parts.url = "github:hercules-ci/flake-parts"; + + }; + outputs = { self, nixpkgs, wrappers, flake-parts, ... }@inputs: + flake-parts.lib.mkFlake { inherit inputs; } ({config, ...}: { + systems = [ "x86_64-linux" ]; + imports = [ + wrappers.flakeModules.wrappers + ./modules/programs/emacs/emacs.nix + ]; + flake.nixosConfigurations.nerv = inputs.nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + ./modules/hosts/nerv/configuration.nix + config.flake.wrappers.emacs.install + { wrappers.emacs.enable = true; } + ]; + }; + + }); + + +} + diff --git a/modules/hosts/nerv/configuration.nix b/modules/hosts/nerv/configuration.nix new file mode 100644 index 0000000..258f6fa --- /dev/null +++ b/modules/hosts/nerv/configuration.nix @@ -0,0 +1,61 @@ +{ config, lib, pkgs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Use latest kernel. + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking.hostName = "nerv"; # Define your hostname. + networking.networkmanager.enable = true; + + # use proprietary nvidia drivers + hardware.graphics.enable = true; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + open = true; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; +}; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + i18n.defaultLocale = "en_US.UTF-8"; + services.desktopManager.gnome.enable = true; + services.displayManager.gdm.enable = true; + services.xserver.xkb.layout = "us"; + services.pipewire = { + enable = true; + pulse.enable = true; + }; + nixpkgs.config.allowUnfree = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.lucy = { + isNormalUser = true; + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + packages = with pkgs; [ + vesktop + google-chrome + ]; + }; + + environment.systemPackages = with pkgs; [ + fastfetch + wget + git + clang + ]; + system.stateVersion = "26.05"; # Did you read the comment? + +} + diff --git a/modules/hosts/nerv/hardware-configuration.nix b/modules/hosts/nerv/hardware-configuration.nix new file mode 100644 index 0000000..6eb8fe8 --- /dev/null +++ b/modules/hosts/nerv/hardware-configuration.nix @@ -0,0 +1,31 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "ahci" "xhci_pci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/a91a4338-b1a9-4964-879f-3908b44c4636"; + fsType = "xfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/B318-A112"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/programs/emacs/emacs.nix b/modules/programs/emacs/emacs.nix new file mode 100644 index 0000000..52c0b08 --- /dev/null +++ b/modules/programs/emacs/emacs.nix @@ -0,0 +1,79 @@ +{ inputs, ... }: { + flake.wrappers.emacs = { pkgs, wlib, lib, ... }: { + imports = [ wlib.wrapperModules.emacs ]; + emacsPackages = + epkgs: with epkgs.melpaPackages; [ + corfu + cape + qml-mode + lua-mode + elcord + nix-mode + ]; + + runtimePkgs = with pkgs; [ + nixd + nixfmt + qt6.qtdeclarative + ]; + constructFiles.early-init.content = lib.mkBefore ";;; -*- lexical-binding: t; -*-"; + configFile = '' + ;;; -*- lexical-binding: t; -*- + (setq make-backup-files nil) + (use-package + corfu + :init + (setq + corfu-auto t + corfu-auto-prefix 1 + corfu-auto-delay 0.2) + (global-corfu-mode)) + + (setq tab-always-indent 'complete) + (use-package + cape + :bind ("C-c p" . cape-prefix-map) ;; Alternative key: M-, M-p, M-+ + :init (add-hook 'completion-at-point-functions #'cape-file)) + (setq corfu-auto-prefix 2) + (use-package qml-mode :ensure t) + (use-package lua-mode :ensure t) + (use-package elcord :ensure t :init (elcord-mode)) + + (add-to-list + 'display-buffer-alist + '("\\*compilation\\*" (display-buffer-reuse-window + display-buffer-below-selected) + (window-height . 0.3))) + + + ;; remove useless shit and set default opts + (setq ring-bell-function 'ignore) + (menu-bar-mode -1) + (tool-bar-mode -1) + (setq display-line-numbers-type 'relative) + (global-display-line-numbers-mode +1) + (global-tab-line-mode 1) + (scroll-bar-mode -1) + (setq inhibit-splash-screen 1) + (setq custom-file "~/.emacs.d/custom.el") + (load custom-file 'noerror) + + + ;; lsp shit + (add-hook 'nix-mode-hook #'eglot-ensure) + (add-hook 'c-mode-hook #'eglot-ensure) + (add-hook 'qml-mode-hook #'eglot-ensure) + (with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs '(nix-mode . ("nixd"))) + (add-to-list 'eglot-server-programs '(qml-mode . ("qmlls")))) + + ;; keybindings + (keymap-global-set "C-c f" 'eglot-format) + (keymap-global-set "C-c t" 'term) + (keymap-global-set "C-c c" 'compile) + (keymap-global-set "C-c k b" 'kill-current-buffer) + (keymap-global-set "C-c k w" 'kill-buffer-and-window) + (windmove-default-keybindings) + ''; + }; +}