fix(tazjin/tverskoy): copy & paste some l2tp fix from nixpkgs#64965

Change-Id: Ib6375cd2281ce7eff87d9a1f8bd8f811ed180a87
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5155
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2022-02-01 12:17:42 +03:00 committed by clbot
parent 586f530ec4
commit 3122cdf0c4
3 changed files with 46 additions and 37 deletions

View file

@ -20,7 +20,7 @@ let
# Stable package set is imported, but not exposed, to overlay
# required packages into the unstable set.
stableNixpkgs = import depot.third_party.sources.nixpkgs-stable {};
stableNixpkgs = import depot.third_party.sources.nixpkgs-stable { };
# Overlay for packages that should come from the stable channel
# instead (e.g. because something is broken in unstable).

View file

@ -1,5 +1,6 @@
# This file has been generated by Niv.
_: let
_:
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
@ -43,14 +44,14 @@ _: let
mkPkgs = sources:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { };
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {}
import <nixpkgs> { }
else
abort
''
@ -90,7 +91,7 @@ _: let
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
@ -121,19 +122,22 @@ _: let
# Create the final "sources" from the config
mkSources = config:
mapAttrs (
mapAttrs
(
name: spec:
if builtins.hasAttr "outPath" spec
then abort
then
abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
) config.sources;
)
config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
, sources ? if isNull sourcesFile then { } else builtins.fromJSON (builtins.readFile sourcesFile)
, pkgs ? mkPkgs sources
}: rec {
# The sources, i.e. the attribute set of spec name to spec
@ -144,4 +148,4 @@ _: let
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }

View file

@ -145,6 +145,11 @@ lib.fix (self: {
];
};
# from https://github.com/NixOS/nixpkgs/issues/64965
environment.etc."ipsec.secrets".text = ''
include ipsec.d/ipsec.nm-l2tp.secrets
'';
security.rtkit.enable = true;
services = {