├── examples ├── nixpkgs-config.nix │ ├── allow-unfree-and-broken │ │ └── config.nix │ ├── override-existing-packages │ │ └── config.nix │ └── declarative-user-environments │ │ └── config.nix ├── nix-shell │ ├── R-examples │ │ └── simple-example │ │ │ └── shell.nix │ ├── simple-example │ │ └── shell.nix │ ├── python-shebang │ │ └── test.py │ ├── override-python-package-version │ │ └── shell.nix │ ├── simple-cxx-stuff │ │ └── shell.nix │ ├── php-examples │ │ └── shell.nix │ ├── pinning-nixpkgs │ │ └── shell.nix │ ├── pinning-nixpkgs-custom-pkgs │ │ └── shell.nix │ ├── README.md │ └── pinning-nixpkgs-custom-pkgs-2 │ │ └── shell.nix ├── nix-env │ ├── declarative-user-environment.md │ └── ad-hoc.md ├── nixops │ ├── load-balancer-ec2.nix │ └── load-balancer.nix └── nixos │ └── vbox │ └── configuration.nix ├── docs └── resolving-problems.md ├── README.md └── LICENSE /examples/nixpkgs-config.nix/allow-unfree-and-broken/config.nix: -------------------------------------------------------------------------------- 1 | { 2 | allowUnfree = true; 3 | allowBroken = true; 4 | } 5 | -------------------------------------------------------------------------------- /examples/nix-shell/R-examples/simple-example/shell.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import {} }: 2 | with pkgs; 3 | stdenv.mkDerivation rec { 4 | name = "my-R-project"; 5 | src = if lib.inNixShell then null else ./.; 6 | buildInputs = with rPackages; [ 7 | R 8 | devtools 9 | ggplot2 10 | knitr 11 | optparse 12 | reshape2 13 | yaml 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /examples/nix-shell/simple-example/shell.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import {} }: 2 | 3 | with pkgs; 4 | stdenv.mkDerivation rec { 5 | name = "simple"; 6 | 7 | buildInputs = [ git 8 | vim 9 | netcdf 10 | ]; 11 | 12 | shellHook = '' 13 | echo "Welcome to your new shell"; 14 | export PS1="\n\[\033[1;32m\][${name}-shell:\w]$\[\033[0m\] " 15 | ''; 16 | } -------------------------------------------------------------------------------- /examples/nix-env/declarative-user-environment.md: -------------------------------------------------------------------------------- 1 | ### Declaratively manage your user environment 2 | To declaratively manage your user environment you can add your tools to `~/.nixpkgs/config.nix` like so [config.nix](/examples/nixpkgs-config.nix/declarative-user-environments/config.nix). 3 | 4 | There is also some work in progress on user services: 5 | - [nixuser](https://github.com/NixOS/nixpkgs/pull/9250) 6 | 7 | And some stuff to managing dotfiles: 8 | - [nix-home](https://github.com/sheenobu/nix-home) 9 | -------------------------------------------------------------------------------- /examples/nix-shell/python-shebang/test.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env nix-shell 2 | #! nix-shell --pure -i python -p 'python3.withPackages(ps: with ps; [ prettytable requests ])' 3 | 4 | import prettytable 5 | 6 | # Print a simple table. 7 | t = prettytable.PrettyTable(["N", "N^2"]) 8 | for n in range(1, 10): t.add_row([n, n * n]) 9 | print(t) 10 | 11 | ####### 12 | 13 | import requests 14 | r = requests.get('https://api.github.com/events') 15 | r = requests.post('http://httpbin.org/post', data = {'key':'value'}) 16 | print(r) 17 | 18 | -------------------------------------------------------------------------------- /examples/nix-shell/override-python-package-version/shell.nix: -------------------------------------------------------------------------------- 1 | with import {}; 2 | ( 3 | let 4 | packageOverrides = self: super: { 5 | flask = super.flask.overrideDerivation (oldAttrs: { 6 | name = "flask-0.12"; 7 | src = fetchurl { 8 | url = "https://pypi.python.org/packages/4b/3a/4c20183df155dd2e39168e35d53a388efb384a512ca6c73001d8292c094a/Flask-0.12.tar.gz"; 9 | sha256 = "12yasybryp33rdchsqgckf15zj4pjfam7ly5spmn2sijpv6h7s4k"; 10 | }; 11 | }); 12 | }; 13 | in (pkgs.python35.override {inherit packageOverrides;}).withPackages (ps: [ps.flask_login ps.numpy]) 14 | ).env 15 | 16 | -------------------------------------------------------------------------------- /examples/nixpkgs-config.nix/override-existing-packages/config.nix: -------------------------------------------------------------------------------- 1 | { 2 | packageOverrides = pkgs: rec { 3 | # Make "grib-api" build the python extensions 4 | grib-api = pkgs.grib-api.override { 5 | enablePython = true; 6 | }; 7 | # Use different sed version than in nixpkgs 8 | gnused = pkgs.gnused.overrideDerivation (oldAttrs: { 9 | name = "sed-4.2.2-pre"; 10 | src = fetchurl { 11 | url = ftp://alpha.gnu.org/gnu/sed/sed-4.2.2-pre.tar.bz2; 12 | sha256 = "11nq06d131y4wmf3drm0yk502d2xc6n5qy82cg88rb9nqd2lj41k"; 13 | }; 14 | patches = []; 15 | }); 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /docs/resolving-problems.md: -------------------------------------------------------------------------------- 1 | ## Build errors: 2 | ### Source/patch not available anymore 3 | If you can find the file somewhere else online, use 4 | ```bash 5 | nix-prefetch-url $THE_FILE_THAT_IS_MISSING 6 | ``` 7 | 8 | 9 | ### Binary cache is down: 10 | If you get a message similar to this: 11 | ```bash 12 | download-from-binary-cache.pl: still waiting for ‘https://cache.nixos.org/s62b4isbam2v42yp5vpf1rcxrfpamih6.narinfo’ after 5 seconds... 13 | ``` 14 | It means cache.nixos.org is currently down. 15 | You can use the option `--option connect-timeout 2`, to make nix give up on downloading the file after two seconds and starts a local build. -------------------------------------------------------------------------------- /examples/nix-shell/simple-cxx-stuff/shell.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import {} }: 2 | with pkgs; 3 | stdenv.mkDerivation rec { 4 | name = "saphir"; 5 | src = if lib.inNixShell then null else ./.; # Avoid copying of src dir when using nix-shell 6 | buildInputs = [ stdenv 7 | # Actual dependencies 8 | armadillo 9 | boost 10 | catch 11 | cmake 12 | nanoflann 13 | proj 14 | gdal 15 | zlib 16 | grib-api 17 | gfortran 18 | ]; 19 | enableParallelBuilding = true; 20 | } 21 | -------------------------------------------------------------------------------- /examples/nixops/load-balancer-ec2.nix: -------------------------------------------------------------------------------- 1 | let 2 | 3 | region = "eu-west-1"; 4 | accessKeyId = "at-dev"; # symbolic name looked up in ~/.ec2-keys 5 | 6 | ec2 = 7 | { resources, ... }: 8 | { deployment.targetEnv = "ec2"; 9 | deployment.ec2.accessKeyId = accessKeyId; 10 | deployment.ec2.region = region; 11 | deployment.ec2.instanceType = "m1.small"; 12 | deployment.ec2.keyPair = resources.ec2KeyPairs.my-key-pair; 13 | }; 14 | 15 | in 16 | { proxy = ec2; 17 | backend1 = ec2; 18 | backend2 = ec2; 19 | 20 | # Provision an EC2 key pair. 21 | resources.ec2KeyPairs.my-key-pair = 22 | { inherit region accessKeyId; }; 23 | } -------------------------------------------------------------------------------- /examples/nix-shell/php-examples/shell.nix: -------------------------------------------------------------------------------- 1 | {nixpkgs ? null}: 2 | let 3 | pinnedPkg = (import {}).fetchFromGitHub { 4 | owner = "NixOS"; 5 | repo = "nixpkgs"; 6 | rev = "8ef3eaeb4e531929ec29a880cb4c67f790e5eb70"; 7 | sha256 = "1v9lgk3j394i91qz1h7cv6mbg6xkdllfccc902ydb1gvp6bzmh6z"; 8 | }; 9 | pkgs = if nixpkgs==null then 10 | import pinnedPkg {} 11 | else 12 | import nixpkgs {}; 13 | in with pkgs; stdenv.mkDerivation rec { 14 | name = "bebenmeldung"; 15 | src = if lib.inNixShell then null else ./.; # Avoid copying of src dir when using nix-shell 16 | buildInputs = [ stdenv 17 | php70Packages.composer 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /examples/nix-env/ad-hoc.md: -------------------------------------------------------------------------------- 1 | ### Listing installed packages 2 | ```bash 3 | nix-env -q 4 | ``` 5 | 6 | ### Listing available packages 7 | ```bash 8 | nix-env -qaP 9 | ``` 10 | 11 | ### Installing packages 12 | ```bash 13 | nix-env -iA nixpkgs.gitFull 14 | ``` 15 | 16 | ### Removing packages 17 | ```bash 18 | nix-env -e git 19 | ``` 20 | (It's best you copy paste the name, which you got from `nix-env -q`) 21 | 22 | ### Updating packages 23 | 24 | 25 | First update your channel 26 | ```bash 27 | nix-channel --update 28 | ``` 29 | 30 | See what's available 31 | ```bash 32 | nix-env -qc 33 | ``` 34 | 35 | Update everything 36 | ```bash 37 | nix-env -u --keep-going --leq 38 | ``` 39 | 40 | ### Show dependencies 41 | ```bash 42 | nix-store --query --references\ 43 | $(nix-instantiate '' -A emacs) 44 | ``` 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nix-cheatsheet 2 | I use this repository as a reference for the `nix` commands, which I use most often. 3 | 4 | 5 | ## My stuff 6 | 7 | - [⚙ Development environments](examples/nix-shell/README.md) 8 | - [💡 Ad-hoc user package management](examples/nix-env/ad-hoc.md) 9 | - [📋 Declarative user package management](examples/nix-env/declarative-user-environment.md) 10 | - [🕵 Defining private pkgs based on nixpkgs](https://github.com/knedlsepp/pkgs-on-nixpkgs) 11 | - [😭 Resolving problems](docs/resolving-problems.md) 12 | 13 | 14 | 15 | ## External links 16 | 17 | - [📖 nix manual](https://nixos.org/nixpkgs/manual/) 18 | - [📖 nixpkgs manual](https://nixos.org/nixpkgs/manual/) 19 | - [📖 nixOS manual](https://nixos.org/nixos/manual/) 20 | - [📖 nixops manual](https://nixos.org/nixops/manual/) 21 | - [🏗 hydra CI server](https://hydra.nixos.org/jobset/nixpkgs/trunk) 22 | - [👨‍🏫 Introductory talk by fpletz@froscon2016](http://slides.com/fpletz/nixos-froscon2016) 23 | -------------------------------------------------------------------------------- /examples/nixpkgs-config.nix/declarative-user-environments/config.nix: -------------------------------------------------------------------------------- 1 | { 2 | allowUnfree = true; 3 | allowBroken = true; 4 | packageOverrides = pkgs: rec { 5 | # Install via 6 | # nix-env -iA nixpkgs.my-default-toolset 7 | my-default-toolset = pkgs.buildEnv { 8 | name = "my-default-toolset"; 9 | paths = with pkgs; [ 10 | cmakeCurses 11 | fish 12 | gdal 13 | wget 14 | gitAndTools.gitFull 15 | htop 16 | # meld 17 | nixops 18 | # pandoc # This is not exactly lightweight 19 | ponysay 20 | tree 21 | vagrant 22 | ] ++ stdenv.lib.optionals (stdenv.isLinux) [ 23 | atom 24 | ]; 25 | }; 26 | # Start via: 27 | # nix-shell -p nixpkgs.cxx-dev-env 28 | cxx-dev-env = pkgs.buildEnv { 29 | name = "my-dev-env"; 30 | paths = with pkgs; [ 31 | cgdb 32 | valgrind 33 | ] ++ stdenv.lib.optionals (stdenv.isLinux) [ 34 | readelf 35 | ]; 36 | }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /examples/nix-shell/pinning-nixpkgs/shell.nix: -------------------------------------------------------------------------------- 1 | # To get the pinned nixpkgs simply use: 2 | # nix-shell 3 | # If you want to use a different nixpkgs version use: 4 | # export NIX_PATH=nixpkgs-1509=https://github.com/NixOS/nixpkgs-channels/archive/nixos-15.09.tar.gz:$NIX_PATH 5 | # nix-shell --arg nixpkgs "" 6 | # export NIX_PATH=my-nixpkgs=$HOME/my-fork:$NIX_PATH 7 | # nix-shell --arg nixpkgs "" 8 | {nixpkgs ? null}: 9 | let 10 | pinnedPkg = (import {}).fetchFromGitHub { 11 | owner = "NixOS"; 12 | repo = "nixpkgs"; 13 | rev = "8ef3eaeb4e531929ec29a880cb4c67f790e5eb70"; 14 | sha256 = "1v9lgk3j394i91qz1h7cv6mbg6xkdllfccc902ydb1gvp6bzmh6z"; 15 | }; 16 | pkgs = if nixpkgs==null then 17 | import pinnedPkg {} 18 | else 19 | import {}; 20 | in with pkgs; stdenv.mkDerivation rec { 21 | name = "some-python-project"; 22 | src = if lib.inNixShell then null else ./.; # Avoid copying of src dir when using nix-shell 23 | buildInputs = [ stdenv 24 | pythonPackages.numpy 25 | pythonPackages.ipython 26 | ]; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Josef Kemetmüller 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/nixops/load-balancer.nix: -------------------------------------------------------------------------------- 1 | let 2 | 3 | backend = 4 | { config, pkgs, ... }: 5 | { services.httpd.enable = true; 6 | services.httpd.adminAddr = "alice@example.org"; 7 | services.httpd.documentRoot = "${pkgs.valgrind.doc}/share/doc/valgrind/html"; 8 | networking.firewall.allowedTCPPorts = [ 80 ]; 9 | }; 10 | 11 | in 12 | 13 | { 14 | network.description = "Load balancing network"; 15 | 16 | proxy = 17 | { config, pkgs, nodes, ... }: 18 | { services.httpd.enable = true; 19 | services.httpd.adminAddr = "bob@example.org"; 20 | services.httpd.extraModules = ["proxy_balancer" "lbmethod_byrequests"]; 21 | services.httpd.extraConfig = 22 | '' 23 | 24 | Allow from all 25 | BalancerMember http://backend1 retry=0 26 | BalancerMember http://backend2 retry=0 27 | 28 | ProxyPass / balancer://cluster/ 29 | ProxyPassReverse / balancer://cluster/ 30 | ''; 31 | networking.firewall.allowedTCPPorts = [ 80 ]; 32 | }; 33 | 34 | backend1 = backend; 35 | backend2 = backend; 36 | } -------------------------------------------------------------------------------- /examples/nix-shell/pinning-nixpkgs-custom-pkgs/shell.nix: -------------------------------------------------------------------------------- 1 | 2 | {nixpkgs ? null}: 3 | let 4 | pinnedPkg = (import {}).fetchFromGitHub { 5 | owner = "NixOS"; 6 | repo = "nixpkgs"; 7 | rev = "8ef3eaeb4e531929ec29a880cb4c67f790e5eb70"; 8 | sha256 = "1v9lgk3j394i91qz1h7cv6mbg6xkdllfccc902ydb1gvp6bzmh6z"; 9 | }; 10 | pkgs = if nixpkgs==null then 11 | import pinnedPkg {} 12 | else 13 | import {}; 14 | my_pythonPackages = rec { 15 | pint = pkgs.pythonPackages.buildPythonPackage rec { 16 | name = "Pint-${version}"; 17 | version = "0.7.2"; 18 | src = pkgs.fetchurl { 19 | url = "mirror://pypi/p/pint/${name}.tar.gz"; 20 | sha256 = "38b97d352a6376bb4e957095c8b75c1c2aa8edbf9a7ccf058d69b147862e77ad"; 21 | }; 22 | }; 23 | }; 24 | in with pkgs; stdenv.mkDerivation rec { 25 | name = "some-python-project"; 26 | src = if lib.inNixShell then null else ./.; # Avoid copying of src dir when using nix-shell 27 | buildInputs = [ stdenv 28 | pythonPackages.numpy 29 | pythonPackages.pandas 30 | my_pythonPackages.pint 31 | ]; 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /examples/nix-shell/README.md: -------------------------------------------------------------------------------- 1 | ### Starting shells with `--packages` (or `-p`) 2 | ```bash 3 | nix-shell --packages git 4 | nix-shell --packages pythonPackages.ipython pythonPackages.numpy 5 | ``` 6 | ### List which packages are available 7 | ```bash 8 | nix-env -qaP 9 | ``` 10 | 11 | ### Starting shells with a `shell.nix` file 12 | In a directory, which contains a `shell.nix` file, simply run: 13 | ```bash 14 | nix-shell 15 | ``` 16 | - Here is a [simple example](simple-example/shell.nix) 17 | - A [C++ Cmake example](simple-cxx-stuff/shell.nix) 18 | - Pin a nixpkgs version [like this](pinning-nixpkgs/shell.nix) 19 | - Define packages not in the official repository [like this](pinning-nixpkgs-custom-pkgs/shell.nix) 20 | - Override (python-)package versions already in the official repository [like this](override-python-package-version/shell.nix) 21 | 22 | You can find other examples of files [here](./): 23 | 24 | 25 | ### Starting a pure shell via `--pure` 26 | To get a shell cleaned from all environment variables use: 27 | ```bash 28 | nix-shell --pure 29 | ``` 30 | 31 | ### Running a command via `--run` 32 | 33 | ```bash 34 | nix-shell -p atom --run "atom" 35 | ``` 36 | 37 | ```bash 38 | nix-shell --pure -p pythonPackages.jupyter pythonPackages.numpy --run jupyter-notebook 39 | ``` 40 | 41 | ```bash 42 | nix-shell -p ponysay --run "ponysay 'This is great.'" 43 | ``` 44 | 45 | ### Keep a nix-shell from being garbage collected 46 | To make a nix-shell persistent and avoid it being garbage collected do the following: 47 | 48 | ```bash 49 | cd 50 | mkdir gcroots 51 | nix-shell ./shell.nix --pure --indirect --add-root gcroots/dep 52 | ``` 53 | -------------------------------------------------------------------------------- /examples/nixos/vbox/configuration.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | with lib; 4 | 5 | { 6 | imports = 7 | [ 8 | 9 | 10 | 11 | ]; 12 | 13 | # FIXME: UUID detection is currently broken 14 | boot.loader.grub.fsIdentifier = "provided"; 15 | 16 | # Allow mounting of shared folders. 17 | users.extraUsers.demo.extraGroups = [ "vboxsf" ]; 18 | 19 | environment.systemPackages = with pkgs; [ vim 20 | git 21 | lynx 22 | tree 23 | htop 24 | gdal ]; 25 | # For german keyboard and umlauts 26 | i18n = { 27 | consoleKeyMap = "de-latin1-nodeadkeys"; 28 | defaultLocale = "de_DE.UTF-8"; 29 | }; 30 | 31 | # Gitlab-Configuration: 32 | 33 | services.nginx = { 34 | enable = true; 35 | recommendedGzipSettings = true; 36 | recommendedOptimisation = true; 37 | recommendedProxySettings = true; 38 | recommendedTlsSettings = true; 39 | virtualHosts."git.example.at" = { 40 | # enableACME = true; 41 | # forceSSL = true; 42 | # locations."/".proxyPass = "http://unix:/run/gitlab/gitlab-workhorse.socket"; 43 | }; 44 | }; 45 | 46 | 47 | #services.gitlab.enable = true; 48 | ## (TODO: Passwords!) 49 | #services.gitlab.databasePassword = "password"; 50 | #services.gitlab.secrets.secret = "30charrandomstuff"; 51 | #services.gitlab.secrets.otp = "30charrandomstuff"; 52 | #services.gitlab.secrets.db = "30charrandomstuff"; 53 | #systemd.services.gitlab.serviceConfig.TimeoutStartSec = "10min"; 54 | 55 | # Add some more video drivers to give X11 a shot at working in 56 | # VMware and QEMU. 57 | services.xserver.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" ]; 58 | 59 | # SVN-Server: 60 | services.httpd.enable = true; 61 | services.httpd.adminAddr = "noone@example.at"; 62 | services.httpd.subservices = { 63 | subversion = { 64 | enable = true; 65 | dataDir = "/var/subversion"; 66 | notificationSender = "asdf@example.at"; 67 | }; 68 | }; 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /examples/nix-shell/pinning-nixpkgs-custom-pkgs-2/shell.nix: -------------------------------------------------------------------------------- 1 | {nixpkgs ? null}: 2 | let 3 | pinnedPkg = (import {}).fetchFromGitHub { 4 | owner = "NixOS"; 5 | repo = "nixpkgs"; 6 | rev = "8ef3eaeb4e531929ec29a880cb4c67f790e5eb70"; 7 | sha256 = "1v9lgk3j394i91qz1h7cv6mbg6xkdllfccc902ydb1gvp6bzmh6z"; 8 | }; 9 | pkgs = if nixpkgs==null then 10 | import pinnedPkg {} 11 | else 12 | import nixpkgs {}; 13 | not_yet_in_nixpkgs = rec { 14 | aniso8601 = pkgs.python35Packages.buildPythonPackage rec { 15 | name = "aniso8601-${version}"; 16 | version = "1.2.0"; 17 | src = pkgs.fetchFromBitbucket { 18 | owner = "nielsenb"; 19 | repo = "aniso8601"; 20 | rev = "v${version}"; 21 | sha256 = "0jrlix76h09vxsayphlvzs3ach2bm526i66h3zaqh3m4sflzxj2w"; 22 | }; 23 | propagatedBuildInputs = with pkgs; [ 24 | python35Packages.dateutil 25 | ]; 26 | }; 27 | 28 | flask-restful = pkgs.python35Packages.buildPythonPackage rec { 29 | name = "Flask-RESTful-${version}"; 30 | version = "0.3.5"; 31 | src = pkgs.fetchurl{ 32 | url = "https://pypi.io/packages/source/f/flask-restful/Flask-RESTful-${version}.tar.gz"; 33 | sha256 = "cce4aeff959b571136b5af098bebe7d3deeca7eb1411c4e722ff2c5356ab4c42"; 34 | }; 35 | buildInputs = with pkgs; [ 36 | python35Packages.nose 37 | ]; 38 | doCheck = false; # FIXME: Currently fails because of some extraction stuff 39 | propagatedBuildInputs = with pkgs; [ 40 | aniso8601 41 | python35Packages.flask 42 | python35Packages.pytz 43 | python35Packages.six 44 | ]; 45 | }; 46 | 47 | livereload = pkgs.python35Packages.buildPythonPackage rec { 48 | name = "livereload-${version}"; 49 | version = "2.5.0"; 50 | src = pkgs.fetchurl { 51 | url = "mirror://pypi/l/livereload/${name}.tar.gz"; 52 | sha256 = "bc708b46e22dff243c02e709c636ffeb8a64cdd019c95a215304e6ce183c4859"; 53 | }; 54 | propagatedBuildInputs = with pkgs; [ 55 | python35Packages.six 56 | python35Packages.tornado 57 | ]; 58 | }; 59 | 60 | mkdocs = pkgs.python35Packages.buildPythonPackage rec { 61 | name = "mkdocs-${version}"; 62 | version = "0.16.0"; 63 | src = pkgs.fetchurl { 64 | url = "mirror://pypi/m/mkdocs/${name}.tar.gz"; 65 | sha256 = "ab674a1545713af8e2542f3732aa1cc84a233ac008aa1cab81ebab7b7a56bdf7"; 66 | }; 67 | doCheck = false; # FIXME: Some UTF8 errors :-/ 68 | buildInputs = with pkgs; [ 69 | python35Packages.mock 70 | ]; 71 | propagatedBuildInputs = with pkgs; [ 72 | livereload 73 | python35Packages.jinja2 74 | python35Packages.markdown 75 | python35Packages.pyyaml 76 | python35Packages.click 77 | python35Packages.tornado 78 | ]; 79 | }; 80 | 81 | pint = pkgs.python35Packages.buildPythonPackage rec { 82 | name = "Pint-${version}"; 83 | version = "0.7.2"; 84 | src = pkgs.fetchurl { 85 | url = "mirror://pypi/p/pint/${name}.tar.gz"; 86 | sha256 = "38b97d352a6376bb4e957095c8b75c1c2aa8edbf9a7ccf058d69b147862e77ad"; 87 | }; 88 | }; 89 | 90 | yamlordereddictloader = pkgs.python35Packages.buildPythonPackage rec { 91 | name = "yamlordereddictloader-${version}"; 92 | version = "0.1.1"; 93 | src = pkgs.fetchFromGitHub { 94 | owner = "fmenabe"; 95 | repo = "python-yamlordereddictloader"; 96 | rev = "${version}"; 97 | sha256 = "1x1dj33sw22kpbvhcmsf7x3qzqbnajc5i3bian7x2ykwhy8yk1hs"; 98 | }; 99 | propagatedBuildInputs = with pkgs; [ 100 | python35Packages.pyyaml 101 | ]; 102 | }; 103 | }; 104 | 105 | in with pkgs; with not_yet_in_nixpkgs; stdenv.mkDerivation rec { 106 | shellHook = '' 107 | export PS1="\n\[\033[1;32m\][${name}-shell:\w]$\[\033[0m\] " 108 | ''; 109 | name = "climvis"; 110 | src = if lib.inNixShell then null else ./.; # Avoid copying of src dir when using nix-shell 111 | buildInputs = [ stdenv 112 | # Dependencies which are not yet in nixpkgs 113 | flask-restful 114 | mkdocs 115 | pint 116 | yamlordereddictloader 117 | # Dependencies which are already in nixpkgs 118 | python35Packages.flask 119 | python35Packages.flask-cors 120 | python35Packages.isodate 121 | python35Packages.markdown 122 | python35Packages.nose 123 | python35Packages.numpy 124 | python35Packages.pillow 125 | python35Packages.pyflakes 126 | python35Packages.pygments 127 | python35Packages.pyodbc 128 | python35Packages.pyparsing 129 | python35Packages.pyyaml 130 | python35Packages.requests2 131 | 132 | ]; 133 | installPhase= '' 134 | ''; 135 | } 136 | --------------------------------------------------------------------------------