diff --git a/.drone.yml b/.drone.yml index b8b5530..e1e9629 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,7 +1,7 @@ --- kind: pipeline type: exec -name: Build all hosts +name: Build all configurations platform: os: linux @@ -38,6 +38,107 @@ trigger: event: - push - pull_request + + + +--- +kind: pipeline +type: exec +name: Build custom packages + +platform: + os: linux + arch: amd64 + +steps: + +- name: Build tinystatus + commands: + - nix build .#tinystatus + +- name: Build mosh + commands: + - nix build .#mosh + + +trigger: + branch: + - main + event: + - push + - pull_request + + +--- +kind: pipeline +type: exec +name: Update flake + +platform: + os: linux + arch: amd64 + +steps: + +- name: create old builds + commands: + - nix build -v '.#nixosConfigurations.lisa.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org" + - mv result lisa-old + - nix build -v '.#nixosConfigurations.newton.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org" + - mv result newton-old + - nix build -v '.#nixosConfigurations.macintosh.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org" + - mv result macintosh-old + + +- name: flake update + commands: + - nix --experimental-features "nix-command flakes" flake update --inputs-from nixpkgs + +- name: Show git diff + commands: + - git diff + +- name: Show flake info + commands: + - nix --experimental-features "nix-command flakes" flake show + - nix --experimental-features "nix-command flakes" flake metadata + - nix --experimental-features "nix-command flakes" flake check + +- name: Run flake checks + commands: + - nix --experimental-features "nix-command flakes" flake check --show-trace + +- name: Build lisa + commands: + - nix build -v '.#nixosConfigurations.lisa.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org" + - mv result lisa-new + +- name: Build newton + commands: + - nix build -v '.#nixosConfigurations.newton.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org" + - mv result newton-new + +- name: Build macintosh + commands: + - nix build -v '.#nixosConfigurations.macintosh.config.system.build.toplevel' --option binary-caches "https://cache.nixos.org" + - mv result macintosh-new + + +- name: Print report + commands: + - echo "lisa:" && nix store diff-closures $(readlink -f lisa-old) $(readlink -f lisa-new) + - echo "newton:" && nix store diff-closures $(readlink -f newton-old) $(readlink -f newton-new) + - echo "macintosh:" && nix store diff-closures $(readlink -f macintosh-old) $(readlink -f macintosh-new) + +trigger: + branch: + - main + event: + - push + - pull_request + - cron + + --- kind: pipeline @@ -82,9 +183,3 @@ steps: status: - failure -trigger: - branch: - - main - event: - - push - - cron diff --git a/flake.nix b/flake.nix index 7029f26..043750f 100644 --- a/flake.nix +++ b/flake.nix @@ -43,6 +43,9 @@ (builtins.attrNames (builtins.readDir ./modules))); nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine name value self.nixosModules)) (importConfig ./machines); - packages."x86_64-linux".tinystatus = import ./packages/tinystatus { inherit pkgs; }; + packages."x86_64-linux" = { + tinystatus = import ./packages/tinystatus { inherit pkgs; }; + mosh = pkgs.callPackage ./packages/mosh {}; + }; }; } diff --git a/packages/mosh/bash_completion_datadir.patch b/packages/mosh/bash_completion_datadir.patch new file mode 100644 index 0000000..d0c56bc --- /dev/null +++ b/packages/mosh/bash_completion_datadir.patch @@ -0,0 +1,20 @@ +diff --git a/configure.ac b/configure.ac +index 3ad983d..ff8ff96 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -476,13 +476,7 @@ AS_IF([echo "$protobuf_LIBS" | grep -q -- -pthread], + + # Bash completion needs to ask where it goes if >= 2.0 is installed. + AS_IF([test "$install_completion" != no], +- [PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], +- [if test "$prefix" = "NONE"; then +- completions="`pkg-config --variable=completionsdir bash-completion`" +- else +- completions="`pkg-config --define-variable=prefix=$prefix --variable=completionsdir bash-completion`" +- fi], +- [completions="${sysconfdir}/bash_completion.d"]) ++ [completions="`pkg-config --define-variable=datadir=$datadir --variable=completionsdir bash-completion`"] + AC_SUBST([completions])]) + + AC_CONFIG_FILES([ + diff --git a/packages/mosh/default.nix b/packages/mosh/default.nix index 5febad7..25d5b4c 100644 --- a/packages/mosh/default.nix +++ b/packages/mosh/default.nix @@ -1,20 +1,20 @@ -#{ lib, stdenv, fetchFromGithub, fetchpatch, zlib, protobuf, ncurses, pkg-config -#, makeWrapper, perlPackages, openssl, autoreconfHook, openssh, bash-completion -#, withUtempter ? stdenv.isLinux, libutempter }: +{ pkgs, lib, stdenv, fetchFromGithub, fetchpatch, zlib, protobuf, ncurses, pkg-config +, makeWrapper, perlPackages, openssl, autoreconfHook, openssh, bash-completion +, withUtempter ? stdenv.isLinux, libutempter }: stdenv.mkDerivation rec { pname = "mosh"; version = "1.3.2"; - src = fetchFromGitHub { + src = pkgs.fetchFromGitHub { owner = "mobile-shell"; repo = pname; rev = "378dfa6aa5778cf168646ada7f52b6f4a8ec8e41"; - sha256 = "05hjhlp6lk8yjcy59zywpf0r6s0h0b9zxq0lw66dh9x8vxrhaq6s"; + sha256 = "LJssBMrICVgaZtTvZTO6bYMFO4fQ330lIUkWzDSyf7o="; }; nativeBuildInputs = [ autoreconfHook pkg-config makeWrapper ]; - buildInputs = [ protobuf ncurses zlib openssl bash-completion ] + buildInputs = [ protobuf ncurses zlib openssl ] ++ (with perlPackages; [ perl IOTty ]) ++ lib.optional withUtempter libutempter; @@ -22,31 +22,16 @@ stdenv.mkDerivation rec { patches = [ ./ssh_path.patch - ./mosh-client_path.patch - ./utempter_path.patch - # Fix w/c++17, ::bind vs std::bind - (fetchpatch { - url = "https://github.com/mobile-shell/mosh/commit/e5f8a826ef9ff5da4cfce3bb8151f9526ec19db0.patch"; - sha256 = "15518rb0r5w1zn4s6981bf1sz6ins6gpn2saizfzhmr13hw4gmhm"; - }) - # Fix build with bash-completion 2.10 ./bash_completion_datadir.patch ]; - postPatch = '' - # Fix build with Xcode 12.5 toolchain/case-insensitive filesystems - # Backport of https://github.com/mobile-shell/mosh/commit/12199114fe4234f791ef4c306163901643b40538; - # remove on next upstream release. - patch -p0 < ${fetchpatch { - url = "https://raw.githubusercontent.com/macports/macports-ports/70ca3f65e622c17582fd938602d800157ed951c3/net/mosh/files/patch-version-subdir.diff"; - sha256 = "1yyh6d07y9zbdx4fb0r56zkq9nd9knwzj22v4dfi55k4k42qxapd"; - }} - substituteInPlace scripts/mosh.pl \ - --subst-var-by ssh "${openssh}/bin/ssh" \ - --subst-var-by mosh-client "$out/bin/mosh-client" + preConfigure = '' + ./autogen.sh ''; + NIX_CFLAGS_COMPILE = "-O2"; + configureFlags = [ "--enable-completion" ] ++ lib.optional withUtempter "--with-utempter"; @@ -74,3 +59,4 @@ stdenv.mkDerivation rec { } + diff --git a/packages/mosh/ssh_path.patch b/packages/mosh/ssh_path.patch new file mode 100644 index 0000000..ff762a1 --- /dev/null +++ b/packages/mosh/ssh_path.patch @@ -0,0 +1,14 @@ +diff --git i/scripts/mosh.pl w/scripts/mosh.pl +index c511482..55bf5f3 100755 +--- i/scripts/mosh.pl ++++ w/scripts/mosh.pl +@@ -66,7 +66,7 @@ my $use_remote_ip = 'proxy'; + my $family = 'prefer-inet'; + my $port_request = undef; + +-my @ssh = ('ssh'); ++my @ssh = ('@ssh@'); + + my $term_init = 1; + + diff --git a/utils.nix b/utils.nix index 06a94df..490c652 100644 --- a/utils.nix +++ b/utils.nix @@ -26,23 +26,7 @@ in (final: prev: { tinystatus = prev.pkgs.callPackage ./packages/tinystatus {}; - mosh = prev.mosh.overrideAttrs (old: { - patches = (prev.lib.take 1 old.patches) ++ (prev.lib.sublist 4 4 old.patches); - postPatch = ''''; - buildInputs = with prev; [ protobuf ncurses zlib openssl ] - ++ (with perlPackages; [ perl IOTty ]) - ++ lib.optional true libutempter; - preConfigure = '' - ./autogen.sh - ''; - NIX_CFLAGS_COMPILE = "-O2"; - src = prev.fetchFromGitHub { - owner = "mobile-shell"; - repo = "mosh"; - rev = "378dfa6aa5778cf168646ada7f52b6f4a8ec8e41"; - sha256 = "LJssBMrICVgaZtTvZTO6bYMFO4fQ330lIUkWzDSyf7o="; - }; - }); + mosh = prev.pkgs.callPackage ./packages/mosh {}; }) ]; }