From d5025c552911b29bb8f2250c5b4aa1f9917a68e4 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 3 Apr 2020 21:12:54 -0700 Subject: Add wemux to the dev machine I also had to refactor the overlays stuff a bit, but it is much nicer now. --- Com/Simatime/Dev/configuration.nix | 2 ++ Com/Simatime/Prod/configuration.nix | 2 +- Com/Simatime/buildOS.nix | 8 +++--- default.nix | 15 ++++++++--- overlay.nix | 50 +++++++++++++++++++++++++++++++++++++ overlays.nix | 35 -------------------------- 6 files changed, 67 insertions(+), 45 deletions(-) create mode 100644 overlay.nix delete mode 100644 overlays.nix diff --git a/Com/Simatime/Dev/configuration.nix b/Com/Simatime/Dev/configuration.nix index d6b3f4b..96a5b89 100644 --- a/Com/Simatime/Dev/configuration.nix +++ b/Com/Simatime/Dev/configuration.nix @@ -51,6 +51,8 @@ in { fira fira-code fira-code-symbols ]; + environment.systemPackages = [ pkgs.wemux ]; + nixpkgs = { config = { allowUnfree = true; diff --git a/Com/Simatime/Prod/configuration.nix b/Com/Simatime/Prod/configuration.nix index d5ad02f..0a1d4fc 100644 --- a/Com/Simatime/Prod/configuration.nix +++ b/Com/Simatime/Prod/configuration.nix @@ -5,7 +5,7 @@ enable = true; domain = "que.run"; port = 3000; - package = pkgs.biz.que-server; + package = pkgs.que-server; }; services.nginx.enable = true; } diff --git a/Com/Simatime/buildOS.nix b/Com/Simatime/buildOS.nix index eb20d88..636377e 100644 --- a/Com/Simatime/buildOS.nix +++ b/Com/Simatime/buildOS.nix @@ -4,7 +4,7 @@ nixos: , vpnConnectTo ? "" , vpnRsaPrivateKeyFile ? null , vpnEd25519PrivateKeyFile ? null -, deps ? {} # added under pkgs.biz +, deps ? {} # an attrset overlayed to pkgs , configuration # see: configuration.nix(5) }: # assert enableVpn -> builtins.isString ipAddress; @@ -16,9 +16,7 @@ let Ed25519PrivateKeyFile = "${vpnEd25519PrivateKeyFile}" PrivateKeyFile = "${vpnRsaPrivateKeyFile}" '' else ""; - bizpkgs = self: super: { - biz = deps; - }; + overlay = self: super: deps; defaults = { boot.cleanTmpDir = true; #networking.interfaces.simatime-vpn = [{ ipv4.address = ipAddress; }]; @@ -28,7 +26,7 @@ let nix.maxJobs = 1; # "auto"; nix.optimise.automatic = true; nix.optimise.dates = [ "Sunday 02:30" ]; - nixpkgs.overlays = [ bizpkgs ]; + nixpkgs.overlays = [ overlay ]; programs.mosh.enable = true; programs.mosh.withUtempter = true; security.acme.email = "ben@bsima.me"; diff --git a/default.nix b/default.nix index 9ac2286..e213bc4 100644 --- a/default.nix +++ b/default.nix @@ -1,11 +1,11 @@ let nixpkgs-tar = builtins.fetchTarball (import ./nixpkgs.nix); - overlay = import ./overlays.nix; - nixpkgs = import "${nixpkgs-tar}" { overlays = [ overlay ]; }; + overlay = import ./overlay.nix; + bizpkgs = import "${nixpkgs-tar}" { overlays = [ overlay ]; }; nixos = import "${nixpkgs-tar}/nixos"; # TODO(bsima): buildNixOS should be split into multiple functions that each # return one thing, instead of a single function that returns multiple things - biz = import ./biz.nix { inherit nixpkgs; }; + biz = import ./biz.nix { nixpkgs = bizpkgs; }; buildOS = import ./Com/Simatime/buildOS.nix nixos; nixos-mailserver = let ver = "v2.3.0"; in builtins.fetchTarball { url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/${ver}/nixos-mailserver-${ver}.tar.gz"; @@ -40,6 +40,9 @@ in rec { Com.Simatime.Dev = buildOS { enableVpn = true; ipAddress = "73.222.221.63"; + deps = { + wemux = bizpkgs.wemux; + }; configuration = { imports = [ ./Com/Simatime/packages.nix @@ -54,7 +57,9 @@ in rec { # The production server for apps # Com.Simatime.Prod = buildOS { - deps = { que-server = Run.Que.Server; }; + deps = { + que-server = Run.Que.Server; + }; configuration = { imports = [ ./Com/Simatime/packages.nix @@ -79,4 +84,6 @@ in rec { Run.Que.Website = biz.buildGhc ./Run/Que/Website.hs; # Development environment repl = biz.globalGhc; + # Fall through to any of our overlay packages + inherit bizpkgs; } diff --git a/overlay.nix b/overlay.nix new file mode 100644 index 0000000..77bf9b4 --- /dev/null +++ b/overlay.nix @@ -0,0 +1,50 @@ +self: super: + +let + claySrc = super.pkgs.fetchFromGitHub { + owner = "sebastiaanvisser"; + repo = "clay"; + rev = "cc7729b1b42a79e261091ff7835f7fc2a7ae3cee"; + sha256 = "1vd67976lvi5l4qq18zy6j44apynkl44ps04p8vwfx4gzr895dyp"; + }; +in { + haskell = super.haskell // { + packages = super.haskell.packages // { + ghc865 = super.haskell.packages.ghc865.override (old: { + overrides = with super.pkgs.haskell.lib; self: super: { + clay = self.callCabal2nix "clay" claySrc {}; + wai-middleware-metrics = dontCheck super.wai-middleware-metrics; + }; + }); + ghcjs = super.haskell.packages.ghcjs.override (old: { + overrides = with super.haskell.lib; self: super: { + QuickCheck = dontCheck super.QuickCheck; + base-compat-batteries = dontCheck super.http-types; + clay = dontCheck (self.callCabal2nix "clay" claySrc {}); + comonad = dontCheck super.comonad; + http-types = dontCheck super.http-types; + network-uri= dontCheck super.network-uri; + scientific = dontCheck super.scientific; # takes forever + servant = dontCheck super.servant; + tasty-quickcheck = dontCheck super.tasty-quickcheck; + time-compat = dontCheck super.time-compat; + }; + }); + }; + }; + wemux = super.stdenv.mkDerivation rec { + name = "wemux"; + version = "2020.04.03"; + src = super.pkgs.fetchFromGitHub { + owner = "zolrath"; + repo = "wemux"; + rev = "01c6541f8deceff372711241db2a13f21c4b210c"; + sha256 = "1y962nzvs7sf720pl3wa582l6irxc8vavd0gp4ag4243b2gs4qvm"; + }; + installPhase = '' + mkdir -p $out/bin + cp ${src}/wemux $out/bin + chmod +x $out/bin/wemux + ''; + }; +} diff --git a/overlays.nix b/overlays.nix deleted file mode 100644 index 5da2957..0000000 --- a/overlays.nix +++ /dev/null @@ -1,35 +0,0 @@ -self: super: - -let - claySrc = super.pkgs.fetchFromGitHub { - owner = "sebastiaanvisser"; - repo = "clay"; - rev = "cc7729b1b42a79e261091ff7835f7fc2a7ae3cee"; - sha256 = "1vd67976lvi5l4qq18zy6j44apynkl44ps04p8vwfx4gzr895dyp"; - }; -in { - haskell = super.haskell // { - packages = super.haskell.packages // { - ghc865 = super.haskell.packages.ghc865.override (old: { - overrides = with super.pkgs.haskell.lib; self: super: { - clay = self.callCabal2nix "clay" claySrc {}; - wai-middleware-metrics = dontCheck super.wai-middleware-metrics; - }; - }); - ghcjs = super.haskell.packages.ghcjs.override (old: { - overrides = with super.haskell.lib; self: super: { - QuickCheck = dontCheck super.QuickCheck; - base-compat-batteries = dontCheck super.http-types; - clay = dontCheck (self.callCabal2nix "clay" claySrc {}); - comonad = dontCheck super.comonad; - http-types = dontCheck super.http-types; - network-uri= dontCheck super.network-uri; - scientific = dontCheck super.scientific; # takes forever - servant = dontCheck super.servant; - tasty-quickcheck = dontCheck super.tasty-quickcheck; - time-compat = dontCheck super.time-compat; - }; - }); - }; - }; -} -- cgit v1.2.3