Compare commits

...

445 commits

Author SHA1 Message Date
Manuel Thalmann 8f47cde54d Add a script for creating backups 2024-09-09 00:05:21 +02:00
Manuel Thalmann b82faa463c Force profile selection for Windows installation actions 2024-09-09 00:04:06 +02:00
Manuel Thalmann 70105a4c26 Force line endings of Unix scripts 2024-09-09 00:00:49 +02:00
Manuel Thalmann a85365ef6a Start setup automatically 2024-09-08 17:48:10 +02:00
Manuel Thalmann 0efe059126 Show profile selection during setup 2024-09-08 17:48:02 +02:00
Manuel Thalmann f8a956f761 Add a function for selecting the profile 2024-09-08 17:47:49 +02:00
Manuel Thalmann 4582e288d7 Use same installer script for all profiles 2024-09-08 17:47:28 +02:00
Manuel Thalmann 0317202c01 Fix non-functioning WSL installation 2024-09-08 17:42:31 +02:00
Manuel Thalmann 164cfaef16 Make Oh-My-Posh theme location dynamic 2024-09-08 17:42:11 +02:00
Manuel Thalmann 47490f9c9e Improve performance 2024-09-08 17:41:30 +02:00
Manuel Thalmann cead93fabb Update Selenium to the newest version 2024-09-08 17:12:01 +02:00
Manuel Thalmann 5dfc580066 Switch to named flakes 2024-09-08 17:09:01 +02:00
Manuel Thalmann 6cb55d1ef5 Store user related options properly 2024-09-03 23:11:28 +02:00
Manuel Thalmann 3ced64b83a Refactor the directory structure 2024-09-03 23:10:35 +02:00
Manuel Thalmann 90cff7df22 Add code for cleaning up after installations 2024-09-03 22:15:15 +02:00
Manuel Thalmann aeca588808 Add functions for uninstalling packages 2024-09-03 22:14:21 +02:00
Manuel Thalmann ab4906cd3a Improve assignments of groups 2024-09-03 20:32:01 +02:00
Manuel Thalmann e1399b527c Remove unnecessary policy change 2024-09-03 16:31:12 +02:00
Manuel Thalmann 691162c51d Migrate winiso script to fish 2024-09-03 12:08:47 +02:00
Manuel Thalmann 6f67f90074 Ask for live scripts only once 2024-09-03 12:08:35 +02:00
Manuel Thalmann 8a06f62b85 Install Ubuntu automatically 2024-09-03 12:08:14 +02:00
Manuel Thalmann 9ecac43db8 Add a backup script for reWASD 2024-09-03 12:02:48 +02:00
Manuel Thalmann 64572662eb Add a backup script for Visual Studio 2024-09-03 12:02:32 +02:00
Manuel Thalmann 7096243208 Allow backing up TrackMania Forever 2024-09-03 12:02:09 +02:00
Manuel Thalmann 076e3e35fa Allow testing winget packages with specific scope 2024-09-03 01:16:42 +02:00
Manuel Thalmann 5e57090030 Allow backing up RetroArch 2024-08-28 13:07:58 +02:00
Manuel Thalmann 139924b0e3 Add scripts for backing up PuTTY 2024-08-28 13:00:37 +02:00
Manuel Thalmann d23081f52e Add scripts for backing up osu! 2024-08-28 12:47:07 +02:00
Manuel Thalmann 9beeaf2924 Install osu!lazer per user 2024-08-28 12:37:20 +02:00
Manuel Thalmann 6890d5104f Add backup support for ManiaPlanet 2024-08-28 05:18:52 +02:00
Manuel Thalmann f1b9a541e6 Add scripts for backing up and restoring LGHub 2024-08-28 05:05:55 +02:00
Manuel Thalmann 54bfcba2e3 Allow users to restore a backup 2024-08-28 04:40:32 +02:00
Manuel Thalmann ab1ebe29cf Add scripts for backing up and restoring personal files 2024-08-28 04:40:00 +02:00
Manuel Thalmann 26cb03ca26 Fix non-functioning profile script 2024-08-28 04:39:15 +02:00
Manuel Thalmann 5e4322dacf Ensure 7z is installed for backups 2024-08-28 04:38:56 +02:00
Manuel Thalmann 5437886a77 Streamline restoration of directories 2024-08-28 04:38:30 +02:00
Manuel Thalmann c1bf82b084 Set a default path for backup artifacts 2024-08-28 00:38:20 +02:00
Manuel Thalmann ce785af138 Add capabilities to back up apps 2024-08-28 00:37:04 +02:00
Manuel Thalmann 0576a87f01 Allow specifying a backup action 2024-08-28 00:29:33 +02:00
Manuel Thalmann af4a33ac3f Ignore unspecified backup archives 2024-08-28 00:22:38 +02:00
Manuel Thalmann 9e9a0f9fab Ignore inexistent backup artifacts 2024-08-28 00:21:06 +02:00
Manuel Thalmann 5fb11eb5c7 Make the install script action agnostic 2024-08-28 00:03:28 +02:00
Manuel Thalmann 5e5759d75b Rename the Windows installer script 2024-08-27 23:35:56 +02:00
Manuel Thalmann 53e941216c Rename outdated script 2024-08-27 23:08:41 +02:00
Manuel Thalmann bad17b213c Silence errors concerning empty aliae configurations 2024-08-27 22:35:31 +02:00
Manuel Thalmann e7c483db2b Make Operations script cross platform 2024-08-27 22:27:44 +02:00
Manuel Thalmann 9b0bf565f6 Handle OneShot tasks only on Windows 2024-08-27 21:32:49 +02:00
Manuel Thalmann aa278cd675 Add a script for managing backups 2024-08-27 21:05:51 +02:00
Manuel Thalmann 2a69eabe81 Add tools for managing aliae 2024-08-27 18:58:33 +02:00
Manuel Thalmann 65ba609a3b Fix non-functioning aliae installation 2024-08-27 18:55:12 +02:00
Manuel Thalmann d29f925a8b Create dedicated script for creating users 2024-08-27 17:04:17 +02:00
Manuel Thalmann 8332affb78 Create dedicated script for installing software 2024-08-27 16:41:08 +02:00
Manuel Thalmann d6b330e07c Prevent reading nix config multiple times 2024-08-27 14:35:04 +02:00
Manuel Thalmann 0b3c738444 Ensure only one user is enabled at once 2024-08-27 14:11:31 +02:00
Manuel Thalmann d4fd4903ba Prevent unnecessary file creation 2024-08-27 14:06:56 +02:00
Manuel Thalmann 9383be6124 Execute OneShot tasks in any operation 2024-08-27 14:05:16 +02:00
Manuel Thalmann d42719c52a Use /mnt as mount directory 2024-08-27 04:30:12 +02:00
Manuel Thalmann 6e9a82d59e Force the use of the managed distribution 2024-08-27 04:26:25 +02:00
Manuel Thalmann 68b4810051 Initialize operation for all users 2024-08-27 04:24:29 +02:00
Manuel Thalmann a3d2d9c002 Handle initialization in operation code 2024-08-27 04:15:37 +02:00
Manuel Thalmann 6bc6b85598 Execute script non-interactive during OneShot tasks 2024-08-27 03:50:08 +02:00
Manuel Thalmann 5ea09f9477 Exit script after running OneShot task 2024-08-27 03:45:44 +02:00
Manuel Thalmann 7952bcf207 Modify user after first login 2024-08-27 03:27:54 +02:00
Manuel Thalmann bb5c47792e Rearm Windows Activation before creating MSAcc 2024-08-27 03:25:19 +02:00
Manuel Thalmann 03349f772f Register MSAcc logon script early 2024-08-27 03:24:37 +02:00
Manuel Thalmann 20fe9287d0 Allow rebooting without registering setup 2024-08-27 03:11:35 +02:00
Manuel Thalmann 469690edc5 Fix non-functioning NoProfile argument 2024-08-27 02:09:04 +02:00
Manuel Thalmann de247e65fa Prevent unnecessary installation actions 2024-08-27 01:57:46 +02:00
Manuel Thalmann 9a9d4f6068 Only install PowerShell module if necessary 2024-08-27 01:25:32 +02:00
Manuel Thalmann 1a03d23d11 Streamline PowerShell installation 2024-08-27 00:45:46 +02:00
Manuel Thalmann e6b4c5153e Add further functionality to the WSL script 2024-08-27 00:38:46 +02:00
Manuel Thalmann 38cf1fcc48 Create a separate script for WSL interaction 2024-08-26 23:33:46 +02:00
Manuel Thalmann 462e0bb650 Fix recursive configuration 2024-08-25 03:58:28 +02:00
Manuel Thalmann 3cf55b510c Fix malformed module 2024-08-24 18:35:43 +02:00
Manuel Thalmann 0ec0264c8e Keep Windows fixes separate 2024-08-24 16:56:29 +02:00
Manuel Thalmann 9ff31b0bdc Remove WSL after operation 2024-08-24 16:52:41 +02:00
Manuel Thalmann 97366cd1f6 Make distribution name unique 2024-08-24 16:41:05 +02:00
Manuel Thalmann 62a67954f6 Streamline WSL distribution name 2024-08-24 16:27:34 +02:00
Manuel Thalmann 6452c3381f Remove unused resources after user setup 2024-08-24 16:15:10 +02:00
Manuel Thalmann 7f32b855e9 Print update logs properly 2024-08-24 14:47:51 +02:00
Manuel Thalmann 148becb52d Allow overriding Windows settings 2024-08-24 14:20:22 +02:00
Manuel Thalmann 98d06dfc07 Update incorrect path 2024-08-24 14:11:38 +02:00
Manuel Thalmann b54ddf43c7 Simplify osu!lazer installation 2024-08-24 14:10:02 +02:00
Manuel Thalmann 320a4b9b36 Determine name of setup user properly 2024-08-24 14:01:05 +02:00
Manuel Thalmann 0d41e9a278 Make OMP configuration platform independent 2024-08-24 13:27:48 +02:00
Manuel Thalmann 595076817a Fix incorrect character in OMP theme 2024-08-24 13:27:35 +02:00
Manuel Thalmann ca08608601 Remove unnecessary code 2024-08-24 04:25:07 +02:00
Manuel Thalmann 36b06c7fa4 Remove unnecessary loop 2024-08-24 04:24:55 +02:00
Manuel Thalmann 7fc948b1b8 Add missing module 2024-08-24 04:24:37 +02:00
Manuel Thalmann 16eaaa1929 Add nextcloud to the module list 2024-08-24 04:18:57 +02:00
Manuel Thalmann 6fa0653e01 Add a function for creating shortcuts 2024-08-24 04:18:33 +02:00
Manuel Thalmann 9ac3b46819 Configure nextcloud syncs 2024-08-24 04:07:47 +02:00
Manuel Thalmann 40ae6fc13c Allow configuring nextcloud syncs 2024-08-24 04:07:35 +02:00
Manuel Thalmann d80eba1ec6 Create separate option holding win users 2024-08-24 03:25:28 +02:00
Manuel Thalmann d3a632c1d1 Rename Nextcloud installer 2024-08-24 01:50:07 +02:00
Manuel Thalmann 4a7406d239 Add file system driver for dual boot 2024-08-24 01:41:09 +02:00
Manuel Thalmann 57fd3e32ed Prevent unnecessary config evaluation 2024-08-24 01:31:39 +02:00
Manuel Thalmann 66d2cd88f9 Fix non-functioning installer 2024-08-24 01:27:26 +02:00
Manuel Thalmann bffd07052b Install vscode extensions by default 2024-08-24 01:16:56 +02:00
Manuel Thalmann 5cd815aaf9 Load theme file from WSL properly 2024-08-24 00:59:59 +02:00
Manuel Thalmann 7f54e2d7c8 Update aliae configuration script 2024-08-24 00:42:57 +02:00
Manuel Thalmann db5c553657 Strip duplicate variables and aliases 2024-08-24 00:08:58 +02:00
Manuel Thalmann a26e106ccb Install posh theme automatically 2024-08-23 23:53:48 +02:00
Manuel Thalmann 7095b9a35d Export missing function 2024-08-23 23:50:13 +02:00
Manuel Thalmann dd849f9ba1 Install aliae by default 2024-08-23 23:46:23 +02:00
Manuel Thalmann 16e2b5450b Add scripts for changing aliae config 2024-08-23 23:44:51 +02:00
Manuel Thalmann eb1124b038 Fix compatibility with mixed new line characters 2024-08-23 23:44:23 +02:00
Manuel Thalmann d90f0c3969 Add a script for installing aliae 2024-08-23 22:38:28 +02:00
Manuel Thalmann 3ac390f708 Add desired posh theme 2024-08-23 19:43:06 +02:00
Manuel Thalmann 60abe32e27 Make option names more clear 2024-08-23 19:42:27 +02:00
Manuel Thalmann 6abf26ea45 Allow configuring oh-my-posh 2024-08-23 19:39:18 +02:00
Manuel Thalmann 2460cb7878 Fetch config from proper section 2024-08-23 19:24:49 +02:00
Manuel Thalmann 05fb824015 Adjust configuration accordingly 2024-08-23 19:14:09 +02:00
Manuel Thalmann d214abd1e8 Refactor option descriptions 2024-08-23 19:02:06 +02:00
Manuel Thalmann 1afb28c31a Clean up the Windows configuration 2024-08-23 18:59:49 +02:00
Manuel Thalmann 05de760fe5 Clean up the users.nix file 2024-08-23 18:51:54 +02:00
Manuel Thalmann b1fdf57b7f Create dedicated rclone module 2024-08-23 18:48:30 +02:00
Manuel Thalmann ae349afc8a Move git module to separate directory 2024-08-23 18:42:16 +02:00
Manuel Thalmann 868a56a558 Move git options to separate module 2024-08-23 18:40:24 +02:00
Manuel Thalmann 6616720f1a Fix inheritance of user config 2024-08-23 18:28:20 +02:00
Manuel Thalmann 33684088e3 Allow OS specific settings 2024-08-23 18:11:48 +02:00
Manuel Thalmann 8f26ea1fb2 Update archiso 2024-08-23 14:19:56 +02:00
Manuel Thalmann e6a9a280eb Set user info during git setup 2024-08-23 02:01:16 +02:00
Manuel Thalmann 619ae6ee59 Make all config scripts platform independent 2024-08-23 01:57:53 +02:00
Manuel Thalmann 92f9ff817a Allow leaving aliases unspecified 2024-08-23 01:52:25 +02:00
Manuel Thalmann 7b18f9e920 Make scripts platform independent 2024-08-23 01:52:04 +02:00
Manuel Thalmann 55b1cba4e6 Add scripts for configuring git 2024-08-23 01:43:26 +02:00
Manuel Thalmann 1ce158b1a4 Configure software implicitly 2024-08-23 01:41:32 +02:00
Manuel Thalmann 671d7c1b7d Skip profile creation for PinnedItem 2024-08-22 23:55:41 +02:00
Manuel Thalmann 6c9fbb4ca7 Allow skipping powershell module registration 2024-08-22 23:55:00 +02:00
Manuel Thalmann efdc1b4aa7 Add profiles to the flake 2024-08-22 23:37:53 +02:00
Manuel Thalmann d6db12504d Remove user profile of OneShot user 2024-08-22 23:12:11 +02:00
Manuel Thalmann 1ae778e714 Add missing OneShotTask declaration 2024-08-22 20:41:30 +02:00
Manuel Thalmann ab52b3ddaf Fix infinite loop 2024-08-22 20:41:17 +02:00
Manuel Thalmann 97907f2ce5 Fix incorrect variable name 2024-08-22 20:34:16 +02:00
Manuel Thalmann 759bba51eb Fix handling empty error messages 2024-08-22 20:12:18 +02:00
Manuel Thalmann fcad25bffb Add choco to the profile of the setup user 2024-08-22 13:46:55 +02:00
Manuel Thalmann 399445aa81 Fix incorrect typings 2024-08-22 11:11:12 +02:00
Manuel Thalmann b2d49f4722 Fix permission issues when enabling Win hack 2024-08-22 11:11:00 +02:00
Manuel Thalmann f8fbd78725 Register setup script as admin 2024-08-22 11:10:39 +02:00
Manuel Thalmann 1619179f59 Execute the entire installer using live scripts 2024-08-21 23:21:32 +02:00
Manuel Thalmann ffd4581372 Streamline the creation of users 2024-08-21 18:34:18 +02:00
Manuel Thalmann f31db199ff Replace osk with cmd during debugging 2024-08-21 18:33:41 +02:00
Manuel Thalmann 83a0eede62 Prevent pauses in OneShot tasks 2024-08-21 18:28:50 +02:00
Manuel Thalmann c1a8ba2f8f Print commands in debug mode 2024-08-21 18:28:08 +02:00
Manuel Thalmann 4a24e241d8 Run OneShot tasks with dedicated user 2024-08-21 18:27:47 +02:00
Manuel Thalmann ca1ae57aa7 Add function for generating startup command 2024-08-21 18:26:58 +02:00
Manuel Thalmann 257f934985 Allow registering startup script for the default user 2024-08-21 18:20:11 +02:00
Manuel Thalmann 3d2810eb67 Prevent unnecessary errors during WSL execution 2024-08-21 14:08:26 +02:00
Manuel Thalmann 3f8fb6a7e5 Register WSL before running OneShot tasks 2024-08-21 03:37:44 +02:00
Manuel Thalmann 7afbc1f7c1 Overwrite broken module 2024-08-21 03:20:37 +02:00
Manuel Thalmann ad48c77df8 Prevent initialization of nested operations 2024-08-21 03:18:31 +02:00
Manuel Thalmann 0e6b1206c3 Improve log messages of OneShot tasks 2024-08-21 02:02:30 +02:00
Manuel Thalmann c7d3501a36 Retry Linux path conversion for errors 2024-08-20 00:20:33 +02:00
Manuel Thalmann 038a4b8776 Fix typo 2024-08-20 00:20:07 +02:00
Manuel Thalmann 36f78e0358 Fix broken signature of Restart-Intermediate 2024-08-19 12:07:26 +02:00
Manuel Thalmann 6414d449eb Report unexpected path conversions 2024-08-19 02:50:41 +02:00
Manuel Thalmann dce5769762 Load missing path 2024-08-19 02:50:19 +02:00
Manuel Thalmann c859646800 Ensure error file can be read from 2024-08-19 02:24:45 +02:00
Manuel Thalmann 65ada0273e Streamline OneShot task handler 2024-08-19 02:24:30 +02:00
Manuel Thalmann 42ca57c698 Simplify script registration 2024-08-19 02:24:13 +02:00
Manuel Thalmann 611c3e872e Fix broken regedit paths 2024-08-19 01:38:25 +02:00
Manuel Thalmann ac09e5ab1b Allow registering reboots for users 2024-08-19 01:37:14 +02:00
Manuel Thalmann 1508e18afa Prevent users from being excluded 2024-08-19 01:10:29 +02:00
Manuel Thalmann 259a3a0b97 Force copying of Linux users to Windows 2024-08-19 00:54:13 +02:00
Manuel Thalmann 2af9f2c707 Improve log messages of updates 2024-08-18 12:20:21 +02:00
Manuel Thalmann 371bff0c9e Remove unnecessary command 2024-08-18 10:24:15 +02:00
Manuel Thalmann bcf3e5973d Fix time for QEMU VMs 2024-08-18 09:35:16 +02:00
Manuel Thalmann b3f005c0ed Remove unnecessary desktop icons 2024-08-18 09:25:23 +02:00
Manuel Thalmann c3e7a9ac9e Add a timeout for the reWASD downloader 2024-08-18 09:05:04 +02:00
Manuel Thalmann 0a7a79f1aa Allow setting a timeout for clicking download buttons 2024-08-18 09:04:42 +02:00
Manuel Thalmann 343df612ef Emit errors concerning WSL commands 2024-08-17 13:51:10 +02:00
Manuel Thalmann 78db8f7fd8 Emit errors using Write-Error 2024-08-17 13:49:21 +02:00
Manuel Thalmann f296b609aa Convert Argument to string explicitly 2024-08-16 23:03:19 +02:00
Manuel Thalmann 596073974b Ignore unfinished browser downloads 2024-08-16 17:57:22 +02:00
Manuel Thalmann 5cdd8c10a0 Install powershell modules for all users 2024-08-16 16:43:30 +02:00
Manuel Thalmann a6ac5c1653 Fix typos 2024-08-16 16:10:09 +02:00
Manuel Thalmann e0a2aeac06 Install AutoHotkey as preparation 2024-08-16 15:22:09 +02:00
Manuel Thalmann 37f7513c31 Allow running live scripts in debug mode 2024-08-16 15:21:41 +02:00
Manuel Thalmann 63a8ef522a Generate env variables using shorthand scripts 2024-08-16 15:16:56 +02:00
Manuel Thalmann 1c5b252e28 Allow running installation in debug mode 2024-08-16 15:16:28 +02:00
Manuel Thalmann 2c8813b965 Redirect winiso exit code properly 2024-08-16 15:13:53 +02:00
Manuel Thalmann d7aec2d3dd Allow specifying winiso build type 2024-08-16 15:13:33 +02:00
Manuel Thalmann c1b6d96d19 Refactor winget check for rare issue 2024-08-16 15:04:37 +02:00
Manuel Thalmann 1bad412e7e Disable Windows Update reboot only as admin 2024-08-16 14:35:35 +02:00
Manuel Thalmann 01981835ba Add a function for queueing startup commands 2024-08-15 18:34:48 +02:00
Manuel Thalmann 75aad9d526 Hide output of DISM commands 2024-08-15 13:57:15 +02:00
Manuel Thalmann 200c3cfb80 Ensure website is loaded before download 2024-08-15 02:42:00 +02:00
Manuel Thalmann 00519e29db Prevent Jellyfin from rebooting 2024-08-15 02:22:07 +02:00
Manuel Thalmann 771f7e2c00 Improve handling of slow websites 2024-08-14 18:47:29 +02:00
Manuel Thalmann 49a4e7332d Fix potential CRC errors 2024-08-14 18:46:42 +02:00
Manuel Thalmann 03de3b3bdf Ensure auto reboot is disabled properly 2024-08-12 21:32:53 +02:00
Manuel Thalmann 513cedee3f Disable auto reboot by default 2024-08-12 01:27:50 +02:00
Manuel Thalmann e060eda21e Add methods for managing auto restart feature 2024-08-12 01:23:42 +02:00
Manuel Thalmann 44f54a280d Install Wave Link first 2024-08-11 18:27:16 +02:00
Manuel Thalmann a55462b9ab Throw an error when failing to load config 2024-08-11 18:27:06 +02:00
Manuel Thalmann 7bede45d69 Fix incorrect script path 2024-08-10 20:37:10 +02:00
Manuel Thalmann 725a738ac4 Allow leaving install action unspecified 2024-08-10 19:27:56 +02:00
Manuel Thalmann 523eb674a9 Retrieve registry value properly 2024-08-10 19:26:53 +02:00
Manuel Thalmann 70488039e7 Add scripts for installing git 2024-08-10 15:28:10 +02:00
Manuel Thalmann 1ad66323cc Remove unnecessary code 2024-08-10 15:24:15 +02:00
Manuel Thalmann d894e7141f Add a function for removing the RunOnce key 2024-08-10 15:24:04 +02:00
Manuel Thalmann e78a2f7949 Set user groups properly 2024-08-10 15:23:38 +02:00
Manuel Thalmann 97d956e534 Configure MS accounts properly 2024-08-10 15:21:13 +02:00
Manuel Thalmann 46d22638db Queue next user after configuration finished 2024-08-10 15:20:36 +02:00
Manuel Thalmann 0f8afcc4cc Disable UAC after logging in MS account 2024-08-10 15:19:14 +02:00
Manuel Thalmann b1445d8783 Enable OneShot listener for MS accounts 2024-08-10 15:18:10 +02:00
Manuel Thalmann 0db26587ff Set timezone automatically 2024-08-10 15:17:21 +02:00
Manuel Thalmann cf88324e0e Prevent variable overwrite 2024-08-10 15:16:57 +02:00
Manuel Thalmann 463f2ad4f4 Register installer script after disabling UAG 2024-08-10 15:16:27 +02:00
Manuel Thalmann 5c302fe4be Redirect user for configuration properly 2024-08-10 15:16:00 +02:00
Manuel Thalmann efd9d0b524 Fix broken redirection of arguments 2024-08-10 15:15:40 +02:00
Manuel Thalmann dd00760aa7 Determine installer action properly 2024-08-10 15:15:21 +02:00
Manuel Thalmann fe70445d02 Redirect arguments to chocolatey properly 2024-08-10 15:13:46 +02:00
Manuel Thalmann 10d584c7d9 Fix non-functioning OneShot script 2024-08-10 15:13:20 +02:00
Manuel Thalmann d63b0904e6 Fix oneshot task execution 2024-08-10 06:11:55 +02:00
Manuel Thalmann 3a660c6f0e Allow removing the OneShot listener 2024-08-10 05:19:24 +02:00
Manuel Thalmann 2d5ba4972f Remove duplicate code 2024-08-10 05:17:08 +02:00
Manuel Thalmann fdee733a3c Fix typo 2024-08-10 03:57:37 +02:00
Manuel Thalmann 8c829fcd05 Fix copy paste error 2024-08-10 03:57:26 +02:00
Manuel Thalmann 546c878c26 Allow skipping the User parameter 2024-08-10 03:40:37 +02:00
Manuel Thalmann 09ecd570f3 Fix incorrect script path 2024-08-10 03:13:13 +02:00
Manuel Thalmann 326ec92b55 Fix broken scripts 2024-08-10 01:50:52 +02:00
Manuel Thalmann 6731e39b6a Remove unnecessary confirmation dialogue 2024-08-10 00:23:47 +02:00
Manuel Thalmann cce56d9d6f Add a task for disabling UAC 2024-08-10 00:23:37 +02:00
Manuel Thalmann 4e3089264e Force creation of sudo alias 2024-08-10 00:22:46 +02:00
Manuel Thalmann 2b54e79624 Allow execution of OneShot tasks 2024-08-10 00:22:30 +02:00
Manuel Thalmann cdc9c2edfa Ensure CONFIG_MODULE is resolved 2024-08-09 23:23:55 +02:00
Manuel Thalmann 6de884bed4 Add dedicated functions for creating startup scripts 2024-08-09 23:23:29 +02:00
Manuel Thalmann 4d930a09ba Change login message 2024-08-09 22:11:12 +02:00
Manuel Thalmann 62b13553ac Set up shared WSL 2024-08-09 16:02:33 +02:00
Manuel Thalmann db37209a14 Install updates only as admin 2024-08-09 16:02:24 +02:00
Manuel Thalmann 767b7ad228 Disable boot message only as admin 2024-08-09 16:02:00 +02:00
Manuel Thalmann f4c89ab20a Add a function for allowing user access 2024-08-09 15:56:16 +02:00
Manuel Thalmann 617fdef38e Fix broken reboot registration 2024-08-09 15:49:36 +02:00
Manuel Thalmann 8297bcc4cb Ensure the script path is detected properly 2024-08-09 14:45:50 +02:00
Manuel Thalmann f772108ffa Allow automatic script execution for MS accounts 2024-08-09 14:45:29 +02:00
Manuel Thalmann fba3e5d860 Reorder winget arguments 2024-08-09 14:45:05 +02:00
Manuel Thalmann 36796cede6 Allow registering reboot for the default user 2024-08-09 14:44:57 +02:00
Manuel Thalmann eb43134682 Add a dedicated function for disabling boot message 2024-08-09 13:35:12 +02:00
Manuel Thalmann be74a65f0c Implement root install loop using a switch 2024-08-09 13:34:46 +02:00
Manuel Thalmann 66e270f34d Force computer reboots 2024-08-09 04:42:55 +02:00
Manuel Thalmann f79112eaea Add scripts for controlling UAC 2024-08-09 04:29:26 +02:00
Manuel Thalmann e6b78fbfeb Set displayname of all users 2024-08-09 04:20:00 +02:00
Manuel Thalmann 6b678efb7c Login to users for configuration 2024-08-09 04:19:49 +02:00
Manuel Thalmann 835644f770 Skip PWSH_PATH if undefined 2024-08-09 04:08:22 +02:00
Manuel Thalmann c8c7d5a496 Fix typo 2024-08-09 03:38:10 +02:00
Manuel Thalmann fa4327275c Add missing setup stage 2024-08-09 03:02:25 +02:00
Manuel Thalmann 7cf7bcd027 Make Get-Users output explicit 2024-08-09 03:02:17 +02:00
Manuel Thalmann e5eff422ff Allow displaying a boot message 2024-08-09 02:59:06 +02:00
Manuel Thalmann 1b58282f69 Disable users by default 2024-08-09 02:58:01 +02:00
Manuel Thalmann fb35f198b4 Add a stage for configuring users 2024-08-09 02:27:24 +02:00
Manuel Thalmann bc46a64b9a Detect installation properly 2024-08-09 02:24:59 +02:00
Manuel Thalmann 998d6c181b Remove unnecessary icon 2024-08-09 02:23:56 +02:00
Manuel Thalmann cdf5cbe419 Add Predator Z301C to the hardware list 2024-08-09 02:23:41 +02:00
Manuel Thalmann 9ae994d5db Add support for the sudo command 2024-08-09 02:22:45 +02:00
Manuel Thalmann ad09c4dcbf Fix renaming user 2024-08-09 02:20:27 +02:00
Manuel Thalmann f22f2994d3 Make specifying PWSH_PATH optional 2024-08-09 02:12:27 +02:00
Manuel Thalmann f7bee2a4db Show error properly 2024-08-09 02:00:18 +02:00
Manuel Thalmann fb1d55bda3 Fix typo 2024-08-09 01:53:59 +02:00
Manuel Thalmann 2f6530a9fb Remove code duplication 2024-08-09 01:33:04 +02:00
Manuel Thalmann 5310089e42 Remove unnecessary console output 2024-08-09 01:22:51 +02:00
Manuel Thalmann 43226734cf Fix incorrect file paths 2024-08-09 00:17:05 +02:00
Manuel Thalmann 962ff80697 Fix incorrect hardware name 2024-08-09 00:03:45 +02:00
Manuel Thalmann 30c13e6cc4 Reorder installation steps 2024-08-08 23:03:10 +02:00
Manuel Thalmann 5da67032a3 Suppress unnecessary output 2024-08-08 22:24:41 +02:00
Manuel Thalmann 0246aec7a0 Refactor the wsl installation check 2024-08-08 22:21:49 +02:00
Manuel Thalmann a91bb53a07 Ensure WSL Ubuntu is installed 2024-08-08 22:08:13 +02:00
Manuel Thalmann 12751ced57 Make config script platform independent 2024-08-08 18:21:16 +02:00
Manuel Thalmann e1884b2a7d Leave groups unspecified 2024-08-08 17:50:32 +02:00
Manuel Thalmann 1e2f61c8bb Add users during installation 2024-08-08 17:49:43 +02:00
Manuel Thalmann 8a59fd4c5d Fix incorrect user conversion 2024-08-08 17:16:51 +02:00
Manuel Thalmann daa37a1b9b Keep Windows groups separate 2024-08-08 15:33:55 +02:00
Manuel Thalmann 47b014e3cd Remove unnecessary options from Win users 2024-08-08 15:32:05 +02:00
Manuel Thalmann 617c6ce8ef Inherit Windows users from linux 2024-08-08 15:28:29 +02:00
Manuel Thalmann 329007b063 Add functions for retrieving attributes 2024-08-08 14:45:34 +02:00
Manuel Thalmann 67ccb819e0 Install Oh My Posh system wide 2024-08-08 14:23:15 +02:00
Manuel Thalmann f278409727 Fix typo 2024-08-08 14:22:22 +02:00
Manuel Thalmann a8b35f4406 Skip scope argument by default 2024-08-08 14:22:13 +02:00
Manuel Thalmann 828c27352d Fix incorrect file paths 2024-08-08 14:21:55 +02:00
Manuel Thalmann af8541791b Configure NVS after installation 2024-08-08 14:09:20 +02:00
Manuel Thalmann 1dbfe0ab4d Refactor app association script 2024-08-08 14:09:07 +02:00
Manuel Thalmann 594a425cd3 Fix typo 2024-08-08 14:08:48 +02:00
Manuel Thalmann a9b8ecf105 Apply the error action globally 2024-08-08 14:08:38 +02:00
Manuel Thalmann d345488655 Move PinnedItem script to proper location 2024-08-08 14:04:51 +02:00
Manuel Thalmann e4bf4898ec Add notes to installation script 2024-08-08 14:03:15 +02:00
Manuel Thalmann de3aaedad0 Add a script for installing LGHub 2024-08-08 13:25:21 +02:00
Manuel Thalmann 4fd18e32b6 Reorder installation steps 2024-08-08 13:17:14 +02:00
Manuel Thalmann 98248d23e0 Reload env after installing git 2024-08-08 12:18:04 +02:00
Manuel Thalmann ae555e133d Enure features for PinnedItem are installed 2024-08-08 05:21:21 +02:00
Manuel Thalmann 6a8303fdc2 Install features using chocolatey 2024-08-08 05:20:58 +02:00
Manuel Thalmann f2cd00248a Ensure git is installed 2024-08-08 05:14:31 +02:00
Manuel Thalmann 7118ec594f Fix broken XML document creation 2024-08-08 05:04:59 +02:00
Manuel Thalmann 580f06779f Fix incorrect parameter access 2024-08-08 05:03:24 +02:00
Manuel Thalmann 43bc0fae7e Fix incorrect path 2024-08-08 05:01:45 +02:00
Manuel Thalmann f5533bf7f6 Add a dedicated user option for windows 2024-08-08 04:45:27 +02:00
Manuel Thalmann 2aa608bc8d Add a stage for creating users 2024-08-08 04:38:40 +02:00
Manuel Thalmann d1a1a13346 Add scripts for all remaining apps 2024-08-08 04:36:35 +02:00
Manuel Thalmann 95418ba6aa Allow custom winget arguments 2024-08-08 04:29:00 +02:00
Manuel Thalmann 6c06f719c9 Improve winget function 2024-08-08 04:28:21 +02:00
Manuel Thalmann bf9679e522 Add missing function 2024-08-08 04:20:11 +02:00
Manuel Thalmann 0af53191ba Refactor browser scripts 2024-08-08 03:32:03 +02:00
Manuel Thalmann e735320fcb Ensure Selenium is imported 2024-08-08 02:59:02 +02:00
Manuel Thalmann 76ba329ad2 Allow skipping the Action argument 2024-08-08 02:56:28 +02:00
Manuel Thalmann 69925fac74 Rename all old installation scripts 2024-08-08 02:56:13 +02:00
Manuel Thalmann 8ad9f00956 Add options for enabling LG Hub 2024-08-08 02:29:51 +02:00
Manuel Thalmann 2ac7045883 Remove Firefox taskbar icon 2024-08-08 02:29:09 +02:00
Manuel Thalmann 4613f82442 Allow removing task bar icons 2024-08-08 02:28:40 +02:00
Manuel Thalmann 95922559c2 Allow installing modules native only 2024-08-08 02:28:23 +02:00
Manuel Thalmann 2eebf4db53 Rename old LGHub script 2024-08-08 02:27:39 +02:00
Manuel Thalmann 2ee11b7fa3 Add missing config 2024-08-08 01:51:21 +02:00
Manuel Thalmann 2612b6b6de Rename PuTTY script 2024-08-08 00:51:45 +02:00
Manuel Thalmann 584841870b Fix permission issue 2024-08-08 00:48:18 +02:00
Manuel Thalmann e204d0f819 Add scripts for installing Tobii apps 2024-08-08 00:06:49 +02:00
Manuel Thalmann a8a99ffc23 Copy keyboard layout to welcome screen 2024-08-07 23:53:26 +02:00
Manuel Thalmann 88dfbc30c9 Add scripts for desktop apps 2024-08-07 23:53:12 +02:00
Manuel Thalmann eeee33917a Rename old Nextcloud script 2024-08-07 23:45:56 +02:00
Manuel Thalmann 6ce28f4751 Configure user only outside of setup 2024-08-07 23:30:29 +02:00
Manuel Thalmann db99c0a10b Add a script for installing Oh My Posh 2024-08-07 23:22:04 +02:00
Manuel Thalmann 4f3573329a Fix incorrect installation filter 2024-08-07 23:20:28 +02:00
Manuel Thalmann 7b31ecf85e Fix profile script for individual profiles 2024-08-07 23:18:44 +02:00
Manuel Thalmann 1d0270e455 Show messages if packages are installed 2024-08-07 23:18:23 +02:00
Manuel Thalmann 32daa81086 Fix incorrect package check 2024-08-07 23:17:07 +02:00
Manuel Thalmann a86b1b1069 Refactor default winget parameters 2024-08-07 22:56:42 +02:00
Manuel Thalmann 52caf4d991 Add scripts for installing PS modules 2024-08-07 22:55:25 +02:00
Manuel Thalmann 211700fbee Allow skipping PowerShell profile files 2024-08-07 22:25:42 +02:00
Manuel Thalmann 38deb9dc88 Resolve dependency loop 2024-08-07 21:54:58 +02:00
Manuel Thalmann cfc5643347 Remove unnecessary statement 2024-08-07 21:53:26 +02:00
Manuel Thalmann 60b9464dfb Refactor chocolatey script 2024-08-07 21:50:21 +02:00
Manuel Thalmann 09009b3541 Pass arguments to software script 2024-08-07 21:37:33 +02:00
Manuel Thalmann 9d024f9c3e Use internal OS detection 2024-08-07 21:35:03 +02:00
Manuel Thalmann 7b9eb1b370 Refactor PowerShell profile script 2024-08-07 21:34:40 +02:00
Manuel Thalmann 99cc9cb12b Move scripts properly 2024-08-07 21:05:32 +02:00
Manuel Thalmann b024445989 Add scripts for installing PowerShell 2024-08-07 20:30:12 +02:00
Manuel Thalmann 498d65e24a Rename PowerShell script directory 2024-08-07 19:08:13 +02:00
Manuel Thalmann 0e30d9cc0b Add script for installing Thunderbird 2024-08-07 18:57:27 +02:00
Manuel Thalmann 2e042f9e1b Install drivers in proper phase 2024-08-07 18:54:07 +02:00
Manuel Thalmann 339379a04f Add a script for installing WinSCP 2024-08-07 18:30:14 +02:00
Manuel Thalmann 5145b5383f Refactor app association script 2024-08-07 18:29:20 +02:00
Manuel Thalmann e9b0cb3f7f Prevent reboot during WaveLink installation 2024-08-07 18:01:17 +02:00
Manuel Thalmann 1d6fafa73f Add scripts for installing drivers 2024-08-07 16:17:49 +02:00
Manuel Thalmann 37e5636da1 Add script for installing AMD packages 2024-08-07 15:25:12 +02:00
Manuel Thalmann 9ab7cdc4d0 Add missing package for selenium 2024-08-07 15:24:56 +02:00
Manuel Thalmann 27d2797ed2 Ensure correct types for setting download dir 2024-08-07 15:24:37 +02:00
Manuel Thalmann 164a3b60ef Add a script for installing ASUS packages 2024-08-07 14:40:24 +02:00
Manuel Thalmann d13d774b4b Refactor browser automation scripts 2024-08-07 14:28:26 +02:00
Manuel Thalmann 7b8849e0bf Execute winget script in a module 2024-08-07 13:36:47 +02:00
Manuel Thalmann 629e2044c7 Install components for browser automation 2024-08-07 13:36:31 +02:00
Manuel Thalmann 9602b40c50 Add functions for installing choco and winget packages 2024-08-07 13:22:12 +02:00
Manuel Thalmann ebc90e6e2e Add a function for checking winget packages 2024-08-07 13:18:29 +02:00
Manuel Thalmann 603d665f9e Enhance the winget install check 2024-08-07 03:34:12 +02:00
Manuel Thalmann 5b299e432d Add a function for checking NuGet packages 2024-08-07 03:23:59 +02:00
Manuel Thalmann 32a190342f Fix non-functioning script 2024-08-07 03:23:21 +02:00
Manuel Thalmann 51558e02c9 Install PowerShell modules after removing old copy 2024-08-06 18:19:33 +02:00
Manuel Thalmann 87036479fa Add config for declaring hardware 2024-08-06 17:23:20 +02:00
Manuel Thalmann 118b653a63 Silence unnecessary output 2024-08-06 17:07:57 +02:00
Manuel Thalmann 0fc2d9348c Add a separate function for executing software actions 2024-08-06 16:54:11 +02:00
Manuel Thalmann c95519fef7 Add a function for checking whether a setup is being run 2024-08-06 14:32:37 +02:00
Manuel Thalmann c437c6c6cf Determine software script name properly 2024-08-06 12:21:48 +02:00
Manuel Thalmann 0c47df9f00 Fix incorrect path 2024-08-06 12:21:00 +02:00
Manuel Thalmann e230a95209 Fix incorrectly imported modules 2024-08-06 11:39:57 +02:00
Manuel Thalmann dbe0515965 Fix incorrect XPaths 2024-08-06 11:39:48 +02:00
Manuel Thalmann 13b33d6ee8 Create Windows image as normal user 2024-08-06 11:39:34 +02:00
Manuel Thalmann 2bde374dca Make the name of the setup user look more Windows like 2024-08-06 11:39:05 +02:00
Manuel Thalmann a919979a68 Set the name of the setup user properly 2024-08-06 10:22:50 +02:00
Manuel Thalmann 83bf9a4d32 Add scripts for installing essential software 2024-08-06 00:04:02 +02:00
Manuel Thalmann fa57e95def Add a function for removing desktop icons 2024-08-06 00:02:07 +02:00
Manuel Thalmann 1e6d44d1bb Add an option for showing file extensions 2024-08-05 23:22:22 +02:00
Manuel Thalmann 2fe3b639f7 Ensure the environment variables are always set properly 2024-08-05 23:09:58 +02:00
Manuel Thalmann 92dee406ff Fix incorrect argument initialization 2024-08-05 23:08:36 +02:00
Manuel Thalmann c37ea23130 Ensure Arguments contains an object 2024-08-05 22:51:29 +02:00
Manuel Thalmann a9769bd980 Fix argument redirection 2024-08-05 22:49:44 +02:00
Manuel Thalmann 290b9a3611 Fix non-functioning script 2024-08-05 22:45:17 +02:00
Manuel Thalmann 633df57fee Allow running further installer actions within an installer 2024-08-05 22:29:20 +02:00
Manuel Thalmann f43e612883 Refactor windows configuration script 2024-08-05 20:07:39 +02:00
Manuel Thalmann 00ee61ac90 Add settings for customizing windows 2024-08-05 19:12:59 +02:00
Manuel Thalmann 39803bbbba Refactor software script environment 2024-08-05 00:07:41 +02:00
Manuel Thalmann db38915911 Set CONFIG_MODULE to full path by default 2024-08-02 01:57:31 +02:00
Manuel Thalmann fb02b79a4d Enter next stage after configuration 2024-08-02 01:44:56 +02:00
Manuel Thalmann 8c447dabbe Make config module persist in WSL 2024-08-02 00:47:33 +02:00
Manuel Thalmann 7a47b016ef Ensure arguments are passed to fish 2024-08-01 23:36:03 +02:00
Manuel Thalmann a9ae8c9a98 Fix installer script structure 2024-08-01 23:34:35 +02:00
Manuel Thalmann 72fd72f5bd Declare InstallerAction in a separate file 2024-08-01 22:52:51 +02:00
Manuel Thalmann 4906bb0b24 Ensure necessary modules are imported 2024-08-01 21:49:46 +02:00
Manuel Thalmann 2e03728d44 Import SetupStage enum into installation module 2024-08-01 21:32:33 +02:00
Manuel Thalmann b5d9489f21 Pause on error by default 2024-08-01 21:08:31 +02:00
Manuel Thalmann d9be9fe3da Display the software name during installation 2024-08-01 21:06:03 +02:00
Manuel Thalmann 8dbac3564d Fix non-functioning command 2024-08-01 20:34:55 +02:00
Manuel Thalmann 38f65b3e63 Remove non-existent script 2024-08-01 19:10:10 +02:00
Manuel Thalmann 06b314b1f5 Nest installation functions in a module 2024-08-01 19:02:12 +02:00
Manuel Thalmann 9bcdd2fd9f Install winget if nonexistent 2024-08-01 18:58:33 +02:00
Manuel Thalmann 429cc25c4c Use the new commands 2024-08-01 18:36:47 +02:00
Manuel Thalmann 629046b212 Add dedicated commands for checking software 2024-08-01 18:35:45 +02:00
Manuel Thalmann 369fcaed00 Add a script for managing software 2024-08-01 18:24:26 +02:00
Manuel Thalmann cc77eaf05c Fix nix installation check 2024-08-01 18:05:10 +02:00
Manuel Thalmann 9324e3074f Make nix visible to WSL 2024-08-01 18:03:48 +02:00
Manuel Thalmann c5be70b11d Add a function for getting the users to create 2024-08-01 17:56:42 +02:00
Manuel Thalmann 38ed315bd2 Rename the file containing software functions 2024-08-01 17:38:59 +02:00
Manuel Thalmann d3dd4ff5a9 Configure clock for dualboot systems 2024-08-01 16:32:03 +02:00
Manuel Thalmann 5b0074bea9 Enter configuration stage if nix exists 2024-08-01 16:28:48 +02:00
Manuel Thalmann 6612b9e7d4 Reboot WSL to pick up nix 2024-08-01 16:25:18 +02:00
Manuel Thalmann 1fb70ecda0 Add a function for retrieving nix options 2024-08-01 16:12:58 +02:00
Manuel Thalmann 781d133e7e Make CONFIG_MODULE available in WSL 2024-08-01 14:39:44 +02:00
Manuel Thalmann bba8da3b84 Install WSL and nix by default 2024-08-01 14:06:40 +02:00
Manuel Thalmann 86732247b9 Rename config module file 2024-08-01 12:39:27 +02:00
Manuel Thalmann be41a143c0 Reword log messages 2024-08-01 12:32:43 +02:00
Manuel Thalmann 8f0e147fa0 Fix syntax error 2024-08-01 12:31:25 +02:00
Manuel Thalmann fa60493ae1 Import scripting module inside the PowerManagement module 2024-08-01 12:24:28 +02:00
Manuel Thalmann a6985d7e1b Add scripts for updating windows 2024-08-01 02:59:32 +02:00
Manuel Thalmann 5bb0cd41cc Fix errors in the PowerManagement module 2024-08-01 02:19:05 +02:00
Manuel Thalmann 467b429bd9 Fix syntax error 2024-08-01 01:22:23 +02:00
Manuel Thalmann f228817817 Fix incorrect documentation comment 2024-07-31 23:10:21 +02:00
Manuel Thalmann e327ca8d17 Fix handling of setup stages 2024-07-31 22:33:37 +02:00
Manuel Thalmann 734ae7bd05 Set registry values properly 2024-07-31 22:33:16 +02:00
Manuel Thalmann cd3f85103a Display console output of hooks 2024-07-31 22:18:47 +02:00
Manuel Thalmann dbdedad1d9 Store stages using their name 2024-07-31 16:52:49 +02:00
Manuel Thalmann 31c30e6854 Refactor the installation loop architecture 2024-07-31 16:25:32 +02:00
Manuel Thalmann 89183dbeed Implement install loop properly 2024-07-31 16:15:09 +02:00
Manuel Thalmann 64c2ba9127 Implement the windows installation in a loop 2024-07-31 16:09:50 +02:00
Manuel Thalmann d07d4c9057 Recreate script to first install pwsh 2024-07-31 15:52:41 +02:00
Manuel Thalmann bb0b4a5988 Normalize script formatting 2024-07-31 15:52:23 +02:00
Manuel Thalmann 1be172ae07 Add a script for managing setup options 2024-07-31 15:42:02 +02:00
Manuel Thalmann fad332b267 Add a script for rebooting the computer 2024-07-31 15:41:45 +02:00
Manuel Thalmann c137952345 Add a separate script for injecting values into scripts 2024-07-31 14:55:00 +02:00
Manuel Thalmann 156c72c977 Add a script for checking for installed choco packages 2024-07-31 14:53:21 +02:00
Manuel Thalmann 8d9e9ca3a6 Copy pwsh to newly setup windows systems 2024-07-31 14:47:42 +02:00
Manuel Thalmann ca2a5f23b0 Rename old windows installation script 2024-07-30 18:47:01 +02:00
Manuel Thalmann 4e87165196 Add a function for executing hooks 2024-07-30 18:34:19 +02:00
Manuel Thalmann 0d926a06b8 Enable rclone services properly 2024-07-30 17:42:29 +02:00
Manuel Thalmann ea991759af Disable root bash login during installation 2024-07-30 00:54:43 +02:00
Manuel Thalmann d285e69c97 Silence unnecessary output 2024-07-30 00:53:20 +02:00
Manuel Thalmann 974b1b8083 Install vscode extensions for each user 2024-07-30 00:53:10 +02:00
Manuel Thalmann 6e505faada Fix installation of brave extensions 2024-07-30 00:52:55 +02:00
Manuel Thalmann 8e1f3e0148 Fix non-functioning installation scripts 2024-07-30 00:52:35 +02:00
Manuel Thalmann 346614deee Fix missing variables 2024-07-30 00:51:50 +02:00
Manuel Thalmann 4d2c02c2b5 Fix non-functioning command 2024-07-29 23:46:14 +02:00
Manuel Thalmann 852b1c71ce Load dualboot sizes from nix 2024-07-29 01:44:12 +02:00
Manuel Thalmann e87a39691b Improve handling of wmic output 2024-07-29 01:22:42 +02:00
Manuel Thalmann 06cbabc36c Save unnecessary space 2024-07-29 00:10:07 +02:00
Manuel Thalmann 5b650f7efc Allow overwriting packages 2024-07-28 23:45:30 +02:00
Manuel Thalmann 5f0a25deb2 Generate locales in proper system 2024-07-28 23:45:09 +02:00
Manuel Thalmann 3c6933c03d Execute userConfig for current user only once 2024-07-28 23:44:58 +02:00
Manuel Thalmann f3049e9fd2 Prevent userConfig from execute multiple times 2024-07-28 23:43:11 +02:00
Manuel Thalmann 4a34593d83 Nest Windows setup in a function 2024-07-28 20:52:07 +02:00
Manuel Thalmann 7d322b8759 Configure Windows on DerGeret 2024-07-28 17:14:38 +02:00
206 changed files with 7332 additions and 1400 deletions

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
*.fish text eol=lf
*.sh text eol=lf

