fixed imports and added scripts

This commit is contained in:
John Lancaster
2026-03-08 14:13:52 -05:00
parent 1228151d5a
commit 3e15d03778
5 changed files with 53 additions and 10 deletions

View File

@@ -6,6 +6,7 @@
imports = with inputs.self.homeModules; [ imports = with inputs.self.homeModules; [
onepassword onepassword
ghostty ghostty
sublime
]; ];
}; };
} }

View File

@@ -12,12 +12,11 @@
imports = with inputs.self.homeModules; [ imports = with inputs.self.homeModules; [
base base
docker docker
sublime
desktop
# resticprofile # 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 { flake.homeConfigurations.john = inputs.home-manager.lib.homeManagerConfiguration {
pkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; pkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
modules = [ modules = [
@@ -25,11 +24,9 @@
# Include another inline module to set the options created through the jsl-home modules # Include another inline module to set the options created through the jsl-home modules
{ {
homeManagerFlakeDir = "~/.config/home-manager"; docker.enable = false;
docker.enable = true;
ssh.matchSets = { ssh.matchSets = {
certs = true; certs = true;
appdaemon = true;
homelab = true; homelab = true;
}; };
} }

View File

@@ -3,10 +3,7 @@
flake.homeModules."john-pc-ubuntu" = { flake.homeModules."john-pc-ubuntu" = {
imports = with inputs.self.homeModules; [ imports = with inputs.self.homeModules; [
desktop desktop
home john
onepassword
sublime
# resticprofile
]; ];
# TODO: Add host-specific settings here: # TODO: Add host-specific settings here:
@@ -22,7 +19,7 @@
# Include another inline module to set the options created through the jsl-home modules # 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; docker.enable = true;
ssh.matchSets = { ssh.matchSets = {
certs = true; certs = true;

24
scripts/inspect.sh Executable file
View 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
View 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