fixed imports and added scripts
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
imports = with inputs.self.homeModules; [
|
||||
onepassword
|
||||
ghostty
|
||||
sublime
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
imports = with inputs.self.homeModules; [
|
||||
base
|
||||
docker
|
||||
sublime
|
||||
desktop
|
||||
# resticprofile
|
||||
];
|
||||
};
|
||||
|
||||
# This is the base homeConfiguration for the john user that will be used if no other
|
||||
flake.homeConfigurations.john = inputs.home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
|
||||
modules = [
|
||||
@@ -25,11 +24,9 @@
|
||||
|
||||
# Include another inline module to set the options created through the jsl-home modules
|
||||
{
|
||||
homeManagerFlakeDir = "~/.config/home-manager";
|
||||
docker.enable = true;
|
||||
docker.enable = false;
|
||||
ssh.matchSets = {
|
||||
certs = true;
|
||||
appdaemon = true;
|
||||
homelab = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
flake.homeModules."john-pc-ubuntu" = {
|
||||
imports = with inputs.self.homeModules; [
|
||||
desktop
|
||||
home
|
||||
onepassword
|
||||
sublime
|
||||
# resticprofile
|
||||
john
|
||||
];
|
||||
|
||||
# TODO: Add host-specific settings here:
|
||||
@@ -22,7 +19,7 @@
|
||||
|
||||
# Include another inline module to set the options created through the jsl-home modules
|
||||
{
|
||||
homeManagerFlakeDir = "~/.config/home-manager";
|
||||
homeManagerFlakeDir = "~/.config/home-manager/jsl-dendritic";
|
||||
docker.enable = true;
|
||||
ssh.matchSets = {
|
||||
certs = true;
|
||||
|
||||
24
scripts/inspect.sh
Executable file
24
scripts/inspect.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
NIX_EVAL_CMD="nix eval --json --no-warn-dirty --apply builtins.attrNames"
|
||||
|
||||
list_flake_attr() {
|
||||
attr="$1"
|
||||
flake="${2:-.}"
|
||||
echo "${attr} [${flake}]:"
|
||||
$NIX_EVAL_CMD "${flake}#${attr}" | jq -r '" - " + .[]'
|
||||
echo
|
||||
}
|
||||
|
||||
list_home_modules() {
|
||||
list_flake_attr "homeModules" "$1"
|
||||
}
|
||||
|
||||
list_home_configurations() {
|
||||
list_flake_attr "homeConfigurations" "$1"
|
||||
}
|
||||
|
||||
current_dir=$(readlink -f .)
|
||||
flake="${1:-$current_dir}"
|
||||
list_home_modules "$flake"
|
||||
list_home_configurations "$flake"
|
||||
24
scripts/switch.sh
Executable file
24
scripts/switch.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
FLAKE_DIR="/home/john/.config/home-manager/jsl-dendritic"
|
||||
|
||||
is_in_array() {
|
||||
local needle="$1"
|
||||
shift
|
||||
local arr=("$@")
|
||||
[[ " ${arr[*]} " == *" ${needle} "* ]] && echo true || echo false
|
||||
}
|
||||
|
||||
hostname_exists() {
|
||||
NIX_EVAL_CMD="nix eval --json --no-warn-dirty --apply builtins.attrNames"
|
||||
mapfile -t HOME_CONFIGS < <(${NIX_EVAL_CMD} ${FLAKE_DIR}#homeConfigurations | jq -r '.[]')
|
||||
is_in_array "$(hostname)" "${HOME_CONFIGS[@]}"
|
||||
}
|
||||
|
||||
HOSTNAME=$(hostname)
|
||||
if [[ "$(hostname_exists)" == "true" ]]; then
|
||||
home-manager switch --flake "${FLAKE_DIR}#${HOSTNAME}"
|
||||
else
|
||||
echo "No homeConfiguration found for hostname '${HOSTNAME}'." >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user