This commit is contained in:
Jeffrey C. Ollie 2023-03-24 10:53:20 -05:00
parent c396dbf91e
commit d181553877
No known key found for this signature in database
GPG key ID: F936E4DCB7E25F15
4 changed files with 31 additions and 7 deletions

View file

@ -1,4 +1,3 @@
{ {
"python.formatting.provider": "black", "python.formatting.provider": "black"
"python.formatting.blackPath": "/run/current-system/sw/bin/black"
} }

View file

@ -1,5 +1,20 @@
{ {
"nodes": { "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": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1678901627, "lastModified": 1678901627,
@ -33,6 +48,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"bash": "bash",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }

View file

@ -7,9 +7,11 @@
flake-utils = { flake-utils = {
url = "github:numtide/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 flake-utils.lib.eachDefaultSystem
(system: (system:
let let
@ -52,6 +54,13 @@
poetry-core 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 in
pkgs.mkShell { pkgs.mkShell {
buildInputs = [ buildInputs = [
@ -61,8 +70,9 @@
pkgs.poetry pkgs.poetry
]; ];
shellHook = '' shellHook = ''
export PATH=$(pwd)/.venv/bin:$PATH
export POETRY_VIRTUALENVS_IN_PROJECT=true export POETRY_VIRTUALENVS_IN_PROJECT=true
export PS1='\[\033[1;34m\][hostapps:\w]\$\[\033[0m\] ' export PS1='${prompt}'
''; '';
}; };
} }

View file

@ -12,7 +12,6 @@ import pynetbox
@click.command() @click.command()
def main(): def main():
data = json.load(open(f"/run/user/{os.getuid()}/secrets/netbox.json")) data = json.load(open(f"/run/user/{os.getuid()}/secrets/netbox.json"))
nb = pynetbox.api( nb = pynetbox.api(
data["url"], data["url"],