From d21bc3c7c56a0f167d66cbb0f3a852f7f97f8130 Mon Sep 17 00:00:00 2001 From: Sebastian Moser Date: Tue, 23 Jan 2024 15:03:48 +0100 Subject: [PATCH] ... --- common/nixos-graphical.nix | 3 +- flake.nix | 38 ++++- hosts/hpm.nix | 3 + hosts/lush.nix | 4 +- hosts/rpi.nix | 2 +- misc/my-hosts | 2 + mods/hec-server.nix | 38 +++++ mods/my-nixpkgs-overlay.nix | 109 ++++++++++++- mods/second-overlay.nix | 27 ++++ mods/static/cdparanoia.patch | 60 +++++++ mods/static/dconf.patch | 68 ++++++++ mods/static/duktape.patch | 58 +++++++ mods/static/gobject-introspection.nix | 194 +++++++++++++++++++++++ mods/static/gobject-introspection.patch | 13 ++ mods/static/python311Packages-lxml.patch | 26 +++ programs/ssh.nix | 5 + scripts/sync-school.sh | 5 + users/me/gui-home.nix | 4 + users/me/gui.nix | 1 + 19 files changed, 643 insertions(+), 17 deletions(-) create mode 100644 mods/hec-server.nix create mode 100644 mods/second-overlay.nix create mode 100644 mods/static/cdparanoia.patch create mode 100644 mods/static/dconf.patch create mode 100644 mods/static/duktape.patch create mode 100644 mods/static/gobject-introspection.nix create mode 100644 mods/static/gobject-introspection.patch create mode 100644 mods/static/python311Packages-lxml.patch diff --git a/common/nixos-graphical.nix b/common/nixos-graphical.nix index 2588726..d28a224 100644 --- a/common/nixos-graphical.nix +++ b/common/nixos-graphical.nix @@ -14,7 +14,7 @@ sessionCommands = '' xmobar ${self}/misc/xmobar.hs & - # aparently needed, so that xmonad works + # the sleep is aparently needed, so that xmonad is already fully started up?? sleep 2 && \ ${pkgs.xorg.xmodmap}/bin/xmodmap \ -e "clear control" \ @@ -66,7 +66,6 @@ # Enable sound. sound.enable = true; hardware.pulseaudio.enable = true; - services.blueman.enable = true; hardware.bluetooth.enable = true; diff --git a/flake.nix b/flake.nix index 1a935a1..9ec0fa7 100644 --- a/flake.nix +++ b/flake.nix @@ -72,16 +72,26 @@ workDir = "/home/me/work"; secretsDir = "/home/me/work/here/secrets"; persistentDir = "/home/me/work/app-data"; + + mypkgs = import nixpkgs { + system = "x86_64-linux"; + config = { + allowUnfree = true; + permittedInsecurePackages = [ + "electron-24.8.6" + "electron-25.9.0" + ]; + }; + overlays = [ + ( import ./mods/my-nixpkgs-overlay.nix { inherit nixpkgs; } ) + ( import ./mods/second-overlay.nix { inherit nixpkgs; } ) + ]; + }; + specialArgs = { inherit inputs confDir workDir secretsDir persistentDir self; system = "x86_64-linux"; - pkgs = import nixpkgs { system = "x86_64-linux"; config = { - allowUnfree = true; - permittedInsecurePackages = [ - "electron-24.8.6" - "electron-25.9.0" - ]; - }; }; + pkgs = mypkgs; }; in { @@ -100,7 +110,7 @@ system = "x86_64-linux"; modules = [ ./hosts/hpm.nix - ./hardware/hpm-laptop.nix + #./hardware/hpm-laptop.nix ]; }; @@ -311,6 +321,15 @@ lush = self.nixosConfigurations.lush.config.system.build.sdImage; rpi = self.nixosConfigurations.rpi.config.system.build.sdImage; + hec-img = nixos-generators.nixosGenerate { + system = "x86_64-linux"; + modules = [ + ./hosts/hpm.nix + ]; + format = "raw"; + inherit specialArgs; + }; + prootTermux = inputs.nix-on-droid.outputs.packages.x86_64-linux.prootTermux; docker = let pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs; in pkgs.dockerTools.buildImage { @@ -336,5 +355,8 @@ program = "${self.packages.x86_64-linux.run-vm}/bin/run-vm"; }; }; + + pkgs = mypkgs; + home.me = import ./users/me/gui-home.nix; }; } diff --git a/hosts/hpm.nix b/hosts/hpm.nix index 522365f..8cb0794 100755 --- a/hosts/hpm.nix +++ b/hosts/hpm.nix @@ -1,9 +1,11 @@ { inputs, pkgs, ... }: { imports = [ + #"${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-x86_64.nix" ../common/all.nix ../common/nixos.nix ../common/nixos-graphical.nix + ../mods/hec-server.nix ../common/building.nix inputs.home-manager.nixosModules.home-manager @@ -19,6 +21,7 @@ }; networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + virtualisation.podman.enable = true; # to build rpi images boot.binfmt.emulatedSystems = [ diff --git a/hosts/lush.nix b/hosts/lush.nix index 2e139a8..c7cd5b8 100755 --- a/hosts/lush.nix +++ b/hosts/lush.nix @@ -11,9 +11,9 @@ ../common/all.nix inputs.home-manager.nixosModules.home-manager - #../users/me/headless.nix + ../users/me/headless.nix - ##### project modules + ##### project modules ##### # the module for the zwave setup #"${workDir}/htl/labor/hackl/zwave.nix" diff --git a/hosts/rpi.nix b/hosts/rpi.nix index aba1b22..4d4e7ba 100644 --- a/hosts/rpi.nix +++ b/hosts/rpi.nix @@ -266,7 +266,7 @@ ############################## files backup ################################## # needs that - programs.fuse.userAllowOther = true; + programs.fuse.userAllowOther = true; # otherwise the root user has no acces to the mount systemd.services.rclone-mount-backup = { enable = true; description = "Mount rclone backup folder"; diff --git a/misc/my-hosts b/misc/my-hosts index 1f79436..2f6f12d 100755 --- a/misc/my-hosts +++ b/misc/my-hosts @@ -3,3 +3,5 @@ 192.168.122.56 uwu ::1 www.youtube.com ::1 youtube.com +::1 localhost +127.0.0.1 localhost diff --git a/mods/hec-server.nix b/mods/hec-server.nix new file mode 100644 index 0000000..d993825 --- /dev/null +++ b/mods/hec-server.nix @@ -0,0 +1,38 @@ +{ workDir, pkgs, ... } : { + + + ############################### desktop ############################### + /* + services.xserver.enable = true; + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + + environment.systemPackages = with pkgs; [ + tightvnc + ]; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + services.blueman.enable = true; + hardware.bluetooth.enable = true; + */ + + ############################# kilian ############################# + users.users.me.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF/yBJcfkHRF5HScWLuaE+jKQQ2BczpKKpHihgc5JmxB kilian@idk" + ]; + + users.users.kilian.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF/yBJcfkHRF5HScWLuaE+jKQQ2BczpKKpHihgc5JmxB kilian@idk" + ]; + + users.users.kilian = { + isNormalUser = true; + #passwordFile = "${secretsDir}/me-pwd"; + password = "hi"; + extraGroups = [ "networkmanager" "wheel" "libvirtd" ]; # Enable ‘sudo’ for the user. + }; + programs.bash.shellInit = builtins.readFile "${workDir}/config/gitignore/killian_bashrc"; + +} diff --git a/mods/my-nixpkgs-overlay.nix b/mods/my-nixpkgs-overlay.nix index d19b427..17cf1f7 100755 --- a/mods/my-nixpkgs-overlay.nix +++ b/mods/my-nixpkgs-overlay.nix @@ -1,7 +1,5 @@ -{ pkgs, inputs, ... }: -{ - nixpkgs.overlays = [ +{ nixpkgs, ... }: final: prev: { #{ #localPacketTracer8 = (pkgs.callPackage ../../prebuilt/packetTracer/default.nix {confDir = confDir;}); #xdg-desktop-portal-termfilechooser = (pkgs.callPackage ../../mods/xdg-desktop-portal-termfilechooser/default.nix {}); @@ -10,5 +8,108 @@ #{ #supabase-cli = pkgs.callPackage ./supabase.nix; #} - ]; + + # for static builds + duktape = prev.duktape.overrideAttrs (innerFinal: innerPrev: { + patches = innerPrev.patches or [] ++ [ + ./static/duktape.patch + ]; + #unpackPhase = "echo hiiiiiiiiiiiiiiiiiiiiiiiiiii"; + #buildPhase = "echo hiiiiiiiiiiiiiiiiiiiiiiiiii"; + + buildPhase = '' + make -f dist-files/Makefile.staticlibrary + make -f Makefile.cmdline + ''; + installPhase = '' + install -d $out/bin + install -m755 duk $out/bin/ + install -d $out/lib/pkgconfig + install -d $out/include + make -f dist-files/Makefile.staticlibrary install INSTALL_PREFIX=$out + substituteAll ${nixpkgs}/pkgs/development/interpreters/duktape/duktape.pc.in $out/lib/pkgconfig/duktape.pc + ''; + }); + + dconf = prev.dconf.overrideAttrs (innerFinal: innerPrev: { + patches = innerPrev.patches or [] ++ [ + ./static/dconf.patch + ]; + }); + + at-spi2-core = prev.at-spi2-core.overrideAttrs (innerFinal: innerPrev: { + mesonFlags = innerPrev.mesonFlags or [] ++ [ + "-Dintrospection=disabled" + "-Ddbus_broker=default" + "-Dgtk2_atk_adaptor=false" + ]; + }); + + cdparanoia = prev.cdparanoia.overrideAttrs (innerFinal: innerPrev: { + patches = innerPrev.patches or [] ++ [ + ./static/cdparanoia.patch + ]; + }); + + + # this is a mess.... + #pkgsStatic = prev.pkgsStatic // {gobject-introspection = prev.callPackage ./static/gobject-introspection.nix { inherit nixpkgs; };}; + #gobject-introspection = prev.callPackage ./static/gobject-introspection.nix { inherit nixpkgs; }; + #buildPackges = prev.buildPackges // {gobject-introspection = prev.callPackage ./static/gobject-introspection.nix { inherit nixpkgs; };}; + # .... gobject-introspection is just not made for dyn linking + + python311Packages = prev.python311Packages // { lxml = prev.python311Packages.lxml.overrideAttrs (innerFinal: innerPrev: + let + libxmlSrc = prev.fetchurl { + url = "mirror://gnome/sources/libxml2/${prev.lib.versions.majorMinor "2.12.4"}/libxml2-2.12.4.tar.xz"; + sha256 = "sha256-SXNg5CPPC9merNt8YhXeqS5tbonulAOTwrrg53y5t9A="; + }; + zlibSrc = let version = "1.3.1"; in prev.fetchurl { + urls = [ + # This URL works for 1.2.13 only; hopefully also for future releases. + "https://github.com/madler/zlib/releases/download/v${version}/zlib-${version}.tar.gz" + # Stable archive path, but captcha can be encountered, causing hash mismatch. + "https://www.zlib.net/fossils/zlib-${version}.tar.gz" + ]; + hash = "sha256-mpOyt9/ax3zrpaVYpYDnRmfdb+3kWFuR7vtg8Dty3yM="; + }; + libiconvSrc = prev.fetchurl { + url = "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz"; + hash = "sha256-j3QhO1YjjIWlClMp934GGYdx5w3Zpzl3n0wC9l2XExM="; + }; + libxsltSrc = let version = "1.1.37"; pname = "libxslt"; in prev.fetchurl { + url = "mirror://gnome/sources/${pname}/${prev.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; + sha256 = "Oksn3IAnzNYUZyWVAzbx7FIJKPMg8UTrX6eZCuYSOrQ="; + }; + in + { + setupPyBuildFlags = [ + "--libxml2-version=2.12.4" + "--libxslt-version=1.1.37" + "--zlib-version=1.3.1" + "--libiconv-version=1.17" + "--without-cython" + ]; + patches = [ + ./static/python311Packages-lxml.patch + ]; + + STATICBUILD = true; + preConfigure = '' + mkdir -p ./libs + cp ${zlibSrc} ./libs/${zlibSrc.name} + cp ${libiconvSrc} ./libs/${libiconvSrc.name} + cp ${libxmlSrc} ./libs/${libxmlSrc.name} + cp ${libxsltSrc} ./libs/${libxsltSrc.name} + + ls ./libs + ''; + #cat ${libxsltSrc} | xz -d | gzip > ./libs/${libxsltSrc.name} + #cat ${libxmlSrc} | xz -d | gzip > ./libs/${libxmlSrc.name} + #mv ./libs/libxslt-1.1.37.tar.xz ./libs/libxslt-1.1.37.tar.gz + #mv ./libs/libxml2-2.10.4.tar.xz ./libs/libxml2-2.10.4.tar.gz + }); + }; } + + diff --git a/mods/second-overlay.nix b/mods/second-overlay.nix new file mode 100644 index 0000000..a80c09f --- /dev/null +++ b/mods/second-overlay.nix @@ -0,0 +1,27 @@ + + +{ nixpkgs, ... }: final: prev: { + #at-spi2-core = prev.at-spi2-core.override { + #withIntrospection = false; + #}; + + /* + gsettings-desktop-schemas = prev.gsettings-desktop-schemas.override { + withIntrospection = true; + #gobject-introspection = prev.callPackage ./static/gobject-introspection.nix { inherit nixpkgs; }; + gobject-introspection = prev.callPackage ./static/gobject-introspection.nix { inherit nixpkgs; }; + }; + */ + /* + gsettings-desktop-schemas = prev.gsettings-desktop-schemas.overrideAttrs (innerFinal: innerPrev: { + nativeBuildInputs = with prev; [ + glib + meson + ninja + pkg-config + gobject-introspection + (prev.callPackage ./static/gobject-introspection.nix { inherit nixpkgs; }) + ]; + }); + */ +} diff --git a/mods/static/cdparanoia.patch b/mods/static/cdparanoia.patch new file mode 100644 index 0000000..4249b1a --- /dev/null +++ b/mods/static/cdparanoia.patch @@ -0,0 +1,60 @@ +diff --git a/Makefile.in b/Makefile.in +index 3d235ad..1cd36ea 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -27,7 +27,7 @@ PWD = $(shell pwd) + + OFILES = main.o report.o header.o buffering_write.o cachetest.o + +-export STATIC ++export STATIC = TRUE + export VERSION + + ifeq ($(STATIC),TRUE) +@@ -71,20 +71,10 @@ install: + $(INSTALL) -d -m 0755 $(INCLUDEDIR) + $(INSTALL) -m 0644 $(srcdir)/paranoia/cdda_paranoia.h $(INCLUDEDIR) + $(INSTALL) -d -m 0755 $(LIBDIR) +- $(INSTALL) -m 0644 $(srcdir)/paranoia/libcdda_paranoia.so.0.$(VERSION) $(LIBDIR) + $(INSTALL) -m 0644 $(srcdir)/paranoia/libcdda_paranoia.a $(LIBDIR) + $(INSTALL) -m 0644 $(srcdir)/interface/cdda_interface.h $(INCLUDEDIR) +- $(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.so.0.$(VERSION) $(LIBDIR) + $(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.a $(LIBDIR) + $(INSTALL) -m 0644 $(srcdir)/utils.h $(INCLUDEDIR) +- ln -fs libcdda_interface.so.0.$(VERSION) \ +- $(LIBDIR)/libcdda_interface.so.0 +- ln -fs libcdda_interface.so.0.$(VERSION) \ +- $(LIBDIR)/libcdda_interface.so +- ln -fs libcdda_paranoia.so.0.$(VERSION) \ +- $(LIBDIR)/libcdda_paranoia.so.0 +- ln -fs libcdda_paranoia.so.0.$(VERSION) \ +- $(LIBDIR)/libcdda_paranoia.so + + cdparanoia: $(OFILES) $(LIBDEP) + $(LD) $(CFLAGS) $(LDFLAGS) $(OFILES) \ +diff --git a/interface/Makefile.in b/interface/Makefile.in +index 40c6098..ac430ac 100644 +--- a/interface/Makefile.in ++++ b/interface/Makefile.in +@@ -23,7 +23,7 @@ OFILES = scan_devices.o common_interface.o cooked_interface.o interface.o\ + + export VERSION + +-all: lib slib ++all: lib + + debug: + $(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)" +diff --git a/paranoia/Makefile.in b/paranoia/Makefile.in +index 89d0328..7bb7c16 100644 +--- a/paranoia/Makefile.in ++++ b/paranoia/Makefile.in +@@ -24,7 +24,7 @@ OFILES = paranoia.o p_block.o overlap.o gap.o isort.o + LIBS = ../interface/libcdda_interface.a -lm + export VERSION + +-all: lib slib ++all: lib + + debug: + $(MAKE) libcdda_paranoia.a CFLAGS="$(DEBUG)" diff --git a/mods/static/dconf.patch b/mods/static/dconf.patch new file mode 100644 index 0000000..dd8c5f1 --- /dev/null +++ b/mods/static/dconf.patch @@ -0,0 +1,68 @@ +diff --git a/client/meson.build b/client/meson.build +index 0308dc2..1f80046 100644 +--- a/client/meson.build ++++ b/client/meson.build +@@ -35,11 +35,11 @@ client_deps = [ + symbol_map = join_paths(meson.current_source_dir(), 'symbol.map') + ldflags = cc.get_supported_link_arguments('-Wl,--version-script,@0@'.format(symbol_map)) + +-libdconf = shared_library( ++libdconf = static_library( + 'dconf', + sources: sources, +- version: libversion, +- soversion: soversion, ++ #version: libversion, ++ #soversion: soversion, + include_directories: top_inc, + dependencies: client_deps, + c_args: dconf_c_args, +diff --git a/gsettings/meson.build b/gsettings/meson.build +index 9463453..1233d6a 100644 +--- a/gsettings/meson.build ++++ b/gsettings/meson.build +@@ -6,7 +6,7 @@ backend_deps = [ + symbol_map = join_paths(meson.current_source_dir(), 'symbol.map') + ldflags = cc.get_supported_link_arguments('-Wl,--version-script,@0@'.format(symbol_map)) + +-libdconf_settings = shared_library( ++libdconf_settings = static_library( + 'dconfsettings', + sources: 'dconfsettingsbackend.c', + include_directories: top_inc, +diff --git a/tests/meson.build b/tests/meson.build +index 19f693a..81967a6 100644 +--- a/tests/meson.build ++++ b/tests/meson.build +@@ -50,19 +50,19 @@ endforeach + + symbol_test = find_program('abicheck.sh') + +-abi_tests = [ +- ['gsettings', libdconf_settings, files('../gsettings/symbols.txt')[0]], +- ['libdconf', libdconf, files('../client/symbols.txt')[0]], +-] ++#abi_tests = [ ++ #['gsettings', libdconf_settings, files('../gsettings/symbols.txt')[0]], ++ #['libdconf', libdconf, files('../client/symbols.txt')[0]], ++#] + +-foreach abi_test: abi_tests +- test( +- abi_test[0], +- symbol_test, +- env: envs, +- args: [abi_test[1].full_path(), abi_test[2]], +- ) +-endforeach ++#foreach abi_test: abi_tests ++ #test( ++ #abi_test[0], ++ #symbol_test, ++ #env: envs, ++ #args: [abi_test[1].full_path(), abi_test[2]], ++ #) ++#endforeach + + + python3 = find_program('python3', required: false) diff --git a/mods/static/duktape.patch b/mods/static/duktape.patch new file mode 100644 index 0000000..90785b9 --- /dev/null +++ b/mods/static/duktape.patch @@ -0,0 +1,58 @@ +diff --git a/dist-files/Makefile.staticlibrary b/dist-files/Makefile.staticlibrary +new file mode 100644 +index 00000000..dc426631 +--- /dev/null ++++ b/dist-files/Makefile.staticlibrary +@@ -0,0 +1,50 @@ ++# ++# Example of how to build and install locally as a static library ++# ++# Usage: ++# ++# $ make -f Makefile.staticlibrary ++# $ sudo make -f Makefile.staticlibrary install ++# $ make -f Makefile.staticlibrary duk # --> example 'duk' linked to static libduktape ++# ++# $ ls -l duk ++# -rwxrwxr-x 1 duktape duktape 413408 Nov 30 15:48 duk ++# ++# Based on: http://tldp.org/HOWTO/Program-Library-HOWTO/static-libraries.html ++ ++# Change to actual path for actual distribution packaging. ++INSTALL_PREFIX = /usr/local ++ ++# The 'noline' variant may be more appropriate for some distributions; it ++# doesn't have #line directives in the combined source. ++DUKTAPE_SRCDIR = ./src ++#DUKTAPE_SRCDIR = ./src-noline ++ ++AR ?= ar ++AR := $(AR) ++CC ?= gcc ++CC := $(CC) ++ ++.PHONY: all ++all: libduktape.a libduktaped.a ++ ++# If the default duk_config.h is not suitable for the distribution, modify it ++# before compiling the static library and copy the same, edited duk_config.h ++# to $INSTALL_PREFIX/include on installation. ++ ++libduktape.a: ++ $(CC) -Wall -Wextra -Os -c $(DUKTAPE_SRCDIR)/duktape.c -o $(DUKTAPE_SRCDIR)/duktape.o ++ $(AR) rcs $@ $(DUKTAPE_SRCDIR)/duktape.o ++ ++libduktaped.a: ++ $(CC) -g -Wall -Wextra -Os -c $(DUKTAPE_SRCDIR)/duktape.c -o $(DUKTAPE_SRCDIR)/duktaped.o ++ $(AR) rcs $@ $(DUKTAPE_SRCDIR)/duktaped.o ++ ++.PHONY: install ++install: libduktape.a libduktaped.a ++ mkdir -p $(INSTALL_PREFIX)/lib/ ++ cp $+ $(INSTALL_PREFIX)/lib/ ++ mkdir -p $(INSTALL_PREFIX)/include/ ++ cp $(DUKTAPE_SRCDIR)/duktape.h $(DUKTAPE_SRCDIR)/duk_config.h $(INSTALL_PREFIX)/include/ ++ ++CCOPTS = -I./examples/cmdline ++duk: ++ $(CC) $(CCOPTS) -I$(INSTALL_PREFIX)/include -L$(INSTALL_PREFIX)/lib -Wall -Wextra -Os -o $@ ./examples/cmdline/duk_cmdline.c -lduktape -lm diff --git a/mods/static/gobject-introspection.nix b/mods/static/gobject-introspection.nix new file mode 100644 index 0000000..5956cda --- /dev/null +++ b/mods/static/gobject-introspection.nix @@ -0,0 +1,194 @@ +{ stdenv +, lib +, fetchurl +, glib +, flex +, bison +, meson +, ninja +, gtk-doc +, docbook-xsl-nons +, docbook_xml_dtd_43 +, docbook_xml_dtd_45 +, pkg-config +, libffi +, python3 +#, cctools # not needed, because i don't build for darwin +, cairo +, gnome +, substituteAll +, buildPackages +, gobject-introspection-unwrapped +, nixStoreDir ? builtins.storeDir +, x11Support ? true +, testers +, nixpkgs # for me only probably, to add other files form nixpkgs +}: + +# now that gobject-introspection creates large .gir files (eg gtk3 case) +# it may be worth thinking about using multiple derivation outputs +# In that case its about 6MB which could be separated + +let + pythonModules = pp: [ + pp.mako + pp.markdown + ]; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gobject-introspection"; + version = "1.76.1"; + + # outputs TODO: share/gobject-introspection-1.0/tests is needed during build + # by pygobject3 (and maybe others), but it's only searched in $out + outputs = [ "out" "dev" "devdoc" "man" ]; + outputBin = "dev"; + + src = fetchurl { + url = "mirror://gnome/sources/gobject-introspection/${lib.versions.majorMinor finalAttrs.version}/gobject-introspection-${finalAttrs.version}.tar.xz"; + sha256 = "GWF4v2Q0VQHc3E2EabNqpv6ASJNU7+cct8uKuCo3OL8="; + }; + + patches = [ + # comment out a test, that tests for shared libs (i am linking static) + ./gobject-introspection.patch + + # Make g-ir-scanner put absolute path to GIR files it generates + # so that programs can just dlopen them without having to muck + # with LD_LIBRARY_PATH environment variable. + (substituteAll { + src = "${nixpkgs}/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch"; + + + inherit nixStoreDir; + }) + ] ++ lib.optionals x11Support [ + # Hardcode the cairo shared library path in the Cairo gir shipped with this package. + # https://github.com/NixOS/nixpkgs/issues/34080 + (substituteAll { + src = "${nixpkgs}/pkgs/development/libraries/gobject-introspection/absolute_gir_path.patch"; + cairoLib = "${lib.getLib cairo}/lib"; + }) + ]; + + strictDeps = true; + + nativeBuildInputs = [ + meson + ninja + pkg-config + flex + bison + gtk-doc + docbook-xsl-nons + docbook_xml_dtd_45 + # Build definition checks for the Python modules needed at runtime by importing them. + (buildPackages.python3.withPackages pythonModules) + finalAttrs.setupHook # move .gir files + # can't use canExecute, we need prebuilt when cross + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ gobject-introspection-unwrapped ]; + + buildInputs = [ + (python3.withPackages pythonModules) + ]; + + #nativeCheckInputs = lib.optionals stdenv.isDarwin [ + #cctools # for otool + #]; + + propagatedBuildInputs = [ + libffi + glib + ]; + + mesonFlags = [ + "--datadir=${placeholder "dev"}/share" + "-Dcairo=disabled" + "-Dgtk_doc=${lib.boolToString (stdenv.hostPlatform == stdenv.buildPlatform)}" + ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + "-Dgi_cross_ldd_wrapper=${substituteAll { + name = "g-ir-scanner-lddwrapper"; + isExecutable = true; + src = "${nixpkgs}/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-lddwrapper.sh"; + inherit (buildPackages) bash; + buildlddtree = "${buildPackages.pax-utils}/bin/lddtree"; + }}" + "-Dgi_cross_binary_wrapper=${stdenv.hostPlatform.emulator buildPackages}" + # can't use canExecute, we need prebuilt when cross + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + "-Dgi_cross_use_prebuilt_gi=true" + ]; + + doCheck = !stdenv.isAarch64; + + # During configurePhase, two python scripts are generated and need this. See + # https://github.com/NixOS/nixpkgs/pull/98316#issuecomment-695785692 + postConfigure = '' + patchShebangs tools/* + ''; + + postInstall = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' + cp -r ${nixpkgs.legacyPackages.x86_64-linux.gobject-introspection-unwrapped.devdoc} $devdoc + # these are uncompiled c and header files which aren't installed when cross-compiling because + # code that installs them is in tests/meson.build which is only run when not cross-compiling + # pygobject3 needs them + cp -r ${nixpkgs.legacyPackages.x86_64-linux.gobject-introspection-unwrapped.dev}/share/gobject-introspection-1.0/tests $dev/share/gobject-introspection-1.0/tests + + ''; /*+ '' + mkdir -p $out/pkgconfig + cp ./meson-private/gobject-introspection-1.0.pc $out/pkgconfig/ + ''; + postFixup = '' + # copy the pc file + echo hiiiiiiiiiiiiiiiiiiiiiiiiiiii + echo $out + ls $out/lib + echo hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii + mkdir -p $out/lib/pkgconfig + cp $out/pkgconfig/* $out/lib/pkgconfig/ + ''; + */ + + + /* + preCheck = '' + # Our gobject-introspection patches make the shared library paths absolute + # in the GIR files. When running tests, the library is not yet installed, + # though, so we need to replace the absolute path with a local one during build. + # We are using a symlink that we will delete before installation. + mkdir -p $out/lib + ln -s $PWD/tests/scanner/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} + ''; + + postCheck = '' + rm $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} + ''; + # */ + + setupHook = "${nixpkgs}/pkgs/development/libraries/gobject-introspection/setup-hook.sh"; + + passthru = { + updateScript = gnome.updateScript { + packageName = "gobject-introspection"; + versionPolicy = "odd-unstable"; + }; + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + }; + + meta = with lib; { + description = "A middleware layer between C libraries and language bindings"; + homepage = "https://gi.readthedocs.io/"; + maintainers = teams.gnome.members ++ (with maintainers; [ lovek323 artturin ]); + pkgConfigModules = [ "gobject-introspection-1.0" ]; + platforms = platforms.unix; + license = with licenses; [ gpl2 lgpl2 ]; + + longDescription = '' + GObject introspection is a middleware layer between C libraries (using + GObject) and language bindings. The C library can be scanned at compile + time and generate a metadata file, in addition to the actual native C + library. Then at runtime, language bindings can read this metadata and + automatically provide bindings to call into the C library. + ''; + }; +}) diff --git a/mods/static/gobject-introspection.patch b/mods/static/gobject-introspection.patch new file mode 100644 index 0000000..8a9528a --- /dev/null +++ b/mods/static/gobject-introspection.patch @@ -0,0 +1,13 @@ +diff --git a/tests/repository/meson.build b/tests/repository/meson.build +index 1744538..a95f083 100644 +--- a/tests/repository/meson.build ++++ b/tests/repository/meson.build +@@ -4,7 +4,7 @@ if glib_dep.type_name() == 'pkgconfig' + 'gitestrepo': typelibs, + 'giteststructinfo': typelibs, + 'gitestthrows': typelibs, +- 'gitypelibtest': [regress_typelib], ++ #'gitypelibtest': [regress_typelib], + } + + repository_test_env = environment() diff --git a/mods/static/python311Packages-lxml.patch b/mods/static/python311Packages-lxml.patch new file mode 100644 index 0000000..f336715 --- /dev/null +++ b/mods/static/python311Packages-lxml.patch @@ -0,0 +1,26 @@ +diff --git a/buildlibxml.py b/buildlibxml.py +index ab2efad..22fa8f6 100644 +--- a/buildlibxml.py ++++ b/buildlibxml.py +@@ -278,7 +278,10 @@ def download_libxml2(dest_dir, version=None): + from_location = "https://gitlab.gnome.org/GNOME/libxml2/-/archive/dea91c97debeac7c1aaf9c19f79029809e23a353/" + version = "dea91c97debeac7c1aaf9c19f79029809e23a353" + else: +- from_location = http_find_latest_version_directory(LIBXML2_LOCATION, version=version) ++ pass ++ #from_location = http_find_latest_version_directory(LIBXML2_LOCATION, version=version) ++ version = "2.12.4" ++ from_location = "https://download.gnome.org/sources/libxml2/2.12/" + + return download_library(dest_dir, from_location, 'libxml2', + version_re, filename, version=version) +@@ -289,7 +292,8 @@ def download_libxslt(dest_dir, version=None): + #version_re = re.compile(r'LATEST_LIBXSLT_IS_([0-9.]+[0-9](?:-[abrc0-9]+)?)') + version_re = re.compile(r'libxslt-([0-9.]+[0-9]).tar.xz') + filename = 'libxslt-%s.tar.xz' +- from_location = http_find_latest_version_directory(LIBXSLT_LOCATION, version=version) ++ #from_location = http_find_latest_version_directory(LIBXSLT_LOCATION, version=version) ++ from_location = "https://download.gnome.org/sources/libxslt/1.1/" + return download_library(dest_dir, from_location, 'libxslt', + version_re, filename, version=version) + diff --git a/programs/ssh.nix b/programs/ssh.nix index 4d60991..aad4006 100644 --- a/programs/ssh.nix +++ b/programs/ssh.nix @@ -9,6 +9,11 @@ "github.com" = { hostname = "github.com"; }; + here = { + port = 8888; + hostname = "127.0.0.1"; + user = "me"; + }; rpi = { port = 49388; user = "me"; diff --git a/scripts/sync-school.sh b/scripts/sync-school.sh index 9996613..eddbd39 100755 --- a/scripts/sync-school.sh +++ b/scripts/sync-school.sh @@ -9,6 +9,11 @@ filter=--exclude="./Forms" echo "########################## DE ##########################" rclone copy -vv $filter share-de-class-materials: ~/work/htl/de/class-materials/ 2>&1 >/dev/null | grep Copied --color=never | awk -F':' '{print $4}' | cut -c 2- | sed 's/^/class-materials: /' +# Labor +echo "########################## Labor ##########################" +rclone copy -vv $filter --exclude="ubuntu-22.04.3-desktop-amd64.iso" share-klotz-class-materials: ~/work/htl/labor/klotz/class-materials/ 2>&1 >/dev/null | grep Copied --color=never | awk -F':' '{print $4}' | cut -c 2- | sed 's/^/class-materials: /' + + # HWE #echo "########################## HWE #########################" diff --git a/users/me/gui-home.nix b/users/me/gui-home.nix index 568ada5..c2fd555 100755 --- a/users/me/gui-home.nix +++ b/users/me/gui-home.nix @@ -98,6 +98,9 @@ rustc #localPacketTracer8 + (ciscoPacketTracer8.overrideAttrs (prev: final: { + src = /home/me/work/software/CiscoPacketTracer_821_Ubuntu_64bit.deb; + })) #ciscoPacketTracer8 @@ -144,6 +147,7 @@ "tab": "00:0a:50:90:f1:00", # "phone": "86:9d:6a:bc:ca:1b", # can't do that, because phone changes mac address on reactivation of hotspot "lush": "dc:a6:32:cb:4d:5f", + "hpm": "bc:17:b8:27:26:5d", } if len(sys.argv) == 1: diff --git a/users/me/gui.nix b/users/me/gui.nix index b669215..127a85a 100644 --- a/users/me/gui.nix +++ b/users/me/gui.nix @@ -14,6 +14,7 @@ home-manager.users.me = import ./gui-home.nix; #home-manager.useGlobalPkgs = true; + nixpkgs.config.allowUnfree = true; fonts.fonts = with pkgs; [