View file

@ -23,7 +23,7 @@ automated_script() {
sleep 1 sleep 1
done done
printf '%s: downloading %s\n' "$0" "${script}" printf '%s: downloading %s\n' "$0" "${script}"
curl "${script}" --location --retry-connrefused --retry 10 -s -o /tmp/startup_script curl "${script}" --location --retry-connrefused --retry 10 --fail -s -o /tmp/startup_script
rt=$? rt=$?
else else
cp "${script}" /tmp/startup_script cp "${script}" /tmp/startup_script

View file

@ -1,8 +1,8 @@
diff --git a/airootfs/root/.zlogin b/airootfs/root/.zlogin diff --git a/airootfs/root/.zlogin b/airootfs/root/.zlogin
index bf6bc8f..76e5893 100755 index bf6bc8f..a0dae7b 100755
--- a/airootfs/root/.zlogin --- a/airootfs/root/.zlogin
+++ b/airootfs/root/.zlogin +++ b/airootfs/root/.zlogin
@@ -4,3 +4,18 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then @@ -4,3 +4,19 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then
fi fi
~/.automated_script.sh ~/.automated_script.sh
@ -16,13 +16,14 @@ index bf6bc8f..76e5893 100755
+ +
+git diff -p -R --no-ext-diff --no-color --diff-filter=M \ +git diff -p -R --no-ext-diff --no-color --diff-filter=M \
+ | grep -E "^(diff|(old|new) mode)" --color=never \ + | grep -E "^(diff|(old|new) mode)" --color=never \
+ | sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" \
+ | git apply + | git apply
+ +
+popd > /dev/null +popd > /dev/null
+ +
+loadkeys de_CH-latin1 +loadkeys de_CH-latin1
diff --git a/packages.x86_64 b/packages.x86_64 diff --git a/packages.x86_64 b/packages.x86_64
index 9e876e7..b89ab30 100755 index 9e876e7..c5db92a 100755
--- a/packages.x86_64 --- a/packages.x86_64
+++ b/packages.x86_64 +++ b/packages.x86_64
@@ -30,8 +30,10 @@ ethtool @@ -30,8 +30,10 @@ ethtool
@ -36,7 +37,15 @@ index 9e876e7..b89ab30 100755
gnu-netcat gnu-netcat
gpart gpart
gpm gpm
@@ -75,6 +77,7 @@ nbd @@ -45,6 +47,7 @@ irssi
iw
iwd
jfsutils
+jq
kitty-terminfo
ldns
less
@@ -75,6 +78,7 @@ nbd
ndisc6 ndisc6
nfs-utils nfs-utils
nilfs-utils nilfs-utils

View file

@ -6,7 +6,7 @@
flake-utils.url = "github:numtide/flake-utils?ref=b1d9ab70662946ef0850d488da1c9019f3a9752a"; flake-utils.url = "github:numtide/flake-utils?ref=b1d9ab70662946ef0850d488da1c9019f3a9752a";
}; };
outputs = { self, flake-utils, nixpkgs }: flake-utils.lib.eachDefaultSystem ( outputs = { self, flake-utils, nixpkgs }: (flake-utils.lib.eachDefaultSystem (
system: system:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
@ -32,5 +32,10 @@
packages = { packages = {
archiso = pkgs.archiso; archiso = pkgs.archiso;
}; };
}); })) // {
valhalla = {
DerGeret = import ./profiles/machines/manuel/DerGeret/Arch/config.nix;
ManuSurface = import ./profiles/machines/manuel/ManuSurface/Arch/config.nix;
};
};
} }

