Add nixos module to import secrets automatically #154
@ -5,11 +5,17 @@
|
||||
imports = [
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
perSystem = { pkgs, ... }: {
|
||||
perSystem = { self', pkgs, ... }: {
|
||||
treefmt.projectRootFile = "flake.nix";
|
||||
treefmt.flakeCheck = true;
|
||||
treefmt.flakeFormatter = true;
|
||||
treefmt.programs.shellcheck.enable = true;
|
||||
|
||||
treefmt.programs.mypy.enable = true;
|
||||
treefmt.programs.mypy.directories = {
|
||||
"pkgs/clan-cli".extraPythonPackages = self'.packages.clan-cli.testDependencies;
|
||||
};
|
||||
|
||||
treefmt.settings.formatter.nix = {
|
||||
command = "sh";
|
||||
options = [
|
||||
@ -38,4 +44,3 @@
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,18 @@
|
||||
import argparse
|
||||
import sys
|
||||
from types import ModuleType
|
||||
from typing import Optional
|
||||
|
||||
from . import admin, secrets, update
|
||||
from . import admin, config, secrets, update
|
||||
from .errors import ClanError
|
||||
from .ssh import cli as ssh_cli
|
||||
|
||||
argcomplete = None
|
||||
argcomplete: Optional[ModuleType] = None
|
||||
try:
|
||||
import argcomplete
|
||||
import argcomplete # type: ignore[no-redef]
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
config = None
|
||||
try:
|
||||
from . import config
|
||||
except ImportError: # jsonschema not installed
|
||||
pass
|
||||
|
||||
|
||||
# this will be the entrypoint under /bin/clan (see pyproject.toml config)
|
||||
def main() -> None:
|
||||
@ -26,7 +22,6 @@ def main() -> None:
|
||||
parser_admin = subparsers.add_parser("admin", help="administrate a clan")
|
||||
admin.register_parser(parser_admin)
|
||||
|
||||
if config:
|
||||
parser_config = subparsers.add_parser("config", help="set nixos configuration")
|
||||
config.register_parser(parser_config)
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
, black
|
||||
, bubblewrap
|
||||
, installShellFiles
|
||||
, mypy
|
||||
, nix
|
||||
, openssh
|
||||
, pytest
|
||||
@ -31,7 +30,6 @@ let
|
||||
pytest
|
||||
pytest-cov
|
||||
pytest-subprocess
|
||||
mypy
|
||||
openssh
|
||||
stdenv.cc
|
||||
];
|
||||
@ -60,16 +58,7 @@ python3.pkgs.buildPythonPackage {
|
||||
];
|
||||
propagatedBuildInputs = dependencies;
|
||||
|
||||
passthru.tests = {
|
||||
clan-mypy = runCommand "clan-mypy" { } ''
|
||||
export CLAN_OPTIONS_FILE="${CLAN_OPTIONS_FILE}"
|
||||
cp -r ${source} ./src
|
||||
chmod +w -R ./src
|
||||
cd ./src
|
||||
${checkPython}/bin/mypy .
|
||||
touch $out
|
||||
'';
|
||||
clan-pytest = runCommand "clan-tests"
|
||||
passthru.tests.clan-pytest = runCommand "clan-tests"
|
||||
{
|
||||
nativeBuildInputs = [ age zerotierone bubblewrap sops nix openssh rsync stdenv.cc ];
|
||||
} ''
|
||||
@ -80,7 +69,6 @@ python3.pkgs.buildPythonPackage {
|
||||
NIX_STATE_DIR=$TMPDIR/nix ${checkPython}/bin/python -m pytest -s ./tests
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
|
||||
passthru.devDependencies = [
|
||||
ruff
|
||||
@ -89,6 +77,8 @@ python3.pkgs.buildPythonPackage {
|
||||
wheel
|
||||
] ++ testDependencies;
|
||||
|
||||
passthru.testDependencies = testDependencies;
|
||||
|
||||
makeWrapperArgs = [
|
||||
"--set CLAN_FLAKE ${self}"
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user