diff --git a/.vscode/settings.json b/.vscode/settings.json index bc3800d..163c984 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,3 @@ { - "python.formatting.provider": "black", - "python.formatting.blackPath": "/run/current-system/sw/bin/black" -} \ No newline at end of file + "python.formatting.provider": "black" +} diff --git a/flake.lock b/flake.lock index d991aa6..ec36c5a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "bash": { + "locked": { + "lastModified": 1678247195, + "narHash": "sha256-m/wSwlSket+hob3JED4XUvoWJLtW7yhtOiZrlRDMShs=", + "ref": "refs/heads/main", + "rev": "e7a00dcc0e75bc3ef6856bdd94d7d809245f5636", + "revCount": 1, + "type": "git", + "url": "https://git.ocjtech.us/jeff/nixos-bash-prompt-builder.git" + }, + "original": { + "type": "git", + "url": "https://git.ocjtech.us/jeff/nixos-bash-prompt-builder.git" + } + }, "flake-utils": { "locked": { "lastModified": 1678901627, @@ -33,6 +48,7 @@ }, "root": { "inputs": { + "bash": "bash", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index 80acb13..d298ef4 100644 --- a/flake.nix +++ b/flake.nix @@ -7,9 +7,11 @@ flake-utils = { url = "github:numtide/flake-utils"; }; - + bash = { + url = "git+https://git.ocjtech.us/jeff/nixos-bash-prompt-builder.git"; + }; }; - outputs = { self, nixpkgs, flake-utils }@input: + outputs = { self, nixpkgs, flake-utils, bash }@input: flake-utils.lib.eachDefaultSystem (system: let @@ -52,6 +54,13 @@ poetry-core ] ); + project = "netbox-maintenance"; + prompt = ( + bash.build_prompt + bash.ansi_normal_blue + "${project} - ${bash.username}@${bash.hostname_short}: ${bash.current_working_directory}" + "${project}:${bash.current_working_directory}" + ); in pkgs.mkShell { buildInputs = [ @@ -61,8 +70,9 @@ pkgs.poetry ]; shellHook = '' + export PATH=$(pwd)/.venv/bin:$PATH export POETRY_VIRTUALENVS_IN_PROJECT=true - export PS1='\[\033[1;34m\][hostapps:\w]\$\[\033[0m\] ' + export PS1='${prompt}' ''; }; } diff --git a/hostapps/update.py b/hostapps/update.py index e025da0..a7dc1b7 100644 --- a/hostapps/update.py +++ b/hostapps/update.py @@ -12,7 +12,6 @@ import pynetbox @click.command() def main(): - data = json.load(open(f"/run/user/{os.getuid()}/secrets/netbox.json")) nb = pynetbox.api( data["url"],