by meatjuice on 2/22/24, 9:56 AM with 77 comments
1. No use of dotfiles
I don't like dotfiles because they're difficult to debug and are tend to be bloated, inefficient and complicated. When using home-manager with nix, those are managed by a file named home.nix so it's very clean. It's also error-free as long as options are set appropriately. Maybe my dotfiles management is just terrible, if you know any good way to do this on Windows, please tell me.
2. Everything is configurable from a single file
On NixOS and MacOS with nix-darwin, you can configure basically everything, from package management to system configuration, in a file: configuration.nix
I would like to do the same on Windows. One thing I considered is to make a powershell script that configures everything on execution.
ChatGPT says that I can use something called [Desired State Configuration](https://learn.microsoft.com/en-us/powershell/dsc/getting-started/wingettingstarted?view=dsc-1.1), but as far as I can see the documentation, it's not something I'm looking for. (correct me if I'm wrong)
3. Containered environment for development
On Nix, you can declare everything necessary to build a package so you don't need to install packages on your system by yourself. I don't want to put myself into a dependency hell anymore. But I have an idea for this: using docker. Docker separates developing environment from host's system so there would be no pre-installed dependencies. It would be good and I'm considering learning docker. Next thing I'm considering is to use something like [nx](https://nx.dev/). If you have better ideas, please tell me.
This is pretty much everything I need for my next Windows environment. Every small tips or tricks are welcome.
by exceptione on 2/22/24, 11:33 AM
That way you contain the inherent mess that a Windows install will eventually devolve into. You also get the ability to snapshot states of your windows install, which makes it possible to mess around a bit and then roll back to a previous state.
You didn't tell what Windows software you want to run, but depending on your needs you could even do a pci-passthrough in this setup.
I do not recommend Ansible as someone else did. You will spend your days fighting a mix of yaml and Jinja. You will end up looking at Python errors because there are no static types. Never again.
by pjc50 on 2/22/24, 11:57 AM
The only things I'd suggest as worth it are:
- separate "data" partition on D:, backed up
- back up %APPDATA% and %USERPROFILE%
- learn one of chocolatey or winget
- WSL2 is a Linux VM; "git bash" is surprisingly good at providing a hybrid environment on the Windows filesystem
- otherwise, just let everything dump itself into C:\Program Files and don't worry too much about it. This is what everyone else will be doing.
It used to be beneficial to do regular reinstalls, but those days are long past. I'd expect you to be able to make it through a 3 year course without having a broken installation incident.
(Not clear what tooling you'll be using? Visual Studio? VSCode? What language(s)?)
by ActorNightly on 2/22/24, 10:18 AM
Install WSL2, do everything development under WSL2. It works very well. It even has x server forwarding now, and supports CUDA. No need for docker, simply use VSCode and the Remote SSH extension works natively with WSL2.
Just make sure to get at least 32gb of ram (most windows laptops you can upgrade the ram).
by jeroenhd on 2/22/24, 12:48 PM
Set up WSL2 for all your Nix and fancy configuration needs. It acts and works like a Linux VM, except with Windows 11 you can also run GUI programs. Set up Windows like any normal Windows user would (pay special attention to the disk encryption not being enabled properly if you don't log in with a Microsoft account) and use it as intended.
Windows does not do dotfiles. Well, some Linux programs do, because they don't really care about user experience, but in general everything configuration related will be stored in %appdata% and the registry.
There is no single file configuration for Windows. There are group policy editors that can control a lot of settings, but what you're looking for doesn't exist and existing tools aren't designed for Windows. Trying to make them work will only frustrate you.
As for containers, WSL2 and Docker work fine. They're running on a Linux VM, so they work as well as they do on Linux, barring some minor overhead from networking and file system integrations.
Alternatively, run Windows in a VM if you already have the Macbook. See how far you'll come before you need some kind of hardware acceleration, you may just be able to use a VM for the few Windows only tools you'll actually he using.
by blackoil on 2/22/24, 1:29 PM
WSL2 + VSCode is enough for most of my use cases. Get Power Toys. You can now create a dev drive that has better performance with many small files like in node, if you are not using WSL. Multiple Desktop/Monitor is so much better than Mac. Need to spend couple of hours initially to tune it to my liking, after that it is mostly smooth run. I thought using Choco/WinGet initially but initial installation by going to each site isn't that big a pain. Go with lot of RAM if using Docker.
by noodlesUK on 2/22/24, 12:03 PM
What software do you need to run?
by sharts on 2/22/24, 1:23 PM
You can script windows things with powershell and package managers — which you can test on Windows VMs.
Just make the VMs your primary work machines, and leave the host are unmodified as possible unless absolutely necessary.
Alternatively, you can use a Linux host for VMs.
by nwellinghoff on 2/22/24, 12:46 PM
Then follow the advice of being disciplined about separating data and os/programs and just use backups.
Then use wsl2 with nixos as your main dev env and backup/src control your configs.
This setup is really nice and has the benefit of being able to run just about anything.
If you really want to go nuts you could setup a lvl1 hypervisor like proxmox and run All the OSes. I have a machine setup like this and run macos, windows 7-11, various linux. The one you use for video games you can do hardware pass through to get native video performance. Overkill but fun!
by rkagerer on 2/22/24, 1:04 PM
by analog31 on 2/22/24, 1:10 PM
Backups are a good thing, but most kids do their schoolwork in the cloud. Possibly the greatest risk is not software related, but either mechanical damage or theft. And battery death. Don't treat a portable appliance as your most prized possession.
And this is also true of people in general: There doesn't seem to be a correlation between how fussy someone is about keeping their computer just right, and actually getting reliable use out of it. So part of the process is deciding for yourself whether you tend to need more computer management, or less, than the average person.
Maybe the Windows requirement is for running anti-cheating software? There is the chance of you being required to install some bizarre spyware. That kind of stuff can also be highly platform specific, which is usually a sign of it being poorly written.
by coreyh14444 on 2/22/24, 12:10 PM
by mikewarot on 2/22/24, 1:26 PM
I'm assuming most people here aren't in the precariat like me. If you are, then get a used Windows laptop, they're even cheaper.
by k8svet on 2/22/24, 1:00 PM
Honestly, there's just not a solution you're going to be happy with, coming from Nix. Windows is like categorically maybe the OS most fundamentally unsuited for folks who appreciate sane ways of managing computers.
If you only need it for one piece of software I'd absolutely use wine or a VM.
by emmanueloga_ on 2/22/24, 1:20 PM
Back in the day I used "Norton Ghost" to create a full image of a just-installed windows just in case I needed to go back in time. Windows includes a snapshot feature built-in but I did not really trust it. These days you can use a "sysprep" tool [2] to create a similar system snapshot. Make a partition and keep everything you don't want deleted on drive D: or something :-).
--
1: https://www.jetpack.io/devbox
2: like https://www.ntlite.com or https://fogproject.org
by xtiansimon on 2/22/24, 1:05 PM
So it’s with curiosity that I read this, but I don’t understand what you’re referring to about configuration. Do you mean setting for networking, peripherals and reg edits to get rid of those darn folders for ‘games’ and ‘videos’?
As much as I try to make my own improvements and insurance against downtime, I find I’m spending a lot of time to only discover its best to let Windows do its thing.
by kkfx on 2/22/24, 9:11 PM
IF NOT then use ntfs snapshots extensively to being able to recover and keep data on a *nix host well managed.
Windows have proprietary automation but being designed as an "endpoint OS", meaning a value-less thing you deploy mostly in a default state without much customization there is not much you can do at a domestic level. BTW if an Uni in 2024 demand Windows specifically to students I doubt can be really a good choice...
by runjake on 2/23/24, 6:07 PM
Do something like this: https://christitus.com/windows-11-perfect-install/
And avoid too many registry tweaks or other unsupported hacks as they will likely break security updates or the Windows system itself.
If you need containers, Docker Desktop + WSL works great.
Or run Linux and use Windows in a virtual machine for the specific things you need Windows for.
by brudgers on 2/22/24, 2:41 PM
Run it in its own silo and use the magic of networking for interfacing with your preferred OS.
Architecturally:
Windows <---> Network Protocols <---> Your Preferred OS
Basically, use the ubiquitous API's rather than trying to write your own. The API's are built into each OS to solve the exact problem.Also, hardware is a useful abstraction. Two laptops make it easier to partition the dimensions of your daily life. And there is nothing magical bout them. Computers are cattle not pets.
Good luck.
by viraptor on 2/22/24, 12:28 PM
While it's good to have windows ready, keep in mind this is often not strictly true, but rather a strong recommendation. I survived at uni while translating MATLAB exercises to Octave, compiling windows stuff for Wine, etc. If you set up dual booting, you'll likely be able to spend 99% of your time in whatever system you want.
by pid-1 on 2/22/24, 12:07 PM
Forget about configuration as code in pure Windows, been there, it's a waste of your time.
Also I'm not 100% positive but you might need a Windows Pro license to run Docker in Windows (something something virtualization can't recall correctly)
by djha-skin on 2/22/24, 1:39 PM
I keep a git repository with all my dot files in it[1]. This seems to work the best. It has a Windows folder as well, and I copy that out whenever I need to set up Windows.
A lot of people like using WSL but I hate how it hogs on my memory. Hyper-V is a terrible virtualization engine for consumer-grade use cases because it can't thin provision RAM. If I need to use docker, I will spin up a small Linux VM using vagrant[3] with Virtualbox[4] and put Docker on there. Vagrant is an extremely underrated tool in my opinion, particularly in a Windows context.
I use scoop[5] for package management. Typically I will scoop install msys2 and then pin it so that it doesn't get blown away by the next upgrade.
Then I basically do all of my development inside of msys2. I can get most things running in there without virtualization. In my case that means sbcl and roswell for common lisp, senpai for irc, and tmux and nvim for sanity. Msys2 uses the pacman package manager and this is good enough.
All In all, I set up my Windows machine affresh after a while of not using it and it took me about 3 hours. Most of that time was just getting through upgrades though, I felt like it was pretty fast.
1: https://git.sr.ht/~skin/dotfiles
by phaer on 2/22/24, 11:34 AM
by hiAndrewQuinn on 2/22/24, 11:57 AM
by leros on 2/22/24, 8:02 PM
by MichaelMug on 2/22/24, 12:28 PM
notepad $PROFILE
From there you can configure environment variables, path, etc.
by in9 on 2/22/24, 1:31 PM
Any guides on using nix-darwin for system configuration and etc? Ive been using it for a while and Id love to learn more!
by mogeko on 2/22/24, 12:41 PM
by michidk on 2/22/24, 11:43 AM
by meatjuice on 2/24/24, 3:06 AM
1. Run Windows on Linux by using VM
for the applications you can’t run on Linux
Risks:
* some softwares may attempt to detect VMs and refuse running
* Anything what needs to touch hardware may not work.
2. separate "data" partition on D:
3. back up %APPDATA% and %USERPROFILE%
4. learn chocolatey, scoop or winget
Winget should be good enough
5. Don’t worry about C:\Program Files
6. (Mixed) Use/Don’t use Ansible (or saltstack/salt)
Use:
* Allows you to setup a new machine quickly and consistently when one breaks, get stolen, or lost in an inconvenient time.
* You can get a clean and consistent development environment so that you do not depend on anything accidentally installed on the machine.
* If you define specialised roles, create test playbooks for those individual roles, use these roles to compose more complex playbooks, and offload logic to custom ansible modules that are written in python, you won't wrestle with heavy logic in the template or playbook layer.
* installing software and pulling some configs and scripts down is fine
Don’t use:
* You will spend your days fighting a mix of yaml and Jinja.
* You will end up looking at Python errors because there are no static types.
* errors are cryptic.
7. Use WSL2
You need 32gb of ram, but ram is cheap so choose a good thinkpad
8. Debloat with Recommended Tweaks
Run
irm christitus.com/win | iex
from Administrator Terminal (Powershell)
The link leads to https://raw.githubusercontent.com/ChrisTitusTech/winutil/mai...
VirusTotal
https://www.virustotal.com/gui/file/709834b0e003b6bb546cf16e...
9. Get [PowerToys](https://github.com/microsoft/PowerToys)
10. Use Devbox for containered environment
11. Dual-Booting Linux and Windows
If you use physically separated drives, you don’t need partitioning.
12. Dedicated Windows machine for class
Yes it sure would be the cleanest solution but I prefer one device for everything
13. keep a git repository with all dot files in it
Many people suggested that using virtualization is the way, otherwise just let Windows be Windows.
Also, backing up seems to be a good practice.
I’m planning to write a blog about this, if it worked.
Again, thank you all for the helps!
by kevinsync on 2/22/24, 2:59 PM
Get an off-lease refurb laptop (Newegg has tons of these [0], $300 can get you a decent 15" Lenovo / HP / Dell with SSD, 32GB ram, i7, etc)
Wipe it and install Windows 10 LTSC [1], install all known required university software, Git for Windows, Chocolatey, text editor(s) of choice, etc.
Image the main drive as a fresh starting point for when the machine gets hosed.
If you NEED real Linux, install those to VMs on a secondary drive or partition (I like VirtualBox as host but there are others) -- better to virtualize the least-demanding OS rather than the most.
Sync your browser bookmarks/history to the cloud.
Keep all of your code in separate private repos so they're backed up and you can pull down if you need to.
While on Windows, if you're trying to do Linux things, just use Git Bash. I doubt you'll ever need to touch Powershell or anything like that in general usage.
I wouldn't waste my time with Docker either -- it's dreadfully slow when using WSL, usable if you go back to regular Hyper-V and crank the RAM, but try as I might, I just have never found a scenario where it felt like the right solution to a problem on Windows.
It's also never a bad idea to find ways to separate your concerns -- my daily setup is a Windows 10 desktop, a Mac mini and a Linux desktop all in a closet, Windows on the main monitor, MacOS on the monitor to the right, keyboard and mouse shared via Synergy, and I SSH into the Linux box from Windows. I do most things on Windows, Mac things on the Mac, Linux things on Linux, but it's ergonomic and feels like one system (to me).
And do pick up all the other tips in this discussion -- good advice in there on snapshots, what to back up, etc.
There's no "correct configuration" for any of this stuff, you'll find a combo that feels good to you. Keep it simple and lean and you'll be fine. I've been using Windows as my primary desktop OS since 3.11 for Workgroups, it can be a fickle lover, sure, but Windows is incredibly capable in 2024.
Links:
[0] https://www.newegg.com/p/pl?N=4131%204016%20600566986%201000...
by stop50 on 2/22/24, 9:59 AM