From 48933194e02120e7346807828e47211d40b1b7dd Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Thu, 2 Feb 2023 09:47:29 -0700 Subject: [PATCH] overlays: split frequent ovlays into files that can be included - add overlay for newer openssh --- default.nix | 2 ++ overlays/default.nix | 47 +++++++------------------------------ overlays/matrix-synapse.nix | 22 +++++++++++++++++ overlays/openssh.nix | 12 ++++++++++ overlays/tailscale.nix | 22 +++++++++++++++++ 5 files changed, 66 insertions(+), 39 deletions(-) create mode 100644 overlays/matrix-synapse.nix create mode 100644 overlays/openssh.nix create mode 100644 overlays/tailscale.nix diff --git a/default.nix b/default.nix index 5f9351f..c384de2 100644 --- a/default.nix +++ b/default.nix @@ -11,10 +11,12 @@ let settings = { PermitRootLogin = "prohibit-password"; PasswordAuthentication = false; + EnableEscapeCommandline = "yes"; }; } else { permitRootLogin = "prohibit-password"; passwordAuthentication = false; + enableEscapeCommandline = "yes"; }; in { imports = [ diff --git a/overlays/default.nix b/overlays/default.nix index 95e9980..1808b09 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,45 +1,12 @@ { self, config, pkgs, lib, isUnstable, ... }: let - tailscale = self: super: { - tailscale = super.callPackage "${super.path}/pkgs/servers/tailscale" { - buildGoModule = args: - super.buildGo119Module (args // rec { - version = "1.36.0"; - src = super.fetchFromGitHub { - owner = "tailscale"; - repo = "tailscale"; - rev = "v${version}"; - sha256 = "sha256-hNyEABs/GdfOx6vLTVBgbOzkbFvEDYZ0y1y0a0mIsfA="; - }; - vendorSha256 = "sha256-Jy3kjUA8qLhcw9XLw4Xo1zhD+IWZrDNM79TsbnKpx/g="; - ldflags = [ - "-X tailscale.com/version.Long=${version}" - "-X tailscale.com/version.Short=${version}" - ]; - }); - }; - }; - matrix-synapse = self: super: { - matrix-synapse = super.matrix-synapse.overrideAttrs (old: rec { - version = "1.76.0"; - pname = "matrix-synapse"; + openssh = import ./openssh.nix; + tailscale = import ./tailscale.nix; + matrix-synapse = import ./matrix-synapse.nix; - src = super.fetchFromGitHub { - owner = "matrix-org"; - repo = "synapse"; - rev = "v${version}"; - hash = "sha256-kPc6T8yLe1TDxPKLnK/TcU+RUxAVIq8qsr5JQXCXyjM="; - }; - - cargoDeps = super.rustPlatform.fetchCargoTarball { - inherit src; - name = "${pname}-${version}"; - hash = "sha256-tXtnVYH9uWu0nHHx53PgML92NWl3qcAcnFKhiijvQBc="; - }; - }); - }; in { nixpkgs.overlays = if isUnstable then [ + openssh tailscale # https://github.com/NixOS/nixpkgs/pull/213613 @@ -101,8 +68,10 @@ in { }); }) - ] else - [ matrix-synapse ]; + ] else [ + matrix-synapse + openssh + ]; } # Example Python dep overlay diff --git a/overlays/matrix-synapse.nix b/overlays/matrix-synapse.nix new file mode 100644 index 0000000..e7d286e --- /dev/null +++ b/overlays/matrix-synapse.nix @@ -0,0 +1,22 @@ +let + matrix-synapse = self: super: { + matrix-synapse = super.matrix-synapse.overrideAttrs (old: rec { + version = "1.76.0"; + pname = "matrix-synapse"; + + src = super.fetchFromGitHub { + owner = "matrix-org"; + repo = "synapse"; + rev = "v${version}"; + hash = "sha256-kPc6T8yLe1TDxPKLnK/TcU+RUxAVIq8qsr5JQXCXyjM="; + }; + + cargoDeps = super.rustPlatform.fetchCargoTarball { + inherit src; + name = "${pname}-${version}"; + hash = "sha256-tXtnVYH9uWu0nHHx53PgML92NWl3qcAcnFKhiijvQBc="; + }; + }); + }; + +in matrix-synapse diff --git a/overlays/openssh.nix b/overlays/openssh.nix new file mode 100644 index 0000000..8a0ea28 --- /dev/null +++ b/overlays/openssh.nix @@ -0,0 +1,12 @@ +let + openssh = self: super: { + openssh = super.openssh.overrideAttrs (old: rec { + version = "9.2p1"; + src = super.fetchurl { + url = "mirror://openbsd/OpenSSH/portable/openssh-${version}.tar.gz"; + hash = "sha256-P2bb8WVftF9Q4cVtpiqwEhjCKIB7ITONY068351xz0Y="; + }; + }); + }; + +in openssh diff --git a/overlays/tailscale.nix b/overlays/tailscale.nix new file mode 100644 index 0000000..d02c55b --- /dev/null +++ b/overlays/tailscale.nix @@ -0,0 +1,22 @@ +let + tailscale = self: super: { + tailscale = super.callPackage "${super.path}/pkgs/servers/tailscale" { + buildGoModule = args: + super.buildGo119Module (args // rec { + version = "1.36.0"; + src = super.fetchFromGitHub { + owner = "tailscale"; + repo = "tailscale"; + rev = "v${version}"; + sha256 = "sha256-hNyEABs/GdfOx6vLTVBgbOzkbFvEDYZ0y1y0a0mIsfA="; + }; + vendorSha256 = "sha256-Jy3kjUA8qLhcw9XLw4Xo1zhD+IWZrDNM79TsbnKpx/g="; + ldflags = [ + "-X tailscale.com/version.Long=${version}" + "-X tailscale.com/version.Short=${version}" + ]; + }); + }; + }; + +in tailscale