update
This commit is contained in:
parent
c396dbf91e
commit
d181553877
4 changed files with 31 additions and 7 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,4 +1,3 @@
|
||||||
{
|
{
|
||||||
"python.formatting.provider": "black",
|
"python.formatting.provider": "black"
|
||||||
"python.formatting.blackPath": "/run/current-system/sw/bin/black"
|
|
||||||
}
|
}
|
16
flake.lock
16
flake.lock
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
16
flake.nix
16
flake.nix
|
@ -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}'
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"],
|
||||||
|
|
Loading…
Reference in a new issue