Skip to content

Instantly share code, notes, and snippets.

@cleverca22
cleverca22 / default.nix
Created August 28, 2019 10:56 — forked from idontgetoutmuch/default.nix
pkg config generation
{ stdenv, fetchurl, gfortran }:
stdenv.mkDerivation rec {
name = "blas-${version}";
version = "3.8.0";
src = fetchurl {
url = "http://www.netlib.org/blas/${name}.tgz";
sha256 = "1s24iry5197pskml4iygasw196bdhplj0jmbsb9jhabcjqj2mpsm";
};
{ pkgs ? import ./nix/nixpkgs.nix {} }:
with pkgs;
haskellPackages.extend (self: super: {
polysemy = self.callHackageDirect {
pkg = "polysemy";
ver = "1.1.0.0";
sha256 = "1krbhfs6sr9m6nxhs9ygkblwd85w234hll5g7ndzhdwy5pfbyfvm";
} {};
self: super:
let
pythonOverlay = pself: psuper:
{
sundials_3_lapack = pself.callPackage ./pkgs/sundials { };
myScikits-odes = pself.callPackage ./pkgs/scikits-odes { };
};
in {
pythonPackages = super.pythonPackages.override { overrides = pythonOverlay; };
}
# in rails project
with (import <nixpkgs> {});
let
rubyenv = bundlerEnv {
name = "cart-env";
# Setup for ruby gems using bundix generated gemset.nix
inherit ruby_2_6;
gemfile = ./Gemfile;
nix-repl> eval = import <nixpkgs/nixos> { configuration = ./snmpd.nix; }
nix-repl> eval.config.systemd.units."snmpd.service".unit
«derivation /nix/store/q8nq58244hw0v04w400kzwllxwb42zrg-unit-snmpd.service.drv»

attrset ? "key" and attrset.key or fallback have nearly equal complexity costs

if attrset ? "key" then attrset.key else fallback is slightly more expensive,

due to being 3 AST nodes (an ExprIf with an ExprOpHasAttr as the condition and then an ExprSelect to extract the "key")

attrset.key or fallback is slightly cheaper, since it is a single AST node (just ExprSelect)

{ mkDerivation, base, stdenv, ... }@args:
mkDerivation {
pname = "nix-assert-bug";
version = "0.1.0.0";
src = ./.;
libraryHaskellDepends = [ args."assert" base ];
license = stdenv.lib.licenses.bsd3;
}
{ lib, config, pkgs, ... }:
{
imports = [ ./iscsi-boot.nix ];
fileSystems = {
"/" = { device = "UUID=132e7c5b-b4a9-4154-8105-4479e17f4f5b"; fsType = "ext4"; };
"/boot/" = { device = "UUID=fdac080d-d111-455c-a890-bc3e5e08c2d5"; fsType = "ext4"; };
};
boot = {
loader = {
{ fetchFromGitHub }:
fetchFromGitHub {
owner = "gazoscalvertos";
repo = "Hass-Custom-Alarm";
rev = "v1.3.1";
sha256 = "1xlwsyg45kmvx3gvkv7k5imbhkxan0s573lalkcqcflf078w7555";
}
subnet 192.168.2.0 netmask 255.255.255.0 {
option domain-search "localnet";
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.2.255;
option routers 192.168.2.1;
option domain-name-servers 192.168.2.1;
range 192.168.2.100 192.168.2.200;
next-server 192.168.2.61;
if exists user-class and option user-class = "iPXE" {
filename "http://c2d.localnet/boot.php?mac=${net0/mac}&asset=${asset:uristring}";