15
lib/eval-attribute.nix Normal file
View file

@ -0,0 +1,15 @@
let
inherit (nixpkgs) lib;
nixpkgs = import <nixpkgs> { config = {}; overlay = []; };
property = (builtins.getEnv "PROPERTY");
processor = if (builtins.stringLength property > 0)
then
(_: lib.attrsets.getAttrFromPath (lib.strings.splitString "." property) _)
else
(_: _);
in
_: processor (lib.evalModules {
modules = [
_
];
}).config

View file

@ -1,7 +0,0 @@
{ lib, ... }: {
options = {
valhalla = {
git = (import ./git/options.nix) { inherit lib; };
};
};
}

View file

@ -1,33 +0,0 @@
{ lib, ... }:
let
inherit (lib)
mkOption
types
;
in {
defaultBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the default branch in git.";
default = null;
};
flow = {
mainBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the stable branch in git flow.";
default = null;
};
devBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the development branch in git flow.";
default = null;
};
};
aliases = mkOption {
type = types.attrsOf types.str;
description = "Git command aliases to install.";
default = {};
};
}

55
lib/modules/hardware.nix Normal file
View file

@ -0,0 +1,55 @@
{ lib, ... }:
let
inherit (lib)
mkOption
types
;
in {
options = {
valhalla = {
hardware = {
components = mkOption {
type = types.listOf types.str;
description = "The names of the hardware components of the computer.";
default = [];
};
eyeX = mkOption {
type = types.bool;
description = "A value indicating whether a Tobii EyeX device is present.";
default = false;
};
amdCPU = mkOption {
type = types.bool;
description = "A value indicating whether an AMD CPU is present.";
default = false;
};
nvidiaGPU = mkOption {
type = types.bool;
description = "A value indicating whether an NVIDIA GPU is present.";
default = false;
};
corsairDevice = mkOption {
type = types.bool;
description = "A value indicating whether a Corsair device is present.";
default = false;
};
elgatoWave = mkOption {
type = types.bool;
description = "A value indicating whether an Elgato Wave device is present.";
default = false;
};
logitechG = mkOption {
type = types.bool;
description = "A value indicating whether a Logitech G device is present.";
default = false;
};
};
};
};
}

52
lib/modules/os.nix Normal file
View file

@ -0,0 +1,52 @@
{ lib, ... }:
let
inherit (lib)
mkOption
types
;
in {
options = {
valhalla = mkOption {
type = types.submodule (
{ extendModules, ... }:
let
osVariant = extendModules {
modules = [
({ config, ... }: {
options = {
config = mkOption {
type = types.attrs;
description = "The configuration of the Operating System.";
default = builtins.removeAttrs config ["_module" "config" "linux" "windows"];
visible = false;
};
};
})
];
};
linuxVariant = osVariant.extendModules { };
windowsVariant = osVariant.extendModules { };
in {
options = {
linux = mkOption {
inherit (linuxVariant) type;
description = "The options for setting up Linux.";
default = {};
visible = "shallow";
};
windows = mkOption {
inherit (windowsVariant) type;
description = "The options for setting up Windows.";
default = {};
visible = "shallow";
};
};
});
description = "Configuration for PortValhalla.";
default = {};
};
};
}

View file

@ -0,0 +1,59 @@
{ lib, ... }:
let
inherit (lib)
mkOption
types
;
gitType = types.submodule (
{ ... }: {
options = {
defaultBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the default branch in newly created repositories.";
default = null;
};
flow = {
mainBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the stable branch in git flow.";
default = null;
};
devBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the development branch in git flow.";
default = null;
};
};
aliases = mkOption {
type = types.attrsOf types.str;
description = "The git command aliases to install.";
default = {};
};
};
});
gitOption = mkOption {
type = gitType;
description = "The git related options.";
default = {};
};
in {
options = {
valhalla = {
git = gitOption;
users = mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
options = {
git = gitOption;
};
}));
};
};
};
}

View file

@ -0,0 +1,44 @@
{ lib, ... }:
let
inherit (lib)
mkEnableOption
mkOption
types
;
syncType = types.submodule (
{ ... }: {
options = {
remotePath = mkOption {
type = types.str;
description = "The path to the folder on the cloud to sync.";
};
localPath = mkOption {
type = types.str;
description = "The path to sync the cloud content to.";
};
virtualFiles = (mkEnableOption "virtual file support") // {
default = true;
};
};
});
in {
options = {
valhalla.windows.users = mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
options = {
nextcloud = {
folderSyncs = mkOption {
type = types.listOf syncType;
description = "The folders to synchronize.";
default = [];
};
};
};
}));
};
};
}

View file

@ -0,0 +1,60 @@
{ lib, ... }:
let
inherit (lib)
mkOption
types
;
themeType = types.submodule (
{ config, ... }: {
options = {
source = mkOption {
type = types.nullOr types.path;
description = "The path to the oh-my-posh theme to use.";
default = null;
};
name = mkOption {
type = types.nullOr types.str;
description = "The name of the theme.";
default = if (config.source != null)
then
lib.strings.removeSuffix ".omp" (lib.strings.removeSuffix ".json" (builtins.baseNameOf config.source))
else
null;
};
};
});
ompType = types.submodule (
{ config, ... }: {
options = {
theme = mkOption {
type = types.either types.str themeType;
description = "The default theme.";
default = {};
};
additionalThemes = mkOption {
type = types.listOf themeType;
description = "A set of additional themes to install.";
default = [];
};
};
});
in {
options = {
valhalla.users = mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
options = {
oh-my-posh = mkOption {
type = ompType;
description = "The Oh My Posh configuration to apply.";
default = {};
};
};
}));
};
};
}

View file

@ -0,0 +1,40 @@
{ lib, ... }:
let
inherit (lib)
mkOption
types
;
syncType = types.submodule (
{ ... }: {
options = {
dirName = mkOption {
type = types.str;
description = "The name of the directory to sync the remote files to.";
};
cacheDuration = mkOption {
type = types.nullOr types.str;
description = "The amount of time to keep cached files.";
default = null;
};
};
});
in {
options = {
valhalla.linux.users = mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
options = {
rclone = {
configurations = mkOption {
type = types.attrsOf syncType;
description = "The configurations of the rclone mounts.";
default = {};
};
};
};
}));
};
};
}

View file

@ -5,24 +5,10 @@
types types
; ;
syncType = types.submodule ( capitalize = (import ../text.nix { inherit lib; }).capitalize;
{ ... }: {
options = {
dirName = mkOption {
type = types.str;
description = "The name of the directory to sync the remote files to.";
};
cacheDuration = mkOption {
type = types.nullOr types.str;
description = "The amount of time to keep cached files.";
default = null;
};
};
});
userType = types.submodule ( userType = types.submodule (
{ ... }: { { ... } : {
options = { options = {
displayName = mkOption { displayName = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
@ -41,21 +27,27 @@
description = "The additional groups of the user."; description = "The additional groups of the user.";
default = []; default = [];
}; };
};
});
linuxUserType = types.submodule (
{ ... }: {
options = {
defaultShell = mkOption { defaultShell = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
description = "The default shell of the user."; description = "The default shell of the user.";
default = null; default = null;
}; };
};
});
git = (import ./git/options.nix) { inherit lib; }; winUserType = types.submodule (
{ ... }: {
rclone = { options = {
configurations = mkOption { microsoftAccount = mkOption {
type = types.attrsOf syncType; type = types.bool;
description = "The configurations of the rclone mounts."; description = "A value indicating whether this user is a Microsoft Account.";
default = {}; default = false;
};
}; };
}; };
}); });
@ -67,6 +59,33 @@
description = "The users to create on the machine."; description = "The users to create on the machine.";
default = {}; default = {};
}; };
linux.users = mkOption {
type = types.attrsOf linuxUserType;
};
windows = mkOption {
type = types.submoduleWith {
modules = [
({ config, options, ... }: {
options = {
users = mkOption {
type = types.attrsOf winUserType;
};
winUsers = mkOption {
type = options.users.type;
description = "Blablabla";
default = (lib.attrsets.concatMapAttrs (
name: options: {
${capitalize name} = options;
}) config.users);
};
};
})
];
};
};
}; };
}; };
} }

