Advertisement
fp01

nixos overlay for postgresql extraPlugins

May 19th, 2018
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.88 KB | None | 0 0
  1. # Below is /etc/nixos/overlays/overlay-1/default.nix
  2. self: super: {
  3. overlay1 = super.fetchFromGitHub {
  4. owner = "NixOS";
  5. repo = "nixpkgs";
  6. # nixos-master as of 2018-05-16T08:47:00-00:00
  7. rev = "e03acfe161f6c28518211df6a9d1611c84957b8f";
  8. sha256 = "00bjc83dp1i18ndfs0sy5hlfhwigd3308m0sij6l62155jsnr8vw";
  9. };
  10. }
  11.  
  12. # below is /etc/nixos/configuration.nix
  13. # the important part is where overlay1 is referenced to include it and secondly to access it when adding postgres extraPlugins.
  14. # if you search for "line 129" this is where nixos-rebuild switch errors out.
  15. # the error from running nixos-rebuild switch is:
  16. [root@nixos:~]# nixos-rebuild switch
  17. building Nix...
  18. building the system configuration...
  19. error: attribute 'cstore_fdw' missing, at /etc/nixos/configuration.nix:129:12
  20. (use '--show-trace' to show detailed location information)
  21.  
  22. # configuration.nix below:
  23.  
  24. # Edit this configuration file to define what should be installed on
  25. # your system. Help is available in the configuration.nix(5) man page
  26. # and in the NixOS manual (accessible by running ‘nixos-help’).
  27.  
  28. { config, lib, pkgs, ... }:
  29.  
  30. {
  31. imports =
  32. [ # Include the results of the hardware scan.
  33. ./hardware-configuration.nix
  34. ];
  35.  
  36. nixpkgs = { overlays = [ (import ./overlays/overlay-1) ]; };
  37. # Use the GRUB 2 boot loader.
  38. boot.loader.grub.enable = true;
  39. boot.loader.grub.version = 2;
  40. # boot.loader.grub.efiSupport = true;
  41. # boot.loader.grub.efiInstallAsRemovable = true;
  42. # boot.loader.efi.efiSysMountPoint = "/boot/efi";
  43. # Define on which hard drive you want to install Grub.
  44. boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
  45. boot.initrd.checkJournalingFS = false;
  46. boot.initrd.kernelModules = [ "hv_vmbus" "hv_netvsc" "hv_utils" "hv_storvsc" ];
  47. boot.kernelParams = ["nomodeset" ];
  48.  
  49. #networking.hostName = "nixos"; # Define your hostname.
  50. #networking.interfaces.eth0.ipv4.addresses = [ { address = "192.168.0.3"; prefixLength = 24; } ];
  51. #networking.defaultGateway = "192.168.0.1";
  52. #networking.nameservers = [ "192.168.0.2" ];
  53. # example from https://nixos.org/nix-dev/2012-August/009680.html
  54. networking = {
  55. hostName = "nixos";
  56. #enableIPv6 = true;
  57. useDHCP = false;
  58. defaultGateway = "192.168.0.99";
  59. nameservers = [ "192.168.0.2" ];
  60. interfaces = [ { name = "eth0"; ipv4.addresses = [ { address = "192.168.0.3"; prefixLength = 24; } ]; } ];
  61. # localCommands = "ip route add default via 2a03:2900:2:1::1";
  62. };
  63. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
  64.  
  65. # Select internationalisation properties.
  66. i18n = {
  67. consoleFont = "Lat2-Terminus16";
  68. consoleKeyMap = "us";
  69. defaultLocale = "en_US.UTF-8";
  70. };
  71.  
  72. # Set your time zone.
  73. time.timeZone = "America/Puerto_Rico";
  74.  
  75. nix.nixPath = [
  76. "nixpkgs-overlays=/etc/nixos/overlays/"
  77. ];
  78. nixpkgs.config.allowUnfree = true;
  79. #nixpkgs.config.packageOverrides = with pkgs; {
  80. # timescaledb = callPackage <nixpkgs/timescaledb.nix { postgresql = pkgs.postgresql100; };
  81. #};
  82. # List packages installed in system profile. To search by name, run:
  83. # $ nix-env -qaP | grep wget
  84. environment.systemPackages = with pkgs; [
  85. wget vim curl screen git vscode python python36 gnumake chromium firefox
  86. findutils mono58 telnet unrar unzip wine zip libreoffice
  87. #pg_repack psqlodbc timescaledb
  88. overlay1.postgresql overlay1.timescaledb
  89. python27Packages.psycopg2 python36Packages.psycopg2
  90. pg_top pgadmin pgcli pgmanage postgis pg_repack
  91. overlay1.pg_topn overlay1.pg_cron overlay1.cstore_fdw
  92. clickhouse grafana
  93. fsharp41
  94. azure-vhd-utils
  95. ];
  96.  
  97.  
  98. # Some programs need SUID wrappers, can be configured further or are
  99. # started in user sessions.
  100. # programs.bash.enableCompletion = true;
  101. # programs.mtr.enable = true;
  102. # programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
  103.  
  104. # List services that you want to enable:
  105.  
  106. # Enable the OpenSSH daemon.
  107. services.openssh.enable = true;
  108. services.openssh.extraConfig = ''
  109. ClientAliveInterval 180
  110. '';
  111.  
  112. # Open ports in the firewall.
  113. # networking.firewall.allowedTCPPorts = [ ... ];
  114. # networking.firewall.allowedUDPPorts = [ ... ];
  115. # Or disable the firewall altogether.
  116. networking.firewall.enable = false;
  117.  
  118. # Enable CUPS to print documents.
  119. # services.printing.enable = true;
  120.  
  121. # Enable sound.
  122. # sound.enable = true;
  123. # hardware.pulseaudio.enable = true;
  124.  
  125. # Enable the X11 windowing system.
  126. services.xserver.enable = true;
  127. services.xserver.layout = "us";
  128. services.xserver.xkbOptions = "eurosign:e";
  129.  
  130. # enable postgresql
  131. # but also see nixos evolution of these options here:
  132. # https://github.com/NixOS/nixpkgs/pull/38698
  133. # For override syntax, see
  134. # https://github.com/NixOS/nixpkgs/issues/21042
  135. # https://github.com/NixOS/nixpkgs/issues/38616
  136. services.postgresql = {
  137. enable = true;
  138. package = pkgs.overlay1.postgresql100;
  139. enableTCPIP = true;
  140. dataDir = "/data/pgdb";
  141. authentication = pkgs.lib.mkOverride 10 ''
  142. local all all trust
  143. host all all 192.168.0.0/24 trust
  144. '';
  145. extraPlugins = [
  146. (pkgs.timescaledb.override { postgresql = pkgs.overlay1.postgresql100; })
  147. (pkgs.postage.override { postgresql = pkgs.overlay1.postgresql100; })
  148. (pkgs.pg_repack.override { postgresql = pkgs.overlay1.postgresql100; })
  149. (pkgs.postgis.override { postgresql = pkgs.overlay1.postgresql100; })
  150. #(pkgs.overlay1.pg_cron.override { postgresql = pkgs.overlay1.postgresql100; })
  151. #(pkgs.pg_topn.override { postgresql = pkgs.overlay1.postgresql100; })
  152. (pkgs.overlay1.cstore_fdw.override { postgresql = pkgs.overlay1.postgresql100; }) #line 129 where the error is
  153. ];
  154. extraConfig = "shared_preload_libraries = 'timescaledb'";
  155. };
  156. services.pgmanage.enable = true;
  157. services.pgmanage.connections = { myserver = "host=localhost port=5432 dbname=postgres"; };
  158.  
  159. # Enable touchpad support.
  160. # services.xserver.libinput.enable = true;
  161.  
  162. # Enable the KDE Desktop Environment.
  163. services.xserver.displayManager.sddm.enable = true;
  164. services.xserver.desktopManager.plasma5.enable = true;
  165.  
  166. # Define a user account. Don't forget to set a password with ‘passwd’.
  167. # users.extraUsers.guest = {
  168. # isNormalUser = true;
  169. # uid = 1000;
  170. # };
  171. users.extraUsers.u1 = {
  172. isNormalUser = true;
  173. home = "/home/u2";
  174. description = "u1";
  175. extraGroups = [ "wheel" "networkmanager" ];
  176. uid = 1000;
  177. };
  178.  
  179. # This value determines the NixOS release with which your system is to be
  180. # compatible, in order to avoid breaking some software such as database
  181. # servers. You should change this only after NixOS release notes say you
  182. # should.
  183. system.stateVersion = "18.03"; # Did you read the comment?
  184.  
  185. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement