Using Guix as a shell system

Needed to package corrosion and still need to figure out how to tell
the cargo build script to find where QtQML includes are in the guix shell
This commit is contained in:
Chris Cochrun 2023-06-30 10:16:34 -05:00
parent 1b57171b1d
commit db761d0399
5 changed files with 101 additions and 65 deletions

7
.envrc
View file

@ -1,5 +1,8 @@
export NIXPKGS_ALLOW_INSECURE=1 # export NIXPKGS_ALLOW_INSECURE=1
export QT_AUTO_SCREEN_SCALE_FACTOR=1 export QT_AUTO_SCREEN_SCALE_FACTOR=1
export CMAKE_EXPORT_COMPILE_COMMANDS=1 export CMAKE_EXPORT_COMPILE_COMMANDS=1
export CMAKE_BUILD_TYPE=Debug export CMAKE_BUILD_TYPE=Debug
use flake . --impure export CXX=g++
export CC=gcc
# use flake . --impure
# eval $(guix shell -D --search-paths)

View file

@ -19,8 +19,8 @@ serde = "1.0.152"
serde_derive = "1.0.152" serde_derive = "1.0.152"
quote = "1.0.27" quote = "1.0.27"
cxx = "1.0.83" cxx = "1.0.83"
cxx-qt = "0.5.2" cxx-qt = "0.5.3"
cxx-qt-lib = "0.5.2" cxx-qt-lib = "0.5.3"
# home = "0.5.4" # home = "0.5.4"
dirs = "5.0.0" dirs = "5.0.0"
diesel = { version = "2.0.3", features = ["sqlite"] } diesel = { version = "2.0.3", features = ["sqlite"] }
@ -32,7 +32,7 @@ youtube_dl = "0.8.0"
# cxx-qt-build generates C++ code from the `#[cxx_qt::bridge]` module # cxx-qt-build generates C++ code from the `#[cxx_qt::bridge]` module
# and compiles it together with the Rust static library # and compiles it together with the Rust static library
[build-dependencies] [build-dependencies]
cxx-qt-build = "0.5.2" cxx-qt-build = "0.5.3"
# [dependencies.confy] # [dependencies.confy]
# features = ["yaml_conf"] # features = ["yaml_conf"]

View file

