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.blackPath": "/run/current-system/sw/bin/black"
}
"python.formatting.provider": "black"
}

View File

@ -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"
}

View File

@ -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}'
'';
};
}

View File

@ -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"],