From 7927990d2f3a03bcda96c6c6d177d686e4f04607 Mon Sep 17 00:00:00 2001 From: Dave Gallant Date: Sat, 16 Jan 2021 01:08:31 -0500 Subject: [PATCH] nixfmt *.nix --- README.md | 8 ++-- nix/home.nix | 77 ++++++++++++++++++--------------------- nix/overlays/default.nix | 1 - nix/overlays/lastpass.nix | 65 ++++++++++++++++----------------- nix/overlays/rfd.nix | 72 ++++++++++++++++++------------------ nix/overlays/vpngate.nix | 37 ++++++++++--------- nix/packages.nix | 6 ++- 7 files changed, 131 insertions(+), 135 deletions(-) diff --git a/README.md b/README.md index f02f7c2..22f5a06 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# config +# nix-config [![built with nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org) -This repo stores nix expressions and other configuration. +This repo stores nix expressions to manage my machines. ## Setup @@ -11,7 +11,7 @@ This repo stores nix expressions and other configuration. Clone this as a bare repo to avoid the need for symlinking: ```console -$ git clone --bare git@github.com:davegallant/config.git $HOME/.dotfiles +$ git clone --bare git@github.com:davegallant/nix-config.git $HOME/.dotfiles $ alias config='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' # add alias to a .bashrc / .zshrc $ config config --local status.showUntrackedFiles no $ config checkout -f # this will overwrite any existing configs in the home directory @@ -22,5 +22,5 @@ $ config checkout -f # this will overwrite any existing configs in the home dire Install [nix](https://nixos.org/guides/install-nix.html) and [home-manager](https://github.com/nix-community/home-manager). ```console -$ home-manager -f ~/nix/home.nix switch +$ home-manager -f ~/nix/home.nix switch ``` diff --git a/nix/home.nix b/nix/home.nix index 6781fe9..e893c86 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -5,9 +5,7 @@ nixpkgs.config.allowUnfree = true; home = { - sessionVariables = { - EDITOR = "vim"; - }; + sessionVariables = { EDITOR = "vim"; }; packages = import ./packages.nix { inherit pkgs; }; }; @@ -17,9 +15,6 @@ defaultCacheTtl = 3600; defaultCacheTtlSsh = 3600; enableSshSupport = true; - extraConfig = '' - pinentry-program ${pkgs.pinentry-curses}/bin/pinentry - ''; }; }; @@ -39,10 +34,11 @@ ''; }; - git = { enable = true; + userName = "Dave Gallant"; + aliases = { "aa" = "add -A ."; "br" = "branch"; @@ -59,18 +55,18 @@ "dic" = "diff --cached"; "dicn" = "diff --cached --name-only"; "din" = "diff --name-only"; - "l" = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"; + "l" = + "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"; "ms" = "merge --squash"; "pb" = "pull --rebase"; "po" = "push origin"; "por" = "push origin HEAD:refs/for/$1"; "st" = "status"; - "wip" = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads"; + "wip" = + "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads"; }; - includes = [ - { path = "~/.gitconfig-work"; } - ]; + includes = [{ path = "~/.gitconfig-work"; }]; delta = { enable = true; @@ -100,15 +96,11 @@ settings = { add_newline = false; - gcloud = { - disabled = true; - }; + gcloud = { disabled = true; }; scan_timeout = 10; - character = { - error_symbol = "[✖](bold red)"; - }; + character = { error_symbol = "[✖](bold red)"; }; - time = { + time = { time_format = "%T"; format = "$time($style) "; style = "bright-white"; @@ -130,16 +122,17 @@ }; initExtra = '' - export GPG_TTY=$(tty) export PATH=$PATH:~/.cargo/bin export PATH=$PATH:~/.local/bin export PATH=$PATH:~/.npm-packages/bin export PATH=$PATH:~/go/bin - export CM_LAUNCHER=rofi + export LANG=en_US.UTF-8 + eval "$(direnv hook zsh)" eval "$(_RFD_COMPLETE=source_zsh rfd)" eval "$(jira --completion-script-zsh)" + setopt noincappendhistory pfetch ''; @@ -154,19 +147,13 @@ "oh-my-zsh" = { enable = true; - plugins = [ - "fzf" - "git" - "last-working-dir" - ]; + plugins = [ "fzf" "git" "last-working-dir" ]; }; - plugins = [ - { - name = "fast-syntax-highlighting"; - src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions"; - } - ]; + plugins = [{ + name = "fast-syntax-highlighting"; + src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions"; + }]; }; alacritty = { @@ -186,12 +173,7 @@ shell = { program = "zsh"; - args = [ - "-l" - "-c" - "tmux" - "u" - ]; + args = [ "-l" "-c" "tmux" "u" ]; }; colors = { @@ -221,15 +203,26 @@ }; key_bindings = [ - { key = "Home"; mods = "Control"; action = "ResetFontSize"; } - { key = "Plus"; mods = "Control"; action = "IncreaseFontSize"; } - { key = "Minus"; mods = "Control"; action = "DecreaseFontSize"; } + { + key = "Home"; + mods = "Control"; + action = "ResetFontSize"; + } + { + key = "Plus"; + mods = "Control"; + action = "IncreaseFontSize"; + } + { + key = "Minus"; + mods = "Control"; + action = "DecreaseFontSize"; + } ]; }; }; }; - go = { enable = true; goBin = "go/bin"; diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 06ad3ff..7ceafd0 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -5,4 +5,3 @@ (import ./lastpass.nix) (import ./vpngate.nix) ] - diff --git a/nix/overlays/lastpass.nix b/nix/overlays/lastpass.nix index f955c1a..98ffc7e 100644 --- a/nix/overlays/lastpass.nix +++ b/nix/overlays/lastpass.nix @@ -1,37 +1,36 @@ -self: super: -rec { +self: super: rec { - lpass = with self; stdenv.mkDerivation rec { - pname = "lpass"; - version = "1.3.4-unreleased"; + lpass = with self; + stdenv.mkDerivation rec { + pname = "lpass"; + version = "1.3.4-unreleased"; - src = fetchFromGitHub { - owner = "lastpass"; - repo = "lastpass-cli"; - rev = "8767b5e53192ad4e72d1352db4aa9218e928cbe1"; - sha256 = "sha256:1d4m5h9byq5cccdg98m8d8457rbvp28q821d8rpglykgrfgnknwp"; + src = fetchFromGitHub { + owner = "lastpass"; + repo = "lastpass-cli"; + rev = "8767b5e53192ad4e72d1352db4aa9218e928cbe1"; + sha256 = "sha256:1d4m5h9byq5cccdg98m8d8457rbvp28q821d8rpglykgrfgnknwp"; + }; + + nativeBuildInputs = [ asciidoc cmake docbook_xsl pkgconfig ]; + + buildInputs = [ bash-completion curl openssl libxml2 libxslt ]; + + enableParallelBuilding = true; + + installTargets = [ "install" "install-doc" ]; + + postInstall = '' + install -Dm644 -T ../contrib/lpass_zsh_completion $out/share/zsh/site-functions/_lpass + install -Dm644 -T ../contrib/completions-lpass.fish $out/share/fish/vendor_completions.d/lpass.fish + ''; + + meta = with lib; { + description = + "Stores, retrieves, generates, and synchronizes passwords securely"; + homepage = "https://github.com/lastpass/lastpass-cli"; + license = licenses.gpl2Plus; + platforms = platforms.unix; + }; }; - - nativeBuildInputs = [ asciidoc cmake docbook_xsl pkgconfig ]; - - buildInputs = [ - bash-completion curl openssl libxml2 libxslt - ]; - - enableParallelBuilding = true; - - installTargets = [ "install" "install-doc" ]; - - postInstall = '' - install -Dm644 -T ../contrib/lpass_zsh_completion $out/share/zsh/site-functions/_lpass - install -Dm644 -T ../contrib/completions-lpass.fish $out/share/fish/vendor_completions.d/lpass.fish - ''; - - meta = with lib; { - description = "Stores, retrieves, generates, and synchronizes passwords securely"; - homepage = "https://github.com/lastpass/lastpass-cli"; - license = licenses.gpl2Plus; - platforms = platforms.unix; - }; - }; } diff --git a/nix/overlays/rfd.nix b/nix/overlays/rfd.nix index 6358b63..7bb38b0 100644 --- a/nix/overlays/rfd.nix +++ b/nix/overlays/rfd.nix @@ -1,44 +1,44 @@ -self: super: -rec { +self: super: rec { python38 = with super; super.python38.override { }; pythonPackages = python38.pkgs; - rfd = with self; pythonPackages.buildPythonApplication rec { - pname = "rfd"; - version = "v0.6.0"; + rfd = with self; + pythonPackages.buildPythonApplication rec { + pname = "rfd"; + version = "v0.6.0"; - src = fetchFromGitHub { - owner = "davegallant"; - repo = "rfd"; - rev = version; - hash = "sha256:0cllhbca4dykl6j8snmml4kk6kzamlzhcrdf49f5v0zk7zljgkl1"; + src = fetchFromGitHub { + owner = "davegallant"; + repo = "rfd"; + rev = version; + hash = "sha256:0cllhbca4dykl6j8snmml4kk6kzamlzhcrdf49f5v0zk7zljgkl1"; + }; + + postPatch = '' + substituteInPlace requirements.txt --replace "soupsieve<=2.0" "soupsieve" + substituteInPlace requirements.txt --replace "beautifulsoup4<=4.8.2" "beautifulsoup4" + ''; + + # No tests included + doCheck = false; + + propagatedBuildInputs = with pythonPackages; [ + beautifulsoup4 + click + colorama + requests + soupsieve + ]; + + passthru.python3 = python3; + + meta = with super.lib; { + homepage = "https://www.redflagdeals.com/"; + description = "View RedFlagDeals from the command line"; + license = licenses.asl20; + maintainers = [ ]; + }; }; - - postPatch = '' - substituteInPlace requirements.txt --replace "soupsieve<=2.0" "soupsieve" - substituteInPlace requirements.txt --replace "beautifulsoup4<=4.8.2" "beautifulsoup4" - ''; - - # No tests included - doCheck = false; - - propagatedBuildInputs = with pythonPackages; [ - beautifulsoup4 - click - colorama - requests - soupsieve - ]; - - passthru.python3 = python3; - - meta = with super.lib; { - homepage = "https://www.redflagdeals.com/"; - description = "View RedFlagDeals from the command line"; - license = licenses.asl20; - maintainers = [ ]; - }; - }; } diff --git a/nix/overlays/vpngate.nix b/nix/overlays/vpngate.nix index 8df97cd..6e17ad9 100644 --- a/nix/overlays/vpngate.nix +++ b/nix/overlays/vpngate.nix @@ -2,25 +2,26 @@ self: super: rec { - vpngate = with self; buildGoModule rec { - pname = "vpngate"; - version = "v0.0.2"; + vpngate = with self; + buildGoModule rec { + pname = "vpngate"; + version = "v0.0.2"; - vendorSha256 = "1ys2rvrbxgsrvmjdxqgpmxf0m9nlp905gnr2mrf3c7iaxm86wgf8"; + vendorSha256 = "1ys2rvrbxgsrvmjdxqgpmxf0m9nlp905gnr2mrf3c7iaxm86wgf8"; - src = fetchFromGitHub { - owner = "davegallant"; - repo = "vpngate"; - rev = version; - sha256 = "0ky3wd04xd4sb2zskrrlbgys2gw88yqhngg3bl0sjy8kr6099vfn"; + src = fetchFromGitHub { + owner = "davegallant"; + repo = "vpngate"; + rev = version; + sha256 = "0ky3wd04xd4sb2zskrrlbgys2gw88yqhngg3bl0sjy8kr6099vfn"; + }; + + meta = with super.lib; { + homepage = "https://www.vpngate.net"; + description = "a client for vpngate.net"; + license = licenses.asl20; + maintainers = with maintainers; [ davegallant ]; + platforms = platforms.linux ++ platforms.darwin; + }; }; - - meta = with super.lib; { - homepage = "https://www.vpngate.net"; - description = "a client for vpngate.net"; - license = licenses.asl20; - maintainers = with maintainers; [ davegallant ]; - platforms = platforms.linux ++ platforms.darwin; - }; - }; } diff --git a/nix/packages.nix b/nix/packages.nix index 3a9c8fc..0aebb8a 100644 --- a/nix/packages.nix +++ b/nix/packages.nix @@ -5,6 +5,7 @@ with pkgs; [ # utils bat bind + binutils-unwrapped colordiff curl direnv @@ -85,6 +86,8 @@ with pkgs; [ kubernetes-helm # nix + nix-index + nixfmt nixpkgs-fmt nixpkgs-review rnix-lsp @@ -144,7 +147,8 @@ with pkgs; [ zathura # overlays - rfd lpass + rfd vpngate + ]