From 7b419672700a074268f975302ff9e5d4f5b7dad3 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 12:21:23 +0100 Subject: [PATCH 01/22] Add docker + flake update --- flake.lock | 18 +++++++++--------- home-manager/desktop-shared.nix | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 85c6871..7efa93c 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1700419052, - "narHash": "sha256-U6a5f9ynbzcp8PMIHULbHPkbwp7YfPKOYmTcLqlalD4=", + "lastModified": 1700553346, + "narHash": "sha256-kW7uWsCv/lxuA824Ng6EYD9hlVYRyjuFn0xBbYltAeQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "993fb02d20760067b8ee19c713d94cee07037759", + "rev": "1aabb0a31b25ad83cfaa37c3fe29053417cd9a0f", "type": "github" }, "original": { @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1700204040, - "narHash": "sha256-xSVcS5HBYnD3LTer7Y2K8ZQCDCXMa3QUD1MzRjHzuhI=", + "lastModified": 1700390070, + "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad", + "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb", "type": "github" }, "original": { @@ -55,11 +55,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1700204040, - "narHash": "sha256-xSVcS5HBYnD3LTer7Y2K8ZQCDCXMa3QUD1MzRjHzuhI=", + "lastModified": 1700390070, + "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad", + "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb", "type": "github" }, "original": { diff --git a/home-manager/desktop-shared.nix b/home-manager/desktop-shared.nix index e32c583..fdefda7 100644 --- a/home-manager/desktop-shared.nix +++ b/home-manager/desktop-shared.nix @@ -56,6 +56,7 @@ home.packages = with pkgs; [ # Coding: + docker git kate From 3af0d40c7921a8536c7f78475fe5a92672eea9dc Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 12:50:29 +0100 Subject: [PATCH 02/22] Add user to docker group --- nixos/shared-desktop/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index f51403b..49a65c2 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -162,7 +162,7 @@ users.users = { lillian = { isNormalUser = true; - extraGroups = ["sudo" "networkmanager" "wheel" "vboxsf"]; + extraGroups = ["sudo" "networkmanager" "wheel" "vboxsf" "docker"]; shell = pkgs.zsh; }; }; From 88d49c594094b633a5ac2139f82717ac96e6d023 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 12:52:38 +0100 Subject: [PATCH 03/22] Add docker compose --- home-manager/desktop-shared.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home-manager/desktop-shared.nix b/home-manager/desktop-shared.nix index fdefda7..7175ffc 100644 --- a/home-manager/desktop-shared.nix +++ b/home-manager/desktop-shared.nix @@ -57,6 +57,7 @@ home.packages = with pkgs; [ # Coding: docker + docker-compose git kate From 6cef1b8ad74936e547b21c39c76b931cdbc13b07 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:14:27 +0100 Subject: [PATCH 04/22] mssql test? --- home-manager/desktop-shared.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/home-manager/desktop-shared.nix b/home-manager/desktop-shared.nix index 7175ffc..f480ef3 100644 --- a/home-manager/desktop-shared.nix +++ b/home-manager/desktop-shared.nix @@ -128,6 +128,20 @@ userEmail = "git@gladtherescake.eu"; userName = "Lillian-Violet"; }; + + config.docker-containers = { + mssql = { + image = "mcr.microsoft.com/mssql/server:latest"; + ports = ["127.0.0.1:1433:1433"]; + volumes = [ + "/var/lib/mssql" + ]; + cmd = [ + "--base-url" + "\"/mssql\"" + ]; + }; + }; # Nicely reload system units when changing configs systemd.user.startServices = "sd-switch"; } From d76c837c13f252eee250c6ebcc4a468b37eac307 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:16:36 +0100 Subject: [PATCH 05/22] Little fix --- home-manager/desktop-shared.nix | 16 +--------------- nixos/shared-desktop/configuration.nix | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/home-manager/desktop-shared.nix b/home-manager/desktop-shared.nix index f480ef3..e668e4b 100644 --- a/home-manager/desktop-shared.nix +++ b/home-manager/desktop-shared.nix @@ -56,8 +56,7 @@ home.packages = with pkgs; [ # Coding: - docker - docker-compose + azuredatastudio git kate @@ -129,19 +128,6 @@ userName = "Lillian-Violet"; }; - config.docker-containers = { - mssql = { - image = "mcr.microsoft.com/mssql/server:latest"; - ports = ["127.0.0.1:1433:1433"]; - volumes = [ - "/var/lib/mssql" - ]; - cmd = [ - "--base-url" - "\"/mssql\"" - ]; - }; - }; # Nicely reload system units when changing configs systemd.user.startServices = "sd-switch"; } diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 49a65c2..f9d6340 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -58,6 +58,8 @@ environment.systemPackages = with pkgs; [ age alejandra + docker + docker-compose git-filter-repo home-manager input-leap @@ -167,6 +169,20 @@ }; }; + config.docker-containers = { + mssql = { + image = "mcr.microsoft.com/mssql/server:latest"; + ports = ["127.0.0.1:1433:1433"]; + volumes = [ + "/var/lib/mssql" + ]; + cmd = [ + "--base-url" + "\"/mssql\"" + ]; + }; + }; + # Enable completion of system packages by zsh environment.pathsToLink = ["/share/zsh"]; } From bce821532f329d045d8117caa03915182e414607 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:18:52 +0100 Subject: [PATCH 06/22] No config attribute? --- nixos/shared-desktop/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index f9d6340..5904e75 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -169,7 +169,7 @@ }; }; - config.docker-containers = { + docker-containers = { mssql = { image = "mcr.microsoft.com/mssql/server:latest"; ports = ["127.0.0.1:1433:1433"]; From a5c6a190d188e5c79a979d3a174ebd52df034fbc Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:21:01 +0100 Subject: [PATCH 07/22] New syntax --- nixos/shared-desktop/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 5904e75..325f074 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -169,7 +169,7 @@ }; }; - docker-containers = { + virtualisation.oci-containers.containers = { mssql = { image = "mcr.microsoft.com/mssql/server:latest"; ports = ["127.0.0.1:1433:1433"]; From c4d9dfd2199493cf2d78ee09b526fd6b91c28054 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:27:44 +0100 Subject: [PATCH 08/22] Will this work with commands? --- nixos/shared-desktop/configuration.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 325f074..1c5b9a9 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -177,8 +177,7 @@ "/var/lib/mssql" ]; cmd = [ - "--base-url" - "\"/mssql\"" + "-e \"ACCEPT_EULA=Y\" -e \"MSSQL_SA_PASSWORD=password\"" ]; }; }; From 000191e2c1a4ca14a37b4976a2b650ab653328e5 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:33:18 +0100 Subject: [PATCH 09/22] Environment? --- nixos/shared-desktop/configuration.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 1c5b9a9..17fc851 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -176,9 +176,10 @@ volumes = [ "/var/lib/mssql" ]; - cmd = [ - "-e \"ACCEPT_EULA=Y\" -e \"MSSQL_SA_PASSWORD=password\"" - ]; + environment = { + "ACCEPT_EULA" = "y"; + "MSSQL_SA_PASSWORD" = "password"; + }; }; }; From e39ce3122121d44a71430213c24411f021a02012 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:35:42 +0100 Subject: [PATCH 10/22] 2022 latest --- nixos/shared-desktop/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 17fc851..1eeb569 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -171,7 +171,7 @@ virtualisation.oci-containers.containers = { mssql = { - image = "mcr.microsoft.com/mssql/server:latest"; + image = "mcr.microsoft.com/mssql/server:2022-latest"; ports = ["127.0.0.1:1433:1433"]; volumes = [ "/var/lib/mssql" From df6bd3f415e6fd90483c1da22744102e93bb7b5e Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:39:20 +0100 Subject: [PATCH 11/22] Let's just remove the volume --- nixos/shared-desktop/configuration.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 1eeb569..2cd8a5e 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -173,9 +173,6 @@ mssql = { image = "mcr.microsoft.com/mssql/server:2022-latest"; ports = ["127.0.0.1:1433:1433"]; - volumes = [ - "/var/lib/mssql" - ]; environment = { "ACCEPT_EULA" = "y"; "MSSQL_SA_PASSWORD" = "password"; From c75c3120b2ce3510561420480964b0a1aeca9137 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:48:51 +0100 Subject: [PATCH 12/22] volume added --- nixos/shared-desktop/configuration.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 2cd8a5e..5ec0f50 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -177,6 +177,7 @@ "ACCEPT_EULA" = "y"; "MSSQL_SA_PASSWORD" = "password"; }; + volumes = ["/home/delegator/filerun/db:/var/lib/myssql"]; }; }; From cd174a04062067f1016fcb3683ff553c13659a40 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:52:41 +0100 Subject: [PATCH 13/22] Maybe mssql volume back --- nixos/shared-desktop/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 5ec0f50..235c08f 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -177,7 +177,7 @@ "ACCEPT_EULA" = "y"; "MSSQL_SA_PASSWORD" = "password"; }; - volumes = ["/home/delegator/filerun/db:/var/lib/myssql"]; + volumes = ["/var/lib/myssql"]; }; }; From 6e86eb4ab3c556962e5c10800d1473dbbb84c3d6 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:55:13 +0100 Subject: [PATCH 14/22] add mssql user --- nixos/shared-desktop/configuration.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 235c08f..95002a2 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -167,6 +167,9 @@ extraGroups = ["sudo" "networkmanager" "wheel" "vboxsf" "docker"]; shell = pkgs.zsh; }; + mssql = { + isNormalUser = false; + }; }; virtualisation.oci-containers.containers = { From b97385041c5a5ab5482857d676b34eaeb1d7fa71 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:56:27 +0100 Subject: [PATCH 15/22] Is system user --- nixos/shared-desktop/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 95002a2..4f95f02 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -168,7 +168,7 @@ shell = pkgs.zsh; }; mssql = { - isNormalUser = false; + isSystemUser = true; }; }; From 479cfc87b81402b00149ac255e5efd4498956222 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:57:14 +0100 Subject: [PATCH 16/22] Add to group --- nixos/shared-desktop/configuration.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 4f95f02..b34a2e4 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -169,6 +169,7 @@ }; mssql = { isSystemUser = true; + group = "mssql"; }; }; From f3f2a833bc6f33e60fc639042321b60bb5d5b071 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 13:58:13 +0100 Subject: [PATCH 17/22] Add the group --- nixos/shared-desktop/configuration.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index b34a2e4..8970760 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -161,6 +161,8 @@ boot.loader.systemd-boot.configurationLimit = 3; boot.loader.efi.canTouchEfiVariables = true; + users.groups.mssql = {}; + users.users = { lillian = { isNormalUser = true; From 9d492f5211455a61405fb4020ff8334b5832cb52 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 14:05:44 +0100 Subject: [PATCH 18/22] Change some small stuff --- nixos/shared-desktop/configuration.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 8970760..9f45eeb 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -178,12 +178,12 @@ virtualisation.oci-containers.containers = { mssql = { image = "mcr.microsoft.com/mssql/server:2022-latest"; - ports = ["127.0.0.1:1433:1433"]; + ports = ["1433:1433"]; environment = { "ACCEPT_EULA" = "y"; "MSSQL_SA_PASSWORD" = "password"; }; - volumes = ["/var/lib/myssql"]; + volumes = ["/home/lillian/docker/mssql:/data"]; }; }; From 20b4491f48166c9da92333ae6a48b5d2b7967da1 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 14:14:34 +0100 Subject: [PATCH 19/22] Quotes --- nixos/shared-desktop/configuration.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 9f45eeb..73a354f 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -180,8 +180,8 @@ image = "mcr.microsoft.com/mssql/server:2022-latest"; ports = ["1433:1433"]; environment = { - "ACCEPT_EULA" = "y"; - "MSSQL_SA_PASSWORD" = "password"; + "\"ACCEPT_EULA" = "Y\""; + "\"MSSQL_SA_PASSWORD" = "password\""; }; volumes = ["/home/lillian/docker/mssql:/data"]; }; From 1e8e483f26ce513d77134593b0c22c113847a359 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 14:16:25 +0100 Subject: [PATCH 20/22] Nope --- nixos/shared-desktop/configuration.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index 73a354f..ec27c25 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -180,8 +180,8 @@ image = "mcr.microsoft.com/mssql/server:2022-latest"; ports = ["1433:1433"]; environment = { - "\"ACCEPT_EULA" = "Y\""; - "\"MSSQL_SA_PASSWORD" = "password\""; + "ACCEPT_EULA" = "Y"; + "MSSQL_SA_PASSWORD" = "password"; }; volumes = ["/home/lillian/docker/mssql:/data"]; }; From e434b108188d8c09fd4cbb71260e05ddee5c2f6d Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 14:27:23 +0100 Subject: [PATCH 21/22] password more secure the issue? --- nixos/shared-desktop/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/shared-desktop/configuration.nix b/nixos/shared-desktop/configuration.nix index ec27c25..c89ebdc 100644 --- a/nixos/shared-desktop/configuration.nix +++ b/nixos/shared-desktop/configuration.nix @@ -181,7 +181,7 @@ ports = ["1433:1433"]; environment = { "ACCEPT_EULA" = "Y"; - "MSSQL_SA_PASSWORD" = "password"; + "MSSQL_SA_PASSWORD" = "EbKihNUHg6S$V$qchADFmw!JCm##toc3"; }; volumes = ["/home/lillian/docker/mssql:/data"]; }; From 8c6ee6423bca0c043f01a2f81beae049ad821c4c Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 22 Nov 2023 15:26:04 +0100 Subject: [PATCH 22/22] Let's try and update this package --- pkgs/azuredatastudio/default.nix | 195 +++++++++++++++++++++++++++++++ pkgs/default.nix | 1 + 2 files changed, 196 insertions(+) create mode 100644 pkgs/azuredatastudio/default.nix diff --git a/pkgs/azuredatastudio/default.nix b/pkgs/azuredatastudio/default.nix new file mode 100644 index 0000000..880fa8f --- /dev/null +++ b/pkgs/azuredatastudio/default.nix @@ -0,0 +1,195 @@ +{ + stdenv, + lib, + fetchurl, + copyDesktopItems, + makeDesktopItem, + makeWrapper, + alsa-lib, + at-spi2-atk, + at-spi2-core, + cairo, + cups, + curl, + dbus, + expat, + gdk-pixbuf, + glib, + gnutar, + gtk3, + icu, + libdrm, + libunwind, + libuuid, + libxkbcommon, + mesa, + nspr, + nss, + openssl, + pango, + systemd, + xorg, + zlib, +}: +# from justinwoo/azuredatastudio-nix +# https://github.com/justinwoo/azuredatastudio-nix/blob/537c48aa3981cd1a82d5d6e508ab7e7393b3d7c8/default.nix +let + desktopItem = makeDesktopItem { + name = "azuredatastudio"; + desktopName = "Azure Data Studio"; + comment = "Data Management Tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux."; + genericName = "Text Editor"; + exec = "azuredatastudio --no-sandbox --unity-launch %F"; + icon = "azuredatastudio"; + startupNotify = true; + startupWMClass = "azuredatastudio"; + categories = ["Utility" "TextEditor" "Development" "IDE"]; + mimeTypes = ["text/plain" "inode/directory" "application/x-azuredatastudio-workspace"]; + keywords = ["azuredatastudio"]; + actions.new-empty-window = { + name = "New Empty Window"; + exec = "azuredatastudio --no-sandbox --new-window %F"; + icon = "azuredatastudio"; + }; + }; + + urlHandlerDesktopItem = makeDesktopItem { + name = "azuredatastudio-url-handler"; + desktopName = "Azure Data Studio - URL Handler"; + comment = "Azure Data Studio"; + genericName = "Text Editor"; + exec = "azuredatastudio --no-sandbox --open-url %U"; + icon = "azuredatastudio"; + startupNotify = true; + startupWMClass = "azuredatastudio"; + categories = ["Utility" "TextEditor" "Development" "IDE"]; + mimeTypes = ["x-scheme-handler/azuredatastudio"]; + keywords = ["azuredatastudio"]; + noDisplay = true; + }; +in + stdenv.mkDerivation rec { + pname = "azuredatastudio"; + version = "1.47.0"; + + desktopItems = [desktopItem urlHandlerDesktopItem]; + + src = fetchurl { + name = "${pname}-${version}.tar.gz"; + url = "https://azuredatastudio-update.azurewebsites.net/${version}/linux-x64/stable"; + sha256 = "0e094179ffb883d0da8fdbe9721a32402303bf68f411445f2d="; + }; + + nativeBuildInputs = [ + makeWrapper + copyDesktopItems + ]; + + buildInputs = [ + libuuid + at-spi2-core + at-spi2-atk + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/pixmaps + cp ${targetPath}/resources/app/resources/linux/code.png $out/share/pixmaps/azuredatastudio.png + + runHook postInstall + ''; + + # change this to azuredatastudio-insiders for insiders releases + edition = "azuredatastudio"; + targetPath = "$out/${edition}"; + + unpackPhase = '' + mkdir -p ${targetPath} + ${gnutar}/bin/tar xf $src --strip 1 -C ${targetPath} + ''; + + sqltoolsserviceRpath = lib.makeLibraryPath [ + stdenv.cc.cc + libunwind + libuuid + icu + openssl + zlib + curl + ]; + + # this will most likely need to be updated when azuredatastudio's version changes + sqltoolsservicePath = "${targetPath}/resources/app/extensions/mssql/sqltoolsservice/Linux/4.7.1.6"; + + rpath = lib.concatStringsSep ":" [ + (lib.makeLibraryPath [ + alsa-lib + at-spi2-atk + cairo + cups + dbus + expat + gdk-pixbuf + glib + gtk3 + mesa + nss + nspr + libdrm + xorg.libX11 + xorg.libxcb + xorg.libXcomposite + xorg.libXdamage + xorg.libXext + xorg.libXfixes + xorg.libXrandr + xorg.libxshmfence + libxkbcommon + xorg.libxkbfile + pango + stdenv.cc.cc.lib + systemd + ]) + targetPath + sqltoolsserviceRpath + ]; + + fixupPhase = '' + fix_sqltoolsservice() + { + mv ${sqltoolsservicePath}/$1 ${sqltoolsservicePath}/$1_old + patchelf \ + --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \ + ${sqltoolsservicePath}/$1_old + + makeWrapper \ + ${sqltoolsservicePath}/$1_old \ + ${sqltoolsservicePath}/$1 \ + --set LD_LIBRARY_PATH ${sqltoolsserviceRpath} + } + + fix_sqltoolsservice MicrosoftSqlToolsServiceLayer + fix_sqltoolsservice MicrosoftSqlToolsCredentials + fix_sqltoolsservice SqlToolsResourceProviderService + + patchelf \ + --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \ + ${targetPath}/${edition} + + mkdir -p $out/bin + makeWrapper \ + ${targetPath}/bin/${edition} \ + $out/bin/azuredatastudio \ + --set LD_LIBRARY_PATH ${rpath} + ''; + + meta = { + maintainers = with lib.maintainers; [xavierzwirtz]; + description = "A data management tool that enables working with SQL Server, Azure SQL DB and SQL DW"; + homepage = "https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio"; + sourceProvenance = with lib.sourceTypes; [binaryNativeCode]; + license = lib.licenses.unfreeRedistributable; + platforms = ["x86_64-linux"]; + }; + } diff --git a/pkgs/default.nix b/pkgs/default.nix index 3d9e23c..cc4f33d 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -2,4 +2,5 @@ # You can build them using 'nix build .#example' pkgs: { # example = pkgs.callPackage ./example { }; + azuredatastudio = pkgs.callPackage ./azuredatastudio {}; }