View file

@ -6,8 +6,13 @@
; ;
in { in {
imports = [ imports = [
./git.nix ./packages/git.nix
./packages/nextcloud.nix
./packages/oh-my-posh.nix
./packages/rclone.nix
./hardware.nix
./i18n.nix ./i18n.nix
./os.nix
./partition.nix ./partition.nix
./software.nix ./software.nix
./users.nix ./users.nix

View file

@ -1,15 +1,18 @@
{ lib, ... }: { lib, config, ... }:
let let
inherit (lib) inherit (lib)
mkOption mkDefault
mkEnableOption mkEnableOption
mkIf mkIf
mkOption
types types
; ;
winType = types.submodule ( capitalize = (import ../text.nix { inherit lib; }).capitalize;
{ config, ... }: { in {
options = { options = {
valhalla = {
windows = {
dualboot = { dualboot = {
enable = mkEnableOption "dual boot"; enable = mkEnableOption "dual boot";
@ -18,20 +21,27 @@
description = "The percentage of the disk size reserved for Linux."; description = "The percentage of the disk size reserved for Linux.";
}; };
}; };
};
config = { showFileExt = mkOption {
dualboot.linuxPercentage = mkIf (!config.dualboot.enable) 0; type = types.bool;
}; description = "A value indicating whether file extensions should be displayed in Windows Explorer.";
}); default = true;
in { };
options = {
valhalla = { legacyIconSpacing = mkEnableOption "legacy icon spacing" // {
windows = mkOption { default = true;
type = winType; };
description = "The options for setting up Windows.";
default = {}; dynamicLighting = mkEnableOption "dynamic lighting";
adware = mkEnableOption "adware"; # Fuck you for displaying ads on an OS I fricking paid for!
}; };
}; };
}; };
config = {
valhalla.windows = {
setupUser.name = mkDefault (capitalize config.valhalla.setupUser.name);
dualboot.linuxPercentage = mkIf (!config.valhalla.windows.dualboot.enable) (mkDefault 0);
};
};
} }

9
lib/text.nix Normal file
View file

@ -0,0 +1,9 @@
{ lib, ... }: {
capitalize = text:
let
chars = lib.strings.stringToCharacters text;
in lib.strings.concatStrings (
[(lib.strings.toUpper (builtins.elemAt chars 0))] ++
(lib.lists.drop 1 chars)
);
}

View file

@ -1,19 +0,0 @@
#!/bin/bash -e
function install() {
function installDrivers() {
. "../../../scripts/Arch/Config/SecureBoot/install.sh";
. "../../../scripts/Arch/Software/nvidia-dkms/install.sh";
. "../../../scripts/Arch/Software/xone/install.sh";
. "../../../scripts/Arch/Software/bt-dualboot/install.sh";
}
function initializeConfig() {
. "../../../scripts/Unix/Devices/Logitech G903/install.sh";
}
pushd "$dir" > /dev/null;
. "../../../scripts/Arch/OS/install.sh";
popd > /dev/null;
}
install;

View file

@ -1,139 +0,0 @@
#!/bin/pwsh
$env:WIN_COMPUTER_NAME = "DerGeret";
$env:SETUP_SCRIPT_NAME = "$PSScriptRoot/Restore.ps1";
function Initialize-SetupConfig() {
param(
[xml] $config,
[System.Xml.XmlNamespaceManager] $namespace
);
$setupComponent = $config.SelectSingleNode(
"/ua:unattend/ua:settings[@pass='windowsPE']/ua:component[@name='Microsoft-Windows-Setup']",
$namespace);
$diskConfig = $setupComponent.SelectSingleNode("./ua:DiskConfiguration/ua:Disk", $namespace);
$partitionCreationContainer = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace);
$partitionCreations = $partitionCreationContainer.SelectNodes("./ua:CreatePartition", $namespace);
$partitionModificationContainer = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace);
$partitionModifications = $partitionModificationContainer.SelectNodes("./ua:ModifyPartition", $namespace);
<#
.SYNOPSIS
Gets the XML element describing the installation partition ID.
#>
function Get-InstallationPartition {
$setupComponent.SelectSingleNode("./ua:ImageInstall/ua:OSImage/ua:InstallTo/ua:PartitionID", $namespace)
}
<#
.SYNOPSIS
Increases the ID of all partitions in the specified range by 1.
#>
function Move-PartitionRange {
param (
[int]$From = 0,
[System.Nullable[int]]$To = $null,
[int]$By = 1
)
# Update installation partition ID if necessary
$installationPartition = Get-InstallationPartition;
$installPartitionID = [int]$installationPartition.InnerText;
if (($installPartitionID -ge $From) -and (($null -eq $To) -or ($installPartitionID -le $To))) {
$installationPartition.InnerText = "$($installPartitionID + $By)";
}
# Update IDs of all partition creations
foreach ($partition in $partitionCreations) {
$orderNode = $partition.SelectSingleNode("./ua:Order", $namespace);
$order = [int]$orderNode.InnerText;
$newOrder = $order;
if (($newOrder -ge $From) -and (($null -eq $To) -or ($newOrder -le $To))) {
$newOrder += $By;
}
if ($order -ne $newOrder) {
$orderNode.InnerText = "$newOrder";
}
}
# Update IDs of all partition modifications
foreach ($partition in $partitionModifications) {
$partitionNode = $partition.SelectSingleNode("./ua:PartitionID", $namespace);
$partitionID = [int]$partitionNode.InnerText;
$newID = $partitionID;
if (($newID -ge $From) -and (($null -eq $To) -or ($newID -le $To))) {
$newID += $By;
}
if ($partitionID -ne $newID) {
$partitionNode.InnerText = "$newID";
$partition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newID";
}
}
}
function Add-Partition {
param (
[int]$Index,
[int]$Size,
[string]$Type = "Primary"
)
Move-PartitionRange -From $Index -By 1;
$newPartition = $partitionCreations[0].CloneNode($true);
$newPartition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$Index";
$newPartition.SelectSingleNode("./ua:Type", $namespace).InnerText = "$Type";
$newPartition.SelectSingleNode("./ua:Size", $namespace).InnerText = "$Size";
$null = $partitionCreationContainer.AppendChild($newPartition);
$newModification = $partitionModifications[2].CloneNode($true);
$newModification.SelectSingleNode("./ua:Order", $namespace).InnerText = "$Index";
$newModification.SelectSingleNode("./ua:PartitionID", $namespace).InnerText = "$Index";
$null = $partitionModificationContainer.AppendChild($newModification);
}
<#
.SYNOPSIS
Relocates the partition with the specified `$From` ID to the specified `$To` ID.
#>
function Invoke-PartitionRelocation {
param (
[int]$From,
[int]$To
)
Move-PartitionRange $From $From (-1 * ($From + 1))
if ($From -gt $To) {
Move-PartitionRange $To ($From - 1);
}
elseif ($From -lt $To) {
Move-PartitionRange ($From + 1) $To -1;
}
Move-PartitionRange -1 -1 ($To + 1)
}
# Resize EFI partition to 1GB
$partitionCreations[1].SelectSingleNode("./ua:Size", $namespace).InnerText = "$(1024)";
# Swap Windows RE partition (partition #1) and boot partition (partition #2)
Invoke-PartitionRelocation 2 1;
# Add space before Windows installation... wha-!? For Linux, ofc! I use Arch Linux, btw.
$swapSpacer = 100;
Add-Partition 2 $swapSpacer;
# Add a 1.2 TB partition for Linux
Add-Partition 3 ((1.2 * 1024 * 1024) - 1024 - $swapSpacer);
}
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";

View file

@ -1,20 +0,0 @@
{ ... }: {
imports = [
../Generic/config.nix
];
config = {
valhalla.partition.os.partitions = {
Boot.keepExisting = true;
Windows = {
index = 6;
label = "OS";
format = "ntfs";
mountPoint = "/win";
mountOptions = ["force"];
keepExisting = true;
};
};
};
}

View file

@ -1,13 +0,0 @@
#!/bin/pwsh
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
. "$PSScriptRoot/../../../scripts/Windows/OS/Install.ps1";
. "$PSScriptRoot/../../../scripts/Windows/Collections/Generic.ps1"
function Restore-Apps {
param([Context] $context)
Restore-GenericApps $context;
}
[Context]$context = [Context]::new();
Invoke-WindowsInstallation $context;
Restart-Computer -Force;

View file

@ -1,6 +0,0 @@
#!/bin/pwsh
$env:WIN_COMPUTER_NAME ??= "win11";
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
$env:CONFIG_MODULE ??= "$PSScriptRoot/../config.nix";
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";

View file

@ -1,4 +0,0 @@
#!/bin/pwsh
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
. "$PSScriptRoot/../../Generic/Windows/Setup.ps1";

View file

@ -1,5 +0,0 @@
#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../../scripts/Arch/OS/install.fish"
end

View file

@ -1,26 +0,0 @@
#!/bin/bash -e
function install() {
function installDrivers() {
. "../../../scripts/Arch/Config/SecureBoot/install.sh";
. "../../../scripts/Arch/Drivers/SurfaceBook2/install.sh";
}
function installSoftware() {
. "../../../scripts/Arch/Collections/school.sh";
}
function initializeConfig() {
. "../../../scripts/Common/Config/Steam/hidpi.sh";
. "../../../scripts/Unix/Devices/Surface Book 2/install.sh";
. "../../../scripts/Unix/Devices/Logitech G903/install.sh";
# Because, as it looks, Surface Books are fucking stupid.
. "../../../scripts/Common/Config/GRUB/verbose.sh";
}
pushd "${BASH_SOURCE%/*}" > /dev/null;
. "../../../scripts/Arch/OS/install.sh";
popd > /dev/null;
}
install;

View file

@ -1,16 +0,0 @@
#!/bin/bash
pushd "${BASH_SOURCE%/*}" > /dev/null;
# Set Hostname
sudo hostnamectl set-hostname ManuSurface;
source "../../../scripts/PopOS/Scripts/preinstall.sh";
source "../../../scripts/PopOS/OS/install.sh";
source "../../../scripts/Debian/Drivers/SurfaceBook2/Setup/install.sh";
source "../../../scripts/PopOS/Software/Collections/school.sh";
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../../scripts/Common/Config/UserProfile/install.sh";
# Install equalizer
source "../../../scripts/Common/Config/EasyEffects/SurfaceBook2/install.sh";
source "../../../scripts/PopOS/Scripts/postinstall.sh";
popd > /dev/null;

View file

@ -1,12 +0,0 @@
#!/bin/bash
pushd "${BASH_SOURCE%/*}" > /dev/null;
# Set Hostname
sudo hostnamectl set-hostname ManuPopOSLive;
source "../../scripts/PopOS/Scripts/prepare.sh";
source "../../scripts/PopOS/OS/install.sh";
source "../../scripts/PopOS/Software/Collections/personal.sh";
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../scripts/Common/Config/UserProfile/personal.sh";
source "../../scripts/PopOS/Scripts/postinstall.sh";
popd > /dev/null;

View file

@ -0,0 +1,19 @@
#!/bin/bash -e
function install() {
function installDrivers() {
. "../../../../../scripts/Arch/Config/SecureBoot/install.sh";
. "../../../../../scripts/Arch/Software/nvidia-dkms/install.sh";
. "../../../../../scripts/Arch/Software/xone/install.sh";
. "../../../../../scripts/Arch/Software/bt-dualboot/install.sh";
}
function initializeConfig() {
. "../../../../../scripts/Unix/Devices/Logitech G903/install.sh";
}
pushd "$dir" > /dev/null;
. "../../../../../scripts/Arch/OS/install.sh";
popd > /dev/null;
}
install;

View file

@ -6,8 +6,8 @@ begin
echo "$dir/install.fish" echo "$dir/install.fish"
end end
CONFIG_MODULE="$dir/config.nix" \ CONFIG_NAME="DerGeret" \
ARCH_HOSTNAME="der-geret" \ ARCH_HOSTNAME="der-geret" \
USER_DISPLAYNAME="Manuel Thalmann" \ USER_DISPLAYNAME="Manuel Thalmann" \
source "$(status dirname)/../../../scripts/Arch/OS/setup.fish" source "$(status dirname)/../../../../../scripts/Arch/OS/setup.fish"
end end

View file

@ -4,6 +4,6 @@ pushd "${BASH_SOURCE%/*}" > /dev/null;
CONFIG_MODULE="./config.nix" \ CONFIG_MODULE="./config.nix" \
ARCH_HOSTNAME="der-geret" \ ARCH_HOSTNAME="der-geret" \
USER_DISPLAYNAME="Manuel Thalmann" \ USER_DISPLAYNAME="Manuel Thalmann" \
. "../../../scripts/Arch/OS/setup.sh"; . "../../../../../scripts/Arch/OS/setup.sh";
popd > /dev/null; popd > /dev/null;

View file