@ -1,4 +1,5 @@
use cxx_qt_build::CxxQtBuilder; use cxx_qt_build::CxxQtBuilder;
use std::env;
fn main() { fn main() {
CxxQtBuilder::new() CxxQtBuilder::new()
@ -13,5 +14,9 @@ fn main() {
.file("src/rust/presentation_model.rs") .file("src/rust/presentation_model.rs")
.file("src/rust/song_model.rs") .file("src/rust/song_model.rs")
.file("src/rust/ytdl.rs") .file("src/rust/ytdl.rs")
.cc_builder (|cc| {
println!("{:?}", env::var ("GUIX_ENVIRONMENT").unwrap_or_default());
cc.include( env::var("GUIX_ENVIRONMENT").unwrap_or_default() + "/include");
})
.build(); .build();
} }

140
guix.scm
View file

@ -1,25 +1,29 @@
;; This file is provided to assist in setting up a development
;; (define-module (lumina) ;; environment for Lumina.
;; #:use-module (gnu packages) ;;
;; #:use-module (gnu packages rust-apps) ;; Author: Chris Cochrun
;; #:use-module (gnu packages llvm) ;;
;; #:use-module (gnu packages qt) ;;
;; #:use-module (gnu packages kde-frameworks) ;;
;; #:use-module (gnu packages video) ;;
;; #:use-module (gnu packages crates-io) ;;
;; #:use-module (gnu services) ;;
;; #:use-module (guix gexp) ;;
;; #:use-module (guix packages) ;;
;; #:use-module (guix git-download) ;;
;; #:use-module (guix build-system cmake) ;;
;; #:use-module ((guix licenses) #:prefix license:))
(use-modules (gnu packages) (use-modules (gnu packages)
(gnu packages rust)
(gnu packages rust-apps) (gnu packages rust-apps)
(gnu packages llvm) (gnu packages llvm)
(gnu packages qt) (gnu packages qt)
(gnu packages gdb)
(gnu packages mold)
(gnu packages pkg-config)
(gnu packages kde-frameworks) (gnu packages kde-frameworks)
(gnu packages video) (gnu packages video)
(gnu packages cmake)
(gnu packages crates-io) (gnu packages crates-io)
(gnu services) (gnu services)
(guix gexp) (guix gexp)
@ -38,29 +42,35 @@
#:recursive? #t #:recursive? #t
#:select? (git-predicate this-directory))) #:select? (git-predicate this-directory)))
;; (define-public corrosion ;; Corrosion allows us to build a cmake project that uses rust too.
;; (package (define-public corrosion
;; (name "corrosion") (let ((commit "6ae04cf691fa721945428b2f96b0818085135890")
;; (version (git-version "0.0.1" revision commit)) (revision "0.4.1"))
;; (source (origin )) (package
;; (build-system cmake-build-system) (name "corrosion")
;; (arguments `(#:phases (version (git-version "0.4.1" revision commit))
;; (modify-phases %standard-phases (source
;; (replace 'build (origin
;; (lambda* (#:key outputs #:allow-other-keys) (method git-fetch)
;; (invoke "cmake" "")))))) (uri (git-reference
;; (inputs (list (url "https://github.com/corrosion-rs/corrosion.git")
;; clang (commit commit)))
;; clang-toolchain)) (file-name (git-file-name name version))
;; (license license:gpl3+) (sha256
;; (home-page "idk") (base32
;; (synopsis "A Church Presentation Application") "1f0zmqm0iz669zqv74222x9759jbn1zq5z4snjwkd5g3lv0p4mkw"))))
;; (description "idk") (build-system cmake-build-system)
;; )) (arguments `(#:tests? #f))
(inputs (list
cmake
`(,rust "out")
`(,rust "cargo")))
(license license:gpl3+)
(home-page "idk")
(synopsis "Adding rust to cmake projects")
(description "idk"))))
(define-public lumina (define-public lumina
;; (let ((commit "62f19dba573b924703829847feb1bfee68885514")
;; (revision "0"))
(package (package
(name "lumina") (name "lumina")
(version "0.0.1") (version "0.0.1")
@ -71,27 +81,43 @@
(replace 'build (replace 'build
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(invoke "sh" "./build.sh" "-d")))))) (invoke "sh" "./build.sh" "-d"))))))
(inputs '(("clang" ,clang)
("clang-toolchain" ,clang-toolchain) (inputs (list mpv
("qtbase" ,qtbase-5.15.8) ffmpeg))
("qttools" ,qttools-5.15.8) (propagated-inputs (list clang
("qtquickcontrols2" ,qtquickcontrols2-5.15.8) cmake
("qtx11extras" ,qtx11extras-5.15.8) clazy
("qtwayland" ,qtwayland-5.15.8) clang-toolchain
("qtwebengine" ,qtwebengine-5.15.8) gdb
("kirigami" ,kirigami) pkg-config
("qqc2-desktop-style" ,qqc2-desktop-style) qtbase-5
("karchive" ,karchive) qttools-5
("mpv" ,mpv) qt-creator
("ffmpeg" ,ffmpeg-5.1.3) qtdeclarative-5
("rust" ,rust) qtquickcontrols2-5
;; both of these need to be packaged yet qtx11extras
;; corrosion is needed for build... qtwayland-5
;; corrosion qtwebengine-5
;; rust-rustfmt kirigami
("rust-clippy" ,rust-clippy) qqc2-desktop-style
("rust-cargo" ,rust-cargo) extra-cmake-modules
("rust-analyzer" ,rust-analyzer))) karchive
kcoreaddons
ki18n
;; corrosion is needed for build and is yet to
;; be packaged.
corrosion
`(,rust "out")
`(,rust "rustfmt")
`(,rust "cargo")
;; rust-analyzer
rust-clippy-0.0))
(native-search-paths
(list (search-path-specification
(variable "CMAKE_INCLUDE_PATH")
(files '("include")))))
(license license:gpl3+) (license license:gpl3+)
(home-page "idk") (home-page "idk")
(synopsis "A Church Presentation Application") (synopsis "A Church Presentation Application")

View file

@ -4,6 +4,10 @@ mkShell rec {
name = "lumina"; name = "lumina";
nativeBuildInputs = [ nativeBuildInputs = [
# ffmpeg
];
buildInputs = [
gcc gcc
stdenv stdenv
gnumake gnumake
@ -14,10 +18,8 @@ mkShell rec {
pkg-config pkg-config
libsForQt5.wrapQtAppsHook libsForQt5.wrapQtAppsHook
makeWrapper makeWrapper
# ffmpeg
];
buildInputs = [
clang-tools clang-tools
clang clang
libclang libclang