diff --git a/README.md b/README.md index 4045708..4e9f497 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ Having deterministic fullstack in development has never been more awesome. ``` { pkgs ? import {} , projectName ? "myProject" + , lib ? (import {}).lib , nix-rehash ? import }: - with pkgs.lib; - with pkgs; + with lib; let services = nix-rehash.reService { @@ -63,9 +63,10 @@ host machine. Staging or deployments have never been easier :) ``` { pkgs ? import + , lib ? (import {}).lib , name ? "myProject" , nix-rehash ? import }: - with pkgs.lib; + with lib; with pkgs; { @@ -80,10 +81,10 @@ host machine. Staging or deployments have never been easier :) } ``` - do `nix-env [-f default.nix] -i myProject-container` or build with hydra and add a channel -- start container: `sudo myProject-start-container` +- start container: `sudo myProject-container-start` - ssh to container: `ssh localhost -p 25` - enable auto updates with cron: ``` * * * * * nix-env -i myProject-container && sudo $HOME/.nix-profile/bin/myProject-update-container ``` -- stop container: `sudo myProject-stop-container` +- stop container: `sudo myProject-container-stop` diff --git a/container.nix b/container.nix index 2ca836b..aebb7d8 100644 --- a/container.nix +++ b/container.nix @@ -1,11 +1,12 @@ { system ? builtins.currentSystem , pkgs ? import { inherit system; } +, lib ? (import { inherit system; }).lib , lxcExtraConfig ? "" , name , configuration }: with pkgs; - with pkgs.lib; + with lib; let container_root = "/var/lib/containers/${name}"; diff --git a/nix-services/default.nix b/nix-services/default.nix index 5db23b5..5ebb8f3 100644 --- a/nix-services/default.nix +++ b/nix-services/default.nix @@ -1,4 +1,5 @@ { system ? builtins.currentSystem +, lib ? (import { }).lib , pkgs ? import { inherit system; # Darwin needs a few packages overrides @@ -14,7 +15,7 @@ , name , configuration }: - with pkgs.lib; + with lib; let moduleList = [ diff --git a/nix-services/environment.nix b/nix-services/environment.nix index d8d5b7f..16935c8 100644 --- a/nix-services/environment.nix +++ b/nix-services/environment.nix @@ -1,5 +1,5 @@ -{ config, pkgs, ... }: -with pkgs.lib; +{ config, pkgs, lib, ... }: +with lib; { options = { environment.systemPackages = mkOption { diff --git a/nix-services/supervisord.nix b/nix-services/supervisord.nix index 8e681b9..6dde038 100644 --- a/nix-services/supervisord.nix +++ b/nix-services/supervisord.nix @@ -1,5 +1,5 @@ -{ config, pkgs, ... }: -with pkgs.lib; +{ config, pkgs, lib, ... }: +with lib; let serviceOpts = { name, config, ...}: { options = { @@ -50,7 +50,7 @@ let export PATH="${pkgs.coreutils}/bin" # Run start scripts first - "${config.userNix.startScript}" + ${config.userNix.startScript} # Run supervisord exec ${supervisor}/bin/supervisord -c "${config.supervisord.configFile}" $extraFlags "$@" diff --git a/nix-services/systemd.nix b/nix-services/systemd.nix index ce4e102..c6706be 100644 --- a/nix-services/systemd.nix +++ b/nix-services/systemd.nix @@ -1,10 +1,12 @@ -{ pkgs, config, ... }: - with pkgs.lib; +{ pkgs, config, lib, ... }: + with lib; with import { inherit config; - inherit (pkgs) lib; + inherit lib; }; let + eqStrings = a: b: (a+(substring 0 0 b)) == ((substring 0 0 a)+b); + services = config.systemd.services; isOneShot = cfg: hasAttr "Type" cfg.serviceConfig && cfg.serviceConfig.Type == "oneshot"; diff --git a/nix-services/user.nix b/nix-services/user.nix index b7dacbf..64688a8 100644 --- a/nix-services/user.nix +++ b/nix-services/user.nix @@ -1,5 +1,5 @@ -{ config, pkgs, ... }: -with pkgs.lib; +{ config, pkgs, lib, ... }: +with lib; { options = { userNix.startScripts = mkOption {