File tree Expand file tree Collapse file tree 4 files changed +105
-2
lines changed Expand file tree Collapse file tree 4 files changed +105
-2
lines changed Original file line number Diff line number Diff line change
1
+ [build-system ]
2
+ requires = [" setuptools" ]
3
+ build-backend = " setuptools.build_meta"
4
+
5
+ [project ]
6
+ name = " nixos-anywhere-pxe"
7
+ description = " Install NixOS with PXE"
8
+ dynamic = [" version" ]
9
+ scripts = { nixos-anywhere-pxe = " nixos_anywhere_pxe:main" }
10
+
11
+ [tool .pytest .ini_options ]
12
+ addopts = " --cov . --cov-report term --cov-fail-under=100 --no-cov-on-fail"
13
+
14
+ [tool .mypy ]
15
+ python_version = " 3.10"
16
+ warn_redundant_casts = true
17
+ disallow_untyped_calls = true
18
+ disallow_untyped_defs = true
19
+ no_implicit_optional = true
20
+
21
+ [[tool .mypy .overrides ]]
22
+ module = " setuptools.*"
23
+ ignore_missing_imports = true
24
+
25
+ [[tool .mypy .overrides ]]
26
+ module = " pytest.*"
27
+ ignore_missing_imports = true
28
+
29
+ [tool .ruff ]
30
+ line-length = 88
31
+
32
+ select = [" E" , " F" , " I" ]
33
+ ignore = [ " E501" ]
34
+
35
+ [tool .black ]
36
+ line-length = 88
37
+ target-version = [' py310' ]
38
+ include = ' \.pyi?$'
39
+ exclude = '''
40
+ /(
41
+ \.git
42
+ | \.hg
43
+ | \.mypy_cache
44
+ | \.tox
45
+ | \.venv
46
+ | _build
47
+ | buck-out
48
+ | build
49
+ | dist
50
+ # The following are specific to Black, you probably don't want those.
51
+ | blib2to3
52
+ | tests/data
53
+ | profiling
54
+ )/
55
+ '''
Original file line number Diff line number Diff line change 2
2
perSystem = { config , pkgs , ... } : {
3
3
packages = {
4
4
nixos-anywhere = pkgs . callPackage ./. { } ;
5
+ nixos-anywhere-pxe = pkgs . callPackage ./nixos_anywhere_pxe { } ;
5
6
default = config . packages . nixos-anywhere ;
6
7
} ;
7
8
devShells . default = config . packages . nixos-anywhere . devShell ;
Original file line number Diff line number Diff line change 21
21
22
22
NIXOS_ANYWHERE_SH = Path (__file__ ).parent .absolute () / "src/nixos-anywhere.sh"
23
23
24
+
24
25
def run (
25
26
cmd : Union [str , list [str ]],
26
27
input : Optional [str ] = None ,
@@ -384,13 +385,14 @@ def build_pxe_image(netboot_image_flake: str) -> Path:
384
385
)
385
386
return Path (res .stdout .strip ())
386
387
388
+
387
389
def pause ():
388
390
print ("" )
389
391
# no clue how to flush stdin with python. Gonna wait for a specific string instead (as opposed to wait for [enter]).
390
392
answer = ""
391
- while ( answer != "continue" ) :
393
+ while answer != "continue" :
392
394
answer = input (
393
- "Answer 'continue' to terminate this script and tear down the network to the server: "
395
+ "Answer 'continue' to terminate this script and tear down the network to the server: "
394
396
)
395
397
396
398
Original file line number Diff line number Diff line change
1
+ { pkgs
2
+ , lib
3
+ , python3
4
+ , ruff
5
+ , runCommand
6
+ } :
7
+ let
8
+ src = ../.. ;
9
+
10
+ devDependencies = lib . attrValues {
11
+ inherit ( pkgs ) ruff ;
12
+ inherit ( python3 . pkgs )
13
+ black
14
+ mypy
15
+ pytest
16
+ pytest-cov
17
+ pytest-subprocess
18
+ setuptools
19
+ wheel
20
+ ;
21
+ } ;
22
+
23
+ package = python3 . pkgs . buildPythonPackage {
24
+ name = "nixos-anywhere-pxe" ;
25
+ inherit src ;
26
+ format = "pyproject" ;
27
+ nativeBuildInputs = [
28
+ python3 . pkgs . setuptools
29
+ ] ;
30
+ passthru . tests = { inherit nixos-anywhere-pxe-mypy ; } ;
31
+ passthru . devDependencies = devDependencies ;
32
+ } ;
33
+
34
+ checkPython = python3 . withPackages ( _ps : devDependencies ) ;
35
+
36
+ nixos-anywhere-pxe-mypy = runCommand "nixos-anywhere-pxe-mypy" { } ''
37
+ cp -r ${ src } ./src
38
+ chmod +w -R ./src
39
+ cd src
40
+ ${ checkPython } /bin/mypy .
41
+ touch $out
42
+ '' ;
43
+
44
+ in
45
+ package
You can’t perform that action at this time.
0 commit comments