diff options
Diffstat (limited to 'nix-conf')
24 files changed, 397 insertions, 236 deletions
diff --git a/nix-conf/home/djmuk1.nix b/nix-conf/home/djmuk1.nix index 6ca3473..d11499e 100644 --- a/nix-conf/home/djmuk1.nix +++ b/nix-conf/home/djmuk1.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ imports = [ ./includes/linux-server.nix ]; # Let Home Manager install and manage itself. diff --git a/nix-conf/home/djmuk2.nix b/nix-conf/home/djmuk2.nix index 250f564..576ed39 100644 --- a/nix-conf/home/djmuk2.nix +++ b/nix-conf/home/djmuk2.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ imports = [ ./includes/linux-server.nix ]; # Let Home Manager install and manage itself. diff --git a/nix-conf/home/edrahil.nix b/nix-conf/home/edrahil.nix index 4e654e3..9b7f2fb 100644 --- a/nix-conf/home/edrahil.nix +++ b/nix-conf/home/edrahil.nix @@ -1,5 +1,9 @@ -{ config, pkgs, ... }: { - imports = [ ./includes/linux-server.nix ./includes/irssi.nix ]; +{ config, pkgs, ... }: +{ + imports = [ + ./includes/linux-server.nix + ./includes/irssi.nix + ]; # Let Home Manager install and manage itself. programs.home-manager.enable = true; @@ -9,7 +13,9 @@ home.username = "djm"; home.homeDirectory = "/home/djm"; - home.sessionVariables = { TMUX_AUTO_ATTACH = 1; }; + home.sessionVariables = { + TMUX_AUTO_ATTACH = 1; + }; # This value determines the Home Manager release that your # configuration is compatible with. This helps avoid breakage diff --git a/nix-conf/home/egalmoth.nix b/nix-conf/home/egalmoth.nix index e680ee3..79d29d0 100644 --- a/nix-conf/home/egalmoth.nix +++ b/nix-conf/home/egalmoth.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ imports = [ ./includes/linux-dev.nix ]; # Let Home Manager install and manage itself. diff --git a/nix-conf/home/includes/clojure.nix b/nix-conf/home/includes/clojure.nix index e362fd0..85bd261 100644 --- a/nix-conf/home/includes/clojure.nix +++ b/nix-conf/home/includes/clojure.nix @@ -1,8 +1,23 @@ -{ config, pkgs, lib, ... }: -let inherit (lib) optionals; -in { - home.packages = with pkgs; - [ babashka clj-kondo clojure clojure-lsp jet maven neil ] +{ + config, + pkgs, + lib, + ... +}: +let + inherit (lib) optionals; +in +{ + home.packages = + with pkgs; + [ + babashka + clj-kondo + clojure + clojure-lsp + jet + maven + neil + ] ++ optionals stdenv.isLinux [ leiningen ]; } - diff --git a/nix-conf/home/includes/common.nix b/nix-conf/home/includes/common.nix index 9ae2151..68fc9e1 100644 --- a/nix-conf/home/includes/common.nix +++ b/nix-conf/home/includes/common.nix @@ -1,16 +1,22 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - hcr = - pkgs.callPackage ./scripts/hm-changes-report.nix { inherit config pkgs; }; - scr = pkgs.callPackage ./scripts/system-changes-report.nix { - inherit config pkgs; - }; + hcr = pkgs.callPackage ./scripts/hm-changes-report.nix { inherit config pkgs; }; + scr = pkgs.callPackage ./scripts/system-changes-report.nix { inherit config pkgs; }; unstable = import <unstable> { }; -in { - imports = [ ./zsh.nix <sops-nix/modules/home-manager/sops.nix> ]; +in +{ + imports = [ + ./zsh.nix + <sops-nix/modules/home-manager/sops.nix> + ]; - nixpkgs.config.allowUnfreePredicate = pkg: - builtins.elem (lib.getName pkg) [ "aspell-dict-en-science" ]; + nixpkgs.config.allowUnfreePredicate = + pkg: builtins.elem (lib.getName pkg) [ "aspell-dict-en-science" ]; sops = { age.keyFile = "${config.xdg.configHome}/sops/age/keys.txt"; @@ -90,13 +96,21 @@ in { config = { style = "full"; pager = "less -RXF"; - map-syntax = [ ".ignore:.gitignore" "*.jenkinsfile:Groovy" ]; + map-syntax = [ + ".ignore:.gitignore" + "*.jenkinsfile:Groovy" + ]; }; }; nix = { package = pkgs.nix; - settings = { extra-experimental-features = [ "nix-command" "flakes" ]; }; + settings = { + extra-experimental-features = [ + "nix-command" + "flakes" + ]; + }; }; programs.gpg.enable = true; @@ -155,8 +169,10 @@ in { UseKeychain yes User djm ''; - includes = - [ "~/.ssh/config_local" config.sops.secrets."ssh_config/oci".path ]; + includes = [ + "~/.ssh/config_local" + config.sops.secrets."ssh_config/oci".path + ]; matchBlocks = { "djm.ovh" = { hostname = "v.djm.ovh"; @@ -183,10 +199,18 @@ in { hostname = "ssh.blinkenshell.org"; port = 2222; }; - "hashbang" = { hostname = "de1.hashbang.sh"; }; - "tilde.institute" = { hostname = "tilde.institute"; }; - "tilde.team" = { hostname = "tilde.team"; }; - "ctrl-c.club" = { hostname = "ctrl-c.club"; }; + "hashbang" = { + hostname = "de1.hashbang.sh"; + }; + "tilde.institute" = { + hostname = "tilde.institute"; + }; + "tilde.team" = { + hostname = "tilde.team"; + }; + "ctrl-c.club" = { + hostname = "ctrl-c.club"; + }; "github.com" = { hostname = "github.com"; user = "git"; @@ -199,18 +223,14 @@ in { programs.git = { enable = true; userName = "David Morgan"; - includes = - [{ path = config.sops.secrets."git_email_config/default".path; }]; + includes = [ { path = config.sops.secrets."git_email_config/default".path; } ]; aliases = { # difftastic - logt = - "!sh -c 'GIT_EXTERNAL_DIFF=\"difft --background=dark\" git log -p --ext-diff'"; - showt = - "!show() { GIT_EXTERNAL_DIFF=difft git show \${1} --ext-diff; }; show"; + logt = "!sh -c 'GIT_EXTERNAL_DIFF=\"difft --background=dark\" git log -p --ext-diff'"; + showt = "!show() { GIT_EXTERNAL_DIFF=difft git show \${1} --ext-diff; }; show"; difft = "difftool"; # "raw" output - rlog = - "!git -c delta.raw=true -c core.pager=${pkgs.less}/bin/less log"; # usually used with -p + rlog = "!git -c delta.raw=true -c core.pager=${pkgs.less}/bin/less log"; # usually used with -p rshow = "!git -c delta.raw=true -c core.pager=${pkgs.less}/bin/less show"; rdiff = "!git -c delta.raw=true -c core.pager=${pkgs.less}/bin/less diff"; # copiable output (without line numbers or +/- indicators) @@ -218,8 +238,7 @@ in { cshow = "!git -c delta.line-numbers=false show"; cdiff = "!git -c delta.line-numbers=false diff"; # diff-so-fancy - flog = '' - !git -c core.pager="diff-so-fancy | less" log''; # usually used with -p + flog = ''!git -c core.pager="diff-so-fancy | less" log''; # usually used with -p fshow = ''!git -c core.pager="diff-so-fancy | less" show''; fdiff = ''!git -c core.pager="diff-so-fancy | less" diff''; @@ -227,25 +246,36 @@ in { update-master = "!git fetch origin master:master"; update-main = "!git fetch origin main:main"; }; - attributes = [ "*.el diff=elisp" "*.clj diff=clojure" ]; + attributes = [ + "*.el diff=elisp" + "*.clj diff=clojure" + ]; extraConfig = { core.editor = "vim"; diff = { tool = "difftastic"; colorMoved = "default"; - elisp = { xfuncname = "^\\((((def\\S+)|use-package)\\s+\\S+)"; }; - clojure = { xfuncname = "^\\((def\\S+\\s+\\S+)"; }; + elisp = { + xfuncname = "^\\((((def\\S+)|use-package)\\s+\\S+)"; + }; + clojure = { + xfuncname = "^\\((def\\S+\\s+\\S+)"; + }; }; difftool = { prompt = false; - difftastic = { cmd = ''difft "$LOCAL" "$REMOTE"''; }; + difftastic = { + cmd = ''difft "$LOCAL" "$REMOTE"''; + }; }; pull = { ff = "only"; rebase = false; }; push.autoSetupRemote = true; - rebase = { autostash = true; }; + rebase = { + autostash = true; + }; }; delta = { enable = true; @@ -273,4 +303,3 @@ in { }; }; } - diff --git a/nix-conf/home/includes/darwin.nix b/nix-conf/home/includes/darwin.nix index 4001348..7372d66 100644 --- a/nix-conf/home/includes/darwin.nix +++ b/nix-conf/home/includes/darwin.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; let @@ -21,7 +26,8 @@ let --prefix PYTHONPATH : $out/${pkgs.mopidyPackages.python.sitePackages} ''; }; -in { +in +{ imports = [ ./dev-common.nix ]; home.packages = with pkgs; [ @@ -30,8 +36,10 @@ in { coreutils curl diffutils - ((emacsPackagesFor emacs29-macport).emacsWithPackages - (ps: [ ps.vterm ps.multi-vterm ])) + ((emacsPackagesFor emacs29-macport).emacsWithPackages (ps: [ + ps.vterm + ps.multi-vterm + ])) findutils gh gh-dash @@ -62,4 +70,3 @@ in { keep-derivations = true; }; } - diff --git a/nix-conf/home/includes/dev-common.nix b/nix-conf/home/includes/dev-common.nix index 97fb3a6..12f4893 100644 --- a/nix-conf/home/includes/dev-common.nix +++ b/nix-conf/home/includes/dev-common.nix @@ -1,9 +1,20 @@ -{ config, pkgs, lib, ... }: -let inherit (lib) optionals; -in { - imports = [ ./common.nix ./clojure.nix ]; +{ + config, + pkgs, + lib, + ... +}: +let + inherit (lib) optionals; +in +{ + imports = [ + ./common.nix + ./clojure.nix + ]; - home.packages = with pkgs; + home.packages = + with pkgs; [ docker docker-compose @@ -11,7 +22,11 @@ in { gopass-jsonapi multimarkdown neovim - ] ++ optionals (!stdenv.isDarwin) [ ffmpeg mpv ]; + ] + ++ optionals (!stdenv.isDarwin) [ + ffmpeg + mpv + ]; programs.tmux = { enable = true; @@ -37,14 +52,8 @@ in { set -g @thumbs-unique enabled set -g @thumbs-position right set -g @thumbs-contrast 1 - #${ - lib.optionalString pkgs.stdenv.isLinux - "set -g @thumbs-upcase-command 'xargs xdg-open {}'" - } - #${ - lib.optionalString pkgs.stdenv.isDarwin - "set -g @thumbs-upcase-command 'xargs open {}'" - } + #${lib.optionalString pkgs.stdenv.isLinux "set -g @thumbs-upcase-command 'xargs xdg-open {}'"} + #${lib.optionalString pkgs.stdenv.isDarwin "set -g @thumbs-upcase-command 'xargs open {}'"} ''; } ]; @@ -61,20 +70,15 @@ in { set-option -g status-left-length 50 set-option -g status-right " %a, %b %d - %H:%M " - ${ - lib.optionalString pkgs.stdenv.isLinux '' - bind-key -T copy-mode y send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b" - bind-key C-y run "xsel -o | tmux load-buffer - ; tmux paste-buffer" - '' - } - ${ - lib.optionalString pkgs.stdenv.isDarwin '' - bind-key -T copy-mode y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" - bind-key C-y run "reattach-to-user-namespace pbpaste | tmux load-buffer - ; tmux paste-buffer" - '' - } + ${lib.optionalString pkgs.stdenv.isLinux '' + bind-key -T copy-mode y send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b" + bind-key C-y run "xsel -o | tmux load-buffer - ; tmux paste-buffer" + ''} + ${lib.optionalString pkgs.stdenv.isDarwin '' + bind-key -T copy-mode y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" + bind-key C-y run "reattach-to-user-namespace pbpaste | tmux load-buffer - ; tmux paste-buffer" + ''} ''; }; } - diff --git a/nix-conf/home/includes/irssi.nix b/nix-conf/home/includes/irssi.nix index 1c43867..54bdc9b 100644 --- a/nix-conf/home/includes/irssi.nix +++ b/nix-conf/home/includes/irssi.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: { programs.irssi = { @@ -141,7 +146,9 @@ certificateFile = "${config.home.homeDirectory}/.irssi/oftc.pem"; }; }; - channels = { home-manager.autoJoin = true; }; + channels = { + home-manager.autoJoin = true; + }; }; blinkenirc = { nick = "djm"; @@ -158,8 +165,7 @@ ssl = { enable = true; verify = true; - certificateFile = - "${config.home.homeDirectory}/.irssi/blinkenirc.pem"; + certificateFile = "${config.home.homeDirectory}/.irssi/blinkenirc.pem"; }; }; channels = { @@ -178,11 +184,12 @@ ssl = { enable = true; verify = true; - certificateFile = - "${config.home.homeDirectory}/.irssi/hashbang.pem"; + certificateFile = "${config.home.homeDirectory}/.irssi/hashbang.pem"; }; }; - channels = { "#!".autoJoin = true; }; + channels = { + "#!".autoJoin = true; + }; }; }; }; diff --git a/nix-conf/home/includes/linux-dev.nix b/nix-conf/home/includes/linux-dev.nix index ddccc25..a7a8dda 100644 --- a/nix-conf/home/includes/linux-dev.nix +++ b/nix-conf/home/includes/linux-dev.nix @@ -1,10 +1,16 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ imports = [ ./dev-common.nix ]; programs.emacs = { enable = true; package = pkgs.emacs29; - extraPackages = (epkgs: [ epkgs.vterm epkgs.multi-vterm ]); + extraPackages = ( + epkgs: [ + epkgs.vterm + epkgs.multi-vterm + ] + ); }; home.packages = with pkgs; [ @@ -18,4 +24,3 @@ ]; } - diff --git a/nix-conf/home/includes/linux-server.nix b/nix-conf/home/includes/linux-server.nix index fc3a2f7..e5f9caa 100644 --- a/nix-conf/home/includes/linux-server.nix +++ b/nix-conf/home/includes/linux-server.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ imports = [ ./common.nix ]; home.packages = with pkgs; [ @@ -49,4 +50,3 @@ programs.vim.packageConfigurable = pkgs.vim; } - diff --git a/nix-conf/home/includes/scripts/hm-changes-report.nix b/nix-conf/home/includes/scripts/hm-changes-report.nix index 0df6e4c..65e7fe8 100644 --- a/nix-conf/home/includes/scripts/hm-changes-report.nix +++ b/nix-conf/home/includes/scripts/hm-changes-report.nix @@ -2,9 +2,9 @@ # https://github.com/gvolpe/nix-config/blob/e28a220d0087064e6bad6b992b4914a65eb545e5/home/scripts/changes-report.nix let - hm-profiles = - "${config.home.homeDirectory}/.local/state/nix/profiles/home-manager-*-link"; -in pkgs.writeShellScriptBin "hm-changes-report" '' + hm-profiles = "${config.home.homeDirectory}/.local/state/nix/profiles/home-manager-*-link"; +in +pkgs.writeShellScriptBin "hm-changes-report" '' # Disable nvd if there are less than 2 hm profiles. if [ $(ls -d1v ${hm-profiles} 2>/dev/null | wc -l) -lt 2 ]; then echo "Skipping changes report..." @@ -12,4 +12,3 @@ in pkgs.writeShellScriptBin "hm-changes-report" '' ${pkgs.nvd}/bin/nvd diff $(ls -d1v ${hm-profiles} | tail -2) fi '' - diff --git a/nix-conf/home/includes/scripts/system-changes-report.nix b/nix-conf/home/includes/scripts/system-changes-report.nix index c7f0449..b94498c 100644 --- a/nix-conf/home/includes/scripts/system-changes-report.nix +++ b/nix-conf/home/includes/scripts/system-changes-report.nix @@ -1,8 +1,10 @@ { config, pkgs, ... }: # https://github.com/gvolpe/nix-config/blob/e28a220d0087064e6bad6b992b4914a65eb545e5/home/scripts/changes-report.nix -let system-profiles = "/nix/var/nix/profiles/system-*-link"; -in pkgs.writeShellScriptBin "system-changes-report" '' +let + system-profiles = "/nix/var/nix/profiles/system-*-link"; +in +pkgs.writeShellScriptBin "system-changes-report" '' # Disable nvd if there are less than 2 hm profiles. if [ $(ls -d1v ${system-profiles} 2>/dev/null | wc -l) -lt 2 ]; then echo "Skipping changes report..." @@ -10,4 +12,3 @@ in pkgs.writeShellScriptBin "system-changes-report" '' ${pkgs.nvd}/bin/nvd diff $(ls -d1v ${system-profiles} | tail -2) fi '' - diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix index 049bd88..9a8c1cf 100644 --- a/nix-conf/home/includes/zsh.nix +++ b/nix-conf/home/includes/zsh.nix @@ -1,6 +1,13 @@ -{ config, pkgs, lib, ... }: -let inherit (lib) optionalAttrs optionals; -in { +{ + config, + pkgs, + lib, + ... +}: +let + inherit (lib) optionalAttrs optionals; +in +{ home.packages = with pkgs; [ zsh-completions ]; programs.fzf = { @@ -17,8 +24,15 @@ in { }; programs.keychain = { enable = lib.mkIf pkgs.stdenv.isLinux true; - agents = [ "ssh" "gpg" ]; - keys = [ "id_rsa" "id_ed25519" "C171251002C200F2" ]; + agents = [ + "ssh" + "gpg" + ]; + keys = [ + "id_rsa" + "id_ed25519" + "C171251002C200F2" + ]; # extraFlags = [ "--quiet" "--ignore-missing" ]; }; programs.command-not-found.enable = true; @@ -52,24 +66,16 @@ in { pp = ''pushbullet push "Pixel" link "''${1}" "''${1}"''; - upgrade_emacs = '' - cp ~/.emacs.d/straight/versions/default.el ~/straight-versions-default-`date "+%Y-%m-%d-%H%M%S"`.el && emacs --batch -l "~/.emacs.d/init.el" -f "my/upgrade-packages"''; - diff_emacs = - "difft --color always --context 0 $(ls -d1v ~/straight-versions-default-*.el | tail -1) ~/.emacs.d/straight/versions/default.el | grep '\\[9[12]' | egrep -v '(gnu-elpa-mirror|nongnu-elpa|melpa|emacsmirror-mirror)'"; - - nix-up = - "git -C ~/dotfiles pull && doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date"; - _nix-up = - "doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date"; - home-up = - "git -C ~/dotfiles pull && nix-channel --update && home-manager switch && hm-changes-report"; - _home-up = - "nix-channel --update && home-manager switch && hm-changes-report"; - nix-hammer = - "nix shell -f https://github.com/jtojnar/nixpkgs-hammering/archive/master.tar.gz -c nixpkgs-hammer"; - - fb = - "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'"; + upgrade_emacs = ''cp ~/.emacs.d/straight/versions/default.el ~/straight-versions-default-`date "+%Y-%m-%d-%H%M%S"`.el && emacs --batch -l "~/.emacs.d/init.el" -f "my/upgrade-packages"''; + diff_emacs = "difft --color always --context 0 $(ls -d1v ~/straight-versions-default-*.el | tail -1) ~/.emacs.d/straight/versions/default.el | grep '\\[9[12]' | egrep -v '(gnu-elpa-mirror|nongnu-elpa|melpa|emacsmirror-mirror)'"; + + nix-up = "git -C ~/dotfiles pull && doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date"; + _nix-up = "doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date"; + home-up = "git -C ~/dotfiles pull && nix-channel --update && home-manager switch && hm-changes-report"; + _home-up = "nix-channel --update && home-manager switch && hm-changes-report"; + nix-hammer = "nix shell -f https://github.com/jtojnar/nixpkgs-hammering/archive/master.tar.gz -c nixpkgs-hammer"; + + fb = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'"; zz = "z $PWD"; @@ -77,8 +83,7 @@ in { erg = "ea run grouped rg --"; fd = "ea run linear fd --"; - git-reset-branch = - "git fetch && git reset --hard origin/$(git branch --show-current)"; + git-reset-branch = "git fetch && git reset --hard origin/$(git branch --show-current)"; # Git log aliases from the omz git plugin gl = "git pull"; @@ -88,27 +93,23 @@ in { glgga = "git log --graph --decorate --all"; glgm = "git log --graph --max-count=10"; glo_ = "git log --oneline --decorate"; - glol = '' - git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"''; - glols = '' - git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat''; - glod = '' - git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"''; - glods = '' - git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short''; - glola = '' - git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all''; + glol = ''git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"''; + glols = ''git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat''; + glod = ''git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"''; + glods = ''git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short''; + glola = ''git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all''; glog = "git log --oneline --decorate --graph"; gloga = "git log --oneline --decorate --graph --all"; - } // optionalAttrs pkgs.stdenv.isDarwin { - oemacs = "open -a /Applications/Emacs.app"; - }; + } // optionalAttrs pkgs.stdenv.isDarwin { oemacs = "open -a /Applications/Emacs.app"; }; localVariables = { PER_DIRECTORY_HISTORY_TOGGLE = "^\\\\"; # ^\\ is ^# HISTORY_START_WITH_GLOBAL = true; - ZSH_AUTOSUGGEST_STRATEGY = [ "history" "completion" ]; + ZSH_AUTOSUGGEST_STRATEGY = [ + "history" + "completion" + ]; NVM_AUTO_USE = true; NVM_LAZY_LOAD = true; @@ -116,15 +117,11 @@ in { LSP_USE_PLISTS = true; LESS = "-iRXF"; - FZF_DEFAULT_COMMAND = '' - rg --files --no-ignore --hidden --follow -g \"!{.git,node_modules}/*\" 2> /dev/null''; - FZF_CTRL_T_COMMAND = - config.programs.zsh.localVariables.FZF_DEFAULT_COMMAND; - FZF_ALT_C_COMMAND = '' - rg --hidden --files --sort-files --null -g \"!{.git,node_modules}/*\" | xargs -0 dirname | sort -u''; + FZF_DEFAULT_COMMAND = ''rg --files --no-ignore --hidden --follow -g \"!{.git,node_modules}/*\" 2> /dev/null''; + FZF_CTRL_T_COMMAND = config.programs.zsh.localVariables.FZF_DEFAULT_COMMAND; + FZF_ALT_C_COMMAND = ''rg --hidden --files --sort-files --null -g \"!{.git,node_modules}/*\" | xargs -0 dirname | sort -u''; FZF_ALT_C_OPTS = "--preview 'eza --tree {} | head -200'"; - FZF_CTRL_R_OPTS = - "--preview 'echo {}' --preview-window down:3:hidden:wrap --bind 'ctrl-t:toggle-preview'"; + FZF_CTRL_R_OPTS = "--preview 'echo {}' --preview-window down:3:hidden:wrap --bind 'ctrl-t:toggle-preview'"; FZF_DEFAULT_OPTS = "--bind=ctrl-t:toggle-all --bind=ctrl-j:jump"; }; initExtraFirst = '' @@ -284,7 +281,8 @@ in { [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh ''; - plugins = with pkgs; + plugins = + with pkgs; [ { name = "zsh-autopair"; @@ -314,8 +312,7 @@ in { { name = "zsh-history-substring-search"; src = zsh-history-substring-search; - file = - "share/zsh-history-substring-search/zsh-history-substring-search.zsh"; + file = "share/zsh-history-substring-search/zsh-history-substring-search.zsh"; } { name = "zsh-forgit"; @@ -342,16 +339,18 @@ in { }; file = "per-directory-history.zsh"; } - ] ++ optionals stdenv.isDarwin [{ - name = "zsh-nvm"; - src = fetchFromGitHub { - owner = "lukechilds"; - repo = "zsh-nvm"; - rev = "23067bd9bb6eb6f4737a3ea90cb0cb5e85f61ba2"; - sha256 = "Zwdi7bezMFKaIKYwsSftu3mJSFvadEWmY2hYnU1Kpu4="; - }; - file = "zsh-nvm.plugin.zsh"; - }]; + ] + ++ optionals stdenv.isDarwin [ + { + name = "zsh-nvm"; + src = fetchFromGitHub { + owner = "lukechilds"; + repo = "zsh-nvm"; + rev = "23067bd9bb6eb6f4737a3ea90cb0cb5e85f61ba2"; + sha256 = "Zwdi7bezMFKaIKYwsSftu3mJSFvadEWmY2hYnU1Kpu4="; + }; + file = "zsh-nvm.plugin.zsh"; + } + ]; }; } - diff --git a/nix-conf/home/otm.nix b/nix-conf/home/otm.nix index b9e3c44..839540c 100644 --- a/nix-conf/home/otm.nix +++ b/nix-conf/home/otm.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let zscaler-cert = '' -----BEGIN CERTIFICATE----- @@ -81,12 +86,12 @@ let -----END CERTIFICATE----- ''; - aws-cert = (builtins.readFile - "${pkgs.awscli2}/lib/python${pkgs.awscli2.python.pythonVersion}/site-packages/awscli/botocore/cacert.pem") + aws-cert = + (builtins.readFile "${pkgs.awscli2}/lib/python${pkgs.awscli2.python.pythonVersion}/site-packages/awscli/botocore/cacert.pem") + zscaler-cert; - full-cert = (builtins.readFile /etc/ssl/cert.pem) + aws-cert + internal-cert - + internal-staging-cert; + full-cert = + (builtins.readFile /etc/ssl/cert.pem) + aws-cert + internal-cert + internal-staging-cert; zscaler-cert-file = pkgs.writeText "zscaler-cert.pem" zscaler-cert; aws-cert-file = pkgs.writeText "aws-cert.pem" aws-cert; @@ -97,13 +102,16 @@ let # See https://github.com/nix-community/home-manager/blob/086f619dd991a4d355c07837448244029fc2d9ab/modules/programs/java.nix#L39-L41 # and https://github.com/NixOS/nixpkgs/blob/4877ea239f4d02410c3516101faf35a81af0c30e/pkgs/development/compilers/openjdk/jre.nix#L32 passthru.home = "${zscaler-jdk}"; # make sure JAVA_HOME is set - installPhase = old.installPhase + '' - $out/bin/keytool -import -noprompt -trustcacerts -alias zscalerrootca -keystore $out/lib/security/cacerts <<< "${zscaler-cert}" - ''; + installPhase = + old.installPhase + + '' + $out/bin/keytool -import -noprompt -trustcacerts -alias zscalerrootca -keystore $out/lib/security/cacerts <<< "${zscaler-cert}" + ''; }); zscaler-lein = pkgs.leiningen.override { jdk = zscaler-jdk; }; -in { +in +{ imports = [ ./includes/darwin.nix ]; # Let Home Manager install and manage itself. @@ -127,15 +135,11 @@ in { }; home.shellAliases = { - notify_success = '' - ( osascript -e 'display notification "The command finished" with title "Success"' && afplay /System/Library/Sounds/Ping.aiff && say done )''; - notify_failure = '' - ( osascript -e 'display notification "The command failed" with title "Failure"' && afplay /System/Library/Sounds/Sosumi.aiff && say failed )''; + notify_success = ''( osascript -e 'display notification "The command finished" with title "Success"' && afplay /System/Library/Sounds/Ping.aiff && say done )''; + notify_failure = ''( osascript -e 'display notification "The command failed" with title "Failure"' && afplay /System/Library/Sounds/Sosumi.aiff && say failed )''; notify = "notify_success || notify_failure"; - auth = - "auth2aws login -r aws_otm_dev_developers,aws_otm_prd_developers && osascript -e 'tell app \"iTerm\" to activate'"; - yarn_build = - "aws codeartifact login --tool npm --repository otm-js --domain otm --domain-owner 103567893073 --region eu-west-1 --profile aws_otm_dev_developers && yarn && yarn build && notify"; + auth = "auth2aws login -r aws_otm_dev_developers,aws_otm_prd_developers && osascript -e 'tell app \"iTerm\" to activate'"; + yarn_build = "aws codeartifact login --tool npm --repository otm-js --domain otm --domain-owner 103567893073 --region eu-west-1 --profile aws_otm_dev_developers && yarn && yarn build && notify"; }; home.packages = with pkgs; [ zscaler-lein ]; diff --git a/nix-conf/machines/djmuk1/configuration.nix b/nix-conf/machines/djmuk1/configuration.nix index ed402c4..3ae99c5 100644 --- a/nix-conf/machines/djmuk1/configuration.nix +++ b/nix-conf/machines/djmuk1/configuration.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ imports = [ ./hardware-configuration.nix ]; boot.tmp.cleanOnBoot = true; @@ -38,7 +39,10 @@ isNormalUser = true; home = "/home/djm"; description = "David Morgan"; - extraGroups = [ "wheel" "plocate" ]; + extraGroups = [ + "wheel" + "plocate" + ]; shell = pkgs.zsh; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCurCpxZCHtByB5wXzsjTXwMyDSB4+B8rq5XY6EGss58NwD8jc5cII4i+QUbCOGTiAggSZUSC9YIP24hjpOeNT/IYs5m7Qn1B9MtBAiUSrIYew8eDwnMLlPzN+k2x9zCrJeCHIvGJaFHPXTh1Lf5Jt2fPVGW9lksE/XUVOe6ht4N/b+nqqszXFhc8Ug6le2bC1YeTCVEf8pjlh/I7DkDBl6IB8uEXc3X2vxxbV0Z4vlBrFkkAywcD3j5VlS/QYfBr4BICNmq/sO3fMkbMbtAPwuFxeL4+h6426AARQZiSS0qVEc8OoFRBVx3GEH5fqVAWfB1geyLzei22HbjUcT9+xN davidmo@gendros" @@ -51,11 +55,13 @@ ''; security.doas = { enable = true; - extraRules = [{ - users = [ "djm" ]; - noPass = true; - keepEnv = true; - }]; + extraRules = [ + { + users = [ "djm" ]; + noPass = true; + keepEnv = true; + } + ]; }; programs.zsh.enable = true; @@ -68,7 +74,10 @@ wget ]; - nix.settings.trusted-users = [ "root" "djm" ]; + nix.settings.trusted-users = [ + "root" + "djm" + ]; i18n.defaultLocale = "en_GB.UTF-8"; diff --git a/nix-conf/machines/djmuk1/hardware-configuration.nix b/nix-conf/machines/djmuk1/hardware-configuration.nix index 88a2e1a..894b817 100644 --- a/nix-conf/machines/djmuk1/hardware-configuration.nix +++ b/nix-conf/machines/djmuk1/hardware-configuration.nix @@ -1,4 +1,5 @@ -{ modulesPath, ... }: { +{ modulesPath, ... }: +{ imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; boot.loader.grub = { efiSupport = true; @@ -9,8 +10,12 @@ device = "/dev/disk/by-uuid/0D60-CDE2"; fsType = "vfat"; }; - boot.initrd.availableKernelModules = - [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ]; + boot.initrd.availableKernelModules = [ + "ata_piix" + "uhci_hcd" + "xen_blkfront" + "vmw_pvscsi" + ]; boot.initrd.kernelModules = [ "nvme" ]; fileSystems."/" = { device = "/dev/sda1"; diff --git a/nix-conf/machines/djmuk2/configuration.nix b/nix-conf/machines/djmuk2/configuration.nix index f332103..9cc0a85 100644 --- a/nix-conf/machines/djmuk2/configuration.nix +++ b/nix-conf/machines/djmuk2/configuration.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ imports = [ ./hardware-configuration.nix ]; boot.tmp.cleanOnBoot = true; @@ -46,7 +47,10 @@ isNormalUser = true; home = "/home/djm"; description = "David Morgan"; - extraGroups = [ "wheel" "plocate" ]; + extraGroups = [ + "wheel" + "plocate" + ]; shell = pkgs.zsh; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCurCpxZCHtByB5wXzsjTXwMyDSB4+B8rq5XY6EGss58NwD8jc5cII4i+QUbCOGTiAggSZUSC9YIP24hjpOeNT/IYs5m7Qn1B9MtBAiUSrIYew8eDwnMLlPzN+k2x9zCrJeCHIvGJaFHPXTh1Lf5Jt2fPVGW9lksE/XUVOe6ht4N/b+nqqszXFhc8Ug6le2bC1YeTCVEf8pjlh/I7DkDBl6IB8uEXc3X2vxxbV0Z4vlBrFkkAywcD3j5VlS/QYfBr4BICNmq/sO3fMkbMbtAPwuFxeL4+h6426AARQZiSS0qVEc8OoFRBVx3GEH5fqVAWfB1geyLzei22HbjUcT9+xN davidmo@gendros" @@ -59,11 +63,13 @@ ''; security.doas = { enable = true; - extraRules = [{ - users = [ "djm" ]; - noPass = true; - keepEnv = true; - }]; + extraRules = [ + { + users = [ "djm" ]; + noPass = true; + keepEnv = true; + } + ]; }; programs.zsh.enable = true; @@ -77,7 +83,10 @@ wget ]; - nix.settings.trusted-users = [ "root" "djm" ]; + nix.settings.trusted-users = [ + "root" + "djm" + ]; nix.optimise.automatic = true; nix.optimise.dates = [ "03:00" ]; @@ -85,4 +94,3 @@ system.stateVersion = "22.05"; } - diff --git a/nix-conf/machines/djmuk2/hardware-configuration.nix b/nix-conf/machines/djmuk2/hardware-configuration.nix index fbc8d57..5c421f9 100644 --- a/nix-conf/machines/djmuk2/hardware-configuration.nix +++ b/nix-conf/machines/djmuk2/hardware-configuration.nix @@ -1,4 +1,5 @@ -{ modulesPath, ... }: { +{ modulesPath, ... }: +{ imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; boot.loader.grub = { efiSupport = true; @@ -9,7 +10,11 @@ device = "/dev/disk/by-uuid/4875-017B"; fsType = "vfat"; }; - boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" ]; + boot.initrd.availableKernelModules = [ + "ata_piix" + "uhci_hcd" + "xen_blkfront" + ]; boot.initrd.kernelModules = [ "nvme" ]; fileSystems."/" = { device = "/dev/mapper/ocivolume-root"; diff --git a/nix-conf/machines/edrahil/configuration.nix b/nix-conf/machines/edrahil/configuration.nix index 76b294b..d78c2a8 100644 --- a/nix-conf/machines/edrahil/configuration.nix +++ b/nix-conf/machines/edrahil/configuration.nix @@ -1,5 +1,9 @@ -{ config, pkgs, ... }: { - imports = [ ./hardware-configuration.nix ./network-configuration.nix ]; +{ config, pkgs, ... }: +{ + imports = [ + ./hardware-configuration.nix + ./network-configuration.nix + ]; boot.tmp.cleanOnBoot = true; zramSwap.enable = true; @@ -7,7 +11,10 @@ networking.hostName = "edrahil"; networking.firewall = { enable = true; - allowedTCPPorts = [ 113 2222 ]; + allowedTCPPorts = [ + 113 + 2222 + ]; }; services.openssh = { @@ -43,7 +50,10 @@ isNormalUser = true; home = "/home/djm"; description = "David Morgan"; - extraGroups = [ "wheel" "plocate" ]; + extraGroups = [ + "wheel" + "plocate" + ]; shell = pkgs.zsh; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCurCpxZCHtByB5wXzsjTXwMyDSB4+B8rq5XY6EGss58NwD8jc5cII4i+QUbCOGTiAggSZUSC9YIP24hjpOeNT/IYs5m7Qn1B9MtBAiUSrIYew8eDwnMLlPzN+k2x9zCrJeCHIvGJaFHPXTh1Lf5Jt2fPVGW9lksE/XUVOe6ht4N/b+nqqszXFhc8Ug6le2bC1YeTCVEf8pjlh/I7DkDBl6IB8uEXc3X2vxxbV0Z4vlBrFkkAywcD3j5VlS/QYfBr4BICNmq/sO3fMkbMbtAPwuFxeL4+h6426AARQZiSS0qVEc8OoFRBVx3GEH5fqVAWfB1geyLzei22HbjUcT9+xN davidmo@gendros" @@ -56,11 +66,13 @@ ''; security.doas = { enable = true; - extraRules = [{ - users = [ "djm" ]; - noPass = true; - keepEnv = true; - }]; + extraRules = [ + { + users = [ "djm" ]; + noPass = true; + keepEnv = true; + } + ]; }; programs.zsh.enable = true; @@ -73,7 +85,10 @@ wget ]; - nix.settings.trusted-users = [ "root" "djm" ]; + nix.settings.trusted-users = [ + "root" + "djm" + ]; nix.optimise.automatic = true; nix.optimise.dates = [ "03:00" ]; diff --git a/nix-conf/machines/edrahil/hardware-configuration.nix b/nix-conf/machines/edrahil/hardware-configuration.nix index e20c7a7..c8ee3f5 100644 --- a/nix-conf/machines/edrahil/hardware-configuration.nix +++ b/nix-conf/machines/edrahil/hardware-configuration.nix @@ -1,8 +1,13 @@ -{ modulesPath, ... }: { +{ modulesPath, ... }: +{ imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; boot.loader.grub.device = "/dev/sda"; - boot.initrd.availableKernelModules = - [ "ata_piix" "uhci_hcd" "vmw_pvscsi" "xen_blkfront" ]; + boot.initrd.availableKernelModules = [ + "ata_piix" + "uhci_hcd" + "vmw_pvscsi" + "xen_blkfront" + ]; boot.initrd.kernelModules = [ "nvme" ]; fileSystems."/" = { device = "/dev/sda1"; diff --git a/nix-conf/machines/edrahil/network-configuration.nix b/nix-conf/machines/edrahil/network-configuration.nix index 626232c..b8ce55f 100644 --- a/nix-conf/machines/edrahil/network-configuration.nix +++ b/nix-conf/machines/edrahil/network-configuration.nix @@ -1,13 +1,16 @@ -{ ... }: { +{ ... }: +{ networking = { - interfaces.ens3.ipv6.addresses = [{ - # Emulate nix-sops. Technically an anti-pattern, but IP addresses aren't real secrets, and this has to be embedded here, - # as we cannot set a file path to read it from. - # Populate/update with: - # SOPS_AGE_KEY=$(doas ssh-to-age -private-key -i /etc/ssh/ssh_host_ed25519_key) sops -d --extract '["ipv6_address"]' secrets/edrahil.yaml | doas tee /root/.config/secrets/ipv6_address - address = builtins.readFile "/root/.config/secrets/ipv6_address"; - prefixLength = 64; - }]; + interfaces.ens3.ipv6.addresses = [ + { + # Emulate nix-sops. Technically an anti-pattern, but IP addresses aren't real secrets, and this has to be embedded here, + # as we cannot set a file path to read it from. + # Populate/update with: + # SOPS_AGE_KEY=$(doas ssh-to-age -private-key -i /etc/ssh/ssh_host_ed25519_key) sops -d --extract '["ipv6_address"]' secrets/edrahil.yaml | doas tee /root/.config/secrets/ipv6_address + address = builtins.readFile "/root/.config/secrets/ipv6_address"; + prefixLength = 64; + } + ]; defaultGateway6 = { address = "fe80::1"; interface = "ens3"; diff --git a/nix-conf/machines/egalmoth/configuration.nix b/nix-conf/machines/egalmoth/configuration.nix index dbdce96..21b7d23 100644 --- a/nix-conf/machines/egalmoth/configuration.nix +++ b/nix-conf/machines/egalmoth/configuration.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: { imports = [ ./hardware-configuration.nix ]; @@ -77,10 +82,18 @@ services.xserver.xkb.layout = "gb"; services.printing.enable = true; - services.printing.drivers = [ pkgs.gutenprint pkgs.hplipWithPlugin ]; + services.printing.drivers = [ + pkgs.gutenprint + pkgs.hplipWithPlugin + ]; - nixpkgs.config.allowUnfreePredicate = pkg: - builtins.elem (lib.getName pkg) [ "corefonts" "hplip" "zoom" ]; + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "corefonts" + "hplip" + "zoom" + ]; hardware.sane.enable = true; @@ -116,8 +129,15 @@ users.users.djm = { isNormalUser = true; description = "David Morgan"; - extraGroups = - [ "wheel" "networkmanager" "scanner" "lp" "plocate" "cdrom" "disk" ]; + extraGroups = [ + "wheel" + "networkmanager" + "scanner" + "lp" + "plocate" + "cdrom" + "disk" + ]; shell = pkgs.zsh; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCurCpxZCHtByB5wXzsjTXwMyDSB4+B8rq5XY6EGss58NwD8jc5cII4i+QUbCOGTiAggSZUSC9YIP24hjpOeNT/IYs5m7Qn1B9MtBAiUSrIYew8eDwnMLlPzN+k2x9zCrJeCHIvGJaFHPXTh1Lf5Jt2fPVGW9lksE/XUVOe6ht4N/b+nqqszXFhc8Ug6le2bC1YeTCVEf8pjlh/I7DkDBl6IB8uEXc3X2vxxbV0Z4vlBrFkkAywcD3j5VlS/QYfBr4BICNmq/sO3fMkbMbtAPwuFxeL4+h6426AARQZiSS0qVEc8OoFRBVx3GEH5fqVAWfB1geyLzei22HbjUcT9+xN davidmo@gendros" @@ -129,11 +149,13 @@ ''; security.doas = { enable = true; - extraRules = [{ - users = [ "djm" ]; - noPass = true; - keepEnv = true; - }]; + extraRules = [ + { + users = [ "djm" ]; + noPass = true; + keepEnv = true; + } + ]; }; services.locate = { @@ -207,4 +229,3 @@ system.stateVersion = "21.05"; # Did you read the comment? } - diff --git a/nix-conf/machines/egalmoth/hardware-configuration.nix b/nix-conf/machines/egalmoth/hardware-configuration.nix index 4d15bf4..e5cb5f7 100644 --- a/nix-conf/machines/egalmoth/hardware-configuration.nix +++ b/nix-conf/machines/egalmoth/hardware-configuration.nix @@ -1,13 +1,25 @@ # 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, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = - [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; @@ -22,8 +34,7 @@ fsType = "vfat"; }; - swapDevices = - [{ device = "/dev/disk/by-uuid/a130cacb-d7e0-4fb8-a312-a34d19f00796"; }]; + swapDevices = [ { device = "/dev/disk/by-uuid/a130cacb-d7e0-4fb8-a312-a34d19f00796"; } ]; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; } |