-
-
Save betaboon/ba03b01f29347234efb3fe8add1bc620 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
network.description = "example"; | |
vbox = { | |
deployment.targetEnv = "virtualbox"; | |
deployment.virtualbox.memorySize = 512; | |
deployment.virtualbox.vcpu = 1; | |
deployment.virtualbox.headless = true; | |
}; | |
example = { resources, ... }: { | |
deployment.targetEnv = "container"; | |
deployment.container.host = resources.machines.vbox; | |
nixpkgs.overlays = [ (import <nixpkgs-overlays>) ]; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self: super: | |
let | |
packageOverrides = self: super: with self; { | |
example = super.callPackage ./packages/python/example { }; | |
}; | |
in rec { | |
python2 = super.python2.override { inherit packageOverrides; }; | |
python3 = super.python3.override { inherit packageOverrides; }; | |
python2Packages = self.python2.pkgs; | |
python3Packages = self.python3.pkgs; | |
example = callPackage ./packages/applications/example {}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
deploymentName = "example"; | |
# create the nixops statefile in this directory | |
# this is done, so that it can be included in git | |
stateFilePath = builtins.toPath ./. + "/localstate.nixops"; | |
# Use a specific revision of nixpkgs-channel | |
nixpkgsRevision = "c99239b"; | |
pkgsSrc = builtins.fetchTarball { url = | |
"https://github.com/nixos/nixpkgs-channels" + | |
"/archive/${nixpkgsRevision}.tar.gz"; | |
}; | |
pkgs = (import pkgsSrc { | |
overlays = [ (import ./overlay.nix) ]; | |
}); | |
# TODO in production this should point to a git-commit of a seperate repo | |
overlaySrc = builtins.toPath ./. + "/overlay.nix"; | |
nixPath = pkgs.lib.concatStringsSep ":" [ | |
pkgs.path | |
"nixpkgs=${pkgs.path}" | |
"nixpkgs-overlays=${overlaySrc}" | |
"." | |
]; | |
in | |
pkgs.stdenv.mkDerivation rec { | |
name = "nixops-env"; | |
buildInputs = with pkgs; [ nixops ]; | |
shellHook = '' | |
export NIX_PATH=${nixPath} | |
export NIXOPS_DEPLOYMENT=${deploymentName} | |
export NIXOPS_STATE=${stateFilePath} | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run with:
$ nix-shell --run "nixops create && nixops deploy"