Skip to content

Commit

Permalink
fix(nix): add '--init none' only if systemd is not installed
Browse files Browse the repository at this point in the history
fix ci

fix ci

update README

bump version code
  • Loading branch information
tsirysndr committed Mar 6, 2024
1 parent 3f78ca7 commit 0cc5077
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .fluentci/src/dagger/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export const test = async (

const stdout = await ctr.stdout();
console.log(stdout);

await ctr.file("/usr/local/cargo/bin/envhub").export("./envhub");

return stdout;
};

Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,14 @@ jobs:
- name: Setup Fluent CI
uses: fluentci-io/setup-fluentci@v4
- name: Run Tests
run: fluentci run . test
run: |
fluentci run . test
cd demo
../envhub init
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
../envhub use
type hello
hello
../envhub unuse
env:
CLOUDFLARE_ROOT_KEY: 123
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ You can use EnvHub as a [GitHub Action](https://github.com/tsirysndr/setup-envhu
```yaml
- uses: tsirysndr/setup-envhub@v1
with:
version: 'v0.2.15'
version: 'v0.2.16'
- run: envhub --help
```
4 changes: 2 additions & 2 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ license = "MIT"
name = "envhub"
readme = "../../README.md"
repository = "https://github.com/tsirysndr/envhub"
version = "0.2.15"
version = "0.2.16"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0.71"
clap = "3.2.20"
envhub-ext = {path = "../ext", version = "0.1.1"}
envhub-hm = {path = "../hm", version = "0.2.3"}
envhub-hm = {path = "../hm", version = "0.2.4"}
envhub-pkgs = {path = "../pkgs", version = "0.1.2"}
envhub-providers = {path = "../providers", version = "0.2.0"}
envhub-stow = {path = "../stow", version = "0.1.0"}
Expand Down
2 changes: 1 addition & 1 deletion crates/hm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ keywords = ["nix", "shell", "environment", "dotfiles"]
license = "MIT"
name = "envhub-hm"
repository = "https://github.com/tsirysndr/envhub"
version = "0.2.3"
version = "0.2.4"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
13 changes: 11 additions & 2 deletions crates/hm/src/nix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,19 @@ pub fn install() -> Result<(), Error> {
"/nix/var/nix/profiles/default/bin"
),
);
let mut child = Command::new("sh")
.arg("-c")
.arg("type systemctl > /dev/null")
.spawn()?;
let status = child.wait()?;
let init = match status.code() {
Some(0) => "",
_ => "--init none",
};

let linux = match std::env::consts::OS {
"linux" => "linux --extra-conf 'sandbox = false' --init none",
_ => "",
"linux" => format!("linux --extra-conf 'sandbox = false' {}", init),
_ => "".to_string(),
};
let mut child = Command::new("sh")
.arg("-c")
Expand Down

0 comments on commit 0cc5077

Please sign in to comment.