From e14390858839d7fd56b579d6489ea7bc88a5e530 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Sun, 2 Jul 2023 15:36:22 +0200 Subject: Add GNU/Guix config files. --- guix/jd/desktops/base.scm | 90 ++++++++++++++++ guix/jd/desktops/mimir.scm | 30 ++++++ guix/jd/desktops/viking.scm | 29 +++++ guix/jd/packages/patches/nm-pptp-autogen.patch | 15 +++ guix/jd/packages/vpn.scm | 144 +++++++++++++++++++++++++ guix/jd/utils.scm | 25 +++++ 6 files changed, 333 insertions(+) create mode 100644 guix/jd/desktops/base.scm create mode 100644 guix/jd/desktops/mimir.scm create mode 100644 guix/jd/desktops/viking.scm create mode 100755 guix/jd/packages/patches/nm-pptp-autogen.patch create mode 100644 guix/jd/packages/vpn.scm create mode 100644 guix/jd/utils.scm (limited to 'guix') diff --git a/guix/jd/desktops/base.scm b/guix/jd/desktops/base.scm new file mode 100644 index 0000000..7618257 --- /dev/null +++ b/guix/jd/desktops/base.scm @@ -0,0 +1,90 @@ +(define-module (jd desktops base) + #:use-module (gnu) + #:use-module (jd packages vpn) + #:use-module (nongnu packages linux) + #:use-module (nongnu system linux-initrd)) + +(use-package-modules wm gnome) +(use-service-modules cups desktop networking ssh xorg + docker virtualization pm sound) + +;; Odin is a base operating system +(define-public odin + (operating-system + (kernel linux) + (initrd microcode-initrd) + (firmware (list linux-firmware)) + + (locale "en_US.utf8") + (timezone "Europe/Warsaw") + (keyboard-layout (keyboard-layout "pl")) + (host-name "odin") + + (users (cons* (user-account + (name "jakub") + (comment "Jakub Dlugosz") + (group "users") + (home-directory "/home/jakub") + (supplementary-groups '("wheel" "netdev" "audio" "video"))) + %base-user-accounts)) + + (packages (append (specifications->packages '("emacs" + "emacs-exwm" + + "brightnessctl" + + "bluez" + "bluez-alsa" + + "xf86-input-libinput" + + "nss-certs")) + + %base-packages)) + + (services + (append (list + (service xfce-desktop-service-type) + (service openssh-service-type) + (set-xorg-configuration + (xorg-configuration (keyboard-layout keyboard-layout))) + + (service network-manager-service-type + (network-manager-configuration + (vpn-plugins (list + network-manager-pptp)))) + + (service bluetooth-service-type + (bluetooth-configuration + (auto-enable? #t))) + + (service docker-service-type) + (service libvirt-service-type + (libvirt-configuration + (unix-sock-group "libvirt") + (tls-port "16555"))) + + (service sane-service-type) + (service cups-service-type + (cups-configuration + (web-interface? #t))) + + (service thermald-service-type) + (service tlp-service-type + (tlp-configuration + (cpu-boost-on-ac? #t) + (wifi-pwr-on-bat? #t)))) + + (modify-services %desktop-services + (delete network-manager-service-type)))) + (bootloader (bootloader-configuration + (bootloader grub-bootloader) + (targets (list "/boot/efi")) + (keyboard-layout keyboard-layout))) + + (file-systems (cons* (file-system + (mount-point "/tmp") + (device "none") + (type "tmpfs") + (check? #f)) + %base-file-systems)))) diff --git a/guix/jd/desktops/mimir.scm b/guix/jd/desktops/mimir.scm new file mode 100644 index 0000000..a635831 --- /dev/null +++ b/guix/jd/desktops/mimir.scm @@ -0,0 +1,30 @@ +(define-module (jd desktops mimir) + #:use-module (jd desktops base) + #:use-module (gnu)) + + +(operating-system + (inherit odin) + (host-name "mimir") + + (bootloader (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets (list "/boot/efi")))) + + + (swap-devices (list (swap-space + (target (uuid + "658793cb-d374-426e-bcd5-00d032b003a0"))))) + + (file-systems (cons* (file-system + (mount-point "/boot/efi") + (device (uuid "64D8-134F" + 'fat32)) + (type "vfat")) + (file-system + (mount-point "/") + (device (uuid + "1f9304b0-5623-4248-ab66-534b5ac85876" + 'ext4)) + (type "ext4")) %base-file-systems))) + diff --git a/guix/jd/desktops/viking.scm b/guix/jd/desktops/viking.scm new file mode 100644 index 0000000..80ddb88 --- /dev/null +++ b/guix/jd/desktops/viking.scm @@ -0,0 +1,29 @@ +(define-module (jd desktops mimir) + #:use-module (jd desktops base) + #:use-module (gnu)) + +(operating-system + (inherit odin) + (host-name "mimir") + + (bootloader (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets (list "/boot/efi")))) + + + (swap-devices (list (swap-space + (target (uuid + "658793cb-d374-426e-bcd5-00d032b003a0"))))) + + (file-systems (cons* (file-system + (mount-point "/boot/efi") + (device (uuid "64D8-134F" + 'fat32)) + (type "vfat")) + (file-system + (mount-point "/") + (device (uuid + "1f9304b0-5623-4248-ab66-534b5ac85876" + 'ext4)) + (type "ext4")) %base-file-systems))) + diff --git a/guix/jd/packages/patches/nm-pptp-autogen.patch b/guix/jd/packages/patches/nm-pptp-autogen.patch new file mode 100755 index 0000000..ef5c731 --- /dev/null +++ b/guix/jd/packages/patches/nm-pptp-autogen.patch @@ -0,0 +1,15 @@ +diff --git a/autogen.sh b/autogen.sh +index 4ed20c6..34834a6 100755 +--- a/autogen.sh ++++ b/autogen.sh +@@ -13,8 +13,6 @@ PKG_NAME=NetworkManager-pptp + exit 1 + } + +-(cd $srcdir; +- autoreconf --install --symlink && +- ./configure --enable-maintainer-mode --enable-more-warnings=error $@ +-) ++cd $srcdir ++autoreconf --install --symlink + diff --git a/guix/jd/packages/vpn.scm b/guix/jd/packages/vpn.scm new file mode 100644 index 0000000..2542bae --- /dev/null +++ b/guix/jd/packages/vpn.scm @@ -0,0 +1,144 @@ +(define-module (jd packages vpn) + #:use-module (jd utils) + + #:use-module (gnu packages) + #:use-module (gnu packages samba) ;; PPP + #:use-module (gnu packages perl) + #:use-module (gnu packages linux) + #:use-module (gnu packages gnome) + #:use-module (gnu packages glib) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages build-tools) + #:use-module (gnu packages gettext) + #:use-module (gnu packages autotools) + #:use-module (gnu packages gtk) + + #:use-module (guix gexp) + #:use-module (guix git-download) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix build-system) + #:use-module (guix build-system gnu) + #:use-module (guix utils) + #:use-module (guix packages) + #:use-module (guix download)) + + + +(define-public pptp-client + (package + (name "pptp-client") + (version "1.10.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://git.code.sf.net/p/pptpclient/git") + (commit version))) + (sha256 + (base32 "0qixs1dxrr1x4sgi22250231p9kqi8l8ifawxn6ws1d3p7mc6ggh")))) + + (build-system gnu-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'check) + (add-before 'build 'change-location-of-pppd + (lambda* (#:key outputs #:allow-other-keys) + (substitute* "Makefile" + (("^PPPD.=.*$") + (string-append "PPPD = " + (which "pppd"))) + (("^IP.=.*$") + (string-append "IP = " + (which "ip")))))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (sbin (string-append out "/sbin"))) + (mkdir-p sbin) + (install-file "pptp" sbin) + #t)))))) + (inputs + (list perl)) + (native-inputs + (list ppp + iproute)) + (home-page "https://sourceforge.net/projects/pptpclient/") + (synopsis "PPTP-Client") + (description + "pptp is an implementation of the PPTP protocol for Linux and +other Unix systems.") + (license license:gpl2+) + (properties `((upstream-name . "NetworkManager-pptp"))))) + + +;; ================================ + +(define-public network-manager-pptp + (package + (name "network-manager-pptp") + (version "1.2.12") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://gitlab.gnome.org/GNOME/NetworkManager-pptp.git") + (commit version))) + (file-name (git-file-name name version)) + + (sha256 + (base32 "1prl14106kfl5x56v9adwi4wqwrh6k3chkimjpd0clwy3drywhcr")) + (patches (jd-search-patches "nm-pptp-autogen.patch")))) + + (build-system gnu-build-system) + (arguments + '(#:configure-flags '("--enable-absolute-paths" + ; "--localstatedir=/var" + "--with-gtk4=yes") + #:phases + (modify-phases %standard-phases + (add-after 'configure 'patch-path + (lambda* (#:key inputs #:allow-other-keys #:rest args) + (let* ((pppd (search-input-file inputs "/sbin/pppd")) + (pptp (search-input-file inputs "/sbin/pptp")) + (modprobe (search-input-file inputs "/bin/modprobe")) + (pretty-pppd (string-append "\"" pppd "\"")) + (pretty-pptp (string-append "\"" pptp "\""))) + + (substitute* "src/nm-pptp-service.c" + (("\"/usr/local/sbin/pppd\"") pretty-pppd) + (("\"/usr/sbin/pppd\"") pretty-pppd) + (("\"/sbin/pppd\"") pretty-pppd) + (("\"/usr/local/sbin/pptp\"") pretty-pptp) + (("\"/usr/sbin/pptp\"") pretty-pptp) + (("\"/sbin/pptp\"") pretty-pptp) + (("/sbin/modprobe") modprobe)))))))) + (native-inputs + (list intltool + `(,glib "bin") + glib + `(,gtk "bin") + pkg-config)) + (inputs + (list autoconf + autoconf-archive + gnulib + gnu-gettext + automake + gtk+ + gtk + kmod + libtool + network-manager + libnma + libsecret + ppp + pptp-client)) + (home-page "https://wiki.gnome.org/Projects/NetworkManager/VPN") + (synopsis "PPTP plug-in for NetworkManager") + (description + "This extension of NetworkManager allows it to take care of connections +to virtual private networks (VPNs) via pptp.") + (license license:gpl2+) + (properties `((upstream-name . "NetworkManager-pptp"))))) diff --git a/guix/jd/utils.scm b/guix/jd/utils.scm new file mode 100644 index 0000000..5be7fa9 --- /dev/null +++ b/guix/jd/utils.scm @@ -0,0 +1,25 @@ +(define-module (jd utils) + #:export (jd-search-patches)) + +;; This code is copied and modified from (gnu packages) module. + +(define %jd-patch-path + (make-parameter + (map (lambda (directory) + (let ((jd-patch-dir (string-append directory "/jd/packages/patches"))) + (if (and (file-exists? jd-patch-dir) + (file-is-directory? jd-patch-dir)) + jd-patch-dir + directory))) + %load-path))) + +(define (jd-search-patch file-name) + "Search the patch FILE-NAME. Raise an error if not found." + (or (search-path (%jd-patch-path) file-name) + (raise (string-append file-name + ": patch not found")))) + +(define-syntax-rule (jd-search-patches file-name ...) + "Return the list of absolute file names corresponding to each +FILE-NAME found in %JD-PATCH-PATH." + (list (jd-search-patch file-name) ...)) -- cgit v1.2.3