Merge pull request #215433 from wineee/dde-api


authored by Sandro and committed by GitHub 10235445 e1ccff27

+359
+1
pkgs/desktops/deepin/default.nix
··· 45 go-lib = callPackage ./go-package/go-lib { inherit replaceAll; }; 46 go-gir-generator = callPackage ./go-package/go-gir-generator { }; 47 go-dbus-factory = callPackage ./go-package/go-dbus-factory { }; 48 deepin-pw-check = callPackage ./go-package/deepin-pw-check { }; 49 50 #### TOOLS
··· 45 go-lib = callPackage ./go-package/go-lib { inherit replaceAll; }; 46 go-gir-generator = callPackage ./go-package/go-gir-generator { }; 47 go-dbus-factory = callPackage ./go-package/go-dbus-factory { }; 48 + dde-api = callPackage ./go-package/dde-api { inherit replaceAll; }; 49 deepin-pw-check = callPackage ./go-package/deepin-pw-check { }; 50 51 #### TOOLS
+39
pkgs/desktops/deepin/go-package/dde-api/0001-fix-PATH-for-NixOS.patch
···
··· 1 + From c8f597bd7286a76e7ce371e4f7982d9d2700868a Mon Sep 17 00:00:00 2001 2 + From: rewine <luhongxu@deepin.org> 3 + Date: Wed, 28 Dec 2022 23:06:53 +0800 4 + Subject: [PATCH] fix PATH for NixOS 5 + 6 + --- 7 + device/main.go | 2 +- 8 + locale-helper/main.go | 2 +- 9 + 2 files changed, 2 insertions(+), 2 deletions(-) 10 + 11 + diff --git a/device/main.go b/device/main.go 12 + index 6c5404c..f79bcfc 100644 13 + --- a/device/main.go 14 + +++ b/device/main.go 15 + @@ -15,7 +15,7 @@ import ( 16 + var logger = log.NewLogger(dbusServiceName) 17 + 18 + func main() { 19 + - os.Setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") 20 + + os.Setenv("PATH", "/run/current-system/sw/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") 21 + service, err := dbusutil.NewSystemService() 22 + if err != nil { 23 + logger.Fatal("failed to new system service:", err) 24 + diff --git a/locale-helper/main.go b/locale-helper/main.go 25 + index 0866e48..ef000b5 100644 26 + --- a/locale-helper/main.go 27 + +++ b/locale-helper/main.go 28 + @@ -45,7 +45,7 @@ var ( 29 + ) 30 + 31 + func main() { 32 + - os.Setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") 33 + + os.Setenv("PATH", "/run/current-system/sw/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") 34 + logger.BeginTracing() 35 + defer logger.EndTracing() 36 + 37 + -- 38 + 2.38.1 39 +
+109
pkgs/desktops/deepin/go-package/dde-api/default.nix
···
··· 1 + { stdenv 2 + , lib 3 + , fetchFromGitHub 4 + , buildGoPackage 5 + , replaceAll 6 + , wrapQtAppsHook 7 + , wrapGAppsHook 8 + , gtk3 9 + , pkg-config 10 + , deepin-gettext-tools 11 + , alsa-lib 12 + , go-dbus-factory 13 + , go-gir-generator 14 + , go-lib 15 + , libcanberra 16 + , libgudev 17 + , librsvg 18 + , poppler 19 + , pulseaudio 20 + , gdk-pixbuf-xlib 21 + , dbus 22 + , coreutils 23 + , deepin-desktop-base 24 + }: 25 + 26 + buildGoPackage rec { 27 + pname = "dde-api"; 28 + version = "5.5.32"; 29 + 30 + goPackagePath = "github.com/linuxdeepin/dde-api"; 31 + 32 + src = fetchFromGitHub { 33 + owner = "linuxdeepin"; 34 + repo = pname; 35 + rev = version; 36 + sha256 = "sha256-F+vEOSpysqVtjs8de5mCmeANuCbYUQ860ZHl5rwNYac="; 37 + }; 38 + 39 + patches = [ ./0001-fix-PATH-for-NixOS.patch ]; 40 + 41 + postPatch = replaceAll "/usr/lib/deepin-api" "/run/current-system/sw/lib/deepin-api" 42 + + replaceAll "/usr/share/i18n/language_info.json" "${deepin-desktop-base}/share/i18n/language_info.json" 43 + + replaceAll "/usr/bin/dbus-send" "${dbus}/bin/dbus-send" 44 + + replaceAll "/usr/bin/true" "${coreutils}/bin/true" 45 + + replaceAll "/usr/sbin/alsactl" "alsactl" 46 + + '' 47 + substituteInPlace lunar-calendar/huangli.go adjust-grub-theme/main.go \ 48 + --replace "/usr/share/dde-api" "$out/share/dde-api" 49 + substituteInPlace themes/{theme.go,settings.go} \ 50 + --replace "/usr/share" "/run/current-system/sw/share" 51 + ''; 52 + 53 + goDeps = ./deps.nix; 54 + 55 + nativeBuildInputs = [ 56 + pkg-config 57 + deepin-gettext-tools 58 + wrapQtAppsHook 59 + wrapGAppsHook 60 + ]; 61 + dontWrapGApps = true; 62 + 63 + buildInputs = [ 64 + go-dbus-factory 65 + go-gir-generator 66 + go-lib 67 + gtk3 68 + alsa-lib 69 + libcanberra 70 + libgudev 71 + librsvg 72 + poppler 73 + pulseaudio 74 + gdk-pixbuf-xlib 75 + ]; 76 + 77 + buildPhase = '' 78 + runHook preBuild 79 + GOPATH="$GOPATH:${go-dbus-factory}/share/gocode" 80 + GOPATH="$GOPATH:${go-gir-generator}/share/gocode" 81 + GOPATH="$GOPATH:${go-lib}/share/gocode" 82 + make -C go/src/${goPackagePath} 83 + runHook postBuild 84 + ''; 85 + 86 + installPhase = '' 87 + runHook preInstall 88 + make install DESTDIR="$out" PREFIX="/" -C go/src/${goPackagePath} 89 + runHook postInstall 90 + ''; 91 + 92 + preFixup = '' 93 + qtWrapperArgs+=("''${gappsWrapperArgs[@]}") 94 + ''; 95 + 96 + postFixup = '' 97 + for binary in $out/lib/deepin-api/*; do 98 + wrapProgram $binary "''${qtWrapperArgs[@]}" 99 + done 100 + ''; 101 + 102 + meta = with lib; { 103 + description = "Dbus interfaces used for screen zone detecting, thumbnail generating, sound playing, etc"; 104 + homepage = "https://github.com/linuxdeepin/dde-api"; 105 + license = licenses.gpl3Plus; 106 + platforms = platforms.linux; 107 + maintainers = teams.deepin.members; 108 + }; 109 + }
+210
pkgs/desktops/deepin/go-package/dde-api/deps.nix
···
··· 1 + [ 2 + { 3 + goPackagePath = "gopkg.in/alecthomas/kingpin.v2"; 4 + fetch = { 5 + type = "git"; 6 + url = "https://gopkg.in/alecthomas/kingpin.v2"; 7 + rev = "v2.2.6"; 8 + sha256 = "sha256-uViE2kPj7tMrGYVjjdLOl2jFDmmu+3P7GvnZBse2zVY="; 9 + }; 10 + } 11 + { 12 + goPackagePath = "github.com/disintegration/imaging"; 13 + fetch = { 14 + type = "git"; 15 + url = "https://github.com/disintegration/imaging"; 16 + rev = "v1.6.2"; 17 + sha256 = "sha256-pSeMTPvSkxlthh65LjNYYhPLvCZDkBgVgAGYWW0Aguo="; 18 + }; 19 + } 20 + { 21 + goPackagePath = "github.com/linuxdeepin/go-x11-client"; 22 + fetch = { 23 + type = "git"; 24 + url = "https://github.com/linuxdeepin/go-x11-client"; 25 + rev = "0.6.9"; 26 + sha256 = "sha256-xXNaXpFFHJN1fCFLoVrQFCXQ4ya+Kga55QWcJL/InkA="; 27 + }; 28 + } 29 + { 30 + goPackagePath = "github.com/mattn/go-sqlites"; 31 + fetch = { 32 + type = "git"; 33 + url = "https://github.com/mattn/go-sqlite3"; 34 + rev = "v1.14.12"; 35 + sha256 = "sha256-SLW1FyyfJGPUid1epgmJHZGJebI77Wg5WMAPiz1GcYs="; 36 + }; 37 + } 38 + { 39 + goPackagePath = "github.com/godbus/dbus"; 40 + fetch = { 41 + type = "git"; 42 + url = "https://github.com/godbus/dbus"; 43 + rev = "v5.1.0"; 44 + sha256 = "sha256-JSPtmkGEStBEVrKGszeLCb7P38SzQKgMiDC3eDppXs0="; 45 + }; 46 + } 47 + { 48 + goPackagePath = "github.com/fsnotify/fsnotify"; 49 + fetch = { 50 + type = "git"; 51 + url = "https://github.com/fsnotify/fsnotify"; 52 + rev = "v1.5.1"; 53 + sha256 = "sha256-B8kZ8yiWgallT7R2j1kSRJcJkSGFVf9ise+TpXa+7XY="; 54 + }; 55 + } 56 + { 57 + goPackagePath = "golang.org/x/sys"; 58 + fetch = { 59 + type = "git"; 60 + url = "https://github.com/golang/sys"; 61 + rev = "289d7a0edf712062d9f1484b07bdf2383f48802f"; 62 + sha256 = "sha256-AzS/J3OocI7mA0xsIfQzyskNKVija7F2yvuts+EFJBs="; 63 + }; 64 + } 65 + { 66 + goPackagePath = "github.com/stretchr/testify"; 67 + fetch = { 68 + type = "git"; 69 + url = "https://github.com/stretchr/testify"; 70 + rev = "v1.7.1"; 71 + sha256 = "sha256-disUVIHiIDSj/go3APtJH8awSl8QwKRRFLKI7LRnl0w="; 72 + }; 73 + } 74 + { 75 + goPackagePath = "github.com/davecgh/go-spew"; 76 + fetch = { 77 + type = "git"; 78 + url = "https://github.com/davecgh/go-spew"; 79 + rev = "v1.1.1"; 80 + sha256 = "sha256-nhzSUrE1fCkN0+RL04N4h8jWmRFPPPWbCuDc7Ss0akI="; 81 + }; 82 + } 83 + { 84 + goPackagePath = "github.com/pmezard/go-difflib"; 85 + fetch = { 86 + type = "git"; 87 + url = "https://github.com/pmezard/go-difflib"; 88 + rev = "5d4384ee4fb2527b0a1256a821ebfc92f91efefc"; 89 + sha256 = "sha256-XA4Oj1gdmdV/F/+8kMI+DBxKPthZ768hbKsO3d9Gx90="; 90 + }; 91 + } 92 + { 93 + goPackagePath = "github.com/stretchr/objx"; 94 + fetch = { 95 + type = "git"; 96 + url = "https://github.com/stretchr/objx"; 97 + rev = "v0.3.0"; 98 + sha256 = "sha256-T753/EiD5Cpk6H2JFhd+s1gFvpNptG2XlEHxZF6dQaw="; 99 + }; 100 + } 101 + { 102 + goPackagePath = "gopkg.in/yaml.v3"; 103 + fetch = { 104 + type = "git"; 105 + url = "https://github.com/go-yaml/yaml"; 106 + rev = "496545a6307b2a7d7a710fd516e5e16e8ab62dbc"; 107 + sha256 = "sha256-j8yDji+vqsitpRZirpb4w/Em8nstgf28wpwkcrOlxBk="; 108 + }; 109 + } 110 + { 111 + goPackagePath = "golang.org/x/image"; 112 + fetch = { 113 + type = "git"; 114 + url = "https://github.com/golang/image"; 115 + rev = "a8550c1d254a56cf1762a2993881d2b23c0c83dd"; 116 + sha256 = "sha256-gtRGCsCe8tKLsZWhKLL8c5whz9rCMoCHfH13rcSW/OM="; 117 + }; 118 + } 119 + { 120 + goPackagePath = "github.com/alecthomas/units"; 121 + fetch = { 122 + type = "git"; 123 + url = "https://github.com/alecthomas/units"; 124 + rev = "b94a6e3cc13755c0a75fffecbb089eb346fc4289"; 125 + sha256 = "sha256-uriYmwxT69xbmWKO/5OAyeMa2lFBOJDrU2KtQh/+ZjY="; 126 + }; 127 + } 128 + { 129 + goPackagePath = "github.com/alecthomas/template"; 130 + fetch = { 131 + type = "git"; 132 + url = "https://github.com/alecthomas/template"; 133 + rev = "fb15b899a75114aa79cc930e33c46b577cc664b1"; 134 + sha256 = "sha256-RsS4qxdRQ3q+GejA8D9Iu31A/mZNms4LbJ7518jWiu4="; 135 + }; 136 + } 137 + { 138 + goPackagePath = "github.com/cryptix/wav"; 139 + fetch = { 140 + type = "git"; 141 + url = "https://github.com/cryptix/wav"; 142 + rev = "8bdace674401f0bd3b63c65479b6a6ff1f9d5e44"; 143 + sha256 = "sha256-psUCHRFGEOpN3obFbCvSfW0AGEFSI29d0q4MFsHG3qI="; 144 + }; 145 + } 146 + { 147 + goPackagePath = "github.com/fogleman/gg"; 148 + fetch = { 149 + type = "git"; 150 + url = "https://github.com/fogleman/gg"; 151 + rev = "v1.3.0"; 152 + sha256 = "sha256-Fs2JI0FmF4N5EzXJzGAPZMxZxo6wKyebkN/iBZ9sdNo="; 153 + }; 154 + } 155 + { 156 + goPackagePath = "github.com/golang/freetype"; 157 + fetch = { 158 + type = "git"; 159 + url = "https://github.com/golang/freetype"; 160 + rev = "e2365dfdc4a05e4b8299a783240d4a7d5a65d4e4"; 161 + sha256 = "sha256-rOOsv1sNLbYEKnwXZtUlB2CXVkFANyzZy2E7w2QbnKQ="; 162 + }; 163 + } 164 + { 165 + goPackagePath = "github.com/gosexy/gettext"; 166 + fetch = { 167 + type = "git"; 168 + url = "https://github.com/gosexy/gettext"; 169 + rev = "74466a0a0c4a62fea38f44aa161d4bbfbe79dd6b"; 170 + sha256 = "sha256-8U2oSi446U13c3uqcbg/14okypxKmckRuvWfZlGHVys="; 171 + }; 172 + } 173 + { 174 + goPackagePath = "github.com/nfnt/resize"; 175 + fetch = { 176 + type = "git"; 177 + url = "https://github.com/nfnt/resize"; 178 + rev = "83c6a9932646f83e3267f353373d47347b6036b2"; 179 + sha256 = "sha256-yvPV+HlDOyJsiwAcVHQkmtw8DHSXyw+cXHkigXm8rAA="; 180 + }; 181 + } 182 + { 183 + goPackagePath = "github.com/youpy/go-wav"; 184 + fetch = { 185 + type = "git"; 186 + url = "https://github.com/youpy/go-wav"; 187 + rev = "v0.3.2"; 188 + sha256 = "sha256-jNqXW3F3fcgjT47+d2MVXauWkA7+1KfYVu3ZZpRCTkM="; 189 + }; 190 + } 191 + { 192 + goPackagePath = "github.com/zaf/g711"; 193 + fetch = { 194 + type = "git"; 195 + url = "https://github.com/zaf/g711"; 196 + rev = "v1.2"; 197 + sha256 = "sha256-G+0cgGw/fcOUFVn32AeqUE0YjyOS82Z5MTcn6IANhCY="; 198 + }; 199 + } 200 + { 201 + goPackagePath = "github.com/youpy/go-riff"; 202 + fetch = { 203 + type = "git"; 204 + url = "https://github.com/youpy/go-riff"; 205 + rev = "v0.1.0"; 206 + sha256 = "sha256-d/3rkxDeRTPveZblArKc61gB4LJVV08n7g0THieuhx8="; 207 + }; 208 + } 209 + ] 210 +