forked from lix-project/lix-installer
fish support (#76)
* Make plans versioned * Delint * speeeeeeeeling * remove file that was dead * Flesh out docs and improve public API * Speeling * Fixups * Fix doctests * Do a better job with actionstate * Add some more docs * Fix doctest * Make CLI stuff optional * Touchup * Speeling * Add fish support * Add shell tests * Add login shell tests * Improve provisioning behavior of shell profiles * Make created shell profiles executable * Bump nix * Try interactive shell * Fixup merge * Bad yaml, bad * Tweak ci * Set GITHUB_PATH * Do github runner automatically * Use GITHUB_PATH more * use login shells again * Ouytput github path in ci * Okay so GITHUB_PATH is a UNIX socket? * Okay yup they are UNIX sockets * Have the macs dump their github path * YAML stuff * Pass github path in invocation * Bump plans * Okay it is not a socket * Remove debugging * Review fixes * Pass correct shell arg to mac * Echo github path * Echo the path, then... * Join GITHUB_PATH writes
This commit is contained in:
parent
90bab4034c
commit
f58280a11a
104
.github/workflows/ci.yml
vendored
104
.github/workflows/ci.yml
vendored
|
@ -65,31 +65,49 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
needs: build-x86_64-linux
|
||||
steps:
|
||||
- run: sudo apt install fish zsh
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: harmonic-x86_64-linux
|
||||
- name: Set executable
|
||||
run: chmod +x ./harmonic
|
||||
|
||||
- name: Initial install
|
||||
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
run: sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
- name: Initial uninstall (without a `nix run` first)
|
||||
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
||||
|
||||
run: sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||
- name: Repeated install
|
||||
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
run: sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
- name: echo $PATH
|
||||
run: echo $PATH
|
||||
- name: Test `nix`
|
||||
run: |
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
nix run nixpkgs#fortune
|
||||
if: success() || failure()
|
||||
run: nix run nixpkgs#fortune
|
||||
- name: Test bash
|
||||
run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
if: success() || failure()
|
||||
shell: bash --login {0}
|
||||
- name: Test sh
|
||||
run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
if: success() || failure()
|
||||
shell: sh -l {0}
|
||||
- name: Test zsh
|
||||
run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
if: success() || failure()
|
||||
shell: zsh --login --interactive {0}
|
||||
## Broken until https://github.com/NixOS/nix/pull/7105 is released due to the version on Ubuntu's runners
|
||||
# - name: Test fish
|
||||
# run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
# if: success() || failure()
|
||||
# shell: fish --login {0}
|
||||
- name: Repeated uninstall
|
||||
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
||||
run: sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||
|
||||
run-steam-deck:
|
||||
name: Run Steam Deck (mock)
|
||||
runs-on: ubuntu-22.04
|
||||
needs: build-x86_64-linux
|
||||
steps:
|
||||
- run: sudo apt install fish zsh
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: harmonic-x86_64-linux
|
||||
|
@ -101,24 +119,40 @@ jobs:
|
|||
echo -e "#! /bin/sh\nexit 0" | sudo tee -a /bin/steamos-readonly
|
||||
sudo chmod +x /bin/steamos-readonly
|
||||
sudo useradd -m deck
|
||||
|
||||
- name: Initial install
|
||||
run: sudo PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install steam-deck --persistence `pwd`/ci-test-nix --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
run: sudo GITHUB_PATH=$GITHUB_PATH PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install steam-deck --persistence `pwd`/ci-test-nix --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
- name: Initial uninstall (without a `nix run` first)
|
||||
run: |
|
||||
cp /nix/harmonic ./harmonic # Since /nix is a mount we must avoid requiring it to remain existing
|
||||
sudo PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||
|
||||
sudo GITHUB_PATH=$GITHUB_PATH PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||
- name: Repeated install
|
||||
run: sudo PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install steam-deck --persistence `pwd`/ci-test-nix --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
run: sudo GITHUB_PATH=$GITHUB_PATH PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install steam-deck --persistence `pwd`/ci-test-nix --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
- name: echo $PATH
|
||||
run: echo $PATH
|
||||
- name: Test `nix`
|
||||
run: |
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
nix run nixpkgs#fortune
|
||||
if: success() || failure()
|
||||
run: nix run nixpkgs#fortune
|
||||
- name: Test bash
|
||||
run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
if: success() || failure()
|
||||
shell: bash --login {0}
|
||||
- name: Test sh
|
||||
run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
if: success() || failure()
|
||||
shell: sh -l {0}
|
||||
- name: Test zsh
|
||||
run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
if: success() || failure()
|
||||
shell: zsh --login --interactive {0}
|
||||
## Broken until https://github.com/NixOS/nix/pull/7105 is released due to the version on Ubuntu's runners
|
||||
# - name: Test fish
|
||||
# run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
# if: success() || failure()
|
||||
# shell: fish --login {0}
|
||||
- name: Repeated uninstall
|
||||
run: |
|
||||
cp /nix/harmonic ./harmonic # Since /nix is a mount we must avoid requiring it to remain existing
|
||||
sudo PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
||||
sudo GITHUB_PATH=$GITHUB_PATH PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||
|
||||
build-x86_64-darwin:
|
||||
name: Build x86_64 Darwin
|
||||
|
@ -144,27 +178,43 @@ jobs:
|
|||
runs-on: macos-12
|
||||
needs: build-x86_64-darwin
|
||||
steps:
|
||||
- run: brew install fish
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: harmonic-x86_64-darwin
|
||||
- name: Set executable
|
||||
run: chmod +x ./harmonic
|
||||
|
||||
- name: Initial install
|
||||
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
run: sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
- name: Initial uninstall (without a `nix run` first)
|
||||
run: |
|
||||
cp /nix/harmonic ./harmonic # Since /nix is a mount we must avoid requiring it to remain existing
|
||||
sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||
|
||||
sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||
- name: Repeated install
|
||||
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
run: sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
||||
- name: echo $PATH
|
||||
run: echo $PATH
|
||||
- name: Test `nix`
|
||||
run: |
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
nix run nixpkgs#fortune
|
||||
if: success() || failure()
|
||||
run: nix run nixpkgs#fortune
|
||||
- name: Test bash
|
||||
run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
if: success() || failure()
|
||||
shell: bash --login {0}
|
||||
- name: Test sh
|
||||
run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
if: success() || failure()
|
||||
shell: sh -l {0}
|
||||
- name: Test zsh
|
||||
run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
if: success() || failure()
|
||||
shell: zsh --login --interactive {0}
|
||||
- name: Test fish
|
||||
run: nix-instantiate -E 'builtins.currentTime' --eval
|
||||
if: success() || failure()
|
||||
shell: fish --login {0}
|
||||
- name: Repeated uninstall
|
||||
run: |
|
||||
cp /nix/harmonic ./harmonic # Since /nix is a mount we must avoid requiring it to remain existing
|
||||
sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||
sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||
|
|
@ -1,24 +1,40 @@
|
|||
use crate::action::base::CreateOrAppendFile;
|
||||
use crate::action::base::{CreateDirectory, CreateOrAppendFile};
|
||||
use crate::action::{Action, ActionDescription, ActionError, StatefulAction};
|
||||
|
||||
use std::path::Path;
|
||||
use nix::unistd::User;
|
||||
use std::path::{Path, PathBuf};
|
||||
use tokio::task::JoinSet;
|
||||
|
||||
// Fish has different syntax than zsh/bash, treat it separate
|
||||
const PROFILE_FISH_SUFFIX: &str = "conf.d/nix.fish";
|
||||
|
||||
/**
|
||||
Each of these are common values of $__fish_sysconf_dir,
|
||||
under which Fish will look for a file named
|
||||
[`PROFILE_FISH_SUFFIX`].
|
||||
*/
|
||||
const PROFILE_FISH_PREFIXES: &[&str] = &[
|
||||
"/etc/fish", // standard
|
||||
"/usr/local/etc/fish", // their installer .pkg for macOS
|
||||
"/opt/homebrew/etc/fish", // homebrew
|
||||
"/opt/local/etc/fish", // macports
|
||||
];
|
||||
const PROFILE_TARGETS: &[&str] = &[
|
||||
"/etc/bashrc",
|
||||
"/etc/profile.d/nix.sh",
|
||||
"/etc/zshrc",
|
||||
"/etc/bash.bashrc",
|
||||
"/etc/zsh/zshrc",
|
||||
// TODO(@hoverbear): FIsh
|
||||
];
|
||||
const PROFILE_NIX_FILE: &str = "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh";
|
||||
const PROFILE_NIX_FILE_SHELL: &str = "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh";
|
||||
const PROFILE_NIX_FILE_FISH: &str = "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish";
|
||||
|
||||
/**
|
||||
Configure any detected shell profiles to include Nix support
|
||||
*/
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
|
||||
pub struct ConfigureShellProfile {
|
||||
create_directories: Vec<StatefulAction<CreateDirectory>>,
|
||||
create_or_append_files: Vec<StatefulAction<CreateOrAppendFile>>,
|
||||
}
|
||||
|
||||
|
@ -26,26 +42,92 @@ impl ConfigureShellProfile {
|
|||
#[tracing::instrument(skip_all)]
|
||||
pub async fn plan() -> Result<StatefulAction<Self>, ActionError> {
|
||||
let mut create_or_append_files = Vec::default();
|
||||
let mut create_directories = Vec::default();
|
||||
|
||||
let shell_buf = format!(
|
||||
"\n\
|
||||
# Nix\n\
|
||||
if [ -e '{PROFILE_NIX_FILE_SHELL}' ]; then\n\
|
||||
{inde}. '{PROFILE_NIX_FILE_SHELL}'\n\
|
||||
fi\n\
|
||||
# End Nix\n
|
||||
\n",
|
||||
inde = " ", // indent
|
||||
);
|
||||
|
||||
for profile_target in PROFILE_TARGETS {
|
||||
let path = Path::new(profile_target);
|
||||
if !path.exists() {
|
||||
tracing::trace!("Did not plan to edit `{profile_target}` as it does not exist.");
|
||||
let profile_target_path = Path::new(profile_target);
|
||||
if let Some(parent) = profile_target_path.parent() {
|
||||
if !parent.exists() {
|
||||
tracing::trace!(
|
||||
"Did not plan to edit `{profile_target}` as it's parent folder does not exist."
|
||||
);
|
||||
continue;
|
||||
}
|
||||
create_or_append_files.push(
|
||||
CreateOrAppendFile::plan(
|
||||
profile_target_path,
|
||||
None,
|
||||
None,
|
||||
0o0755,
|
||||
shell_buf.to_string(),
|
||||
)
|
||||
.await?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let fish_buf = format!(
|
||||
"\n\
|
||||
# Nix\n\
|
||||
if test -e '{PROFILE_NIX_FILE_FISH}'\n\
|
||||
{inde}. '{PROFILE_NIX_FILE_FISH}'\n\
|
||||
end\n\
|
||||
# End Nix\n\
|
||||
\n",
|
||||
inde = " ", // indent
|
||||
);
|
||||
|
||||
for fish_prefix in PROFILE_FISH_PREFIXES {
|
||||
let fish_prefix_path = PathBuf::from(fish_prefix);
|
||||
|
||||
if !fish_prefix_path.exists() {
|
||||
// If the prefix doesn't exist, don't create the `conf.d/nix.fish`
|
||||
continue;
|
||||
}
|
||||
let buf = format!(
|
||||
"\n\
|
||||
# Nix\n\
|
||||
if [ -e '{PROFILE_NIX_FILE}' ]; then\n\
|
||||
. '{PROFILE_NIX_FILE}'\n\
|
||||
fi\n\
|
||||
# End Nix\n
|
||||
\n",
|
||||
|
||||
let mut profile_target = fish_prefix_path;
|
||||
profile_target.push(PROFILE_FISH_SUFFIX);
|
||||
|
||||
if let Some(conf_d) = profile_target.parent() {
|
||||
create_directories.push(
|
||||
CreateDirectory::plan(conf_d.to_path_buf(), None, None, 0o0644, false).await?,
|
||||
);
|
||||
}
|
||||
|
||||
create_or_append_files.push(
|
||||
CreateOrAppendFile::plan(profile_target, None, None, 0o0755, fish_buf.to_string())
|
||||
.await?,
|
||||
);
|
||||
}
|
||||
|
||||
// If the `$GITHUB_PATH` environment exists, we're almost certainly running on Github
|
||||
// Actions, and almost certainly wants the relevant `$PATH` additions added.
|
||||
if let Ok(github_path) = std::env::var("GITHUB_PATH") {
|
||||
let mut buf = "/nix/var/nix/profiles/default/bin\n".to_string();
|
||||
// Actions runners operate as `runner` user by default
|
||||
if let Ok(Some(runner)) = User::from_name("runner") {
|
||||
buf += &format!(
|
||||
"/nix/var/nix/profiles/per-user/{}/profile/bin\n",
|
||||
runner.uid
|
||||
);
|
||||
}
|
||||
create_or_append_files
|
||||
.push(CreateOrAppendFile::plan(path, None, None, 0o0644, buf).await?);
|
||||
.push(CreateOrAppendFile::plan(&github_path, None, None, None, buf).await?)
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
create_directories,
|
||||
create_or_append_files,
|
||||
}
|
||||
.into())
|
||||
|
@ -70,14 +152,21 @@ impl Action for ConfigureShellProfile {
|
|||
async fn execute(&mut self) -> Result<(), ActionError> {
|
||||
let Self {
|
||||
create_or_append_files,
|
||||
create_directories,
|
||||
} = self;
|
||||
|
||||
for create_directory in create_directories {
|
||||
create_directory.try_execute().await?;
|
||||
}
|
||||
|
||||
let mut set = JoinSet::new();
|
||||
let mut errors = Vec::default();
|
||||
|
||||
for (idx, create_or_append_file) in create_or_append_files.iter().enumerate() {
|
||||
let span = tracing::Span::current().clone();
|
||||
let mut create_or_append_file_clone = create_or_append_file.clone();
|
||||
let _abort_handle = set.spawn(async move {
|
||||
let _ = span.enter();
|
||||
create_or_append_file_clone.try_execute().await?;
|
||||
Result::<_, ActionError>::Ok((idx, create_or_append_file_clone))
|
||||
});
|
||||
|
@ -114,6 +203,7 @@ impl Action for ConfigureShellProfile {
|
|||
#[tracing::instrument(skip_all)]
|
||||
async fn revert(&mut self) -> Result<(), ActionError> {
|
||||
let Self {
|
||||
create_directories,
|
||||
create_or_append_files,
|
||||
} = self;
|
||||
|
||||
|
@ -138,6 +228,10 @@ impl Action for ConfigureShellProfile {
|
|||
};
|
||||
}
|
||||
|
||||
for create_directory in create_directories {
|
||||
create_directory.try_revert().await?;
|
||||
}
|
||||
|
||||
if !errors.is_empty() {
|
||||
if errors.len() == 1 {
|
||||
return Err(errors.into_iter().next().unwrap().into());
|
||||
|
|
|
@ -23,12 +23,11 @@ arguments. For example, several 'composite' actions accept a [`CommonSettings`](
|
|||
You can manually plan, execute, then revert an [`Action`] like so:
|
||||
|
||||
```rust,no_run
|
||||
# async fn wrapper() -> Result<(), harmonic::HarmonicError> {
|
||||
# async fn wrapper() {
|
||||
use harmonic::action::base::CreateDirectory;
|
||||
let mut action = CreateDirectory::plan("/nix", None, None, 0o0755, true).await?;
|
||||
action.try_execute().await?;
|
||||
action.try_revert().await?;
|
||||
# Ok(())
|
||||
let mut action = CreateDirectory::plan("/nix", None, None, 0o0755, true).await.unwrap();
|
||||
action.try_execute().await.unwrap();
|
||||
action.try_revert().await.unwrap();
|
||||
# }
|
||||
```
|
||||
|
||||
|
|
|
@ -10,16 +10,16 @@ use crate::channel_value::ChannelValue;
|
|||
|
||||
/// Default [`nix_package_url`](CommonSettings::nix_package_url) for Linux x86_64
|
||||
pub const NIX_X64_64_LINUX_URL: &str =
|
||||
"https://releases.nixos.org/nix/nix-2.11.0/nix-2.11.0-x86_64-linux.tar.xz";
|
||||
"https://releases.nixos.org/nix/nix-2.11.1/nix-2.11.1-x86_64-linux.tar.xz";
|
||||
/// Default [`nix_package_url`](CommonSettings::nix_package_url) for Linux aarch64
|
||||
pub const NIX_AARCH64_LINUX_URL: &str =
|
||||
"https://releases.nixos.org/nix/nix-2.11.0/nix-2.11.0-aarch64-linux.tar.xz";
|
||||
"https://releases.nixos.org/nix/nix-2.11.1/nix-2.11.1-aarch64-linux.tar.xz";
|
||||
/// Default [`nix_package_url`](CommonSettings::nix_package_url) for Darwin x86_64
|
||||
pub const NIX_X64_64_DARWIN_URL: &str =
|
||||
"https://releases.nixos.org/nix/nix-2.11.0/nix-2.11.0-x86_64-darwin.tar.xz";
|
||||
"https://releases.nixos.org/nix/nix-2.11.1/nix-2.11.1-x86_64-darwin.tar.xz";
|
||||
/// Default [`nix_package_url`](CommonSettings::nix_package_url) for Darwin aarch64
|
||||
pub const NIX_AARCH64_DARWIN_URL: &str =
|
||||
"https://releases.nixos.org/nix/nix-2.11.0/nix-2.11.0-aarch64-darwin.tar.xz";
|
||||
"https://releases.nixos.org/nix/nix-2.11.1/nix-2.11.1-aarch64-darwin.tar.xz";
|
||||
|
||||
/** Common settings used by all [`BuiltinPlanner`](crate::planner::BuiltinPlanner)s
|
||||
|
||||
|
|
23
tests/fixtures/darwin/darwin-multi.json
vendored
23
tests/fixtures/darwin/darwin-multi.json
vendored
|
@ -85,7 +85,7 @@
|
|||
"action": "provision_nix",
|
||||
"fetch_nix": {
|
||||
"action": {
|
||||
"url": "https://releases.nixos.org/nix/nix-2.11.0/nix-2.11.0-x86_64-darwin.tar.xz",
|
||||
"url": "https://releases.nixos.org/nix/nix-2.11.1/nix-2.11.1-x86_64-darwin.tar.xz",
|
||||
"dest": "/nix/temp-install-dir"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
|
@ -556,14 +556,15 @@
|
|||
},
|
||||
"configure_shell_profile": {
|
||||
"action": {
|
||||
"create_directories": [],
|
||||
"create_or_append_files": [
|
||||
{
|
||||
"action": {
|
||||
"path": "/etc/bashrc",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 420,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
},
|
||||
|
@ -572,8 +573,18 @@
|
|||
"path": "/etc/zshrc",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 420,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"path": "/etc/bash.bashrc",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
}
|
||||
|
@ -659,7 +670,7 @@
|
|||
"nix_build_group_id": 3000,
|
||||
"nix_build_user_prefix": "_nixbld",
|
||||
"nix_build_user_id_base": 300,
|
||||
"nix_package_url": "https://releases.nixos.org/nix/nix-2.11.0/nix-2.11.0-x86_64-darwin.tar.xz",
|
||||
"nix_package_url": "https://releases.nixos.org/nix/nix-2.11.1/nix-2.11.1-x86_64-darwin.tar.xz",
|
||||
"extra_conf": [],
|
||||
"force": false
|
||||
},
|
||||
|
|
39
tests/fixtures/linux/linux-multi.json
vendored
39
tests/fixtures/linux/linux-multi.json
vendored
|
@ -17,7 +17,7 @@
|
|||
"action": "provision_nix",
|
||||
"fetch_nix": {
|
||||
"action": {
|
||||
"url": "https://releases.nixos.org/nix/nix-2.11.0/nix-2.11.0-x86_64-linux.tar.xz",
|
||||
"url": "https://releases.nixos.org/nix/nix-2.11.1/nix-2.11.1-x86_64-linux.tar.xz",
|
||||
"dest": "/nix/temp-install-dir"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
|
@ -488,14 +488,45 @@
|
|||
},
|
||||
"configure_shell_profile": {
|
||||
"action": {
|
||||
"create_directories": [],
|
||||
"create_or_append_files": [
|
||||
{
|
||||
"action": {
|
||||
"path": "/etc/bashrc",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"path": "/etc/profile.d/nix.sh",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"path": "/etc/zshrc",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"path": "/etc/bash.bashrc",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 420,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
}
|
||||
|
@ -581,7 +612,7 @@
|
|||
"nix_build_group_id": 3000,
|
||||
"nix_build_user_prefix": "nixbld",
|
||||
"nix_build_user_id_base": 3000,
|
||||
"nix_package_url": "https://releases.nixos.org/nix/nix-2.11.0/nix-2.11.0-x86_64-linux.tar.xz",
|
||||
"nix_package_url": "https://releases.nixos.org/nix/nix-2.11.1/nix-2.11.1-x86_64-linux.tar.xz",
|
||||
"extra_conf": [],
|
||||
"force": false
|
||||
}
|
||||
|
|
39
tests/fixtures/linux/steam-deck.json
vendored
39
tests/fixtures/linux/steam-deck.json
vendored
|
@ -60,7 +60,7 @@
|
|||
"action": "provision_nix",
|
||||
"fetch_nix": {
|
||||
"action": {
|
||||
"url": "https://releases.nixos.org/nix/nix-2.11.0/nix-2.11.0-x86_64-linux.tar.xz",
|
||||
"url": "https://releases.nixos.org/nix/nix-2.11.1/nix-2.11.1-x86_64-linux.tar.xz",
|
||||
"dest": "/nix/temp-install-dir"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
|
@ -531,14 +531,45 @@
|
|||
},
|
||||
"configure_shell_profile": {
|
||||
"action": {
|
||||
"create_directories": [],
|
||||
"create_or_append_files": [
|
||||
{
|
||||
"action": {
|
||||
"path": "/etc/bashrc",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"path": "/etc/profile.d/nix.sh",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"path": "/etc/zshrc",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"path": "/etc/bash.bashrc",
|
||||
"user": null,
|
||||
"group": null,
|
||||
"mode": 420,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
"mode": 493,
|
||||
"buf": "\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"
|
||||
},
|
||||
"state": "Uncompleted"
|
||||
}
|
||||
|
@ -625,7 +656,7 @@
|
|||
"nix_build_group_id": 3000,
|
||||
"nix_build_user_prefix": "nixbld",
|
||||
"nix_build_user_id_base": 3000,
|
||||
"nix_package_url": "https://releases.nixos.org/nix/nix-2.11.0/nix-2.11.0-x86_64-linux.tar.xz",
|
||||
"nix_package_url": "https://releases.nixos.org/nix/nix-2.11.1/nix-2.11.1-x86_64-linux.tar.xz",
|
||||
"extra_conf": [],
|
||||
"force": false
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ const STEAM_DECK: &str = include_str!("./fixtures/linux/steam-deck.json");
|
|||
const DARWIN_MULTI: &str = include_str!("./fixtures/darwin/darwin-multi.json");
|
||||
|
||||
// Ensure existing plans still parse
|
||||
// If this breaks and you need to update the fixture, it's time to raise version.
|
||||
// If this breaks and you need to update the fixture, disable these tests, bump harmonic to a new version, and update the plans.
|
||||
#[test]
|
||||
fn plan_compat_linux_multi() -> eyre::Result<()> {
|
||||
let _: InstallPlan = serde_json::from_str(LINUX_MULTI)?;
|
||||
|
@ -13,7 +13,7 @@ fn plan_compat_linux_multi() -> eyre::Result<()> {
|
|||
}
|
||||
|
||||
// Ensure existing plans still parse
|
||||
// If this breaks and you need to update the fixture, it's time to raise version.
|
||||
// If this breaks and you need to update the fixture, disable these tests, bump harmonic to a new version, and update the plans.
|
||||
#[test]
|
||||
fn plan_compat_steam_deck() -> eyre::Result<()> {
|
||||
let _: InstallPlan = serde_json::from_str(STEAM_DECK)?;
|
||||
|
@ -21,7 +21,7 @@ fn plan_compat_steam_deck() -> eyre::Result<()> {
|
|||
}
|
||||
|
||||
// Ensure existing plans still parse
|
||||
// If this breaks and you need to update the fixture, it's time to raise version.
|
||||
// If this breaks and you need to update the fixture, disable these tests, bump harmonic to a new version, and update the plans.
|
||||
#[test]
|
||||
fn plan_compat_darwin_multi() -> eyre::Result<()> {
|
||||
let _: InstallPlan = serde_json::from_str(DARWIN_MULTI)?;
|
||||
|
|
Loading…
Reference in a new issue