diff --git a/configs/bash/default.nix b/configs/bash/default.nix index 0541081..6b5044a 100644 --- a/configs/bash/default.nix +++ b/configs/bash/default.nix @@ -8,16 +8,15 @@ in initExtra = '' export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 - export PASSWORD_STORE_DIR=/Users/${config.home.username}/.password-store '' + (if isDarwin then '' - export PATH="$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:$PATH" - export PATH="$PATH:/etc/profiles/per-user/${config.home.username}/bin" - export PATH="$PATH:/opt/homebrew/bin" - export PATH="$PATH:/opt/homebrew/opt/node@18/bin" - export JAVA_HOME=/usr/libexec/java_home - export PASSWORD_STORE_DIR="/Users/${config.home.username}/.password-store" + export PATH="$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:$PATH" + export PATH="$PATH:/etc/profiles/per-user/${config.home.username}/bin" + export PATH="$PATH:/opt/homebrew/bin" + export PATH="$PATH:/opt/homebrew/opt/node@18/bin" + export JAVA_HOME=/usr/libexec/java_home + export PASSWORD_STORE_DIR="/Users/${config.home.username}/.password-store" '' else '' diff --git a/configs/fish/default.nix b/configs/fish/default.nix index 9a645df..6d62a23 100644 --- a/configs/fish/default.nix +++ b/configs/fish/default.nix @@ -58,13 +58,13 @@ in '' + (if isDarwin then '' - # this is needed, otherwise darwin-rebuild wouldn't be in PATH - fish_add_path --prepend --global "$HOME/.nix-profile/bin" /nix/var/nix/profiles/default/bin /run/current-system/sw/bin - set PATH $PATH /etc/profiles/per-user/${config.home.username}/bin - set PATH $PATH /opt/homebrew/bin - set PATH $PATH /opt/homebrew/opt/node@18/bin - set JAVA_HOME /usr/libexec/java_home - set PASSWORD_STORE_DIR /Users/${config.home.username}/.password-store + # this is needed, otherwise darwin-rebuild wouldn't be in PATH + fish_add_path --prepend --global "$HOME/.nix-profile/bin" /nix/var/nix/profiles/default/bin /run/current-system/sw/bin + set PATH $PATH /etc/profiles/per-user/${config.home.username}/bin + set PATH $PATH /opt/homebrew/bin + set PATH $PATH /opt/homebrew/opt/node@18/bin + set JAVA_HOME /usr/libexec/java_home + set PASSWORD_STORE_DIR /Users/${config.home.username}/.password-store '' else '' diff --git a/configs/gopass/default.nix b/configs/gopass/default.nix index 4bacbea..e98e0f8 100644 --- a/configs/gopass/default.nix +++ b/configs/gopass/default.nix @@ -1,16 +1,7 @@ -{ config, pkgs, ... }: -let - isDarwin = pkgs.stdenv.isDarwin; -in -{ +{ config, pkgs, ... }: { home.file.".config/gopass/config".text = - if isDarwin then '' + '' [mounts] path = ${config.home.homeDirectory}/.password-store - '' - else - '' - [mounts] - path = ${config.home.homeDirectory}/.local/share/.password-store - ''; + ''; } diff --git a/flake.nix b/flake.nix index cd402d8..b0497b8 100644 --- a/flake.nix +++ b/flake.nix @@ -38,7 +38,9 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.rounak = { - imports = [ ./hosts/ninezeroes/home.nix ]; + imports = [ + ./hosts/ninezeroes/home.nix + ]; _module.args.self = self; _module.args.host = "ninezeroes"; _module.args.inputs = inputs; diff --git a/hosts/ckmac/configuration.nix b/hosts/ckmac/configuration.nix index 09d78b8..1c098b7 100644 --- a/hosts/ckmac/configuration.nix +++ b/hosts/ckmac/configuration.nix @@ -1,4 +1,4 @@ -{ inputs, config, pkgs, ... }: +{ inputs, config, pkgs, lib, ... }: { nix.settings = { diff --git a/hosts/ckmac/home.nix b/hosts/ckmac/home.nix index 051d97a..eee1cb4 100644 --- a/hosts/ckmac/home.nix +++ b/hosts/ckmac/home.nix @@ -2,6 +2,7 @@ imports = [ ../../configs + ../commons/pass.nix ]; home = { diff --git a/hosts/commons/pass.nix b/hosts/commons/pass.nix new file mode 100644 index 0000000..bc823e6 --- /dev/null +++ b/hosts/commons/pass.nix @@ -0,0 +1,30 @@ +{ config, pkgs, ... }: { + home.activation = { + passwordStore = '' + PW_DIR=${config.home.homeDirectory}/.password-store + + if [ ! -d "$PW_DIR" ]; then + mkdir -p "$PW_DIR" + fi + cd $PW_DIR + + # the following PATH addition is to make sure that binaries like `git`, `emacs`, `ssh` are available for use + export PATH="${config.home.path}/bin:/run/current-system/sw/bin:/etc/profiles/per-user/${config.home.username}/bin:$PATH" + # `ssh` is on the following path in darwin, so there we go + export PATH="/usr/bin:$PATH" + + git init + if git remote | grep -q origin; then + git remote set-url origin git@gitlab.com:rounakdatta/pass.git + else + git remote add origin git@gitlab.com:rounakdatta/pass.git + fi + + git fetch origin + git pull origin master + + gopass-jsonapi configure --browser chrome --global=false --path=${config.home.homeDirectory}/.config/gopass + gopass-jsonapi configure --browser firefox --global=false --path=${config.home.homeDirectory}/.config/gopass + ''; + }; +} diff --git a/hosts/ninezeroes/home.nix b/hosts/ninezeroes/home.nix index b2e85ff..e66bf8c 100644 --- a/hosts/ninezeroes/home.nix +++ b/hosts/ninezeroes/home.nix @@ -2,6 +2,7 @@ imports = [ ../../configs + ../commons/pass.nix ]; home = {