Skip to content

Instantly share code, notes, and snippets.

@Denommus
Created September 6, 2017 18:10
Show Gist options
  • Save Denommus/da492682ebce88e3067e5555c28d420f to your computer and use it in GitHub Desktop.
Save Denommus/da492682ebce88e3067e5555c28d420f to your computer and use it in GitHub Desktop.
{ pkgs ? import <nixpkgs> {} }:
let
stdenv = pkgs.stdenv;
lib = stdenv.lib;
python = import ./requirements.nix { inherit pkgs; };
# The filter function will be used bellow by filterSource
filter = path: type: let baseName = baseNameOf (toString path); in
!(lib.hasSuffix ".sqlite3" baseName) &&
!(lib.hasSuffix ".log" baseName) &&
path != "./assets" &&
path != "ui/static/assets" &&
path != "static/assets" &&
baseName != "__pycache__";
in python.mkDerivation {
name = "auctionhouse-1.0.0";
# filterSource takes a function that takes path and type as params
# and allows me to specify which files to include in my src.
# I do this so some impure files (such as the sqlite database) doesn't
# affect the package
src = builtins.filterSource filter ./.;
# attrValues converts a directory into a list of values
buildInputs = builtins.attrValues python.packages ++ [ pkgs.which ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment