Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSC Resource for oh-my-posh #4340

Open
1 task done
denelon opened this issue Oct 13, 2023 · 16 comments
Open
1 task done

DSC Resource for oh-my-posh #4340

denelon opened this issue Oct 13, 2023 · 16 comments
Assignees
Labels
🚀 feat New feature

Comments

@denelon
Copy link
Contributor

denelon commented Oct 13, 2023

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

Suggested new feature or improvement

I'd like to be able to use the WinGet Configuration feature to configure oh-my-posh.

In the future when DSC v3 supports the "export" behavior, this could also be used as a part of the export a configuration scenario.

Scenario

I want to set up a new device and have the ability to configure oh-my-posh with WinGet Configure or by selecting the configuration in Dev Home.

Additional details

I would expect the Microsoft.WinGet.DSC resource would be used to install oh-my-posh on my machine. Then as a dependency I'd like to be able to use a DSC resource to configure oh-my-posh the way I like it.

oh-my-posh
@denelon denelon added the 🚀 feat New feature label Oct 13, 2023
@denelon
Copy link
Contributor Author

denelon commented Oct 13, 2023

As soon as we get this working, we should put a sample configuration at Dev Home.

@nopeless
Copy link
Contributor

This looks like an interesting feature, but I don't see how this can drastically reduce time setting up oh my posh

@denelon
Copy link
Contributor Author

denelon commented Oct 13, 2023

It's not aiming to drastically reduce time. It's more about automating the setup and configuration.

@nopeless
Copy link
Contributor

I didn't notice you are the product manager for winget

Good luck with the PR, and thanks for the work 👍

@JanDeDobbeleer
Copy link
Owner

@denelon I've been trying to give this a go and I'm blocked on the first step. Maybe it's something obvious, or there are dependencies I don't have which results in a bad user experience.

Sample configuration file:

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  resources:
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: ohmyposh
      directives:
        description: Install Oh My Posh
        allowPrerelease: true
      settings:
        id: JanDeDobbeleer.OhMyPosh
        source: winget
  configurationVersion: 0.2.0

Outcome:

image

@denelon
Copy link
Contributor Author

denelon commented Feb 2, 2024

@JanDeDobbeleer I'm so sorry for a very late reply. I didn't see your reply, and was just checking in.

I wasn't able to repro the problem you encountered.

ohmyposh
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  resources:
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: ohmyposh
      directives:
        description: Install Oh My Posh
        allowPrerelease: true
      settings:
        id: JanDeDobbeleer.OhMyPosh
        source: winget
  configurationVersion: 0.2.0

@denelon
Copy link
Contributor Author

denelon commented Feb 2, 2024

We're adding sample configurations to Dev Home.

We're currently working on improving the documentation and providing additional samples for specific DSC Resources. I'd love to add a sample for configuring oh-my-posh. It's one of the very first things I do when I'm setting up a new device.

I'll be building a configuration (as will several others) to demonstrate everything I like to install and configure on Windows so share. We'll be adding a README with links to several examples for MSFT contributors to capture gaps in WinGet configuration and to share our progress.

I think it would be awesome to share this in my future presentations. 😊

@JanDeDobbeleer
Copy link
Owner

JanDeDobbeleer commented Feb 11, 2024

@denelon I still have that error. It just doesn't work on my machine. I can't work on this until someone can tell me how to solve this. I'll create a bug at winget.

2024-02-11 16:04:33.217 [CONF] Configuration unit WinGetPackage[ohmyposh] failed with code 0x8a15c105 and error message:
Could not load file or assembly 'Microsoft.WinGet.Client.Engine, Version=1.21.0.0, Culture=neutral, PublicKeyToken=null'. Uncaught exception during type initialization. (0x80131534)
Microsoft.Management.Configuration.Processor.Exceptions.InvokeDscResourceException: Failed when calling `Test` for resource: WinGetPackage [Microsoft.WinGet.DSC] Message: 'Could not load file or assembly 'Microsoft.WinGet.Client.Engine, Version=1.21.0.0, Culture=neutral, PublicKeyToken=null'. Uncaught exception during type initialization. (0x80131534)
'
   at Microsoft.Management.Configuration.Processor.DscModule.DscModuleV2.InvokeTestResource(PowerShell pwsh, ValueSet settings, String name, ModuleSpecification moduleSpecification)
   at Microsoft.Management.Configuration.Processor.Runspaces.HostedEnvironment.InvokeTestResource(ValueSet settings, String name, ModuleSpecification moduleSpecification)
   at Microsoft.Management.Configuration.Processor.Unit.ConfigurationUnitProcessor.TestSettings()
2024-02-11 16:04:33.229 [CLI ] Terminating context: 0x8a15c005 at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\ConfigurationFlow.cpp:3f9

@joadoumie
Copy link
Contributor

@ryfu-msft - any chance you can help debug? I'd love to have this feature added to my setup script.

@JanDeDobbeleer
Copy link
Owner

JanDeDobbeleer commented Feb 14, 2024

@joadoumie @denelon I found that dll in the PowerShell module, but my .NET skills are ancient and I couldn't add this where winget expects them. Although I'd argue this shouldn't be my experience 😅

EDIT: I didn't validate the version though, will have a look at that as well.

@ryfu-msft
Copy link

ryfu-msft commented Feb 14, 2024

@JanDeDobbeleer, can you repro this again but with the --verbose flag and then post the logs from that run either here or in the winget-cli issue that you opened. That will give us a bit more info.

@JanDeDobbeleer
Copy link
Owner

@joadoumie
Copy link
Contributor

@JanDeDobbeleer - I was curious what it would take to get this done, so I started playing around with it today. If you're interested and it's helpful, I can share my WIP first-draft. Right now, it only is working for pwsh setup because that's all I'm honestly familiar with.

@JanDeDobbeleer
Copy link
Owner

@joadoumie you can always share, but as I'm having issues getting this to work I'm not including this until I can also test and support it.

@joadoumie
Copy link
Contributor

@JanDeDobbeleer - totally makes sense! I just got curious what it would take so it's been fun to play around with it. I also likely haven't accounted for a lot of things I'd imagine. I'll clean it up a little more than maybe just open a draft PR in the repo for comparison in the future whenever you're able to fix the issue & test/support.

@denelon
Copy link
Contributor Author

denelon commented Jun 11, 2024

It looks like the issue "might" be related to running Windows on a Mac using Parallels. I'll need to see if I can reproduce this on another device. If anyone else can confirm, that would also be sufficient for us to see if we can make some progress for that particular device/OS configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 feat New feature
Projects
None yet
Development

No branches or pull requests

5 participants