From e75df1a6699dd2ac02d0e1685c3cb2f7c1f16e4f Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Fri, 26 Jul 2019 09:50:42 -0500 Subject: [PATCH] install nixfmt and format this project with it --- darwin/default.nix | 8 +--- darwin/lorri.nix | 12 ++--- dotfiles/default.nix | 15 +++--- dotfiles/emacs.nix | 110 ++++++++++--------------------------------- dotfiles/git.nix | 2 +- dotfiles/neovim.nix | 4 +- dotfiles/zsh.nix | 3 +- pkgs/lorri.nix | 16 +++---- 8 files changed, 45 insertions(+), 125 deletions(-) diff --git a/darwin/default.nix b/darwin/default.nix index d21c766..fb5ac9e 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -1,15 +1,11 @@ { config, pkgs, ... }: { - imports = [ - ../home-manager/nix-darwin - ./lorri.nix - ./defaults.nix - ]; + imports = [ ../home-manager/nix-darwin ./lorri.nix ./defaults.nix ]; # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget - environment.systemPackages = []; + environment.systemPackages = [ ]; # Use a custom configuration.nix location. # $ darwin-rebuild switch -I darwin-config=$HOME/.dotfiles/darwin/default.nix diff --git a/darwin/lorri.nix b/darwin/lorri.nix index e06431d..1d5ccab 100644 --- a/darwin/lorri.nix +++ b/darwin/lorri.nix @@ -1,17 +1,11 @@ { pkgs, ... }: -let - lorri = pkgs.callPackage ../pkgs/lorri.nix {}; -in -{ +let lorri = pkgs.callPackage ../pkgs/lorri.nix { }; +in { launchd.user.agents.lorri = { command = "lorri daemon"; - path = [ - lorri - pkgs.nix - pkgs.gnutar - ]; + path = [ lorri pkgs.nix pkgs.gnutar ]; serviceConfig = { StandardErrorPath = "/usr/local/var/log/lorri.err.log"; diff --git a/dotfiles/default.nix b/dotfiles/default.nix index 4ba7d8d..ac19a8b 100644 --- a/dotfiles/default.nix +++ b/dotfiles/default.nix @@ -1,15 +1,7 @@ { pkgs, ... }: { - imports = [ - ./direnv.nix - ./emacs.nix - ./fzf.nix - ./git.nix - ./neovim.nix - ./ssh.nix - ./zsh.nix - ]; + imports = [ ./direnv.nix ./emacs.nix ./fzf.nix ./git.nix ./neovim.nix ./ssh.nix ./zsh.nix ]; home.packages = [ pkgs.ag @@ -23,6 +15,11 @@ # https://github.com/jwoudenberg/dotfiles/commit/12bd31b269b82f0dc661140b8df275ef24f41b81) # but I don't want to have to symlink into the overlays directory manually. (pkgs.callPackage ../pkgs/lorri.nix { }) + + # remote packages. Probably could do this better (or use various cachix + # implementations) but I don't really want to. + (import (fetchTarball "https://github.com/serokell/nixfmt/archive/e4f31f45799554ff378370256a24f606a3025b0a.tar.gz") + { }) ]; programs.man.enable = true; diff --git a/dotfiles/emacs.nix b/dotfiles/emacs.nix index 6b7d976..50c5905 100644 --- a/dotfiles/emacs.nix +++ b/dotfiles/emacs.nix @@ -9,11 +9,7 @@ let configs = [ { file = ./emacs/init.el; - pkgs = epkgs: [ - epkgs.general - epkgs.delight - epkgs.use-package - ]; + pkgs = epkgs: [ epkgs.general epkgs.delight epkgs.use-package ]; } { file = ./emacs/evil.el; @@ -22,9 +18,9 @@ let # fail to build. We'll patch it out for now and hope it gets fixed in a # future version. (epkgs.evil-escape.overrideAttrs (attrs: { - patches = (attrs.patches or []) ++ [ + patches = (attrs.patches or [ ]) ++ [ (pkgs.fetchpatch { - url = https://github.com/BrianHicks/evil-escape/commit/b548e8450570a0c8dea47b47221b728c047a9baf.patch; + url = "https://github.com/BrianHicks/evil-escape/commit/b548e8450570a0c8dea47b47221b728c047a9baf.patch"; sha256 = "1a2qrf4bpj7wm84qa3haqdg3pd9d8nh5vrj8v1sc0j1a9jifsbf6"; }) ]; @@ -41,24 +37,15 @@ let } { file = ./emacs/basics.el; - pkgs = epkgs: [ - epkgs.bug-hunter - epkgs.shackle - epkgs.smartparens - epkgs.which-key - epkgs.exec-path-from-shell - ]; + pkgs = epkgs: [ epkgs.bug-hunter epkgs.shackle epkgs.smartparens epkgs.which-key epkgs.exec-path-from-shell ]; } { file = ./emacs/compilation.el; - pkgs = epkgs: []; + pkgs = epkgs: [ ]; } { file = ./emacs/completion.el; - pkgs = epkgs: [ - epkgs.company - epkgs.company-statistics - ]; + pkgs = epkgs: [ epkgs.company epkgs.company-statistics ]; } { file = ./emacs/diffing.el; @@ -70,17 +57,11 @@ let } { file = ./emacs/display.el; - pkgs = epkgs: [ - epkgs.airline-themes - epkgs.doom-themes - epkgs.hl-todo - epkgs.powerline - epkgs.solaire-mode - ]; + pkgs = epkgs: [ epkgs.airline-themes epkgs.doom-themes epkgs.hl-todo epkgs.powerline epkgs.solaire-mode ]; } { file = ./emacs/eshell-config.el; - pkgs = epkgs: []; + pkgs = epkgs: [ ]; } { file = ./emacs/folding.el; @@ -88,17 +69,11 @@ let } { file = ./emacs/git.el; - pkgs = epkgs: [ - epkgs.evil-magit - epkgs.magit - ]; + pkgs = epkgs: [ epkgs.evil-magit epkgs.magit ]; } { file = ./emacs/helm-config.el; - pkgs = epkgs: [ - epkgs.helm - epkgs.helm-ag - ]; + pkgs = epkgs: [ epkgs.helm epkgs.helm-ag ]; } { file = ./emacs/icons.el; @@ -106,26 +81,15 @@ let } { file = ./emacs/jumping.el; - pkgs = epkgs: [ - epkgs.ace-window - epkgs.avy - ]; + pkgs = epkgs: [ epkgs.ace-window epkgs.avy ]; } { file = ./emacs/linting.el; - pkgs = epkgs: [ - epkgs.flycheck - epkgs.flycheck-status-emoji - epkgs.flycheck-color-mode-line - ]; + pkgs = epkgs: [ epkgs.flycheck epkgs.flycheck-status-emoji epkgs.flycheck-color-mode-line ]; } { file = ./emacs/projects.el; - pkgs = epkgs: [ - epkgs.ag - epkgs.helm-projectile - epkgs.projectile - ]; + pkgs = epkgs: [ epkgs.ag epkgs.helm-projectile epkgs.projectile ]; } { file = ./emacs/snippets.el; @@ -147,10 +111,7 @@ let } { file = ./emacs/lang/dockerfile.el; - pkgs = epkgs: [ - epkgs.alchemist - epkgs.elixir-mode - ]; + pkgs = epkgs: [ epkgs.alchemist epkgs.elixir-mode ]; } { file = ./emacs/lang/elm.el; @@ -181,19 +142,11 @@ let } { file = ./emacs/lang/haskell.el; - pkgs = epkgs: [ - epkgs.haskell-mode - epkgs.hindent - epkgs.hlint-refactor - epkgs.intero - ]; + pkgs = epkgs: [ epkgs.haskell-mode epkgs.hindent epkgs.hlint-refactor epkgs.intero ]; } { file = ./emacs/lang/html.el; - pkgs = epkgs: [ - epkgs.emmet-mode - epkgs.web-mode - ]; + pkgs = epkgs: [ epkgs.emmet-mode epkgs.web-mode ]; } { file = ./emacs/lang/haml.el; @@ -201,10 +154,7 @@ let } { file = ./emacs/lang/javascript.el; - pkgs = epkgs: [ - epkgs.js2-mode - epkgs.prettier-js - ]; + pkgs = epkgs: [ epkgs.js2-mode epkgs.prettier-js ]; } { file = ./emacs/lang/json.el; @@ -212,10 +162,7 @@ let } { file = ./emacs/lang/markdown.el; - pkgs = epkgs: [ - epkgs.markdown-mode - epkgs.markdown-toc - ]; + pkgs = epkgs: [ epkgs.markdown-mode epkgs.markdown-toc ]; } { file = ./emacs/lang/nix.el; @@ -223,7 +170,7 @@ let } { file = ./emacs/lang/org-mode-config.el; - pkgs = epkgs: []; + pkgs = epkgs: [ ]; } { file = ./emacs/lang/ruby.el; @@ -244,10 +191,7 @@ let } { file = ./emacs/lang/terraform.el; - pkgs = epkgs: [ - epkgs.hcl-mode - epkgs.terraform-mode - ]; + pkgs = epkgs: [ epkgs.hcl-mode epkgs.terraform-mode ]; } { file = ./emacs/lang/toml.el; @@ -259,18 +203,12 @@ let } ]; - extraSystemPackages = [ - pkgs.ag - pkgs.ispell - pkgs.shellcheck - ]; + extraSystemPackages = [ pkgs.ag pkgs.ispell pkgs.shellcheck ]; - extraConfig = - '' - (setq yas-snippet-dirs '("${./emacs-snippets}")) + extraConfig = '' + (setq yas-snippet-dirs '("${./emacs-snippets}")) ''; -in -{ +in { programs.emacs.enable = true; programs.emacs.package = pkgs.emacsMacport; programs.emacs.extraPackages = epkgs: builtins.concatMap (config: config.pkgs epkgs) configs ++ extraSystemPackages; diff --git a/dotfiles/git.nix b/dotfiles/git.nix index 2c1c72d..c06d113 100644 --- a/dotfiles/git.nix +++ b/dotfiles/git.nix @@ -14,7 +14,7 @@ co = "checkout"; dc = "diff --cached"; di = "diff"; - gclone = "!\"gclone() { mkdir -p ~/code/$1; git clone git@github.com:$1.git ~/code/$1; }; gclone\""; + gclone = ''!"gclone() { mkdir -p ~/code/$1; git clone git@github.com:$1.git ~/code/$1; }; gclone"''; publish = "!git push -u origin $(git rev-parse --abbrev-ref HEAD)"; st = "status"; }; diff --git a/dotfiles/neovim.nix b/dotfiles/neovim.nix index eecce94..3738736 100644 --- a/dotfiles/neovim.nix +++ b/dotfiles/neovim.nix @@ -17,9 +17,7 @@ # TODO: does this have to be called myVimPackage? Why? Seems to be in # `pkgs.wrapNeovim` - packages.myVimPackage = with pkgs.vimPlugins; { - start = [ vim-surround ]; - }; + packages.myVimPackage = with pkgs.vimPlugins; { start = [ vim-surround ]; }; }; }; } diff --git a/dotfiles/zsh.nix b/dotfiles/zsh.nix index 335fb59..0ac35f1 100644 --- a/dotfiles/zsh.nix +++ b/dotfiles/zsh.nix @@ -14,8 +14,7 @@ let ]; extraInitExtra = builtins.foldl' (soFar: new: soFar + "\n" + builtins.readFile new) "" extras; -in -{ +in { programs.zsh = { enable = true; diff --git a/pkgs/lorri.nix b/pkgs/lorri.nix index 79d4d71..67ffc1f 100644 --- a/pkgs/lorri.nix +++ b/pkgs/lorri.nix @@ -1,12 +1,10 @@ { pkgs }: let - src = - pkgs.fetchFromGitHub { - owner = "target"; - repo = "lorri"; - rev = "d3e452ebc2b24ab86aec18af44c8217b2e469b2a"; - sha256 = "07yf3gl9sixh7acxayq4q8h7z4q8a66412z0r49sr69yxb7b4q89"; - }; -in - pkgs.callPackage src { inherit src; } + src = pkgs.fetchFromGitHub { + owner = "target"; + repo = "lorri"; + rev = "d3e452ebc2b24ab86aec18af44c8217b2e469b2a"; + sha256 = "07yf3gl9sixh7acxayq4q8h7z4q8a66412z0r49sr69yxb7b4q89"; + }; +in pkgs.callPackage src { inherit src; }