From 6579f8d0120f7f4f86739be43f69dc1370d48e4e Mon Sep 17 00:00:00 2001 From: willemml Date: Thu, 29 Dec 2022 11:25:37 -0800 Subject: [PATCH] fix errors --- emacs.nix | 125 +++++++++++++++++++------------------- flake.nix | 15 +++-- home.nix | 20 +++--- packages.nix | 110 +++++++++++---------------------- programs.nix | 145 ++++++++++++++++++++++---------------------- python-packages.nix | 5 +- 6 files changed, 190 insertions(+), 230 deletions(-) diff --git a/emacs.nix b/emacs.nix index 80db692..ff08df4 100644 --- a/emacs.nix +++ b/emacs.nix @@ -1,7 +1,6 @@ -{ config, pkgs, inputs, nurNoPkgs, ... }: +{ config, pkgs, inputs, lib, ... }: -let - pcfg = config.programs.emacs.init.usePackage; +let pcfg = config.programs.emacs.init.usePackage; in { imports = [ pkgs.nur.repos.rycee.hmModules.emacs-init @@ -15,92 +14,92 @@ in { usePackageVerbose = false; earlyInit = '' -;; Disable Toolbar -(tool-bar-mode -1) -;; Disable scrollbar -(scroll-bar-mode -1) -;; Disable menubar -(menu-bar-mode -1) + ;; Disable Toolbar + (tool-bar-mode -1) + ;; Disable scrollbar + (scroll-bar-mode -1) + ;; Disable menubar + (menu-bar-mode -1) -;; Increase garbage collector threshold before load -(setq gc-cons-threshold 640000000) + ;; Increase garbage collector threshold before load + (setq gc-cons-threshold 640000000) -(setq debug-on-error t) + (setq debug-on-error t) -;; Use UTF-8 -(set-terminal-coding-system 'utf-8) -(set-keyboard-coding-system 'utf-8) -(prefer-coding-system 'utf-8) + ;; Use UTF-8 + (set-terminal-coding-system 'utf-8) + (set-keyboard-coding-system 'utf-8) + (prefer-coding-system 'utf-8) -;; Minimize native-comp warnings -(setq native-comp-async-report-warnings-errors nil) -(setq warning-minimum-level 'error) -''; + ;; Minimize native-comp warnings + (setq native-comp-async-report-warnings-errors nil) + (setq warning-minimum-level 'error) + ''; prelude = '' -;; Disable startup message. -(setq inhibit-startup-screen t - inhibit-startup-echo-area-message (user-login-name)) + ;; Disable startup message. + (setq inhibit-startup-screen t + inhibit-startup-echo-area-message (user-login-name)) -(setq initial-major-mode 'fundamental-mode - initial-scratch-message nil) + (setq initial-major-mode 'fundamental-mode + initial-scratch-message nil) -;; Accept 'y' and 'n' rather than 'yes' and 'no'. -(defalias 'yes-or-no-p 'y-or-n-p) + ;; Accept 'y' and 'n' rather than 'yes' and 'no'. + (defalias 'yes-or-no-p 'y-or-n-p) -;; Don't use tabs for indents -(setq indent-tabs-mode nil) + ;; Don't use tabs for indents + (setq indent-tabs-mode nil) -;; Don't warn when cannot guess python indent level -(setq python-indent-guess-indent-offset-verbose nil) + ;; Don't warn when cannot guess python indent level + (setq python-indent-guess-indent-offset-verbose nil) -;; Set indent level to 4 -(setq-default tab-width 4) + ;; Set indent level to 4 + (setq-default tab-width 4) -;; Increase emacs data read limit (default too low for LSP) -(setq read-process-output-max (* 1024 1024)) + ;; Increase emacs data read limit (default too low for LSP) + (setq read-process-output-max (* 1024 1024)) -;; Reduce wrist pain -(global-set-key (kbd "M-n") "~") -(global-set-key (kbd "M-N") "`") + ;; Reduce wrist pain + (global-set-key (kbd "M-n") "~") + (global-set-key (kbd "M-N") "`") -;; Stop creating backup and autosave files. -(setq make-backup-files nil - auto-save-default nil) + ;; Stop creating backup and autosave files. + (setq make-backup-files nil + auto-save-default nil) -;; Always show line and column number in the mode line. -(line-number-mode) -(column-number-mode) + ;; Always show line and column number in the mode line. + (line-number-mode) + (column-number-mode) -;; Use one space to end sentences. -(setq sentence-end-double-space nil) + ;; Use one space to end sentences. + (setq sentence-end-double-space nil) -;; I typically want to use UTF-8. -(prefer-coding-system 'utf-8) + ;; I typically want to use UTF-8. + (prefer-coding-system 'utf-8) -;; Enable highlighting of current line. -(global-hl-line-mode 1) + ;; Enable highlighting of current line. + (global-hl-line-mode 1) -(setq custom-file (locate-user-emacs-file "custom.el")) -(load custom-file) + (setq custom-file (locate-user-emacs-file "custom.el")) + (load custom-file) -;; When finding file in non-existing directory, offer to create the -;; parent directory. -(defun with-buffer-name-prompt-and-make-subdirs () - (let ((parent-directory (file-name-directory buffer-file-name))) - (when (and (not (file-exists-p parent-directory)) - (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory))) - (make-directory parent-directory t)))) + ;; When finding file in non-existing directory, offer to create the + ;; parent directory. + (defun with-buffer-name-prompt-and-make-subdirs () + (let ((parent-directory (file-name-directory buffer-file-name))) + (when (and (not (file-exists-p parent-directory)) + (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory))) + (make-directory parent-directory t)))) -(add-to-list 'find-file-not-found-functions #'with-buffer-name-prompt-and-make-subdirs) -''; + (add-to-list 'find-file-not-found-functions #'with-buffer-name-prompt-and-make-subdirs) + ''; usePackage = { dracula-theme = { enable = true; config = '' -(load-theme 'dracula t) -''; + (load-theme 'dracula t) + ''; }; }; }; diff --git a/flake.nix b/flake.nix index 5ebd2ff..3c98d75 100644 --- a/flake.nix +++ b/flake.nix @@ -11,10 +11,11 @@ nur.url = "github:nix-community/NUR"; }; - outputs = { self, nixpkgs-unstable, nixpkgs-22_11, home-manager, nur, ... }@inputs: + outputs = + { self, nixpkgs-unstable, nixpkgs-22_11, home-manager, nur, ... }@inputs: let system = "aarch64-darwin"; - + pkgs = import nixpkgs-22_11 { inherit system; overlays = [ @@ -37,15 +38,13 @@ # Specify your home configuration modules here, for example, # the path to your home.nix. - modules = [ - ./home.nix - ]; + modules = [ nur.hmModules.nur ./home.nix ]; # Optionally use extraSpecialArgs # to pass through arguments to home.nix - extraSpecialArgs = { - inherit nurNoPkgs; - }; + # extraSpecialArgs = { + # inherit nurNoPkgs; + # }; }; }; } diff --git a/home.nix b/home.nix index ad69a96..aa74f24 100644 --- a/home.nix +++ b/home.nix @@ -1,17 +1,23 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, inputs, ... }: -let - inherit (lib.systems.elaborate { system = builtins.currentSystem; }) isLinux isDarwin; - homeDirectory = config.home.homeDirectory; +let homeDirectory = config.home.homeDirectory; in { imports = [ - ./emacs.nix + #./emacs.nix ./packages.nix ./programs.nix ]; nixpkgs.config = { allowUnfree = true; + allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ "discord" "unrar" ]; + }; + + home = { + username = "willem"; + homeDirectory = "/Users/willem"; + stateVersion = "22.11"; }; home.language = { @@ -25,7 +31,5 @@ in { variant = "colemak"; }; - home.sessionVariables = { - EDITOR = "emacs"; - }; + home.sessionVariables = { EDITOR = "emacs"; }; } diff --git a/packages.nix b/packages.nix index c530d73..00ce9fc 100644 --- a/packages.nix +++ b/packages.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, isDarwin, ... }: +{ config, lib, pkgs, ... }: let comma = (import (pkgs.fetchFromGitHub { @@ -6,77 +6,41 @@ let repo = "comma"; rev = "v1.4.0"; sha256 = "02zh0zn0yibbgn26r0idcsv8nl7pxlnq545qas0fzj5l70hdgyhh"; - })).default; - - rnix-lsp = (import (pkgs.fetchFromGitHub { - owner = "nix-community"; - repo = "rnix-lsp"; - rev = "95d40673fe43642e2e1144341e86d0036abd95d9"; - sha256 = "197s5qi0yqxl84axziq3pcpf5qa9za82siv3ap6v3rcjmndk8jqp"; })); - - darwinPackages = with pkgs; [ - coreutils - gnused - spoof-mac - colima - pinentry_mac - iterm2 - ]; - - guiPackages = with pkgs; [ - discord - ]; - - dockerPackages = with pkgs; [ - unstable.docker - docker-compose - ]; - - editingPackages = with pkgs; [ - black - shellcheck - plantuml - rnix-lsp - clang-tools - graphviz - nixfmt - texlive.combined.scheme-full - ]; - - nodePackages = with pkgs.nodePackages; [ - bash-language-server - ]; - - sharedPackages = with pkgs; [ - zsh-powerlevel10k - comma - automake - autoconf - cmake - bash - rustup - curl - pv - wget - htop - bat - fd - ripgrep - jq - nmap - unzip - rsync - openssh - tldr - (import ./python-packages.nix { inherit pkgs; }) - ]; -in -{ - home.packages = sharedPackages -++ (lib.optionals isDarwin darwinPackages) -++ guiPackages -++ editingPackages -++ nodePackages -++ dockerPackages ; +in { + home.packages = with pkgs; + [ coreutils gnused spoof-mac colima pinentry_mac iterm2 ] ++ [ discord ] + ++ [ docker docker-compose ] ++ [ + black + shellcheck + plantuml + clang-tools + graphviz + nixfmt + texlive.combined.scheme-full + ] ++ [ nodePackages.bash-language-server ] ++ [ + zsh-powerlevel10k + comma + automake + autoconf + cmake + bash + rustup + curl + pv + wget + htop + bat + fd + ripgrep + jq + nmap + unzip + unp + unrar + rsync + openssh + tldr + (import ./python-packages.nix { inherit pkgs; }) + ]; } diff --git a/programs.nix b/programs.nix index 7418dc8..9168b0e 100644 --- a/programs.nix +++ b/programs.nix @@ -2,90 +2,87 @@ { programs = { - direnv = { - enable = true; - nix-direnv = { + direnv = { enable = true; + nix-direnv = { enable = true; }; }; - }; - - gpg = { - enable = true; - settings = { - use-agent = true; - default-key = "860B5C62BF1FCE4272D26BF8C3DE5DF6198DACBD"; - }; - }; - java = { - enable = true; - package = pkgs.jdk; - }; - - git = { - enable = true; - delta = { + gpg = { enable = true; + settings = { + use-agent = true; + default-key = "860B5C62BF1FCE4272D26BF8C3DE5DF6198DACBD"; + }; }; - signing = { - key = "C3DE5DF6198DACBD"; - signByDefault = true; - }; - extraConfig.init.defaultBranch = "master"; - extraConfig.core.autocrlf = false; - package = pkgs.gitAndTools.gitFull; - userName = "willemml"; - userEmail = "willem@leit.so"; - }; - zoxide = { - enable = true; - enableZshIntegration = true; - }; + java = { + enable = true; + package = pkgs.jdk; + }; - exa = { - enable = true; - enableAliases = true; - }; + git = { + enable = true; + delta = { enable = true; }; + signing = { + key = "C3DE5DF6198DACBD"; + signByDefault = true; + }; + extraConfig.init.defaultBranch = "master"; + extraConfig.core.autocrlf = false; + package = pkgs.gitAndTools.gitFull; + userName = "willemml"; + userEmail = "willem@leit.so"; + }; - zsh = { - enable = true; - enableCompletion = true; - enableSyntaxHighlighting = true; - enableVteIntegration = true; - autocd = true; - defaultKeymap = "emacs"; - envExtra = "export PATH=${pkgs.pinentry_mac.out}/Applications/pinentry-mac.app/Contents/MacOS:$PATH"; - dirHashes = { - docs = "$HOME/Documents"; - appsup = "$HOME/Library/Application Support"; - dls = "$HOME/Downloads"; - ubc = "$HOME/Documents/school/ubc"; + zoxide = { + enable = true; + enableZshIntegration = true; }; - dotDir = ".config/zsh"; - history = { - path = "$HOME/.local/zsh/history"; - extended = true; - ignoreDups = true; + + exa = { + enable = true; + enableAliases = true; }; - shellAliases = { - em = "emacsclient -c"; - emt = "emacsclient -c -nw"; - np = "nix-shell -p"; - hms = "home-manager switch"; + + zsh = { + enable = true; + enableCompletion = true; + enableSyntaxHighlighting = true; + enableVteIntegration = true; + autocd = true; + defaultKeymap = "emacs"; + envExtra = + "export PATH=${pkgs.pinentry_mac.out}/Applications/pinentry-mac.app/Contents/MacOS:$PATH"; + dirHashes = { + docs = "$HOME/Documents"; + appsup = "$HOME/Library/Application Support"; + dls = "$HOME/Downloads"; + ubc = "$HOME/Documents/school/ubc"; + }; + dotDir = ".config/zsh"; + history = { + path = "$HOME/.local/zsh/history"; + extended = true; + ignoreDups = true; + }; + shellAliases = { + em = "emacsclient -c"; + emt = "emacsclient -c -nw"; + np = "nix-shell -p"; + hms = "home-manager switch"; + }; + plugins = with pkgs; [ + { + name = "powerlevel10k"; + src = pkgs.zsh-powerlevel10k; + file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + } + { + name = "powerlevel10k-config"; + src = lib.cleanSource ./p10k-config; + file = "p10k.zsh"; + } + ]; }; - plugins = with pkgs; [ - { - name = "powerlevel10k"; - src = pkgs.zsh-powerlevel10k; - file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; - } - { - name = "powerlevel10k-config"; - src = lib.cleanSource ./p10k-config; - file = "p10k.zsh"; - } - ]; - }; }; } diff --git a/python-packages.nix b/python-packages.nix index c78374f..36b2be7 100644 --- a/python-packages.nix +++ b/python-packages.nix @@ -1,6 +1,3 @@ { pkgs }: -pkgs.python310.withPackages(p: with p; [ - matplotlib - latexify-py -]) +pkgs.python310.withPackages (p: with p; [ matplotlib latexify-py ])