Skip to content

Commit 3695662

Browse files
committed
fix: Move test to example
1 parent 109a6db commit 3695662

File tree

11 files changed

+161
-26
lines changed

11 files changed

+161
-26
lines changed

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
# created when `just run <service>` is used
55
/test/data
66

7-
/nix/cargo-doc-live/target
8-
97
# created when `just run ex-*` is used
108
/example/share-services/pgweb/data/
119
/example/simple/data/
1210
/example/grafana-tempo/data/
11+
/example/cargo-doc-live/target
1312

1413
/.pre-commit-config.yaml

nix/cargo-doc-live/Cargo.lock example/cargo-doc-live/Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/cargo-doc-live/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[package]
2+
name = "test"

example/cargo-doc-live/flake.lock

+106
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/cargo-doc-live/flake.nix

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
4+
flake-parts.url = "github:hercules-ci/flake-parts";
5+
systems.url = "github:nix-systems/default";
6+
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
7+
services-flake.url = "github:juspay/services-flake";
8+
};
9+
outputs = inputs:
10+
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
11+
systems = import inputs.systems;
12+
imports = [
13+
inputs.process-compose-flake.flakeModule
14+
];
15+
perSystem = { self', pkgs, lib, ... }: {
16+
# `process-compose.foo` will add a flake package output called "foo".
17+
# Therefore, this will add a default package that you can build using
18+
# `nix build` and run using `nix run`.
19+
process-compose."default" = { ... }:
20+
{
21+
imports = [
22+
inputs.services-flake.processComposeModules.default
23+
];
24+
25+
services.cargo-doc-live."cargo-doc-live1" = {
26+
src = inputs.self;
27+
enable = true;
28+
port = 8009;
29+
};
30+
31+
settings.processes.test = {
32+
command = pkgs.writeShellApplication {
33+
name = "cargo-doc-live-test";
34+
runtimeInputs = [ pkgs.curl ];
35+
text = ''
36+
curl http://127.0.0.1:8009/test
37+
'';
38+
};
39+
depends_on."cargo-doc-live1".condition = "process_healthy";
40+
};
41+
};
42+
};
43+
};
44+
}
File renamed without changes.

nix/cargo-doc-live/default.nix nix/cargo-doc-live.nix

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ in
66
options = {
77
enable = lib.mkEnableOption name;
88

9+
src = lib.mkOption {
10+
type = types.path;
11+
description = "The src of the cargo";
12+
};
13+
914
port = lib.mkOption {
1015
type = types.port;
1116
description = "The port for 'cargo doc'";
@@ -16,7 +21,7 @@ in
1621
type = types.str;
1722
description = "The crate to use when opening docs in browser";
1823
default = builtins.replaceStrings [ "-" ] [ "_" ]
19-
((lib.trivial.importTOML ./Cargo.toml).package.name);
24+
((lib.trivial.importTOML "${config.src}/Cargo.toml").package.name);
2025
defaultText = "The crate name is derived from the Cargo.toml file";
2126
};
2227

nix/cargo-doc-live/Cargo.toml

-2
This file was deleted.

nix/cargo-doc-live/cargo-doc-live_test.nix

-18
This file was deleted.

nix/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ in
2222
./tempo.nix
2323
./weaviate.nix
2424
./searxng.nix
25-
./cargo-doc-live
25+
./cargo-doc-live.nix
2626
];
2727
}

test/flake.nix

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"${inputs.services-flake}/nix/cassandra_test.nix"
5050
"${inputs.services-flake}/nix/tempo_test.nix"
5151
"${inputs.services-flake}/nix/weaviate_test.nix"
52-
"${inputs.services-flake}/nix/cargo-doc-live/cargo-doc-live_test.nix"
5352
] ++ lib.optionals pkgs.stdenv.isLinux [
5453
# Broken on Darwin: https://github.com/NixOS/nixpkgs/issues/316954
5554
"${inputs.services-flake}/nix/grafana_test.nix"

0 commit comments

Comments
 (0)