{ description = "A Nix library to create and manage virtual machines running Windows."; inputs.nixpkgs.url = github:NixOS/nixpkgs/f8248ab6d9e69ea9c07950d73d48807ec595e923; outputs = { self, nixpkgs }: let pkgs = import nixpkgs { system = "x86_64-linux"; }; lib = pkgs.lib; # utils utils = (import wfvm/utils.nix { inherit pkgs; }); # layers layers = (import wfvm/layers { inherit pkgs; }); # end of layers # makeWindowsImage makeWindowsImage = attrs: import wfvm/win.nix ({ inherit pkgs; } // attrs ); build-demo-image = { impureMode ? false }: makeWindowsImage { # Build install script & skip building iso inherit impureMode; # Custom base iso # windowsImage = pkgs.requireFile rec { # name = "Win10_21H1_English_x64.iso"; # sha256 = "1sl51lnx4r6ckh5fii7m2hi15zh8fh7cf7rjgjq9kacg8hwyh4b9"; # message = "Get ${name} from https://www.microsoft.com/en-us/software-download/windows10ISO"; # }; # impureShellCommands = [ # "powershell.exe echo Hello" # ]; # User accounts # users = { # artiq = { # password = "1234"; # # description = "Default user"; # # displayName = "Display name"; # groups = [ # "Administrators" # ]; # }; # }; # Auto login # defaultUser = "artiq"; # fullName = "M-Labs"; # organization = "m-labs"; # administratorPassword = "12345"; # Imperative installation commands, to be installed incrementally installCommands = if impureMode then [] else (with layers; [ (collapseLayers [ disable-autosleep disable-autolock disable-firewall ]) anaconda3 msys2 msvc msvc-ide-unbreak ]); # services = { # # Enable remote management # WinRm = { # Status = "Running"; # PassThru = true; # }; # }; # License key (required) # productKey = throw "Search the f* web" # imageSelection = "1"; # Locales # uiLanguage = "en-US"; # inputLocale = "en-US"; # userLocale = "en-US"; # systemLocale = "en-US"; }; in { # bundle dev env devShell.x86_64-linux = pkgs.mkShell { name = "wfvm-dev-shell"; buildInputs = with pkgs; [ go ]; shellHook = '' unset GOPATH ''; }; inherit utils; inherit makeWindowsImage; inherit layers; demo-ssh = utils.wfvm-run { name = "demo-ssh"; image = build-demo-image {}; isolateNetwork = false; script = '' ${pkgs.sshpass}/bin/sshpass -p1234 -- ${pkgs.openssh}/bin/ssh -p 2022 wfvm@localhost -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ''; }; packages.x86_64-linux = { demo-image = build-demo-image {}; demo-image-impure = build-demo-image { impureMode = true; }; make-msys-packages = utils.wfvm-run { name = "get-msys-packages"; image = makeWindowsImage { installCommands = [ layers.msys2 ]; }; script = '' cat > getmsyspackages.bat << EOF set MSYS=C:\\MSYS64 set TOOLPREF=mingw-w64-x86_64- set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH% pacman -Sp %TOOLPREF%gcc %TOOLPREF%binutils make autoconf automake libtool texinfo > packages.txt EOF \${utils.win-put}/bin/win-put getmsyspackages.bat \${utils.win-exec}/bin/win-exec getmsyspackages \${utils.win-get}/bin/win-get packages.txt ''; }; }; }; }