diff --git a/README.md b/README.md new file mode 100644 index 0000000..1c33723 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +blah blah \ No newline at end of file diff --git a/cnc/config.json b/cnc/config.json deleted file mode 100644 index f14bf1b..0000000 --- a/cnc/config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "proxy": { - "name": "wrensch" - }, - "hosts": [ - { - "name": "excession", - "mac": "c8:7f:54:07:91:90", - "port": "22" - } - ] -} diff --git a/cnc/main.py b/cnc/main.py index c9c6b5c..3cac338 100755 --- a/cnc/main.py +++ b/cnc/main.py @@ -1,4 +1,3 @@ -from email.policy import default import subprocess from pathlib import Path from time import sleep @@ -6,16 +5,17 @@ import click import yaml -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel from rich.console import Console from typing_extensions import Self -from xdg_base_dirs import xdg_config_home console = Console() -CONFIG_DIR = xdg_config_home() / "cnc" +CONFIG_DIR = Path.home() / ".config/cnc" CONFIG_FILE = CONFIG_DIR / "config.yml" +CONFIG_DIR.mkdir(parents=True, exist_ok=True) + HostKey = NewType("HostKey", str) diff --git a/devenv.nix.bak b/devenv.nix.bak deleted file mode 100644 index 0d8ac85..0000000 --- a/devenv.nix.bak +++ /dev/null @@ -1,35 +0,0 @@ -{pkgs, ...}: { - # https://devenv.sh/basics/ - env.GREET = "devenv"; - - # https://devenv.sh/packages/ - packages = [ - pkgs.git - pkgs.nodePackages.pyright - pkgs.ruff - ]; - - # https://devenv.sh/scripts/ - scripts.hello.exec = "echo hello from $GREET"; - - enterShell = '' - hello - git --version - ''; - - # https://devenv.sh/languages/ - # languages.nix.enable = true; - # - languages.python = { - enable = true; - poetry.enable = true; - }; - - # https://devenv.sh/pre-commit-hooks/ - # pre-commit.hooks.shellcheck.enable = true; - - # https://devenv.sh/processes/ - # processes.ping.exec = "ping example.com"; - - # See full reference at https://devenv.sh/reference/options/ -} diff --git a/devenv.yaml.bak b/devenv.yaml.bak deleted file mode 100644 index c7cb5ce..0000000 --- a/devenv.yaml.bak +++ /dev/null @@ -1,3 +0,0 @@ -inputs: - nixpkgs: - url: github:NixOS/nixpkgs/nixpkgs-unstable diff --git a/flake.lock b/flake.lock index 0427830..c8c8ff2 100644 --- a/flake.lock +++ b/flake.lock @@ -70,6 +70,24 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -196,6 +214,40 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1683500055, + "narHash": "sha256-K/h9MKFQPkVrF9ikRSkYmsEscS4mHqO68mmHQLAdb1c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b12e23df623e88ad982229bdf9ea8fe81702a9ba", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1683444282, + "narHash": "sha256-EBSqcwtN5bSinvTdn/zGsYhR/42RU+WwYJWVpKxU+h8=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "aedba94fdebc9cdaa811d33f991c1b9b57bb5460", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": [ @@ -228,7 +280,8 @@ "inputs": { "devenv": "devenv", "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "poetry2nix": "poetry2nix" } }, "systems": { @@ -245,6 +298,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 55a472d..954c87f 100644 --- a/flake.nix +++ b/flake.nix @@ -3,17 +3,29 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; devenv.url = "github:cachix/devenv"; flake-utils.url = "github:numtide/flake-utils"; + poetry2nix.url = "github:nix-community/poetry2nix"; }; - outputs = { self, nixpkgs, devenv, flake-utils, ... } @ inputs: + outputs = { self, nixpkgs, devenv, flake-utils, poetry2nix, ... } @ inputs: flake-utils.lib.eachDefaultSystem (system: - let pkgs = nixpkgs.legacyPackages.${system}; in + let + inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication; + pkgs = nixpkgs.legacyPackages.${system}; + python310 = pkgs.python310Full; + in { - devShell.x86_64-linux = devenv.lib.mkShell { + packages = { + cnc = mkPoetryApplication { + projectDir = ./.; + python = python310; + preferWheel = true; + }; + default = self.packages.${system}.cnc; + }; + devShells.default = devenv.lib.mkShell { inherit inputs pkgs; modules = [ ({ pkgs, ... }: { - packages = [ pkgs.git pkgs.nodePackages.pyright @@ -23,8 +35,8 @@ languages.python = { enable = true; poetry.enable = true; + package = python310; }; - }) ]; }; diff --git a/poetry.lock b/poetry.lock index a75eb11..58dad5c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. +# This file is automatically @generated by Poetry and should not be changed by hand. [[package]] name = "appnope" @@ -1018,19 +1018,7 @@ files = [ {file = "wcwidth-0.2.6.tar.gz", hash = "sha256:a5220780a404dbe3353789870978e472cfe477761f06ee55077256e509b156d0"}, ] -[[package]] -name = "xdg-base-dirs" -version = "6.0.0" -description = "Variables defined by the XDG Base Directory Specification" -category = "main" -optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "xdg_base_dirs-6.0.0-py3-none-any.whl", hash = "sha256:71b878d3b6c80923a8ddd7c4fb25f9f694c6796aa79214c3fe32dd49a13dcc82"}, - {file = "xdg_base_dirs-6.0.0.tar.gz", hash = "sha256:3bc8813e260a78acba2f718b48eb00b5ff82bd9f02688b54b9e4ccd8a65d42cc"}, -] - [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "a3f22750dba57bc54bfb35e5fe339b0fbc8a990cbe818c5cdde2c7629a9b863b" +content-hash = "caab45b3acc8e7b44da481976942eedc53ebf16b831d859fd618da10534bec6d" diff --git a/pyproject.toml b/pyproject.toml index 1f27e9c..768d631 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,6 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.10" rich = "^13.3.5" -xdg-base-dirs = "^6.0.0" pydantic = "^1.10.7" pyyaml = "^6.0" click = "^8.1.3"