I want to manage Windows itself declaratively like I can manage NixOS: declarative packages / apps & OS settings, since Nix isn’t directly supported on Windows (not supported outside of WSL). I have an x64 desktop I’m thinking of dual booting NixOS and Windows (for certain windows only apps).
- GitHub - LGUG2Z/Nazm: Declarative configuration management for Windows
- Windows declared configuration protocol | Microsoft Learn
- https://duckduckgo.com/?q=windows+declarative+config&ia=web
Best of luck finding a suitable option. IMO this topic is not really appropriate for this forum though, as nix doesn’t run on windows yet.
Tell me you didn’t read the post without telling me you didn’t read the post.
Actually, just putting a random thought I had once here (not forced to use windows, so never implemented it): Since WSL can run host programs, you could implement kind of module that’s designed to run inside NixOS-WSL and manages the host system through the module system. So you could write something like this:
host.windows.packages = [
"Notepad++.Notepad++"
"Microsoft.VisualStudioCode"
"Microsoft.PowerToys"
];
and then rebuilding would make the winget installed package list equal to that, and possibly do some pinning if it can.
It would not even have to be limited to winget, you could probably cross-compile everything for windows from inside a nix derivation (adding the WSL binfmt would be a bad idea because you could probably just run curl.exe from inside a non-fixed-output derivation). You could use systemd-tmpfiles or smfh to handle copying files, and PowerShell activation scripts (Or bash that runs exes, powershell just feels more likely to work in more scenarios).
You can always just “winget import” some list of apps and packages that you want. Quick tool might be enough for your simple request. You can just run flags to auto accept if they are simple windows apps anyways.
I run an Ubuntu WSL with Nix + system-manager inside. I maximise the WSL terminal window and generally avoid everything in Windows except the web browser. For the Windows applications I’m forced to run, I install them on the company iPhone. This is somewhat acceptable when forced to run Windows.
There is a nixos-wsl distro, but I haven’t tried to use it. Working in Windows environments usually implies working with a lot of mutable state in your mandated tooling, where pure NixOS gives you a lot of work even getting started.
The Ubuntu WSL ships with quite a few integrations to the host system including filtersystem sync via 9p.