From baaa0f4942bdc551db1a9d50ad62c4ee13041b9d Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Mon, 17 Feb 2025 21:45:54 -0500 Subject: [PATCH] initial nix flake rewrite --- flake.lock | 48 ++++++++++++++++++++++++++++++++++++++ flake.nix | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ oem/install.bat | 2 +- 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f58a54b --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1739736696, + "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "wfvm": "wfvm" + } + }, + "wfvm": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718082876, + "narHash": "sha256-u4OgfsO6jnQwHNmxHhSIfCKaa2gYoIYwGKPJFZSpK/A=", + "ref": "refs/heads/master", + "rev": "e811c7c5d87059cb93b6548109fcafb3268a3af1", + "revCount": 70, + "type": "git", + "url": "https://git.m-labs.hk/m-labs/wfvm" + }, + "original": { + "type": "git", + "url": "https://git.m-labs.hk/m-labs/wfvm" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8d25155 --- /dev/null +++ b/flake.nix @@ -0,0 +1,61 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + wfvm.url = "git+https://git.m-labs.hk/m-labs/wfvm"; + + # wfvm uses a very old branch of nixpkgs (2023-05-25) + wfvm.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = + { + self, + nixpkgs, + wfvm, + }: + let + # import nixpkgs + pkgs = (import nixpkgs {}); + in + { + packages."${pkgs.system}".windows-vm = wfvm.lib.makeWindowsImage { + windowsImage = (pkgs.fetchurl { + url = "file:///home/primary/Downloads/tiny11.iso"; + sha256 = "ea9cee512457c763484dbeaeee98caba8c2e69e0420bdae8c4508e31ad8ccd99"; + }); + + installCommands = [ + { + name = "execute oem bat"; + script = + let + oem_bat = ./oem/install.bat; + in + '' + ln -s ${oem_bat} ./oem_bat.bat + win-put oem_bat.bat . + echo Running Oem Bat... + win-exec 'start /wait "" .\oem_bat.bat' + echo Oem Bat finished + ''; + } + { + name = "execute powershell"; + script = + let + powershell_oem = ./oem/powershell-stuff.ps1; + in + '' + ln -s ${powershell_oem} ./oem_ps.ps1 + win-put oem_ps.ps1 . + echo Running Oem PS... + win-exec 'start /wait "" powershell -executionpolicy remotesigned -File .\oem_ps.ps1' + echo Oem powershell finished + ''; + } + + ]; + + }; + }; +} diff --git a/oem/install.bat b/oem/install.bat index bbff87b..99e6301 100644 --- a/oem/install.bat +++ b/oem/install.bat @@ -19,7 +19,7 @@ winget install -e --id Microsoft.VisualStudio.2022.BuildTools --accept-source-ag winget install -e --id Microsoft.VisualStudio.2022.Community --accept-source-agreements --override "--passive --wait --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended" :: powershell stuff -powershell -executionpolicy remotesigned -File C:\OEM\powershell-stuff.ps1 +:: powershell -executionpolicy remotesigned -File C:\OEM\powershell-stuff.ps1 winget install Mozilla.Firefox --accept-source-agreements