chore(nix)_: switch to nix flake

This commit is contained in:
Anton Iakimov 2024-10-10 12:11:42 +02:00
parent 237387bb03
commit 8950d19b01
No known key found for this signature in database
5 changed files with 167 additions and 118 deletions

42
flake.lock Normal file
View File

@ -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
}

15
flake.nix Normal file
View File

@ -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 { };
};
}

View File

@ -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 <nixpkgs> { }).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 ];
}

100
nix/shell.nix Normal file
View File

@ -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
]));
}

110
shell.nix
View File

@ -1,100 +1,10 @@
{ (import
pkgs ? import ./nix/pkgs.nix (
}: let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
let url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
qtCustom = (with pkgs.qt515_8; sha256 = lock.nodes.flake-compat.locked.narHash;
# TODO:check the required modules }
env "qt-custom-${qtbase.version}" ([ )
qtbase { src = ./.; }
qtdeclarative ).shellNix
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
]));
}