@ -1,7 +1,7 @@
#!/bin/pwsh #!/bin/pwsh
$null = New-Module { $null = New-Module {
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1"; . "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
. "$PSScriptRoot/../../../scripts/Windows/OS/Manage.ps1"; . "$PSScriptRoot/../../../../../scripts/Windows/OS/Legacy.ps1";
Write-Host "Starting Backup of Windows"; Write-Host "Starting Backup of Windows";
$context = [Context]::new(); $context = [Context]::new();

View file

@ -1,12 +1,12 @@
#!/bin/pwsh #!/bin/pwsh
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1"; . "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
function Install-PortValhallaDrivers { function Install-PortValhallaDrivers {
param( param(
[Context] $context [Context] $context
) )
$winPath = "$PSScriptRoot/../../../scripts/Windows"; $winPath = "$PSScriptRoot/../../../../../scripts/Windows";
$driverPath = "$winPath/Drivers"; $driverPath = "$winPath/Drivers";
$mbDriverPath = "$driverPath/ROG Zenith Extreme Alpha"; $mbDriverPath = "$driverPath/ROG Zenith Extreme Alpha";
$context.RegisterReboot(); $context.RegisterReboot();
@ -38,7 +38,7 @@ function Install-PersonalDrivers {
[Context] $context [Context] $context
) )
$softwarePath = "$PSScriptRoot/../../../scripts/Windows/Software"; $softwarePath = "$PSScriptRoot/../../../../../scripts/Windows/Software";
. "$softwarePath/TobiiGhost/Install.ps1" $context; . "$softwarePath/TobiiGhost/Install.ps1" $context;
. "$softwarePath/TobiiGameHub/Install.ps1" $context; . "$softwarePath/TobiiGameHub/Install.ps1" $context;
} }

View file

@ -1,8 +1,8 @@
#!/bin/pwsh #!/bin/pwsh
. "$PSScriptRoot/Drivers.ps1"; . "$PSScriptRoot/Drivers.ps1";
. "$PSScriptRoot/../../../scripts/Windows/Collections/Personal.ps1" . "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
. "$PSScriptRoot/../../../scripts/Windows/OS/Install.ps1"; . "$PSScriptRoot/../../../../../scripts/Windows/Collections/Personal.ps1"
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1"; . "$PSScriptRoot/../../../../../scripts/Windows/OS/Manage.ps1";
function Initialize-Configuration { function Initialize-Configuration {
# Fix synchronization between Linux and Windows clock # Fix synchronization between Linux and Windows clock
@ -26,5 +26,4 @@ function Restore-Apps {
Write-Host "Starting Restoration of Windows"; Write-Host "Starting Restoration of Windows";
[Context]$context = [Context]::new(); [Context]$context = [Context]::new();
Invoke-WindowsInstallation $context; Start-WindowsInstallation;
Restart-Computer -Force;

View file

@ -0,0 +1,5 @@
#!/bin/pwsh
$env:WIN_COMPUTER_NAME = "DerGeret";
$env:CONFIG_NAME = $env:WIN_COMPUTER_NAME;
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Setup.ps1";

View file

@ -0,0 +1,48 @@
{ ... }: {
imports = [
../defaults.nix
];
config = {
valhalla = {
windows = {
dualboot = {
enable = true;
linuxPercentage = 70; # better safe than sorry
};
users.manuel = {
microsoftAccount = true;
groups = ["Administrators"];
};
};
partition.os.partitions = {
Boot.keepExisting = true;
Windows = {
index = 6;
label = "OS";
format = "ntfs";
mountPoint = "/win";
mountOptions = ["force"];
keepExisting = true;
};
};
hardware = {
components = [
"ROG Zenith Extreme Alpha"
"Predator Z301C"
];
eyeX = true;
amdCPU = true;
nvidiaGPU = true;
logitechG = true;
corsairDevice = true;
elgatoWave = true;
};
};
};
}

View file

@ -3,11 +3,11 @@ function install() {
local dir="$(realpath "${BASH_SOURCE%/*}")"; local dir="$(realpath "${BASH_SOURCE%/*}")";
function installDrivers() { function installDrivers() {
. "$dir/../../../scripts/Arch/Config/SecureBoot/install.sh"; . "$dir/../../../../../scripts/Arch/Config/SecureBoot/install.sh";
} }
. "../../../scripts/Arch/OS/install.sh"; . "../../../../../scripts/Arch/OS/install.sh";
} }
install; install;

View file

@ -4,6 +4,6 @@ pushd "${BASH_SOURCE%/*}" > /dev/null;
ARCH_MOUNT_ROOT="/mnt" \ ARCH_MOUNT_ROOT="/mnt" \
ARCH_HOSTNAME="archlinux" \ ARCH_HOSTNAME="archlinux" \
USER_DISPLAYNAME="Manuel Thalmann" \ USER_DISPLAYNAME="Manuel Thalmann" \
. "../../../scripts/Arch/OS/setup.sh"; . "../../../../../scripts/Arch/OS/setup.sh";
popd > /dev/null; popd > /dev/null;

View file

@ -0,0 +1,13 @@
#!/bin/pwsh
. "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Manage.ps1";
. "$PSScriptRoot/../../../../../scripts/Windows/Collections/Generic.ps1"
function Restore-Apps {
param([Context] $context)
Restore-GenericApps $context;
}
[Context]$context = [Context]::new();
Invoke-WindowsInstallation $context;
Restart-Computer -Force;

View file

@ -0,0 +1,5 @@
#!/bin/pwsh
$env:WIN_COMPUTER_NAME ??= "win11";
$env:CONFIG_MODULE ??= "$PSScriptRoot/../config.nix";
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Setup.ps1";

View file

@ -1,9 +1,9 @@
{ lib, config, ... }: { lib, config, ... }:
let let
fs = import ../../lib/modules/partition/fs.nix; fs = import ../../../../lib/modules/partition/fs.nix;
in { in {
imports = [ imports = [
../../lib/modules/valhalla.nix ../defaults.nix
]; ];
config = { config = {
@ -35,31 +35,6 @@
}; };
}; };
users = {
manuel = {
displayName = "Manuel Thalmann";
mailAddress = "m@nuth.ch";
groups = [
"wheel"
"nix-users"
];
defaultShell = "fish";
rclone = {
configurations = {
nextcloud = {
dirName = "Nextcloud";
};
proton = {
dirName = "Proton";
};
};
};
};
};
timeZone = "Europe/Zurich"; timeZone = "Europe/Zurich";
keyMap = "de_CH-latin1"; keyMap = "de_CH-latin1";
keyboardLayout = "ch"; keyboardLayout = "ch";

View file

@ -14,4 +14,4 @@ function Install-PortValhallaDrivers {
choco install -y spice-agent; choco install -y spice-agent;
} }
. "$PSScriptRoot/../../Generic/Windows/Install.ps1"; . "$PSScriptRoot/../../../../Generic/Windows/Install.ps1";

View file

@ -0,0 +1,2 @@
#!/bin/pwsh
. "$PSScriptRoot/../../../../Generic/Windows/Setup.ps1";

View file

@ -0,0 +1,5 @@
#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../../../../scripts/Arch/OS/install.fish"
end

View file

@ -0,0 +1,26 @@
#!/bin/bash -e
function install() {
function installDrivers() {
. "../../../../../scripts/Arch/Config/SecureBoot/install.sh";
. "../../../../../scripts/Arch/Drivers/SurfaceBook2/install.sh";
}
function installSoftware() {
. "../../../../../scripts/Arch/Collections/school.sh";
}
function initializeConfig() {
. "../../../../../scripts/Common/Config/Steam/hidpi.sh";
. "../../../../../scripts/Unix/Devices/Surface Book 2/install.sh";
. "../../../../../scripts/Unix/Devices/Logitech G903/install.sh";
# Because, as it looks, Surface Books are fucking stupid.
. "../../../../../scripts/Common/Config/GRUB/verbose.sh";
}
pushd "${BASH_SOURCE%/*}" > /dev/null;
. "../../../../../scripts/Arch/OS/install.sh";
popd > /dev/null;
}
install;

View file

@ -3,7 +3,7 @@ begin
set -l dir (status dirname) set -l dir (status dirname)
function installDrivers -V dir -S function installDrivers -V dir -S
source "$dir/../../../scripts/Common/Scripts/config.fish" source "$dir/../../../../../scripts/Common/Scripts/config.fish"
pacstrap -K (getConfig valhalla.partition.rootDir) linux-firmware-marvell; pacstrap -K (getConfig valhalla.partition.rootDir) linux-firmware-marvell;
end end
@ -11,8 +11,8 @@ begin
echo "$dir/install.fish" echo "$dir/install.fish"
end end
CONFIG_MODULE="$(status dirname)/config.nix" \ CONFIG_NAME="ManuSurface" \
ARCH_HOSTNAME="manu-surface" \ ARCH_HOSTNAME="manu-surface" \
USER_DISPLAYNAME="Manuel Thalmann" \ USER_DISPLAYNAME="Manuel Thalmann" \
source "$(status dirname)/../../../scripts/Arch/OS/setup.fish"; source "$(status dirname)/../../../../../scripts/Arch/OS/setup.fish";
end end

View file

@ -0,0 +1,16 @@
#!/bin/bash
pushd "${BASH_SOURCE%/*}" > /dev/null;
# Set Hostname
sudo hostnamectl set-hostname ManuSurface;
source "../../../../../scripts/PopOS/Scripts/preinstall.sh";
source "../../../../../scripts/PopOS/OS/install.sh";
source "../../../../../scripts/Debian/Drivers/SurfaceBook2/Setup/install.sh";
source "../../../../../scripts/PopOS/Software/Collections/school.sh";
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../../../../scripts/Common/Config/UserProfile/install.sh";
# Install equalizer
source "../../../../../scripts/Common/Config/EasyEffects/SurfaceBook2/install.sh";
source "../../../../../scripts/PopOS/Scripts/postinstall.sh";
popd > /dev/null;

View file

@ -0,0 +1,12 @@
#!/bin/bash
pushd "${BASH_SOURCE%/*}" > /dev/null;
# Set Hostname
sudo hostnamectl set-hostname ManuPopOSLive;
source "../../../../scripts/PopOS/Scripts/prepare.sh";
source "../../../../scripts/PopOS/OS/install.sh";
source "../../../../scripts/PopOS/Software/Collections/personal.sh";
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../../../scripts/Common/Config/UserProfile/personal.sh";
source "../../../../scripts/PopOS/Scripts/postinstall.sh";
popd > /dev/null;

View file

@ -0,0 +1,6 @@
{ ... }: {
imports = [
../../users/manuel/config.nix
../../../lib/modules/valhalla.nix
];
}

View file

@ -0,0 +1,66 @@
{ ... }: {
imports = [
../../../lib/modules/valhalla.nix
];
config = {
valhalla = {
users.manuel = {
displayName = "Manuel Thalmann";
mailAddress = "m@nuth.ch";
oh-my-posh = {
theme = {
source = ./manuel.omp.json;
};
};
};
linux.users.manuel = {
defaultShell = "fish";
groups = [
"wheel"
"nix-users"
];
rclone = {
configurations = {
nextcloud = {
dirName = "Nextcloud";
};
proton = {
dirName = "Proton";
};
};
};
};
windows.users.manuel = {
nextcloud = {
folderSyncs =
let
localPath = "C:/tools/RetroArch-Win64";
remotePath = "/Saved Games/RetroArch";
in [
{
remotePath = "${remotePath}/Saves";
localPath = "${localPath}/saves";
virtualFiles = false;
}
{
remotePath = "${remotePath}/System";
localPath = "${localPath}/system";
}
];
};
};
partition = {
os = {
partitions = { };
};
};
};
};
}

View file

@ -0,0 +1,173 @@
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 2,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "os",
"style": "diamond",
"leading_diamond": "\ue0b6",
"trailing_diamond": "\ue0b4",
"background_templates": [
"{{ if eq .OS \"ubuntu\" }}#EA531A{{ end }}",
"{{ if eq .OS \"debian\" }}#D80150{{ end }}",
"{{ if eq .OS \"arch\" }}#1793D1{{ end }}"
],
"foreground": "p:white",
"template": "{{ if ne .OS \"windows\" }}{{ .Icon }} {{ end }}"
},
{
"type": "session",
"style": "diamond",
"leading_diamond": "\ue0b6",
"trailing_diamond": "\ue0b0",
"background": "p:yellow",
"foreground": "p:black",
"properties": {
"display_host": false
},
"template": " {{ if .SSHSession }}\ueb39 {{ end }}{{ .UserName }} "
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"background": "p:orange",
"foreground": "p:black",
"properties": {
"home_icon": "~",
"style": "folder"
},
"template": " \udb80\ude4b {{ path .Path .Location }} "
},
{
"type": "dotnet",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"foreground": "p:black",
"background": "#00ffff",
"template": " \udb81\ude10 {{ .Full }} "
},
{
"type": "java",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"background": "#4063d8",
"template": " \udb82\udf37 {{ .Full }} "
},
{
"type": "python",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"background": "#906cff",
"template": " \udb80\udf20 {{ .Full }} "
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"trailing_diamond": "\ue0b4",
"background": "p:green",
"background_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}",
"{{ if gt .Ahead 0 }}#49416D{{ end }}",
"{{ if gt .Behind 0 }}#7A306C{{ end }}"
],
"foreground": "p:black",
"foreground_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}",
"{{ if gt .Ahead 0 }}p:white{{ end }}"
],
"properties": {
"branch_max_length": 25,
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true,
"upstream_icons": {
"codeberg.org": "\uf330 ",
"git.nuth.ch": "\uf335",
"git.jonascosta.ch": "\uf339 ",
"git.romhackersworld.eu": "\uf339 ",
"aur.archlinux.org": "\uf303 "
}
},
"templates": [
"{{ if .UpstreamURL }} {{ url .UpstreamIcon .UpstreamURL }}{{ end }}",
" {{ .HEAD }} ",
"{{ if .BranchStatus }}{{ .BranchStatus }} {{ end }}",
"{{ if .Working.Changed }} \uf044 {{ .Working.String }} {{ end }}",
"{{ if and (.Working.Changed) (or (.Staging.Changed) (gt .StashCount 0)) }} | {{ end }}",
"{{ if .Staging.Changed }} \uf046 {{ .Staging.String }} {{ end }}",
"{{ if and (.Staging.Changed) (gt .StashCount 0) }} | {{ end }}",
"{{ if gt .StashCount 0 }} \udb80\udd93 {{ .StashCount }}{{ end }} "
]
},
{
"type": "node",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"background": "#6ca35e",
"foreground": "p:white",
"properties": {
"fetch_version": true
},
"template": " \udb80\udf99 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} "
},
{
"type": "root",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"background": "p:yellow",
"foreground": "p:white",
"properties": {
"root_icon": "\uf0e7"
}
},
{
"type": "executiontime",
"style": "plain",
"background": "#83769c",
"foreground": "p:white",
"properties": {
"always_enabled": true
},
"template": "<transparent>\ue0b0</> \udb81\udead {{ .FormattedMs }}\u2800"
},
{
"type": "text",
"style": "diamond",
"background": "p:blue",
"trailing_diamond": "\ue0b4",
"background_templates": [
"{{ if gt .Code 0 }}p:red{{ end }}"
],
"foreground": "p:white",
"properties": {
"always_enabled": true
},
"template": "<parentBackground>\ue0b0</> {{ if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} "
}
]
}
],
"transient_prompt": {
"background": "transparent",
"foreground": "p:black",
"template": "<p:yellow,transparent>\ue0b6</><,p:yellow> {{ .Folder }} </><p:yellow,transparent>\ue0b0</> "
},
"final_space": true,
"palette": {
"black": "#262B44",
"blue": "#4B95E9",
"green": "#59C9A5",
"orange": "#F07623",
"red": "#D81E5B",
"white": "#E0DEF4",
"yellow": "#F3AE35"
}
}

View file

@ -68,7 +68,7 @@ begin
end | begin end | begin
read LOCALES read LOCALES
and arch-chroot "$mountDir" sed -i "s/^#\?\(\($LOCALES\).*\)\$/\1/" /etc/locale.gen and arch-chroot "$mountDir" sed -i "s/^#\?\(\($LOCALES\).*\)\$/\1/" /etc/locale.gen
and locale-gen and arch-chroot "$mountDir" locale-gen
end end
and begin and begin

View file

@ -3,11 +3,19 @@ begin
set -l dir (status dirname) set -l dir (status dirname)
source "$dir/../../Common/Scripts/software.fish" source "$dir/../../Common/Scripts/software.fish"
function runYay -d "Run yay with pre-configured defaults"
yay --needed --answerclean=None --answerdiff=None -Syu $argv
end
function yayinst -d "Install yay-package non-interactively" function yayinst -d "Install yay-package non-interactively"
yay --noconfirm --needed --answerclean=None --answerdiff=None -Syu $argv runYay --noconfirm $argv
end
function runPacman -d "Run pacman with pre-configured defaults"
sudo pacman --needed -Syu $argv
end end
function pacinst -d "Install pacman-package non-interactively" function pacinst -d "Install pacman-package non-interactively"
sudo pacman --noconfirm --needed -Syu $argv runPacman --noconfirm $argv
end end
end end

View file

@ -5,12 +5,12 @@ begin
function installSW function installSW
yayinst qemu-full yayinst qemu-full
yes | runPacman --asdeps iptables-nft
yes | yayinst \ yes | yayinst \
virtiofsd \ virtiofsd \
virt-manager \ virt-manager \
dnsmasq \ dnsmasq \
iptables-nft \
swtpm \ swtpm \
lxc \ lxc \
virt-bootstrap-git virt-bootstrap-git

View file

@ -3,7 +3,7 @@ begin
set -l dir (status dirname) set -l dir (status dirname)
source "$dir/../../Scripts/software.fish" source "$dir/../../Scripts/software.fish"
function installSW function installSW -V dir
yayinst \ yayinst \
aliae-bin aliae-bin

View file

@ -4,7 +4,7 @@ begin
source "$dir/../../Scripts/software.fish" source "$dir/../../Scripts/software.fish"
source "$dir/../../../Common/Software/brave/main.fish" source "$dir/../../../Common/Software/brave/main.fish"
function installSW function installSW -V dir
yayinst brave-bin ( yayinst brave-bin (
# brave-beta-bin # brave-beta-bin
# brave-nightly-bin # brave-nightly-bin

View file

@ -4,7 +4,7 @@ begin
source "$dir/../../Scripts/software.fish" source "$dir/../../Scripts/software.fish"
source "$dir/../../../Common/Software/git/main.fish" source "$dir/../../../Common/Software/git/main.fish"
function installSW function installSW -V dir
yayinst \ yayinst \
git \ git \
git-lfs \ git-lfs \

View file

@ -3,7 +3,7 @@ begin
set -l dir (status dirname) set -l dir (status dirname)
source "$dir/../../Scripts/software.fish" source "$dir/../../Scripts/software.fish"
function installSW function installSW -V dir
yayinst grub-theme-minegrub-git yayinst grub-theme-minegrub-git
fish "$dir/../../../Common/Software/minegrub-theme/main.fish" configure fish "$dir/../../../Common/Software/minegrub-theme/main.fish" configure
end end

View file

@ -5,7 +5,7 @@ begin
function installSW -V dir function installSW -V dir
yayinst nodejs-n yayinst nodejs-n
sudo fish "$dir/../../../Common/Software/n/main.fish" configure sudo --preserve-env --set-home fish "$dir/../../../Common/Software/n/main.fish" configure
end end
runInstaller $argv runInstaller $argv

View file

@ -7,10 +7,12 @@ begin
yayinst \ yayinst \
openssh \ openssh \
libfido2 libfido2
source (status filename) configure
end end
function configureSW function configureSW
systemctl --global enable --now ssh-agent sudo systemctl --global enable ssh-agent
and begin and begin
printf %s\n \ printf %s\n \

View file

@ -3,7 +3,7 @@ begin
set -l dir (status dirname) set -l dir (status dirname)
source "$dir/../../Scripts/software.fish" source "$dir/../../Scripts/software.fish"
function installSW function installSW -V dir
yayinst pyenv yayinst pyenv
fish "$dir/../../../Common/Software/pyenv/main.fish" configure fish "$dir/../../../Common/Software/pyenv/main.fish" configure
end end

View file

@ -4,7 +4,7 @@ begin
source "$dir/../../Scripts/software.fish" source "$dir/../../Scripts/software.fish"
source "$dir/../../../Common/Software/vim/main.fish" source "$dir/../../../Common/Software/vim/main.fish"
function installSW function installSW -V dir
yayinst ( yayinst (
# Necessary for accessing clipboard in terminal: https://wiki.archlinux.org/title/Vim # Necessary for accessing clipboard in terminal: https://wiki.archlinux.org/title/Vim
) gvim \ ) gvim \

View file

@ -3,7 +3,7 @@ begin
set -l dir (status dirname) set -l dir (status dirname)
source "$dir/../../Scripts/software.fish" source "$dir/../../Scripts/software.fish"
function installSW function installSW -V dir
yayinst \ yayinst \
zoxide zoxide

View file

@ -1,10 +1,10 @@
#!/bin/pwsh #!/bin/pwsh
. "$PSScriptRoot/../../Software/powershell/profile.ps1"; . "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
Add-PowerShellProfileStatement ` Add-PowerShellProfileStatement `
-System ` -System `
-Category "oh-my-posh" ` -Category "oh-my-posh" `
-Statement $( -Script $(
@( @(
"# Oh My Posh!", "# Oh My Posh!",
$(Get-ScriptInitializer "oh-my-posh init pwsh"), $(Get-ScriptInitializer "oh-my-posh init pwsh"),

View file

@ -1,8 +1,8 @@
#!/bin/pwsh #!/bin/pwsh
. "$PSScriptRoot/../../Software/powershell/profile.ps1"; . "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
foreach ($defaultUser in @($true, $false)) { foreach ($defaultUser in @($true, $false)) {
Add-PowerShellProfileStatement -DefaultUser:$defaultUser -Statement "# aliae`naliae init pwsh | Invoke-Expression"; Add-PowerShellProfileStatement -DefaultUser:$defaultUser -Script "# aliae`naliae init pwsh | Invoke-Expression";
} }
Add-PowerShellProfileStatement -System -Category "aliae" -Statement "# aliae`n$(Get-ScriptInitializer "aliae completion powershell")"; Add-PowerShellProfileStatement -System -Category "aliae" -Script "# aliae`n$(Get-ScriptInitializer "aliae completion powershell")";

View file

@ -1,10 +1,10 @@
#!/bin/pwsh #!/bin/pwsh
. "$PSScriptRoot/../../Software/powershell/profile.ps1"; . "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
Add-PowerShellProfileStatement ` Add-PowerShellProfileStatement `
-System ` -System `
-Category "zoxide" ` -Category "zoxide" `
-Statement $( -Script $(
@( @(
"# zoxide", "# zoxide",
$(Get-ScriptInitializer "zoxide init powershell | Out-String") $(Get-ScriptInitializer "zoxide init powershell | Out-String")

View file

@ -6,6 +6,7 @@ source "$dir/../Scripts/hooks.fish"
if [ (id -u) -eq 0 ] if [ (id -u) -eq 0 ]
set -l name (getConfig valhalla.setupUser.name) set -l name (getConfig valhalla.setupUser.name)
set -l sudoConfig "/etc/sudoers.d/PortValhalla" set -l sudoConfig "/etc/sudoers.d/PortValhalla"
rm ~/.bash_profile
runHook createUser || \ runHook createUser || \
begin begin
@ -23,7 +24,7 @@ if [ (id -u) -eq 0 ]
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL" echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"
end > "$sudoConfig" end > "$sudoConfig"
and sudo --preserve-env="CONFIG_MODULE" --user "$name" "$INSTALLER_SCRIPT" and sudo --preserve-env="CONFIG_NAME" --user "$name" "$INSTALLER_SCRIPT"
rm "$sudoConfig" rm "$sudoConfig"
userdel -r "$name" userdel -r "$name"
else else

View file

@ -39,7 +39,7 @@ function runSetup
function wrapScript -S function wrapScript -S
printf %s\n \ printf %s\n \
"cd $PROJECT_CLONE_ROOT" \ "cd $PROJECT_CLONE_ROOT" \
"export CONFIG_MODULE=$(string escape (getCloneFile "$CONFIG_MODULE"))" \ "export CONFIG_NAME=$(string escape (getCloneFile "$CONFIG_NAME"))" \
"$argv" "$argv"
end end

View file

@ -0,0 +1,163 @@
#!/bin/bash
$null = New-Module {
. "$PSScriptRoot/System.ps1";
<#
.SYNOPSIS
Runs an action involving browser automation.
.PARAMETER Action
The action to execute.
#>
function Start-BrowserAutomation {
param(
[scriptblock] $Action
)
if (-not ("OpenQA.Selenium.Firefox.FirefoxDriver" -as [type])) {
$packageRoot = Split-Path -Parent (Get-Package Selenium.WebDriver).Source;
$file = Join-Path $packageRoot "lib/netstandard2.0/WebDriver.dll";
$env:SE_MANAGER_PATH = Join-Path $packageRoot "manager" ($IsWindows ? "windows" : "linux") "selenium-manager$($IsWindows ? ".exe" : '')";
$null = [System.Reflection.Assembly]::LoadFile($file);
}
& $Action;
}
<#
.SYNOPSIS
Downloads a file from the specified url using browser automation.
.PARAMETER URL
The url to download the file from.
.PARAMETER Action
The action to execute in the browser for initiating the download.
.PARAMETER OutDir
The directory to download the file to.
#>
function Start-CustomBrowserDownload {
param(
[string] $URL,
[scriptblock] $Action,
[string] $OutDir
)
$downloadAction = $Action;
Start-BrowserAutomation {
if (-not $OutDir) {
$OutDir = ".";
}
$dir = New-TemporaryDirectory;
Write-Host "Downloading ``$URL`` using browser automation…";
$options = [OpenQA.Selenium.Firefox.FirefoxOptions]::new();
$options.SetPreference("browser.download.folderList", 2);
$options.SetPreference("browser.download.dir", "$dir");
$downloadChecker = {
$files = Get-ChildItem $dir;
if ((@($files)).Count -eq 1) {
$file = $files[0];
try {
$stream = [System.IO.File]::Open($file.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None);
if ($stream) {
$stream.Close();
}
}
catch {
return $true;
}
return $false;
} else {
return $true;
}
};
$browser = [OpenQA.Selenium.Firefox.FirefoxDriver]::new($options);
$browser.Navigate().GoToUrl($URL);
while (-not ($browser.ExecuteScript("return document.readyState;") -eq "complete")) {
Start-Sleep 0.1;
}
try {
$null = & $downloadAction -Browser $browser;
while (& $downloadChecker) {
Write-Host "Waiting for the download to finish…";
Start-Sleep 1;
}
$file = Get-ChildItem $dir;
$result = Move-Item $file $OutDir -PassThru;
$browser.Quit();
Remove-Item -Recurse $dir;
$result;
}
catch {
Write-Error $Error;
}
}
}
<#
.SYNOPSIS
Downloads a file from the specified url using browser automation.
.PARAMETER URL
The url to download the file from.
.PARAMETER ButtonSelector
The jQuery selector for finding the download button.
.PARAMETER OutDir
The directory to download the file to.
.PARAMETER Timeout
The number of seconds to wait before clicking the download button.
#>
function Start-BrowserDownload {
param(
[string] $URL,
[string] $ButtonSelector,
[string] $OutDir = $null,
[double] $Timeout = 0
)
Start-CustomBrowserDownload @PSBoundParameters -Action {
param(
[OpenQA.Selenium.Firefox.FirefoxDriver] $Browser
)
$selector = [OpenQA.Selenium.By]::CssSelector($ButtonSelector);
[OpenQA.Selenium.IWebElement] $element = $null;
for ($i = 0; $i -lt 5; $i++) {
$element = $Browser.FindElement($selector);
if ($element) {
break;
} else {
Start-Sleep 1;
}
}
if ($Timeout -gt 0) {
Start-Sleep $Timeout;
}
if ($element) {
$Browser.FindElement($selector).Click();
} else {
Write-Error "Unable to find download button!";
}
};
}
};

View file

@ -0,0 +1,575 @@
using namespace Microsoft.Win32;
using namespace System.Management.Automation.Host;
using namespace System.Security.AccessControl;
using namespace System.Security.Principal;
enum WindowsInstallerStage {
Initialize
Run
Cleanup
Completed
}
enum SetupStage {
Initialize
Configure
Install
CreateUser
}
enum BackupStage {
Initialize
Backup
BackupUsers
}
enum UserStage {
Create
Configure
Cleanup
Completed
}
$null = New-Module {
[string] $configRoot = "HKLM:\Software\PortValhalla";
[string] $stageOption = "Stage";
[string] $setupStageOption = "SetupStage";
[string] $backupStageOption = "BackupStage";
[string] $userOption = "SetupUser";
[string] $userStageOption = "UserStage";
[string] $accountOption = "MSAccount";
[string] $finishedOption = "Finished";
[RegistryKey] $key = $null;
<#
.SYNOPSIS
Prompts the user to select a profile to act on.
#>
function Show-ProfileNamePrompt {
. "$PSScriptRoot/../../Windows/Types/WindowsInstallerAction.ps1";
$profiles = & {
. "$PSScriptRoot/SoftwareManagement.ps1";
if (Test-Command "wsl") {
return Invoke-ConfigScript "getProfiles";
} else {
return Get-ChildItem "$PSScriptRoot/../../../.config" | ForEach-Object { Split-Path -LeafBase $_ };
}
};
$choice = $Host.UI.PromptForChoice(
"Select Profile",
(& {
switch (Get-Stage) {
([WindowsInstallerAction]::Backup) {
"Which profile do you wish to back up?";
}
([WindowsInstallerAction]::Install) {
"Which profile do you wish to install?";
}
$null {
"Which profile do you wish to set up?";
}
}
}),
(& {
for ($i = 0; $i -lt $profiles.Count; $i++) {
[ChoiceDescription]"&$i - $($profiles[$i])";
}
[ChoiceDescription]"&Abort";
}),
$profiles.Count);
if ($choice -eq $profiles.Count) {
exit;
} else {
$env:CONFIG_NAME = $profiles[$choice];
}
}
<#
.SYNOPSIS
Converts the specified path to linux and escapes it for the use in a script.
.PARAMETER Path
The path to convert.
#>
function ConvertTo-LinuxPath {
param(
[string] $Path
)
& {
$ErrorActionPreference = 'Continue';
$completed = $false;
while (-not $completed) {
$job = Start-Job {
$env:Value = Resolve-Path $Using:Path;
$env:WSLENV = "Value/p";
$result = wsl -- bash -c 'echo "$Value"';
wsl -e printf "%q" "$result";
};
$result = Receive-Job -Wait $job;
if ((Split-Path -Leaf $Path) -ne (Split-Path -Leaf $result)) {
Write-Error "The result of the path conversion of ``$Path`` was unexpected: ``$result``";
continue;
}
if ($job.State -ne ([System.Management.Automation.JobState]::Completed)) {
Write-Error "An error occurred while converting ``$Path`` to a Linux path.`nOutput: ``$result``";
continue;
}
$completed = $true;
}
$result;
};
}
<#
.SYNOPSIS
Gets the registry key containing options related to the setup.
#>
function Get-SetupConfigKey {
if (-not (Test-Path $configRoot)) {
$key = New-Item $configRoot;
$acl = Get-Acl $configRoot;
$acl.AddAccessRule(
[RegistryAccessRule]::new(
[SecurityIdentifier]::new([WellKnownSidType]::BuiltinUsersSid, $null),
[RegistryRights]::FullControl,
[InheritanceFlags]::ObjectInherit -bor [InheritanceFlags]::ContainerInherit,
[PropagationFlags]::None,
[AccessControlType]::Allow));
Set-Acl $configRoot $acl;
} else {
$key = Get-Item $configRoot;
}
return $key;
}
<#
.SYNOPSIS
Runs a script based on the `config.fish` script.
.PARAMETER Script
The script to run.
#>
function Invoke-ConfigScript {
param(
[string] $Script
)
$scriptPath = "$PSScriptRoot/../../Common/Scripts/config.fish";
if ($env:CONFIG_NAME -or ($Script -eq "getProfiles")) {
$output = & {
if (-not $IsWindows) {
$escapedPath = (fish -c 'string escape $argv' "$scriptPath");
fish -c ". $escapedPath; $Script";
} else {
$cleanup = { };
$projectRoot = "$PSScriptRoot/../../..";
$archisoDir = "$projectRoot/archiso";
function fish {
wsl --shell-type login -- nix --extra-experimental-features "nix-command flakes" run nixpkgs`#fish -- $args
}
if (Test-Path -PathType Container "$archisoDir") {
$git = {
git -C "$projectRoot" -c safe.directory="$("$(Resolve-Path $projectRoot)".Replace("\", "/"))" @args;
};
& $git rm -r --cached "$archisoDir" *> $null;
$cleanup = { & $git restore --staged "$archisoDir" };
}
$output = fish -c ". $(ConvertTo-LinuxPath $scriptPath); $Script";
if (-not $?) {
Write-Error "The configuration could not be retrieved!";
} else {
$output;
}
& $cleanup *> $null;
}
}
if (-not ($output -and ($output | Test-Json))) {
Write-Error "The value ``$output`` is not valid JSON.";
} else {
$output | ConvertFrom-Json;
}
} else {
$null;
}
}
<#
.SYNOPSIS
Gets a configuration option.
.PARAMETER Name
The name of the option to get.
#>
function Get-Config {
param(
[string] $Name,
[Parameter(ValueFromRemainingArguments)]
[string[]] $ArgumentList
)
Invoke-ConfigScript "getConfig $Name --json $ArgumentList";
}
<#
.SYNOPSIS
Gets the name of the config root.
#>
function Get-ConfigRootName {
return "valhalla.$($IsWindows ? "windows" : "linux")";
}
<#
.SYNOPSIS
Gets the name of the user root.
#>
function Get-UserRootName {
return "$(Get-ConfigRootName).$($IsWindows ? "winUsers" : "users")";
};
<#
.SYNOPSIS
Gets a user configuration.
.PARAMETER UserName
The name of the user to get the configuration for.
.PARAMETER Name
The name of the configuration to get.
#>
function Get-UserConfig {
param(
[string] $UserName = ($IsWindows ? $env:UserName : $env:USER),
[Parameter(Mandatory, Position = 0)]
[string] $Name
)
if ((Get-Users) -contains $UserName) {
Get-Config "$(Get-UserRootName).$UserName.$Name";
} else {
return $null;
}
}
<#
.SYNOPSIS
Gets the attributes of a configuration object.
.PARAMETER Name
The name of the configuration to get the attributes of.
#>
function Get-Attributes {
param(
[string] $Name
)
Invoke-ConfigScript "getAttributes $Name";
}
<#
.SYNOPSIS
Gets the names of the users to create.
#>
function Get-Users {
[OutputType([string[]])]
param()
Get-Attributes "$(Get-UserRootName)";
}
<#
.SYNOPSIS
Gets the name of the setup user.
#>
function Get-SetupUser {
[OutputType([string])]
param()
Get-Config "$(Get-ConfigRootName).setupUser.name";
}
<#
.SYNOPSIS
Gets the value of an option related to the setup.
.PARAMETER Name
The name of the option value to get.
#>
function Get-SetupOption {
param(
[string] $Name
)
$key = Get-SetupConfigKey;
if ($key.GetValueNames().Contains($Name)) {
return $key.GetValue($Name);
} else {
return $null;
}
}
<#
.SYNOPSIS
Sets the value of an option related to the setup.
.PARAMETER Name
The name of the option to set.
.PARAMETER Value
The value to set the option to.
#>
function Set-SetupOption {
param(
[string] $Name,
$Value
)
$key = Get-SetupConfigKey;
$null = Set-ItemProperty ($key.PSPath) -Name $Name -Value $Value;
}
<#
.SYNOPSIS
Gets the name of the current stage of the Windows install script action.
#>
function Get-Stage {
$stage = Get-SetupOption $stageOption;
if ($null -ne $stage) {
$stage = [WindowsInstallerStage]$stage;
}
return $stage;
}
<#
.SYNOPSIS
Sets the name of the current stage of the Windows install script action.
.PARAMETER Name
The name of the stage to set.
#>
function Set-Stage {
param(
$Name
)
if (-not (($null -eq $Name) -or ($Name -is [string]))) {
$Name = ([WindowsInstallerStage]$Name).ToString();
}
$null = Set-SetupOption $stageOption $Name;
}
<#
.SYNOPSIS
Gets the name of the current setup stage.
#>
function Get-SetupStage {
$stage = Get-SetupOption $setupStageOption;
if ($null -ne $stage) {
$stage = [SetupStage]$stage;
}
return $stage;
}
<#
.SYNOPSIS
Sets the current stage.
.PARAMETER Name
The name to set the current stage to.
#>
function Set-SetupStage {
param(
$Name
)
if (-not (($null -eq $Name) -or ($Name -is [string]))) {
$Name = ([SetupStage]$Name).ToString();
}
$null = Set-SetupOption $setupStageOption $Name;
}
<#
.SYNOPSIS
Gets the name of the current stage of the backup.
#>
function Get-BackupStage {
$stage = Get-SetupOption $backupStageOption;
if ($null -ne $stage) {
$stage = [BackupStage]$stage;
}
return $stage;
}
<#
.SYNOPSIS
Sets the current stage of the backup.
.PARAMETER Name
The name to set the current stage to.
#>
function Set-BackupStage {
param(
$Name
)
if (-not (($null -eq $Name) -or ($Name -is [string]))) {
$Name = ([BackupStage]$Name).ToString();
}
$null = Set-SetupOption $backupStageOption $Name;
}
<#
.SYNOPSIS
Gets the current user to set up.
#>
function Get-CurrentUser {
return (Get-SetupOption $userOption) ?? 0;
}
<#
.SYNOPSIS
Sets the index of the current user to set up.
.PARAMETER Value
The index of the user to set up.
#>
function Set-CurrentUser {
param(
[int] $Value
)
Set-SetupOption $userOption $value;
}
<#
.SYNOPSIS
Gets the name of the current stage of the user setup.
#>
function Get-UserStage {
$stage = Get-SetupOption $userStageOption;
if ($null -ne $stage) {
$stage = [UserStage]$stage;
}
return $stage;
}
<#
.SYNOPSIS
Sets the current stage of the user setup.
.PARAMETER Name
The name of the stage to set.
#>
function Set-UserStage {
param(
$Name
)
if (-not (($null -eq $Name) -or ($Name -is [string]))) {
$Name = ([UserStage]$Name).ToString();
}
$null = Set-SetupOption $userStageOption $Name;
}
<#
.SYNOPSIS
Gets the name of the microsoft account to create.
#>
function Get-MSAccountName {
return Get-SetupOption $accountOption;
}
<#
.SYNOPSIS
Sets the name of the microsoft account to create.
.PARAMETER Name
The name of the microsoft account to create.
#>
function Set-MSAccountName {
param(
[string] $Name
)
Set-SetupOption $accountOption $Name;
}
<#
.SYNOPSIS
Gets a value indicating whether the setup has finished.
#>
function Get-IsFinished {
return [bool](Get-SetupOption $finishedOption);
}
<#
.SYNOPSIS
Sets a value indicating whether the setup has finished.
#>
function Set-IsFinished {
param(
$Value
)
Set-SetupOption $finishedOption $true;
}
<#
.SYNOPSIS
Checks whether the running system is a QEMU virtual machine.
#>
function Test-Qemu {
((Get-WmiObject win32_computersystem).Manufacturer) -eq "QEMU";
}
<#
.SYNOPSIS
Checks whether the current user is the setup user.
#>
function Test-SetupUser {
($IsWindows ? $env:UserName : $env:USER) -eq (Get-SetupUser);
}
<#
.SYNOPSIS
Checks whether the active session is executed with admin rights.
#>
function Test-Admin {
net session 2> $null | Out-Null;
return $?;
}
}

View file

@ -1,6 +1,6 @@
#!/bin/pwsh #!/bin/pwsh
. "$PSScriptRoot/Entrypoints.ps1"; . "$PSScriptRoot/../../Common/Scripts/Entrypoints.ps1";
. "$PSScriptRoot/../../Common/Software/powershell/profile.ps1"; . "$PSScriptRoot/../../Common/Software/PowerShell/Profile.ps1";
class Context { class Context {
[string]$EntryPoint; [string]$EntryPoint;
@ -68,9 +68,9 @@ class Context {
[void] AddPowerShellProfileStatement([bool] $system, [string] $category, [string] $statement, [bool] $overwrite) { [void] AddPowerShellProfileStatement([bool] $system, [string] $category, [string] $statement, [bool] $overwrite) {
if ($system) { if ($system) {
Add-PowerShellProfileStatement -System -Category $category -Statement $statement -Overwrite $overwrite; Add-PowerShellProfileStatement -System -Category $category -Script $statement -Overwrite:$overwrite;
} else { } else {
Add-PowerShellProfileStatement -Category $category -Statement $statement -Overwrite $overwrite; Add-PowerShellProfileStatement -Category $category -Script $statement -Overwrite:$overwrite;
} }
} }

View file

@ -0,0 +1,429 @@
using namespace System.Management.Automation.Host;
. "$PSScriptRoot/../Types/OneShotTask.ps1";
$null = New-Module {
. "$PSScriptRoot/Config.ps1";
. "$PSScriptRoot/../Scripts/SoftwareManagement.ps1";
. "$PSScriptRoot/../Types/OneShotTask.ps1";
. "$PSScriptRoot/../../Windows/Scripts/Hooks.ps1";
. "$PSScriptRoot/../../Windows/Scripts/PowerManagement.ps1";
. "$PSScriptRoot/../../Windows/Scripts/Registry.ps1";
. "$PSScriptRoot/../../Windows/Scripts/Security.ps1";
. "$PSScriptRoot/../../Windows/Scripts/WSL.ps1";
$oneShotTaskName = "PortValhalla OneShot";
$logName = "Application";
$oneShotTrigger = 1337;
$taskOption = "OneShotTask";
# ToDo: Store "ProgramData/PortValhalla" path somewhere as const
$errorPath = "$env:ProgramData/PortValhalla/error.txt";
$getUserName = {
"$(Get-SetupUser)OneShot";
};
$taskSetter = {
param([Nullable[OneShotTask]] $Task)
Set-SetupOption $taskOption ([string]$Task);
};
<#
.SYNOPSIS
Gets the PowerShell modules required for operating.
#>
function Get-RequiredModules {
$modules = @(
@("PSScriptAnalyzer")
) + (& {
if (-not $IsWindows) {
@()
} else {
@(
@("KnownFolders"),
@("PSWindowsUpdate"),
@("LocalAccounts", $true),
@("NuGet")
)
}
});
for ($i = 0; $i -lt $modules.Count; $i++) {
if ($modules[$i] -is [string]) {
$modules[$i] = @($modules[$i]);
}
}
return $modules;
}
function Start-Operation {
param(
[switch] $NonInteractive,
[switch] $NoImplicitCleanup,
[scriptblock] $Action
)
$cleanup = { };
$taskPending = $false;
if (-not $Global:InOperation) {
if ($env:DEBUG) {
Set-PSDebug -Trace 1;
}
if ($IsWindows -and ($null -ne (Get-OneShotTask))) {
$taskPending = $true;
[switch] $NonInteractive = $true;
}
$Global:InOperation = $true;
$Global:ErrorActionPreference = $NonInteractive.IsPresent ? 'Continue' : 'Inquire';
if ($IsWindows) {
$env:WSLENV = "CONFIG_NAME";
New-Alias -Force "sudo" gsudo;
}
if (-not $NoImplicitCleanup.IsPresent) {
$cleanup = {
Clear-OperationResources;
};
}
& {
$initialized = $false;
while (-not $initialized) {
if ($IsWindows) {
if (-not ((Test-Command "choco") -and (Test-Command "refreshenv"))) {
Invoke-Hook "Install-Chocolatey" -Fallback {
# Install chocolatey
New-Item -Force $PROFILE;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'));
Import-Module $env:ChocolateyInstall/helpers/chocolateyProfile.psm1;
refreshenv;
};
continue;
}
if (-not (Test-ChocoPackage "powershell-core")) {
Invoke-Hook "Install-PowerShellCore" -Fallback {
choco install -y powershell-core --install-arguments='"ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 REGISTER_MANIFEST=1 USER_MU=1 ENABLE_MU=1"';
};
Restart-Intermediate;
return;
}
if ($env:PWSH_PATH -and (Test-Path $env:PWSH_PATH)) {
attrib "-R" "$env:PWSH_PATH\*" /S /D;
Remove-Item -Recurse -Force $env:PWSH_PATH;
continue;
}
if ($env:DEBUG) {
$liveScriptOption = "LiveScripts";
if (($null -eq (Get-SetupOption $liveScriptOption)) -and (Test-Qemu)) {
$result = $Host.UI.PromptForChoice(
"Confirm",
"Do you wish to swap to live scripts?",
[ChoiceDescription[]]@(
[ChoiceDescription]::new("&No", "Use scripts stored in the virtual machine"),
[ChoiceDescription]::new("&Yes", "Use live scripts stored on the host")),
0);
Set-SetupOption $liveScriptOption $result;
if ($result -eq 1) {
Install-ChocoPackage winfsp qemu-guest-agent;
Get-Service VirtioFsSvc | Start-Service -PassThru | Set-Service -StartupType Automatic;
while (-not (Test-Path Z:\)) {
Start-Sleep 0.1;
}
foreach ($name in @("INSTALLER_SCRIPT")) {
$variable = Get-Item "Env:\$name";
$path = Join-Path `
"Z:\Repositories\PortValhalla" `
([System.IO.Path]::GetRelativePath("$PSScriptRoot/../../..", $variable.Value));
Set-Item "Env:\$name" $path;
Write-Host "The new value of ``$name`` is ``$path``";
}
Restart-Intermediate;
exit;
}
}
}
if (-not (Test-Command "gsudo")) {
Install-ChocoPackage gsudo;
refreshenv;
continue;
}
if ($env:DEBUG) {
& {
$sys32 = "$env:WINDIR/System32";
$osk = (Get-Item "$sys32/osk.exe").FullName;
$cmd = (Get-Item "$sys32/cmd.exe").FullName;
if ((Get-FileHash $osk).Hash -ne (Get-FileHash $cmd).Hash) {
Set-MpPreference -ExclusionPath $osk;
gsudo -d --ti move $osk "${osk}_";
gsudo -d -s copy $cmd $osk;
continue;
}
};
}
if (-not (Test-Winget)) {
. "$PSScriptRoot/../../Windows/Software/winget/Manage.ps1";
continue;
}
if (-not (Test-Command "git")) {
Install-WingetPackage Git.Git;
refreshenv;
continue;
}
if (-not (Test-Command "7z")) {
Install-ChocoPackage 7zip.portable;
refreshenv;
continue;
}
if (-not (Test-Command "yq")) {
Install-ChocoPackage "yq";
refreshenv;
continue;
}
if (-not (Test-Wsl)) {
Install-Wsl;
Restart-Intermediate;
return;
}
if (-not (Test-WslDistribution)) {
if (-not (Test-Path (Get-WslDistributionDisk))) {
Install-WslDistribution;
}
Register-WslDistribution;
continue;
}
if (-not (wsl --shell-type login type -t nix)) {
wsl -- sh `<`(curl -L https://nixos.org/nix/install`) --daemon --yes;
wsl --shutdown;
continue;
}
if (-not (Test-PSPackage Selenium.WebDriver)) {
Write-Host "Installing browser automation tools…";
$null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.24.0 -SkipDependencies;
continue;
}
Install-ChocoPackage selenium-gecko-driver firefox;
Install-WingetPackage AutoHotkey.AutoHotkey;
. "$PSScriptRoot/../../Windows/Software/PinnedItem/Manage.ps1";
}
Invoke-Hook "Install-PSModules" -Fallback {
foreach ($module in (Get-RequiredModules)) {
$parameters = @{ };
if ($module -is [string]) {
$module = @($module);
}
if ($module[1]) {
$parameters = @{
allowPrerelease = $true;
};
}
if (-not (Test-PSModule $module[0])) {
Install-Module -Scope AllUsers -AcceptLicense -Force -AllowClobber $module[0] @parameters;
Import-Module $module[0];
}
}
};
if (-not $env:CONFIG_NAME) {
Show-ProfileNamePrompt;
}
$initialized = $true;
}
}
}
if ($taskPending) {
Start-OneShot;
} else {
& $Action;
}
& $cleanup;
}
<#
.SYNOPSIS
Gets the current OneShot task.
#>
function Get-OneShotTask {
$task = Get-SetupOption $taskOption;
if ($task) {
return [OneShotTask]$task;
} else {
return $null;
}
}
<#
.SYNOPSIS
Registers a task for listening to OneShot invocations.
#>
function Enable-OneShotListener {
$tempTask = "PortValhalla Temp";
$user = & $getUserName;
$password = [string]([guid]::NewGuid());
$adminGroup = @{
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
};
$null = New-LocalUser -Name $user -Password (ConvertTo-SecureString -AsPlainText $password);
Add-LocalGroupMember -Member $user @adminGroup;
$path = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList";
$null = New-Item -Force -ErrorAction SilentlyContinue $path;
Set-ItemProperty $path -Name $user -Value 0;
$action = New-ScheduledTaskAction -Execute "pwsh" -Argument "-Command & { $([string](Get-StartupCommand)) } 2>&1 | Tee-Object -FilePath `$env:ProgramData/PortValhalla/OneShotTask.log";
schtasks /Create /SC ONEVENT /EC $logName /MO "*[System[Provider[@Name='$logName'] and EventID=$($oneShotTrigger)]]" /TR cmd.exe /TN $tempTask;
$trigger = (Get-ScheduledTask $tempTask).Triggers;
$null = Register-ScheduledTask -Force $oneShotTaskName -Action $action -Trigger $trigger -RunLevel Highest -User $user -Password $password;
$null = Unregister-ScheduledTask -Confirm:$false $tempTask;
}
<#
.SYNOPSIS
Removes the OneShot task.
#>
function Disable-OneShotListener {
Unregister-ScheduledTask -Confirm:$false $oneShotTaskName;
$user = Get-LocalUser (& $getUserName);
[string] $sid = $user.SID;
Remove-LocalUser $user;
Get-CimInstance Win32_UserProfile | Where-Object { $_.SID -eq $sid } | Remove-CimInstance;
}
<#
.SYNOPSIS
Invokes a one-shot task.
.PARAMETER Task
The task to run.
#>
function Invoke-OneShot {
param(
[OneShotTask] $Task
)
& $taskSetter $Task;
& {
$identifier = "EventLog$oneShotTrigger";
$log = [System.Diagnostics.EventLog]::new($logName);
$log.EnableRaisingEvents = $true;
$null = Register-ObjectEvent -InputObject $log -EventName EntryWritten -Action {
$entry = $Event.SourceEventArgs.Entry;
$trigger = $Event.MessageData.Trigger;
$identifier = $Event.MessageData.Identifier;
if ($entry.EventID -eq $trigger) {
$null = New-Event -SourceIdentifier $identifier;
}
} `
-MessageData @{
Trigger = $oneShotTrigger;
Identifier = $identifier;
};
Write-EventLog -LogName $logName -Source $logName -EventId $oneShotTrigger -Message "Starting OneShot task ``$(Get-OneShotTask)``";
for ($i = 0; $i -lt 2; $i++) {
Remove-Event -EventIdentifier (Wait-Event -SourceIdentifier $identifier).EventIdentifier;
}
};
if (Test-Path $errorPath) {
$errorMessage = Get-Content $errorPath;
Remove-Item $errorPath;
if ($errorMessage) {
Write-Error $errorMessage;
}
}
}
# ToDo: Store Run-OneShot and Receive-OneShot somewhere else in Windows folder
<#
.SYNOPSIS
Executes the specified action and notifies the OneShot task executor.
#>
function Start-OneShot {
try {
Write-Host "Running OneShot task ``$(Get-OneShotTask)``";
switch (Get-OneShotTask) {
([OneShotTask]::InitializeMSAccount) {
Initialize-UserCreation;
}
([OneShotTask]::DisableUAC) {
Disable-UAC;
Register-Setup;
}
}
}
catch {
Set-Content -Path $errorPath -Value $Error;
Set-UserPermissions $errorPath;
}
finally {
& $taskSetter $null;
Write-EventLog -LogName $logName -Source $logName -EventId $oneShotTrigger -Message "The OneShot task ``$(Get-OneShotTask)`` finished.";
}
}
<#
.SYNOPSIS
Clears resources allocated during the operation.
#>
function Clear-OperationResources {
if ($IsWindows) {
Uninstall-WslDistribution;
$null = Uninstall-Package Selenium.WebDriver -ErrorAction Continue;
Uninstall-ChocoPackage 7zip.portable gsudo selenium-gecko-driver yq;
Uninstall-WingetPackage AutoHotkey.AutoHotkey;
}
foreach ($module in (Get-RequiredModules)) {
Remove-Module -Force $module[0];
Uninstall-Module -Force -Name $module[0] -ErrorAction SilentlyContinue;
}
}
};

View file

@ -0,0 +1,71 @@
<#
.SYNOPSIS
Converts the specified value into a form to safle inject it into a script.
.PARAMETER value
The value to convert for injection.
#>
function ConvertTo-Injection {
param(
$Value
)
"([System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String('$(
[System.Convert]::ToBase64String([System.Text.Encoding]::Default.GetBytes($value))
)')))"
}
<#
.SYNOPSIS
Writes a PowerShell script to a specified location.
.PARAMETER FileName
The name of the file to write the script to.
.PARAMETER Script
The script to write to the file.
.PARAMETER Replace
A value indicating whether the file should be overwritten if it exists.
.PARAMETER Append
A value indicating whether the content should be appended if the file already exists.
#>
function Write-PSScript {
param(
[Parameter(Mandatory=$true)]
[Parameter(ParameterSetName="Common")]
[Parameter(ParameterSetName="Replace")]
[Parameter(ParameterSetName="Append")]
[string] $FileName,
[Parameter(Mandatory=$true)]
[Parameter(ParameterSetName="Common")]
[Parameter(ParameterSetName="Replace")]
[Parameter(ParameterSetName="Append")]
[string] $Script,
[Parameter(ParameterSetName="Replace", Mandatory=$true)]
[switch] $Replace,
[Parameter(ParameterSetName="Append", Mandatory=$true)]
[switch] $Append
)
Import-Module PSScriptAnalyzer;
$dirName = Split-Path -Parent $FileName;
$Script = ($Script -split "\r?\n") -join [System.Environment]::NewLine;
$content = Invoke-Formatter -ScriptDefinition $Script;
$exists = Test-Path -PathType Leaf $FileName;
if (-not (Test-Path -PathType Container $dirName)) {
$null = New-Item -ItemType Directory $dirName;
}
if ($exists -and ($Append.IsPresent)) {
Add-Content -Force $FileName "`n$content";
} else {
if ((-not $exists) -or $Replace.IsPresent) {
Set-Content -Force $FileName $content;
} else {
Write-Host "The file ``$FileName`` already exists!";
}
}
}

View file

@ -0,0 +1,392 @@
. "$PSScriptRoot/Config.ps1";
. "$PSScriptRoot/Operations.ps1";
. "$PSScriptRoot/System.ps1";
. "$PSScriptRoot/../Types/InstallerAction.ps1";
$null = New-Module {
. "$PSScriptRoot/BrowserAutomation.ps1";
. "$PSScriptRoot/SoftwareManagement.ps1";
. "$PSScriptRoot/../Types/InstallerAction.ps1";
$userArgument = "name";
$chocoRunner = {
param(
[string] $Action = 'install',
[string[]] $ArgumentList,
[scriptblock] $Guard = { $true },
[Parameter(Position = 0)]
[string] $Name,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]] $AdditionalNames = @()
)
[System.Collections.ArrayList] $Names = @();
$null = $Names.Add($Name);
$Names.AddRange($AdditionalNames);
if (-not ($Force.IsPresent)) {
for ($i = $Names.Count - 1; $i -ge 0; $i--) {
$name = $Names[$i];
if (-not (& $Guard $name)) {
$Names.RemoveAt($i);
}
}
}
if ($Names.Count -ge 1) {
choco $Action -y @ArgumentList @Names;
}
};
$wingetRunner = {
param(
[string] $Action = 'install',
[string[]] $ArgumentList,
[scriptblock] $Guard = { $true },
[Parameter(Position = 0)]
[string] $Name,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]] $AdditionalNames = @()
)
[System.Collections.ArrayList] $Names = @();
$null = $Names.Add($Name);
$Names.AddRange($AdditionalNames);
[string[]] $arguments = $ArgumentList + (& {
if ($Action -eq 'install') {
@("--accept-package-agreements")
};
});
foreach ($name in $Names) {
if ($Force.IsPresent -or (& $Guard $name $PSBoundParameters)) {
winget $Action `
--accept-source-agreements `
--source winget `
@arguments `
--exact --id $name ;
} else {
Write-Host "Package ``$name`` is already installed"
}
}
};
<#
.SYNOPSIS
Installs the specified packages using chocolatey.
.PARAMETER Names
The names of the packages to install.
#>
function Install-ChocoPackage {
param(
[switch] $Force,
[string[]] $ArgumentList,
[Parameter(Position=0)]
[string] $Name,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]] $AdditionalNames = @()
)
& $chocoRunner @PSBoundParameters -Guard {
param($Name)
if (Test-ChocoPackage $Name) {
Write-Host "Package ``$Name`` is already installed"
$false;
} else {
$true;
}
};
}
<#
.SYNOPSIS
Uninstalls the specified packages using chocolatey.
#>
function Uninstall-ChocoPackage {
param(
[string[]] $ArgumentList,
[Parameter(Position=0)]
[string] $Name,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]] $AdditionalNames = @()
)
& $chocoRunner @PSBoundParameters -Action 'uninstall' -Guard {
param($Name)
if (Test-ChocoPackage $Name) {
$true;
} else {
Write-Host "Package ``$Name`` is not installed";
$false;
}
};
}
<#
.SYNOPSIS
Installs the specified packages using `winget`.
.PARAMETER Names
The names of the packages to install.
#>
function Install-WingetPackage {
param(
[switch] $Force,
[string[]] $ArgumentList,
[Parameter(Position=0)]
[string] $Name,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]] $AdditionalNames = @()
)
& $wingetRunner @PSBoundParameters `
-Guard {
param($Name, $Parameters)
if (Test-WingetPackage @Parameters) {
Write-Host "Package ``$Name`` is already installed"
$false;
} else {
$true;
}
};
}
<#
.SYNOPSIS
Uninstalls the specified packages using `winget`.
#>
function Uninstall-WingetPackage {
param(
[string[]] $ArgumentList,
[Parameter(Position=0)]
[string] $Name,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]] $AdditionalNames = @()
)
& $wingetRunner @PSBoundParameters -Action 'uninstall' -Guard {
param($Name, $Parameters)
if (Test-WingetPackage @Parameters) {
$true;
} else {
Write-Host "Package ``$Name`` is not installed"
$false;
}
};
}
<#
.SYNOPSIS
Installs a setup package from the specified source.
.PARAMETER Source
The location of the setup package.
.PARAMETER ArgumentList
The arguments to pass to the setup package.
.PARAMETER Local
A value indicating whether the setup package is stored locally.
#>
function Install-SetupPackage {
param(
[string] $Source,
[string[]] $ArgumentList = @("/S"),
[switch] $Local
)
[string] $dir = $null;
[string] $filePath = $null;
if (-not ($Local.IsPresent)) {
$dir = New-TemporaryDirectory;
Write-Host "Determining the file name of ``$Source``";
$fileName = ([uri]$Source).Segments[-1];
Write-Host "Found name ``$fileName``";
$filePath = Join-Path $dir $fileName;
Write-Host "Downloading setup file from ``$Source``";
Invoke-WebRequest $Source -OutFile $filePath;
} else {
$filePath = $Source;
}
Write-Host "Starting installation of ``$(Split-Path -Leaf $filePath)``";
Start-Process -Wait -WorkingDirectory (Split-Path -Parent $filePath) -FilePath $filePath -ArgumentList $ArgumentList;
if ($dir) {
Remove-Item -Recurse $dir;
}
}
<#
.SYNOPSIS
Installs a package downloaded from ASUS.
.PARAMETER URL
The URL to download the package from.
#>
function Install-AsusPackage {
param(
[string] $URL
)
$file = "AsusPackage.zip";
$dir = New-TemporaryDirectory;
$unpackDir = New-TemporaryDirectory;
$null = Push-Location $dir;
Invoke-WebRequest $URL -OutFile $file;
Expand-Archive $file $unpackDir;
$null = Pop-Location;
Remove-Item -Recurse $dir;
$null = Start-Process -Wait -WorkingDirectory $unpackDir -FilePath (Join-Path $unpackDir "AsusSetup.exe") -ArgumentList "/S";
Remove-Item -Recurse $unpackDir;
}
<#
.SYNOPSIS
Downloads and installs a package from the AMD website.
.PARAMETER URL
The URL to download the package from.
#>
function Install-AmdPackage {
param(
[string] $URL
)
$dir = New-TemporaryDirectory;
$cookieBannerSelector = "#onetrust-consent-sdk";
$osSelector = "div[id$='oscategory']>div[id$='-0']";
$downloadSelector = "$osSelector div[id$='panel'] .button a";
$file = Start-CustomBrowserDownload @PSBoundParameters -OutDir $dir -Action {
param(
[OpenQA.Selenium.Firefox.FirefoxDriver] $Browser
)
$osContainer = $Browser.FindElement([OpenQA.Selenium.By]::CssSelector($osSelector));
if (-not ([bool] $osContainer.GetAttribute("cmp-expanded"))) {
$osContainer.Click();
}
$download = {
$browser.FindElement([OpenQA.Selenium.By]::CssSelector($downloadSelector)).Click();
};
try {
& $download;
} catch {
$null = $Browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()");
& $download;
}
};
Start-Process -Wait -WorkingDirectory (Split-Path -Parent "$file") -FilePath "$file" -ArgumentList "/S";
Remove-Item -Recurse $dir;
}
function Start-SoftwareInstaller {
param(
[string] $Name,
[scriptblock] $Backup = $null,
[scriptblock] $Installer = $null,
[scriptblock] $Configurator = $null,
[scriptblock] $UserBackup = $null,
[scriptblock] $UserConfigurator = $null,
[Nullable[InstallerAction]] $Action,
[hashtable] $Arguments
)
[InstallerAction] $Action = & {
if ($null -ne $Action) {
$Action;
} else {
[InstallerAction]::Install;
}
};
if (-not $Name) {
$Name = Split-Path -Leaf (Split-Path -Parent ((Get-PSCallStack)[1].ScriptName));
}
Start-Operation {
if ($null -ne $Name) {
$Name = "``$Name``";
} else {
$Name = "unknown software";
}
$installHandler = {
param(
[InstallerAction] $Action,
[hashtable] $Arguments
)
$Arguments ??= @{ };
$argumentList = @{
installer = $installHandler;
arguments = $Arguments;
};
switch ($Action) {
([InstallerAction]::Backup) {
if ($Backup) {
Write-Host "Backing up $Name";
& $Backup @argumentList;
}
}
([InstallerAction]::Install) {
if ($Installer) {
Write-Host "Installing $Name";
& $Installer @argumentList;
}
& $installHandler @argumentList -Action ([InstallerAction]::Configure);
if ($UserConfigurator -and (-not (Test-SetupUser))) {
& $installHandler @argumentList -Action ([InstallerAction]::ConfigureUser);
}
}
([InstallerAction]::Configure) {
if ($Configurator) {
Write-Host "Configuring $Name";
& $Configurator @argumentList;
}
}
default {
if ((-not $Arguments.ContainsKey($userArgument)) -or (-not $Arguments[$userArgument])) {
$Arguments.Add($userArgument, ($IsWindows ? $env:UserName : $env:USER));
}
$user = $Arguments[$userArgument];
switch ($_) {
([InstallerAction]::BackupUser) {
if ($UserBackup) {
Write-Host "Backing up ``$Name`` for user ``$user``";
& $UserBackup @argumentList;
}
}
([InstallerAction]::ConfigureUser) {
if ($UserConfigurator) {
Write-Host "Configuring $Name for user ``$user``";
& $UserConfigurator @argumentList;
}
}
}
}
}
};
& $installHandler -Action $Action -Arguments $Arguments;
};
}
}

View file

@ -0,0 +1,121 @@
#!/bin/bash
function Install-SoftwarePackage($context, [string] $location, [string[]] $argumentList = @("/S"), [switch]$local) {
. "$PSScriptRoot/Context.ps1";
[Context]$context = $context;
[string]$filePath = "";
[string]$tempDir = $null;
if (-not ($local.IsPresent)) {
$tempDir = $context.GetTempDirectory();
Write-Information "Determining the file name of $location";
$fileName = ([uri]$location).Segments[-1];
Write-Information "$fileName";
$filePath = Join-Path $tempDir $fileName;
Write-Information "Downloading setup file from $location";
Invoke-WebRequest $location -OutFile $filePath;
} else {
$filePath = $location;
}
$fileName = [System.IO.Path]::GetFileName($filePath);
Write-Information "Starting installation of $fileName";
Start-Process -Wait -FilePath $filePath -ArgumentList $argumentList;
if ($tempDir) {
Remove-Item -Recurse $tempDir;
}
}
<#
.SYNOPSIS
Checks whether the specified package has been installed using Chocolatey.
.PARAMETER Name
The name of the package to check.
#>
function Test-ChocoPackage {
[OutputType([bool])]
param(
[string] $Name
);
-not [string]::IsNullOrEmpty((choco list --limit-output --exact $name));
}
<#
.SYNOPSIS
Checks whether a `winget` package with the specified id is installed.
.PARAMETER ID
The id of the package to check.
#>
function Test-WingetPackage {
[OutputType([bool])]
param(
[string] $Name,
[string[]] $ArgumentList
)
& { $null = winget list --accept-source-agreements -e --id $Name @ArgumentList; $?; };
}
<#
.SYNOPSIS
Checks whether a command with the specified name exists.
.PARAMETER Name
The name of the command to check.
#>
function Test-Command {
param (
[string] $Name
)
[bool] (Get-Command $Name -ErrorAction SilentlyContinue);
}
<#
.SYNOPSIS
Checks whether `winget` is working properly.
#>
function Test-Winget {
(Test-Command winget) -and (
& {
$output = winget source update winget;
$? -and -not ([System.Linq.Enumerable]::Any(
[string[]]($output),
[System.Func[string,bool]]{ param($line) $line -eq "Cancelled"; }));
});
}
<#
.SYNOPSIS
Checks whether a package with the specified name is installed.
.PARAMETER Name
The name of the package to check.
#>
function Test-PSPackage {
param(
[string] $Name
)
[bool] (Get-Package $Name -ErrorAction SilentlyContinue);
}
<#
.SYNOPSIS
Checks whether a module with the specified name is installed.
.PARAMETER Name
The name of the module to check.
#>
function Test-PSModule {
param(
[string] $Name
)
[bool](Get-Module -ListAvailable $Name -ErrorAction SilentlyContinue);
}

View file

@ -0,0 +1,68 @@
<#
.SYNOPSIS
Creates a new temporary directory.
#>
function New-TemporaryDirectory {
$path = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName());
New-Item -ItemType Directory $path;
}
<#
.SYNOPSIS
Removes desktop icons which apply to the specified pattern.
.PARAMETER Pattern
The pattern to match the icons to delete.
#>
function Remove-DesktopIcon {
param(
[string] $Pattern
)
$path = "Desktop/$Pattern";
foreach ($userDir in @("~", $env:PUBLIC, "$env:SystemDrive/Users/Default")) {
$fullName = "$userDir/$path";
if (Test-Path -PathType Leaf $fullName) {
Remove-Item $fullName;
}
}
}
<#
.SYNOPSIS
Adds a new shortcut to the start menu.
.PARAMETER Name
The name of the icon to create.
.PARAMETER Target
The file to link to.
#>
function Add-StartMenuIcon {
param(
[string] $Name,
[string] $Target
)
Import-Module KnownFolders;
Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1";
Install-ChocolateyShortcut -ShortcutFilePath "$((Get-KnownFolder "Common Programs").Path)/$Name.lnk" -TargetPath ((Get-Item $Target).FullName);
}
<#
.SYNOPSIS
Removes icons from the task bar.
.PARAMETER Pattern
The pattern of the icon names to remove.
#>
function Remove-TaskbarItem {
param(
[string] $Pattern
)
Import-Module -UseWindowsPowerShell PinnedItem;
Get-PinnedItem -Type TaskBar | Where-Object { $_.Name -like "$Pattern" } | ForEach-Object { Remove-PinnedItem $_ };
}

View file

@ -1,15 +1,24 @@
#!/bin/env fish #!/bin/env fish
function isConfigured -S function isConfigured -S
set -q "$CONFIG_MODULE" set -q "$CONFIG_NAME"
end
function getProfiles -S
source "$(status dirname)/eval-flake.fish";
evalFlake "" "" --apply "builtins.attrNames" --json
end end
function getConfig -S -a property function getConfig -S -a property
source "$(status dirname)/eval-module.fish" source "$(status dirname)/eval-flake.fish"
evalModule "$CONFIG_MODULE" "$property" $argv[2..] evalFlake "$CONFIG_NAME" "$property" $argv[2..]
end
function getAttributes -S -a property
getConfig "$property" --apply "builtins.attrNames" --json
end end
function getUsers -S function getUsers -S
getConfig valhalla.users --apply "builtins.attrNames" --json getAttributes "valhalla.users"
end end
function isSet -S -a property function isSet -S -a property

View file

@ -0,0 +1,27 @@
#!/bin/env fish
function evalFlake --argument-names config property
set -l argv $argv[3..]
argparse --ignore-unknown "apply=" "json" -- $argv
if [ -z "$_flag_json" ]
set -a argv --raw
else
set -a argv --json
end
if [ -z "$_flag_apply" ]
set _flag_apply "_: _"
end
if [ -n "$config" ]
set config ".$config"
set _flag_apply "_: ($_flag_apply) ((import $(status dirname)/../../../lib/eval-attribute.nix) _)"
end
ROOT="$(realpath (status dirname))/../../.." \
PROPERTY="$property" \
nix eval --impure --extra-experimental-features "nix-command flakes" \
--apply "$_flag_apply" \
"$(status dirname)/../../..#valhalla$config" \
$argv
end

View file

@ -25,7 +25,9 @@ begin
end end
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0) for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
runInstaller userConfig "$name" if [ "$name" != "$USER" ]
runInstaller userConfig "$name"
end
end end
else if [ "$action" = "userConfig" ] else if [ "$action" = "userConfig" ]
set -l name $argv[2] set -l name $argv[2]

View file

@ -14,7 +14,7 @@ then
UNPACKED_EXTENSION="${UNPACKED_EXTENSION}" \ UNPACKED_EXTENSION="${UNPACKED_EXTENSION}" \
EXTENSION_DIR="${EXTENSION_DIR}" \ EXTENSION_DIR="${EXTENSION_DIR}" \
EXTENSION_POLICY_DIR="${EXTENSION_POLICY_DIR}" \ EXTENSION_POLICY_DIR="${EXTENSION_POLICY_DIR}" \
bash "$BASH_SOURCE" "$USER"; bash --login "$BASH_SOURCE" "$USER";
else else
keyFile="$UNPACKED_EXTENSION.pem"; keyFile="$UNPACKED_EXTENSION.pem";
extensionFile="$UNPACKED_EXTENSION.crx"; extensionFile="$UNPACKED_EXTENSION.crx";

View file

@ -0,0 +1,57 @@
param (
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../aliae/Manage.ps1";
. "$PSScriptRoot/../PowerShell/Profile.ps1";
. "$PSScriptRoot/../../Scripts/Software.ps1";
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Configurator {
Add-PowerShellProfileStatement `
-System `
-Category "oh-my-posh" `
-Script (
@(
"# Oh My Posh!",
(Get-ScriptInitializer "oh-my-posh init pwsh"),
(Get-ScriptInitializer "oh-my-posh completion powershell")
) -join [System.Environment]::NewLine)
} `
-UserConfigurator {
param(
[hashtable] $Arguments
)
$theme = Get-UserConfig "oh-my-posh.theme";
if ($theme) {
$varName = "POSH_THEME";
if ($theme -isnot [string]) {
$root = "$($IsWindows ? $env:AppData : "~/.config")/oh-my-posh";
$path = Join-Path $root "$($theme.name).omp.json";
$null = New-Item -Force -ItemType Directory $root;
Set-Content $path (
& {
if ($IsWindows) {
wsl cat $theme.source
} else {
cat $theme.source
}
});
$theme = [string] $path;
}
if ($IsWindows) {
[System.Environment]::SetEnvironmentVariable($varName, "%AppData%/$([System.IO.Path]::GetRelativePath($env:AppData, $path))", "User");
} else {
. "$PSScriptRoot/../aliae/Manage.ps1";
Add-EnvironmentVariable -User $Arguments.Name $varName ($path).Replace("~", "{{ .Home }}");
}
}
};

View file

@ -0,0 +1,43 @@
param (
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../../Scripts/Software.ps1";
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Configurator {
[string] $globalDir = $null;
$indicator = "# Profile Files";
if (-not $IsWindows) {
$globalDir = '"/etc/powershell/conf.d"';
} else {
$globalDir = '"$env:ProgramData/PowerShell/conf.d"';
}
if (-not ((Test-Path -PathType Leaf $PROFILE) -and ((Get-Content $PROFILE) -contains $indicator))) {
Add-PowerShellProfileStatement `
-DefaultUser `
-Script (@(
$indicator,
"`$globalDir = $globalDir",
({
$profileRoot = Split-Path -Parent $PROFILE;
$profilePaths = @(
"$profileRoot/conf.d/*.ps1",
"$globalDir/*.ps1"
)
foreach ($profilePath in $profilePaths) {
if (Test-Path $profilePath) {
Get-Item $profilePath | ForEach-Object { . $_; };
}
}
}).ToString()) -join "`n") `
-Append;
}
};

View file

@ -0,0 +1,72 @@
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
$null = New-Module {
<#
.SYNOPSIS
Generates the components for creating a module installer.
.PARAMETER Name
The name of the module to install.
.PARAMETER NativeOnly
A value indicating whether the module is installed in Windows PowerShell only.
.PARAMETER NoProfile
A value indicating whether the module is not added to the profile script of users.
#>
function Get-ModuleInstallerComponents {
param(
[string] $Name,
[switch] $NativeOnly,
[switch] $NoProfile
)
@{
arguments = @{
name = $Name;
nativeOnly = $NativeOnly;
};
installer = {
param(
[scriptblock] $Installer,
[hashtable] $Arguments
)
$env:PENDING_MODULE_NAME = $Arguments.Name;
$installAction = {
$module = $env:PENDING_MODULE_NAME;
if (-not (Get-Module -ListAvailable $module -ErrorAction SilentlyContinue)) {
Install-Module -Scope AllUsers -Force $module @args;
}
};
if (-not $Arguments.NativeOnly) {
& $installAction -AcceptLicense;
}
if (Test-Command powershell) {
powershell -c ($installAction.ToString());
}
Remove-Item Env:\PENDING_MODULE_NAME;
& $Installer -Action ([InstallerAction]::Configure) @PSBoundParameters;
};
configurator = ($NoProfile.IsPresent) ? { } : {
param(
[hashtable] $Arguments
)
$name = $Arguments.Name;
Add-PowerShellProfileStatement `
-DefaultUser `
-Category $name `
-Script "Import-Module `"$name`";";
};
}
}
};

View file

@ -0,0 +1,123 @@
$null = New-Module {
. "$PSScriptRoot/../../Scripts/Scripting.ps1";
. "$PSScriptRoot/../../Scripts/Software.ps1";
<#
.SYNOPSIS
Adds an initialization script to the profile.
.PARAMETER System
A value indicating whether the script should be installed globally.
.PARAMETER DefaultUser
A value indicating whether the script should be installed to users by default.
.PARAMETER HomeDir
The path to the home directory of the user to install the script to.
.PARAMETER Category
The category name of the script to install.
.PARAMETER Script
The script to install.
.PARAMETER Replace
A value indicating whether the script should be replaced if it already exists.
.PARAMETER Append
A value indicating whether the content should be appended to the script if it already exists.
#>
function Add-PowerShellProfileStatement {
param(
[Parameter(ParameterSetName = "Global", Mandatory)]
[switch] $System,
[Parameter(ParameterSetName = "DefaultUser", Mandatory)]
[switch] $DefaultUser,
[Parameter(ParameterSetName = "Home")]
[string] $HomeDir = "~",
[Parameter(ParameterSetName = "Global", Mandatory)]
[Parameter(ParameterSetName = "DefaultUser")]
[Parameter(ParameterSetName = "Home")]
[string] $Category = $null,
[Parameter(Position = 0, Mandatory)]
[string] $Script,
[switch] $Replace,
[switch] $Append
)
[System.Collections.ArrayList] $profiles = @();
if ($System) {
[string] $configRoot = $null;
if ($IsWindows) {
# ToDo Change to "PowerShell"
$configRoot = "$env:ProgramData";
} else {
$configRoot = "/etc";
}
$profiles = @("$configRoot/powershell/.");
} else {
if ($DefaultUser) {
if (-not $IsWindows) {
$HomeDir = "/etc/skel";
} else {
$HomeDir = "C:/Users/Default";
}
}
foreach ($shell in @("pwsh", "powershell")) {
if (Test-Command $shell) {
$null = $profiles.Add((& $shell -NoProfile -c '$PROFILE'));
}
}
Push-Location ~;
$profiles = @(
$profiles |
ForEach-Object { [System.IO.Path]::GetRelativePath((Get-Location), $_) } |
ForEach-Object { "$HomeDir/$_" }
);
Pop-Location;
}
if ($Category) {
$profiles = @($profiles | ForEach-Object { Join-Path (Split-Path -Parent $_) "conf.d" "$Category.ps1" });
}
$profiles | ForEach-Object {
$arguments = @{};
if ($Replace.IsPresent) {
$null = $arguments.Add("Replace", $Replace);
}
if ($Append.IsPresent) {
$null = $arguments.Add("Append", $Append);
}
Write-PSScript @arguments `
-FileName $_ `
-Script $Script;
};
}
<#
.SYNOPSIS
Creates an eval-script using the `[scriptblock]::Create` method.
.PARAMETER Initializer
The code to evaluate.
#>
function Get-ScriptInitializer {
param (
[Parameter(Position=0, Mandatory=$true)]
$Initializer
)
return ". ([scriptblock]::Create(($Initializer) -join `"``n`"))";
}
};

View file

@ -0,0 +1,15 @@
param (
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../PowerShell/Module.ps1";
. "$PSScriptRoot/../../Scripts/Software.ps1";
$parameters = Get-ModuleInstallerComponents "Terminal-Icons";
foreach ($key in $PSBoundParameters.Keys) {
$parameters.Add($key, $PSBoundParameters[$key]);
}
Start-SoftwareInstaller @parameters;

View file

@ -14,5 +14,9 @@ begin
end end
end end
function userConfig -a name
sudo usermod -aG libvirt "$name"
end
runInstaller $argv runInstaller $argv
end end

View file

@ -0,0 +1,15 @@
<#
.SYNOPSIS
Gets a powershell expression which points to the global `aliae` configuration.
#>
function Get-GlobalConfigExpression {
return "`"$($IsWindows ? "`$env:ProgramData" : "/etc")/aliae/aliae.yml`"";
}
<#
.SYNOPSIS
Gets the path to the global `aliae` configuration.
#>
function Get-GlobalConfigPath {
return & ([scriptblock]::Create((Get-GlobalConfigExpression)));
}

View file

@ -0,0 +1,50 @@
param(
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/Constants.ps1";
. "$PSScriptRoot/../PowerShell/Profile.ps1";
. "$PSScriptRoot/../../Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Configurator {
. "$PSScriptRoot/Constants.ps1";
$pathExpression = Get-GlobalConfigExpression;
$path = Get-GlobalConfigPath;
$null = New-Item -Force -ItemType Directory (Split-Path -Parent $path);
Copy-Item -Force "$PSScriptRoot/aliae.yml" $path;
Add-PowerShellProfileStatement `
-System `
-Category "aliae" `
-Script (
@(
{
#aliae
},
"`$globalPath = $pathExpression",
{
$userPath = & {
if ($env:ALIAE_CONFIG) {
$env:ALIAE_CONFIG;
} else {
"~/.aliae.yaml";
}
};
if (Test-Path $globalPath) {
$null = & ([scriptblock]::Create((aliae init pwsh --config $globalPath))) *>&1;
}
if (Test-Path $userPath) {
$null = & ([scriptblock]::Create((aliae init pwsh))) *>&1;
}
aliae completion powershell | Out-String | Invoke-Expression;
}
) -join [System.Environment]::NewLine)
} `
-UserConfigurator {
Copy-Item -Force "$PSScriptRoot/aliae.yml" ~/.aliae.yml;
};

View file

@ -0,0 +1,98 @@
$null = New-Module {
. "$PSScriptRoot/Constants.ps1";
<#
.SYNOPSIS
Adds an alias to an existing `aliae` configuration.
.PARAMETER Name
The name of the alias to add.
.PARAMETER Value
The script the alias should point to.
.PARAMETER User
The user to add the alias to.
#>
function Add-Alias {
param(
[string] $Name,
[string] $Value,
[string] $User
)
Edit-Config `
-Variables @{
Name = "$Name";
Value = "$Value";
} `
".alias |= [((. // [])[] | select(.name != env.Name))] + [{ name: env.Name, value: env.Value }]" `
-User $User;
}
<#
.SYNOPSIS
Adds an environment variable to an existing `aliae` configuration.
.PARAMETER Name
The name of the variable to add.
.PARAMETER Value
The value of the variable.
#>
function Add-EnvironmentVariable {
param(
[string] $Name,
[string] $Value,
[string] $User
)
Edit-Config `
-Variables @{
Name = "$Name";
Value = "$Value";
} `
".env |= [((. // [])[] | select(.name != env.Name))] + [{ name: env.Name, value: env.Value }]" `
-User $User;
}
<#
.SYNOPSIS
Edits the underlying `aliae` configuration.
.PARAMETER Script
The yq script to run over the configuration.
.PARAMETER User
The user to edit the configuration for.
#>
function Edit-Config {
param(
[string] $Script,
[hashtable] $Variables,
[string] $User
)
if ($User) {
$path = "$($IsWindows ? "~" : "$(sudo -u $User bash -c "realpath ~")")/.aliae.yaml";
} else {
$path = Get-GlobalConfigPath;
}
Start-Job {
$file = New-TemporaryFile;
$variables = $using:Variables;
foreach ($key in $variables.Keys) {
Set-Item "Env:\$key" $variables[$key];
}
sudo -u $using:User cp $using:path $file;
yq -yi $using:Script $file;
sudo -u $using:User cp $file $using:path;
Remove-Item $file;
} | Receive-Job -Wait;
}
Export-ModuleMember -Function Add-Alias,Add-EnvironmentVariable;
};

View file

@ -1,22 +1,4 @@
alias: alias: []
- name: totsch env: []
value: git
env:
- name: POSH_THEME
value: '{{ if eq .OS "windows" }}{{ .Home }}/Nextcloud/.omp{{ else }}/usr/local/share/oh-my-posh/themes{{ end }}/manuel.omp.json'
path: [] path: []
script: script: []
- value: |
# Profile Files
$profileRoot = Split-Path -Parent $PROFILE;
$profilePaths = @(
"$profileRoot/conf.d/*.ps1",
"{{ if eq .OS "windows" }}$env:ProgramData{{ else }}/etc{{ end }}/powershell/conf.d/*.ps1"
);
foreach ($profilePath in $profilePaths) {
if (Test-Path $profilePath) {
Get-Item $profilePath | ForEach-Object { . $_; };
}
}
if: match .Shell "pwsh"

View file

@ -10,28 +10,35 @@ begin
function configureSW -V dir function configureSW -V dir
source "$dir/../bash/profile.fish" source "$dir/../bash/profile.fish"
source "$dir/../fish/profile.fish" source "$dir/../fish/profile.fish"
set -l file /etc/aliae/aliae.yml set -l file (pwsh -CommandWithArgs '. $args[0]; Get-GlobalConfigPath' "$dir/Constants.ps1");
echo "export ALIAE_CONFIG=$(string escape "$file")" | sudo tee /etc/profile.d/aliae.sh
sudo install -Dm644 "$dir/aliae.yml" "$file" sudo install -Dm644 "$dir/aliae.yml" "$file"
begin begin
printf %s\n \ printf %s\n \
"# aliae" \ "if [ -f $(string escape $file) ]" \
'eval "$(aliae init bash)"' \ 'then' \
" eval \"\$(aliae init bash --config $(string escape $file))\"" \
'fi' \
'' \
'if [ -n "$ALIAE_CONFIG" ] && [ -f "$ALIAE_CONFIG" ] || [ -f ~/.aliae.yaml ]' \
'then' \
' eval "$(aliae init bash)"' \
'fi' \
'' \
'eval "$(aliae completion bash)"' 'eval "$(aliae completion bash)"'
end | installBashProfile "aliae" "aliae" end | installBashProfile "aliae" "aliae"
begin
printf %s\n "" \
"# aliae" \
'eval "$(aliae init bash)"' \
'eval "$(aliae completion bash)"'
end | sudo tee /etc/skel/.bashrc > /dev/null
if type -q fish if type -q fish
begin begin
printf %s\n \ printf %s\n \
"aliae init fish | source" \ "if [ -f $(string escape $file) ]" \
" eval \"\$(aliae init bash --config $(string escape $file))\"" \
'end' \
'' \
'if [ -n "$ALIAE_CONFIG" ] && [ -f "$ALIAE_CONFIG" ] || [ -f ~/.aliae.yaml ]' \
' aliae init fish | source' \
'end' \
'' \
"aliae completion fish | source" "aliae completion fish | source"
end | installFishProfile "aliae" "aliae" end | installFishProfile "aliae" "aliae"
end end

View file

@ -17,12 +17,22 @@ begin
if type -q "$bins[$i]" if type -q "$bins[$i]"
set bin "$bins[$i]" set bin "$bins[$i]"
set extensionRoot "$extensionRoots[$i]" set extensionRoot "$extensionRoots[$i]"
break
end end
end end
BROWSER_BIN="$bin" \ BROWSER_BIN="$bin" \
EXTENSION_POLICY_DIR="$braveExtensions" \ EXTENSION_POLICY_DIR="$extensionRoot" \
bash "$dir/../Chromium/ytmdl.sh" bash "$dir/../Chromium/ytmdl.sh"
for i in (seq (count $bins))
if [ "$extensionRoots[$i]" != "$extensionRoot" ]
if [ -d "$extensionRoots[$i]" ]
sudo rm -rf "$extensionRoots[$i]"
sudo ln -s "$extensionRoot" "$extensionRoots[$i]"
end
end
end
end end
runInstaller $argv runInstaller $argv

View file

@ -0,0 +1,113 @@
param (
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../../Scripts/Software.ps1";
. "$PSScriptRoot/../../Scripts/System.ps1";
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
$null = New-Module {
param(
[hashtable] $Parameters
)
$configure = {
param(
[string] $User
)
$root = "valhalla";
if ($User) {
$root = "$root$($IsWindows ? ".windows" : '').users.$User";
$sudoArgs = @("-u", $User);
$configArgs = @("--global");
} else {
$sudoArgs = @();
$configArgs = @("--system");
}
$config = Get-Config "$root.git";
<#
.SYNOPSIS
Sets a configuration option in git.
#>
function Set-GitConfig {
sudo @sudoArgs git config @configArgs $args;
}
if ((-not $IsWindows) -or $User) {
$branch = $config.defaultBranch;
if ($branch) {
Set-GitConfig "init.defaultBranch" $branch;
}
}
if ($User) {
$displayName = Get-UserConfig "displayName";
$mailAddress = Get-UserConfig "mailAddress";
if ($displayName) {
Set-GitConfig "user.name" $displayName;
}
if ($mailAddress) {
Set-GitConfig "user.email" $mailAddress;
}
}
# Git Flow
. {
$dir = New-TemporaryDirectory;
$key = "flow";
$mainBranch = $config."$key".mainBranch;
$devBranch = $config."$key".devBranch;
& {
git -C "$dir" init;
git -C "$dir" config user.name "PortValhalla";
git -C "$dir" config user.email "no-reply@valhal.la";
git -C "$dir" commit --allow-empty -m "Initial commit";
git -C "$dir" branch master;
git -C "$dir" branch dev;
git -C "$dir" flow init --defaults;
} | Out-Null;
if ($mainBranch) {
git -C "$dir" branch $mainBranch | Out-Null;;
sudo @sudoArgs git -C "$dir" flow config set @configArgs master $mainBranch;
}
if ($devBranch) {
git -C "$dir" branch $devBranch | Out-Null;
sudo @sudoArgs git -C "$dir" flow config set @configArgs develop $devBranch;
}
Remove-Item -Recurse -Force $dir;
};
# Aliases
[PSCustomObject] $aliases = $config.aliases;
if ($aliases) {
foreach ($alias in ($aliases | Get-Member -MemberType Properties)) {
Set-GitConfig "alias.$($alias.Name)" $aliases.$($alias.Name);
}
}
};
Start-SoftwareInstaller @Parameters `
-Configurator {
& $configure @PSBoundParameters;
} `
-UserConfigurator {
param(
[hashtable] $Arguments
)
& $configure -User $Arguments.Name;
};
} $PSBoundParameters;

Some files were not shown because too many files have changed in this diff Show more