From ce87105c6d10e83fd03fe64432971e9de2caa440 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sat, 23 Oct 2021 15:36:57 -0700 Subject: refactor(wpcarro/configs): Nixify configs/{install,uninstall} After receiving another computer from Google and attempting to "easily" install my configuration, I realized that I had some holes. In reality these could (and perhaps should) be easily tested using CI that attempts to cleanly install my configuration on various platfoms (e.g. Debian, NixOS), but I'm not interested in supporting something like that (at least not at the moment). For now, it suffices to nixify some of the lingering shell scripts with implicit dependencies on tools like `stow`. > Don't let perfect be the enemy of good? Change-Id: Ifdeac2c855e46973e3a4ea416418109a748eb41d Reviewed-on: https://cl.tvl.fyi/c/depot/+/4790 Tested-by: BuildkiteCI Reviewed-by: wpcarro Autosubmit: wpcarro --- users/wpcarro/Makefile | 20 ++++++++++++++------ users/wpcarro/configs/default.nix | 11 +++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 users/wpcarro/configs/default.nix (limited to 'users/wpcarro') diff --git a/users/wpcarro/Makefile b/users/wpcarro/Makefile index 52f46d0ea6..4e3361b800 100644 --- a/users/wpcarro/Makefile +++ b/users/wpcarro/Makefile @@ -1,9 +1,17 @@ -install: - source "${WPCARRO}/configs/install" +install-cli-tools: + nix-env -f "${BRIEFCASE}" -iA shared.cliTools -uninstall: - source "${WPCARRO}/configs/uninstall" +install-configs: + nix-build -A configs.install && \ + ./result && \ + rm ./result + +uninstall-configs: + nix-build -A configs.uninstall && \ + ./result && \ + rm ./result list-broken-links: - find "${HOME}" -maxdepth 1 -xtype l && \ - find "${HOME}/.config" -maxdepth 1 -xtype l + nix-build -A tools.symlinkManager && \ + ./result/bin/symlink-mgr -audit && \ + rm ./result diff --git a/users/wpcarro/configs/default.nix b/users/wpcarro/configs/default.nix new file mode 100644 index 0000000000..5b0b6a7dcc --- /dev/null +++ b/users/wpcarro/configs/default.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: + +{ + install = pkgs.writeShellScript "install-configs" '' + cd "$WPCARRO/configs" && ${pkgs.stow}/bin/stow --target="$HOME" . + ''; + + uninstall = pkgs.writeShellScript "uninstall-configs" '' + cd "$WPCARRO/configs" && ${pkgs.stow}/bin/stow --delete --target="$HOME" . + ''; +} -- cgit 1.4.1