diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..f6f6ce7980 --- /dev/null +++ b/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1651477912, + "narHash": "sha256-YDFgJElf0ZL977+fo6ueQAmpb6lwrw1lzDlxLEINVXE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "66b0db71f463164486a36dded50bedee185e45c2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-20.09", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..51e9e28c71 --- /dev/null +++ b/flake.nix @@ -0,0 +1,15 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-20.09"; + # for nix-shell support + inputs.flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"; + + outputs = { self, nixpkgs, flake-compat }: + let + pkgs = import nixpkgs { + system = "x86_64-linux"; + overlays = [ (import ./nix/overlay.nix) ]; + }; + in { + devShells.x86_64-linux.default = pkgs.callPackage ./nix/shell.nix { }; + }; +} diff --git a/nix/pkgs.nix b/nix/pkgs.nix deleted file mode 100644 index 68786b857b..0000000000 --- a/nix/pkgs.nix +++ /dev/null @@ -1,18 +0,0 @@ -# This file controls the pinned version of nixpkgs we use for our Nix environment -# as well as which versions of package we use, including their overrides. -let - # For testing local version of nixpkgs - #nixpkgsSrc = (import { }).lib.cleanSource "/home/jakubgs/work/nixpkgs"; - - # We follow the release-20.09 branch of official nixpkgs. - nixpkgsSrc = builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/66b0db71f463164486a36dded50bedee185e45c2.tar.gz"; - sha256 = "sha256:0wam1m12qw9rrijhvbvhm5psj2a0ksms77xzxzyr5laz94j60cb0"; - }; - - # Override some packages and utilities - pkgsOverlay = import ./overlay.nix; -in - (import nixpkgsSrc) { - overlays = [ pkgsOverlay ]; - } diff --git a/nix/shell.nix b/nix/shell.nix new file mode 100644 index 0000000000..56bf21adde --- /dev/null +++ b/nix/shell.nix @@ -0,0 +1,100 @@ +{ + pkgs +}: + +let + qtCustom = (with pkgs.qt515_8; + # TODO:check the required modules + env "qt-custom-${qtbase.version}" ([ + qtbase + qtdeclarative + qtquickcontrols + qtquickcontrols2 + qtsvg + qtmultimedia + qtwebview + qttools + qtwebchannel + qtgraphicaleffects + qtwebengine + qtlocation + ])); + +in pkgs.mkShell { + name = "status-desktop-build-shell"; + + # TODO:check the required packages + buildInputs = with pkgs; [ + bash curl wget git file unzip jq lsb-release which cacert gnupg + linuxdeployqt appimagekit + libglvnd # TODO: Qt 5.15.2 fix, review after upgrade + cmake_3_19 gnumake pkg-config gnugrep qtCustom + go_1_21 go-bindata mockgen protobuf3_20 protoc-gen-go + pcre nss pcsclite extra-cmake-modules + xorg.libxcb xorg.libX11 libxkbcommon + ] ++ (with gst_all_1; [ + gst-libav gstreamer + gst-plugins-bad gst-plugins-base + gst-plugins-good gst-plugins-ugly + ]); + + # Avoid terminal issues. + TERM = "xterm"; + LANG = "en_US.UTF-8"; + LANGUAGE = "en_US.UTF-8"; + + QTDIR = qtCustom; + # TODO: still needed? + # https://github.com/NixOS/nixpkgs/pull/109649 + QT_INSTALL_PLUGINS = "${qtCustom}/${pkgs.qt515_8.qtbase.qtPluginPrefix}"; + + shellHook = '' + export MAKEFLAGS="-j$NIX_BUILD_CORES" + export PATH="${pkgs.lddWrapped}/bin:$PATH" + ''; + + LIBKRB5_PATH = pkgs.libkrb5; + QTWEBENGINE_PATH = pkgs.qt515_8.qtwebengine.out; + GSTREAMER_PATH = pkgs.gst_all_1.gstreamer; + NSS_PATH = pkgs.nss; + + # Used for linuxdeployqt + # TODO:check which deps are needed + LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath ( + [ + alsaLib + expat + fontconfig + freetype + gcc-unwrapped + glib + gmp + harfbuzz + libglvnd + libkrb5 + libpng + libpulseaudio + libxkbcommon + openexr + openssl + p11-kit + zlib + ] ++ (with xorg; [ + libICE + libSM + libX11 + libXrender + libxcb + xcbutil + xcbutilimage + xcbutilkeysyms + xcbutilrenderutil + xcbutilwm + ]) ++ (with gst_all_1; [ + gst-plugins-base + gst-plugins-good + gst-plugins-bad + gst-plugins-ugly + gstreamer + ])); +} diff --git a/shell.nix b/shell.nix index d93290803b..942ce016ac 100644 --- a/shell.nix +++ b/shell.nix @@ -1,100 +1,10 @@ -{ - pkgs ? import ./nix/pkgs.nix -}: - -let - qtCustom = (with pkgs.qt515_8; - # TODO:check the required modules - env "qt-custom-${qtbase.version}" ([ - qtbase - qtdeclarative - qtquickcontrols - qtquickcontrols2 - qtsvg - qtmultimedia - qtwebview - qttools - qtwebchannel - qtgraphicaleffects - qtwebengine - qtlocation - ])); - -in pkgs.mkShell { - name = "status-desktop-build-shell"; - - # TODO:check the required packages - buildInputs = with pkgs; [ - bash curl wget git file unzip jq lsb-release which cacert gnupg - linuxdeployqt appimagekit - libglvnd # TODO: Qt 5.15.2 fix, review after upgrade - cmake_3_19 gnumake pkg-config gnugrep qtCustom - go_1_21 go-bindata mockgen protobuf3_20 protoc-gen-go - pcre nss pcsclite extra-cmake-modules - xorg.libxcb xorg.libX11 libxkbcommon - ] ++ (with gst_all_1; [ - gst-libav gstreamer - gst-plugins-bad gst-plugins-base - gst-plugins-good gst-plugins-ugly - ]); - - # Avoid terminal issues. - TERM = "xterm"; - LANG = "en_US.UTF-8"; - LANGUAGE = "en_US.UTF-8"; - - QTDIR = qtCustom; - # TODO: still needed? - # https://github.com/NixOS/nixpkgs/pull/109649 - QT_INSTALL_PLUGINS = "${qtCustom}/${pkgs.qt515_8.qtbase.qtPluginPrefix}"; - - shellHook = '' - export MAKEFLAGS="-j$NIX_BUILD_CORES" - export PATH="${pkgs.lddWrapped}/bin:$PATH" - ''; - - LIBKRB5_PATH = pkgs.libkrb5; - QTWEBENGINE_PATH = pkgs.qt515_8.qtwebengine.out; - GSTREAMER_PATH = pkgs.gst_all_1.gstreamer; - NSS_PATH = pkgs.nss; - - # Used for linuxdeployqt - # TODO:check which deps are needed - LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath ( - [ - alsaLib - expat - fontconfig - freetype - gcc-unwrapped - glib - gmp - harfbuzz - libglvnd - libkrb5 - libpng - libpulseaudio - libxkbcommon - openexr - openssl - p11-kit - zlib - ] ++ (with xorg; [ - libICE - libSM - libX11 - libXrender - libxcb - xcbutil - xcbutilimage - xcbutilkeysyms - xcbutilrenderutil - xcbutilwm - ]) ++ (with gst_all_1; [ - gst-plugins-base - gst-plugins-good - gst-plugins-bad - gst-plugins-ugly - gstreamer - ])); -} +(import + ( + let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in + fetchTarball { + url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } + ) + { src = ./.; } +).shellNix