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:
parent
586f530ec4
commit
3122cdf0c4
3 changed files with 46 additions and 37 deletions
2
third_party/nixpkgs/default.nix
vendored
2
third_party/nixpkgs/default.nix
vendored
|
@ -20,7 +20,7 @@ let
|
||||||
|
|
||||||
# Stable package set is imported, but not exposed, to overlay
|
# Stable package set is imported, but not exposed, to overlay
|
||||||
# required packages into the unstable set.
|
# 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
|
# Overlay for packages that should come from the stable channel
|
||||||
# instead (e.g. because something is broken in unstable).
|
# instead (e.g. because something is broken in unstable).
|
||||||
|
|
22
third_party/sources/default.nix
vendored
22
third_party/sources/default.nix
vendored
|
@ -1,5 +1,6 @@
|
||||||
# This file has been generated by Niv.
|
# This file has been generated by Niv.
|
||||||
_: let
|
_:
|
||||||
|
let
|
||||||
|
|
||||||
#
|
#
|
||||||
# The fetchers. fetch_<type> fetches specs of type <type>.
|
# The fetchers. fetch_<type> fetches specs of type <type>.
|
||||||
|
@ -43,14 +44,14 @@ _: let
|
||||||
mkPkgs = sources:
|
mkPkgs = sources:
|
||||||
let
|
let
|
||||||
sourcesNixpkgs =
|
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;
|
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
|
||||||
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
||||||
in
|
in
|
||||||
if builtins.hasAttr "nixpkgs" sources
|
if builtins.hasAttr "nixpkgs" sources
|
||||||
then sourcesNixpkgs
|
then sourcesNixpkgs
|
||||||
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
||||||
import <nixpkgs> {}
|
import <nixpkgs> { }
|
||||||
else
|
else
|
||||||
abort
|
abort
|
||||||
''
|
''
|
||||||
|
@ -90,7 +91,7 @@ _: let
|
||||||
);
|
);
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
|
# 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
|
# 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));
|
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
|
# Create the final "sources" from the config
|
||||||
mkSources = config:
|
mkSources = config:
|
||||||
mapAttrs (
|
mapAttrs
|
||||||
|
(
|
||||||
name: spec:
|
name: spec:
|
||||||
if builtins.hasAttr "outPath" spec
|
if builtins.hasAttr "outPath" spec
|
||||||
then abort
|
then
|
||||||
|
abort
|
||||||
"The values in sources.json should not have an 'outPath' attribute"
|
"The values in sources.json should not have an 'outPath' attribute"
|
||||||
else
|
else
|
||||||
spec // { outPath = replace name (fetch config.pkgs name spec); }
|
spec // { outPath = replace name (fetch config.pkgs name spec); }
|
||||||
) config.sources;
|
)
|
||||||
|
config.sources;
|
||||||
|
|
||||||
# The "config" used by the fetchers
|
# The "config" used by the fetchers
|
||||||
mkConfig =
|
mkConfig =
|
||||||
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
|
{ 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
|
, pkgs ? mkPkgs sources
|
||||||
}: rec {
|
}: rec {
|
||||||
# The sources, i.e. the attribute set of spec name to spec
|
# The sources, i.e. the attribute set of spec name to spec
|
||||||
|
@ -144,4 +148,4 @@ _: let
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
|
mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }
|
||||||
|
|
|
@ -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;
|
security.rtkit.enable = true;
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
|
Loading…
Reference in a new issue