diff --git a/flake.nix b/flake.nix index a2c41bf..92fbad1 100644 --- a/flake.nix +++ b/flake.nix @@ -79,6 +79,8 @@ }; }; + packages."${system}" = lib.my.mapModules ./packages (p: pkgs.callPackage p { inherit inputs; }); + nixosModules = mapModulesRec ./modules import; nixosConfigurations = mapHosts ./hosts {}; }; diff --git a/hosts/manwe/users/chris/default.nix b/hosts/manwe/users/chris/default.nix index 3ec3bd5..c65005f 100644 --- a/hosts/manwe/users/chris/default.nix +++ b/hosts/manwe/users/chris/default.nix @@ -30,6 +30,7 @@ office.enable = true; steam.enable = true; recording.enable = true; + studio.enable = true; }; terminal = { diff --git a/modules/home/desktop/applications/studio.nix b/modules/home/desktop/applications/studio.nix index 7bd0f8b..940c386 100644 --- a/modules/home/desktop/applications/studio.nix +++ b/modules/home/desktop/applications/studio.nix @@ -1,14 +1,17 @@ -{ config, lib, user, ... }: +{ pkgs, config, lib, user, ... }: let - inherit (lib) mkIf; - # inherit (lib.my) mkWinApp; + inherit (lib) mkIf mkEnableOption; cfg = config.modules.${user}.desktop.applications.studio; in { - options.${user}.desktop.applications.studio = {}; + options.modules.${user}.desktop.applications.studio = { + enable = mkEnableOption "Enable Bricklink Studio"; + }; config = mkIf cfg.enable { - + environment.systemPackages = with pkgs; [ + my.studio + ]; }; } diff --git a/modules/system/services/auth.nix b/modules/system/services/auth.nix index b6e2ebe..7df011a 100644 --- a/modules/system/services/auth.nix +++ b/modules/system/services/auth.nix @@ -127,7 +127,7 @@ in authorization_policy = "one_factor"; userinfo_signed_response_alg = "none"; consent_mode = "implicit"; - scopes = [ "openid" "email" "picture" "profile" "groups" ]; + scopes = [ "offline_access" "openid" "email" "picture" "profile" "groups" ]; redirect_uris = [ "http://localhost:3000/api/auth/oauth2/callback/authelia" ]; } ]; diff --git a/packages/studio.nix b/packages/studio.nix new file mode 100644 index 0000000..3bec05d --- /dev/null +++ b/packages/studio.nix @@ -0,0 +1,102 @@ +{ pkgs, lib, inputs }: let + inherit (builtins) fetchurl; + inherit (pkgs) makeDesktopItem wineWowPackages; + inherit (inputs.erosanix.lib.x86_64-linux) mkWindowsApp makeDesktopIcon; + + wine = wineWowPackages.base; +in mkWindowsApp rec { + inherit wine; + + pname = "studio"; + version = "2.25.4_1"; + + src = fetchurl { + url = "https://studio.download.bricklink.info/Studio2.0+EarlyAccess/Archive/2.25.4_1/Studio+2.0+EarlyAccess.exe"; + sha256 = "sha256:1gw6pyvfr7zr42g21hqgiwkjs88nvhq2c2v40y21frvwv17hja92"; + }; + + enableMonoBootPrompt = false; + dontUnpack = true; + + wineArch = "win64"; + enableInstallNotification = true; + + fileMap = { + "$HOME/.cache/${pname}" = "drive_c/${pname}/${pname}-cache"; + }; + + fileMapDuringAppInstall = false; + + persistRegistry = false; + persistRuntimeLayer = false; + inputHashMethod = "store-path"; + + # Can be used to precisely select the Direct3D implementation. + # + # | enableVulkan | rendererOverride | Direct3D implementation | + # |--------------|------------------|-------------------------| + # | false | null | OpenGL | + # | true | null | Vulkan (DXVK) | + # | * | dxvk-vulkan | Vulkan (DXVK) | + # | * | wine-opengl | OpenGL | + # | * | wine-vulkan | Vulkan (VKD3D) | + enableVulkan = false; + rendererOverride = null; + + enableHUD = false; + + enabledWineSymlinks = { }; + graphicsDriver = "auto"; + inhibitIdle = false; + + winAppInstall = '' + d="$WINEPREFIX/drive_c/${pname}" + config_dir="$HOME/.config/studio" + + mkdir -p "$d" + wine ${src} + + mkdir -p "$config_dir" + ''; + + winAppPreRun = ''''; + + winAppRun = '' + wine "$WINEPREFIX/drive_c/${pname}/studio-${version}-64.exe" "$ARGS" + ''; + + winAppPostRun = ""; + installPhase = '' + runHook preInstall + + ln -s $out/bin/.launcher $out/bin/${pname} + + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + mimeTypes = []; + + name = pname; + exec = pname; + icon = pname; + desktopName = "Bricklink studio"; + genericName = "Lego creation app"; + categories = []; + }) + ]; + + desktopIcon = makeDesktopIcon { + name = pname; + src = ./studio.png; + }; + + meta = with lib; { + description = "App for creating lego builds"; + homepage = "https://www.bricklink.com/v3/studio/main.page"; + license = ""; + maintainers = []; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/packages/studio.png b/packages/studio.png new file mode 100644 index 0000000..1e7cd5f Binary files /dev/null and b/packages/studio.png differ