From 3552d9644caa2d4c2a733ea899d530e84ecee199 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Fri, 17 Jan 2020 10:29:51 -0500 Subject: [PATCH] nixos: pull CoreRAD package and module from unstable --- nixos/configuration.nix | 18 +++++++++------ nixos/corerad.nix | 3 +++ nixos/modules/corerad.nix | 46 --------------------------------------- nixos/pkgs/corerad.nix | 24 -------------------- 4 files changed, 14 insertions(+), 77 deletions(-) delete mode 100644 nixos/modules/corerad.nix delete mode 100644 nixos/pkgs/corerad.nix diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 7c51e5f..d7106af 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -4,7 +4,9 @@ { config, lib, pkgs, ... }: -let vars = import ./vars.nix; +let + vars = import ./vars.nix; + unstable = import {}; in { imports = [ @@ -21,17 +23,15 @@ in { ./dhcpd4.nix ./wgipamd.nix - # Modules which are not in nixpkgs. - ./modules/corerad.nix + # Unstable modules. + + + # 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 = { diff --git a/nixos/corerad.nix b/nixos/corerad.nix index 55ec848..1049ec0 100644 --- a/nixos/corerad.nix +++ b/nixos/corerad.nix @@ -2,6 +2,7 @@ let vars = import ./vars.nix; + unstable = import {}; 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. diff --git a/nixos/modules/corerad.nix b/nixos/modules/corerad.nix deleted file mode 100644 index 1a2c4ae..0000000 --- a/nixos/modules/corerad.nix +++ /dev/null @@ -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"; - }; - }; - }; -} diff --git a/nixos/pkgs/corerad.nix b/nixos/pkgs/corerad.nix deleted file mode 100644 index c06181d..0000000 --- a/nixos/pkgs/corerad.nix +++ /dev/null @@ -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 ]; - }; -}