1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00

nixos: pull CoreRAD package and module from unstable

This commit is contained in:
Matt Layher 2020-01-17 10:29:51 -05:00
parent a07880e259
commit 3552d9644c
4 changed files with 14 additions and 77 deletions

View file

@ -4,7 +4,9 @@
{ config, lib, pkgs, ... }:
let vars = import ./vars.nix;
let
vars = import ./vars.nix;
unstable = import <unstable> {};
in {
imports = [
@ -21,17 +23,15 @@ in {
./dhcpd4.nix
./wgipamd.nix
# Modules which are not in nixpkgs.
./modules/corerad.nix
# Unstable modules.
<unstable/nixos/modules/services/networking/corerad.nix>
# Out-of-tree modules.
./modules/wgipamd.nix
];
nixpkgs.overlays = [
(self: super: {
# Packages which are not in nixpkgs.
corerad = super.callPackage ./pkgs/corerad.nix {
buildGoModule = super.buildGo113Module;
};
wgipamd = super.callPackage ./pkgs/wgipamd.nix {
buildGoModule = super.buildGo113Module;
};
@ -80,6 +80,7 @@ in {
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# Stable packages.
bind
byobu
cbfstool
@ -100,6 +101,9 @@ in {
tmux
wget
wireguard-tools
# Unstable packages.
unstable.corerad
];
services = {

View file

@ -2,6 +2,7 @@
let
vars = import ./vars.nix;
unstable = import <unstable> {};
guest0 = vars.interfaces.guest0;
iot0 = vars.interfaces.iot0;
@ -11,6 +12,8 @@ let
in {
services.corerad = {
enable = true;
# Use unstable package until CoreRAD reaches stable.
package = unstable.corerad;
configFile = pkgs.writeText "corerad.toml" ''
# CoreRAD vALPHA configuration file.

View file

@ -1,46 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.corerad;
in {
meta = {
maintainers = with maintainers; [ mdlayher ];
};
options.services.corerad = {
enable = mkEnableOption "CoreRAD IPv6 NDP RA daemon";
configFile = mkOption {
type = types.path;
example = literalExample "\"\${pkgs.corerad}/etc/corerad/corerad.toml\"";
description = "Path to CoreRAD TOML configuration file.";
};
package = mkOption {
default = pkgs.corerad;
defaultText = literalExample "pkgs.corerad";
type = types.package;
description = "CoreRAD package to use.";
};
};
config = mkIf cfg.enable {
systemd.services.corerad = {
description = "CoreRAD IPv6 NDP RA daemon";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
LimitNPROC = 512;
LimitNOFILE = 1048576;
CapabilityBoundingSet = "CAP_NET_ADMIN CAP_NET_RAW";
AmbientCapabilities = "CAP_NET_ADMIN CAP_NET_RAW";
NoNewPrivileges = true;
DynamicUser = true;
ExecStart = "${getBin cfg.package}/bin/corerad -c=${cfg.configFile}";
Restart = "on-failure";
};
};
};
}

View file

@ -1,24 +0,0 @@
{ stdenv, buildGoModule, fetchFromGitHub }:
buildGoModule rec {
pname = "corerad";
version = "0.1.7";
goPackagePath = "github.com/mdlayher/corerad";
src = fetchFromGitHub {
owner = "mdlayher";
repo = "corerad";
rev = "v${version}";
sha256 = "0qn179kvzbm4jgrrfs1l5j9q328bxa3wwyhz1pcnqr05f6bzpjx3";
};
modSha256 = "0biiyjlpidxi1h211wrfwd47snij69ck2rf4yiiajmmnyhsh2x2y";
meta = with stdenv.lib; {
homepage = "https://github.com/mdlayher/corerad";
description = "CoreRAD extensible and observable IPv6 NDP RA daemon";
license = licenses.asl20;
maintainers = with maintainers; [ mdlayher ];
};
}