Add new step: GNU Guix by JamesClarke7283 (#1)

* Added new step: guix (basic support)

* Fixed clippy errors and better practice, Thanks To guidence from @enchant97 <Leo Spratt>

* Removed accidental swp file, as pointed out by @strangelittlemonkey in pull request #982

Authored-by: James Clarke <james@james-clarke.ynh.fr>
Approved-by: Thomas Schönauer <t.schoenauer@hgs-wt.at>
This commit is contained in:
DottoDev
2022-10-10 18:03:34 +00:00
committed by GitHub
parent a5e0128e1b
commit 5dffa2c6cc
3 changed files with 21 additions and 0 deletions

View File

@@ -94,6 +94,7 @@ pub enum Step {
GithubCliExtensions,
GitRepos,
Go,
Guix,
Haxelib,
GnomeShellExtensions,
HomeManager,

View File

@@ -191,6 +191,8 @@ fn run() -> Result<()> {
{
runner.execute(Step::Yadm, "yadm", || unix::run_yadm(&ctx))?;
runner.execute(Step::Nix, "nix", || unix::run_nix(&ctx))?;
runner.execute(Step::Guix, "guix", || unix::run_guix(&ctx))?;
runner.execute(Step::HomeManager, "home-manager", || unix::run_home_manager(run_type))?;
runner.execute(Step::Asdf, "asdf", || unix::run_asdf(run_type))?;
runner.execute(Step::Pkgin, "pkgin", || unix::run_pkgin(&ctx))?;

View File

@@ -251,6 +251,24 @@ pub fn run_brew_cask(ctx: &ExecutionContext, variant: BrewVariant) -> Result<()>
Ok(())
}
pub fn run_guix(ctx: &ExecutionContext) -> Result<()> {
let guix = require("guix")?;
let run_type = ctx.run_type();
let output = Command::new(&guix).arg("pull").check_output();
debug!("guix pull output: {:?}", output);
let should_upgrade = output.is_ok();
debug!("Can Upgrade Guix: {:?}", should_upgrade);
print_separator("Guix");
if should_upgrade {
return run_type.execute(&guix).args(&["package", "-u"]).check_run();
}
Err(SkipStep(String::from("Guix Pull Failed, Skipping")).into())
}
pub fn run_nix(ctx: &ExecutionContext) -> Result<()> {
let nix = require("nix")?;
let nix_channel = require("nix-channel")?;