Skip to content

Commit

Permalink
Nix Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Jul 26, 2024
1 parent 2998f51 commit ce56d20
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Tests/test_fault.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def run(label, steps):
if step[0] == "nl2bench":
cmd = step
else:
cmd = ["swift", "run", "fault"] + step
cmd = shlex.split(os.getenv("PYTEST_FAULT_BIN", "swift run Fault")) + step
print(f"$ {shlex.join(cmd)}")
subprocess.check_call(cmd)

Expand Down
25 changes: 14 additions & 11 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ stdenv.mkDerivation (finalAttrs: {

src = nix-gitignore.gitignoreSourcePure ./.gitignore ./.;

nativeBuildInputs = [ swift swiftpm makeBinaryWrapper ];
swiftpmFlags = [
"--verbose"
];
Expand All @@ -39,6 +38,12 @@ stdenv.mkDerivation (finalAttrs: {
# "-Xswiftc"
# "x86_64-apple-macosx11"
# ];
nativeBuildInputs = [ swift swiftpm makeBinaryWrapper ];

buildInputs = with swiftPackages; [
Foundation
XCTest
] ++ lib.lists.optional (!stdenv.isDarwin) [Dispatch];

propagatedBuildInputs = [
pyenv
Expand All @@ -48,10 +53,9 @@ stdenv.mkDerivation (finalAttrs: {
nl2bench
];

buildInputs = with swiftPackages; [
Foundation
XCTest
] ++ lib.lists.optional (!stdenv.isDarwin) [Dispatch];
nativeCheckInputs = with python3.pkgs; [
pytest
];

configurePhase = generated.configure;

Expand All @@ -66,9 +70,9 @@ stdenv.mkDerivation (finalAttrs: {
export LD_LIBRARY_PATH=${swiftPackages.Dispatch}/lib:$LD_LIBRARY_PATH
'';

doCheck = !swiftPackages.stdenv.isDarwin;
doCheck = true;

preCheck = ''
faultEnv = ''
export PYTHONPATH=${pyenv}/${pyenv.sitePackages}
export PATH=${verilog}/bin:$PATH
export PATH=${yosys}/bin:$PATH
Expand All @@ -77,9 +81,8 @@ stdenv.mkDerivation (finalAttrs: {
'';

checkPhase = ''
${finalAttrs.preCheck}
echo $PATH
swift test
${finalAttrs.faultEnv}
PYTEST_FAULT_BIN="$(swiftpmBinPath)/fault" pytest
'';

fixupPhase = ''
Expand All @@ -98,5 +101,5 @@ stdenv.mkDerivation (finalAttrs: {
platforms = platforms.linux ++ platforms.darwin;
};

shellHook = finalAttrs.preCheck + finalAttrs.preBuild;
shellHook = finalAttrs.faultEnv + finalAttrs.preBuild;
})
11 changes: 6 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
nix-eda.url = github:efabless/nix-eda;
nl2bench.url = github:donn/nl2bench;
quaigh = {
url = github:coloquinte/quaigh;
url = github:donn/quaigh/fix_nix_linux;
inputs.nixpkgs.follows = "nix-eda/nixpkgs";
};
};
Expand Down

0 comments on commit ce56d20

Please sign in to comment.