modules/ryan-packages/login.scm
72d1c1aae5c6ef87a88e81111a74d7b041c57a22
· 4.2 KB · 102 lines
raw
| 1 | (define-module (ryan-packages login) |
| 2 | #:use-module (guix gexp) |
| 3 | #:use-module (guix packages) |
| 4 | #:use-module (guix download) |
| 5 | #:use-module (guix git-download) |
| 6 | #:use-module (guix build-system zig) |
| 7 | #:use-module ((guix licenses) #:prefix license:) |
| 8 | #:use-module (gnu packages) |
| 9 | #:use-module (gnu packages base) |
| 10 | #:use-module (gnu packages curl) |
| 11 | #:use-module (gnu packages linux) |
| 12 | #:use-module (gnu packages nss) |
| 13 | #:use-module (gnu packages version-control) |
| 14 | #:use-module (gnu packages zig) |
| 15 | #:use-module (gnu packages zig-xyz) |
| 16 | #:use-module (guix utils)) |
| 17 | |
| 18 | (define ly-source |
| 19 | (let ((commit "cdba55657976ad289da090b7d4fd1e5e16c156f9") |
| 20 | (revision "11") |
| 21 | (name "ly") |
| 22 | (version "ly-rev11")) |
| 23 | (origin |
| 24 | (method git-fetch) |
| 25 | (uri (git-reference |
| 26 | (url "https://github.com/ryan77627/ly-fork") |
| 27 | (commit commit))) |
| 28 | (file-name (git-file-name name version)) |
| 29 | (sha256 |
| 30 | (base32 "1czv95pwmsv8zi92pjrra3swr7m82l3spks8mdkryxk9k62yd2k6"))))) |
| 31 | |
| 32 | (define ly-zig-cache |
| 33 | (computed-file |
| 34 | "ly-zig-cache" |
| 35 | (with-imported-modules '((guix build utils)) |
| 36 | #~(begin |
| 37 | (use-modules (guix build utils)) |
| 38 | (let ((cert-dir (string-append #$nss-certs "/etc/ssl/certs")) |
| 39 | (certs "/tmp/ca-certificates.crt") |
| 40 | (zig-bin (string-append #$zig-0.15 "/bin")) |
| 41 | (git-bin (string-append #$git-minimal "/bin")) |
| 42 | (curl-bin (string-append #$curl "/bin")) |
| 43 | (proot-bin (string-append #$proot "/bin")) |
| 44 | (coreutils-bin (string-append #$(@ (gnu packages base) coreutils) "/bin"))) |
| 45 | (call-with-output-file certs |
| 46 | (lambda (out) |
| 47 | (for-each (lambda (file) |
| 48 | (call-with-input-file file |
| 49 | (lambda (p) |
| 50 | (dump-port p out) |
| 51 | (display "\n" out)))) |
| 52 | (find-files cert-dir "\\.pem$")))) |
| 53 | (setenv "HOME" "/tmp") |
| 54 | (setenv "PATH" (string-append zig-bin ":" curl-bin ":" proot-bin ":" git-bin ":" coreutils-bin)) |
| 55 | (setenv "ZIG_GLOBAL_CACHE_DIR" "/tmp/zcache") |
| 56 | (setenv "SSL_CERT_FILE" certs) |
| 57 | (setenv "GIT_SSL_CAINFO" certs) |
| 58 | (setenv "CURL_CA_BUNDLE" certs) |
| 59 | (mkdir-p "/tmp/zcache") |
| 60 | (mkdir-p "/tmp/src") |
| 61 | (copy-recursively #$ly-source "/tmp/src") |
| 62 | (chmod "/tmp/src" #o755) |
| 63 | (with-directory-excursion "/tmp/src" |
| 64 | (invoke "proot" "-b" (string-append certs ":/etc/ssl/certs/ca-certificates.crt") |
| 65 | "zig" "build" "--fetch=all")) |
| 66 | (copy-recursively "/tmp/zcache/p" #$output)))) |
| 67 | #:options (list |
| 68 | #:hash-algo 'sha256 |
| 69 | #:hash (base32 "1qmj0ysynvyfvwc68apy3lxqccrv3rxak5a21ij6y0c2dw3yzl64") |
| 70 | #:recursive? #t))) |
| 71 | |
| 72 | (define-public ly |
| 73 | (package |
| 74 | (name "ly") |
| 75 | (version "1.3.2") |
| 76 | (source ly-source) |
| 77 | (build-system zig-build-system) |
| 78 | (arguments |
| 79 | (list |
| 80 | #:zig-release-type "small" |
| 81 | #:zig-build-flags #~(list "-Denable_x11_support=false" |
| 82 | "--search-prefix" |
| 83 | #$(this-package-input "linux-pam")) |
| 84 | #:zig zig-0.15 |
| 85 | #:tests? #f |
| 86 | #:phases |
| 87 | #~(modify-phases %standard-phases |
| 88 | (add-before 'configure 'seed-zig-cache |
| 89 | (lambda _ |
| 90 | (let ((cache-dir "/tmp/zig-cache")) |
| 91 | (mkdir-p cache-dir) |
| 92 | (symlink #$ly-zig-cache (string-append cache-dir "/p")) |
| 93 | (setenv "ZIG_GLOBAL_CACHE_DIR" cache-dir))))))) |
| 94 | (native-inputs (list |
| 95 | ly-zig-cache)) |
| 96 | (inputs (list linux-pam)) |
| 97 | (home-page "https://codeberg.org/fairyglade/ly") |
| 98 | (synopsis "TTY-based login manager written in Zig.") |
| 99 | (description "Zig-based login manager that can launch X Server and Wayland based compositors.") |
| 100 | (license license:expat))) |
| 101 | |
| 102 | ly |