setup-home.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. [ -f ~/.config/sops/age/keys.txt ] || ( echo "Age key not present, aborting." ; exit 1 )
  3. [ -e ~/dotfiles ] || git clone git@codeberg.org:djm/dotfiles.git
  4. if [ -x "$(command -v nixos-version)" ]; then
  5. # On NixOS use the hm version corresponding to the NixOS version, and add nixos-unstable as unstable
  6. nix-channel --add https://github.com/nix-community/home-manager/archive/release-$(nixos-version | cut -d. -f1-2).tar.gz home-manager
  7. nix-channel --add https://nixos.org/channels/nixos-unstable unstable
  8. else
  9. # On other systems use master, and add nixpkgs-unstable as unstable for compatibility between NixOS and non-NixOS installations
  10. nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
  11. nix-channel --add https://nixos.org/channels/nixpkgs-unstable unstable
  12. fi
  13. nix-channel --add https://github.com/Mic92/sops-nix/archive/master.tar.gz sops-nix
  14. nix-channel --update
  15. export NIX_PATH=$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/root/channels${NIX_PATH:+:$NIX_PATH}
  16. nix-shell '<home-manager>' -A install
  17. HOME_CONF="$HOME/dotfiles/nix-conf/home/${CONF:-${HOST}}.nix"
  18. [ -f $HOME_CONF ] && ln -sf $HOME_CONF ~/.config/home-manager/home.nix
  19. ln -sf ~/dotfiles/.p10k.zsh ~/
  20. ln -sf ~/dotfiles/.emacs.d ~/
  21. home-manager switch
  22. if [ "$(uname 2> /dev/null)" = "Darwin" ]; then
  23. ln -sf ~/.nix-profile/Applications/Emacs.app /Applications/
  24. ln -sf ~/.nix-profile/lib/pam /usr/local/lib/pam
  25. fi