Compare commits

...

4 Commits

5 changed files with 46 additions and 5 deletions

View File

@ -52,3 +52,30 @@ Impure/pure mode
Sometimes it can be useful to build the image _outside_ of the Nix sandbox for debugging purposes. Sometimes it can be useful to build the image _outside_ of the Nix sandbox for debugging purposes.
For this purpose we have an attribute called `impureMode` which outputs the shell script used by Nix inside the sandbox to build the image. For this purpose we have an attribute called `impureMode` which outputs the shell script used by Nix inside the sandbox to build the image.
Usage with Nix Flakes
---------------------
Build the demo by running:
```shell
nix build .#demoImage
```
This project's **flake.nix** exposes its functions under `lib`. To use
in your own project, setup your flake like this:
```nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
wfvm.url = "git+https://git.m-labs.hk/m-labs/wfvm";
};
outputs = { self, nixpkgs, wfvm }: {
packages."x86_64-linux".flaky-os = wfvm.lib.makeWindowsImage {
# configuration parameters go here
};
};
}
```

View File

@ -16,5 +16,9 @@
lib = import ./wfvm { lib = import ./wfvm {
inherit pkgs; inherit pkgs;
}; };
packages.${system}.demoImage = import ./wfvm/demo-image.nix {
inherit self;
};
}; };
} }

View File

@ -1,7 +1,17 @@
{ pkgs ? import <nixpkgs> {}, impureMode ? false }: { pkgs ? import <nixpkgs> {}
# Whether to generate just a script to start and debug the windows installation
, impureMode ? false
# Flake input `self`
, self ? null
}:
let let
wfvm = (import ./default.nix { inherit pkgs; }); wfvm =
if self == null
# nix-build
then (import ./default.nix { inherit pkgs; })
# built from flake.nix
else self.lib;
in in
wfvm.makeWindowsImage { wfvm.makeWindowsImage {
# Build install script & skip building iso # Build install script & skip building iso

View File

@ -72,7 +72,7 @@ in
bootstrapper = pkgs.fetchurl { bootstrapper = pkgs.fetchurl {
name = "RESTRICTDIST-vs_Community.exe"; name = "RESTRICTDIST-vs_Community.exe";
url = "https://aka.ms/vs/16/release/vs_community.exe"; url = "https://aka.ms/vs/16/release/vs_community.exe";
sha256 = "0vj6s82b1c0n6cjysx1lba7xmgmy7pmmk3apq1i4xsqwcjv80xwv"; sha256 = "sha256-4X8NhdcNyfHkN6eKkNz8Unvv49wRZE4CQ1vf6P1R2ic=";
}; };
# This touchy-feely "community" piece of trash seems deliberately crafted to break Wine, so we use the VM to run it. # This touchy-feely "community" piece of trash seems deliberately crafted to break Wine, so we use the VM to run it.
download-vs = wfvm.utils.wfvm-run { download-vs = wfvm.utils.wfvm-run {

View File

@ -36,8 +36,8 @@ let
); );
windowsIso = if windowsImage != null then windowsImage else pkgs.requireFile rec { windowsIso = if windowsImage != null then windowsImage else pkgs.requireFile rec {
name = "Win10_21H1_English_x64.iso"; name = "Win10_21H2_English_x64.iso";
sha256 = "1sl51lnx4r6ckh5fii7m2hi15zh8fh7cf7rjgjq9kacg8hwyh4b9"; sha256 = "0kr3m0bjy086whcbssagsshdxj6lffcz7wmvbh50zhrkxgq3hrbz";
message = "Get ${name} from https://www.microsoft.com/en-us/software-download/windows10ISO"; message = "Get ${name} from https://www.microsoft.com/en-us/software-download/windows10ISO";
}; };