Do the same as the nix-info script, which nix-builds this file and inspects the exit code.
Short version:
nix-build --no-out-link -E 'import <nixpkgs/pkgs/tools/nix/info/multiuser.nix>' 2> /dev/null
| #!/usr/bin/env bash | |
| # Installs NixOS on an OVH server, wiping the server. | |
| # | |
| # This is for a specific server configuration; adjust where needed. | |
| # Originally written for an OVH STOR-1 server. | |
| # | |
| # Prerequisites: | |
| # * Create a LUKS key file at /root/benacofs-luks-key | |
| # e.g. by copying it up. |
| { config, lib, pkgs, ... }: | |
| with lib; | |
| let | |
| cfg = config.services.ceph-benaco; | |
| inherit (pkgs.callPackage ../helpers.nix {}) ensureUnitExists; | |
| in |
Do the same as the nix-info script, which nix-builds this file and inspects the exit code.
Short version:
nix-build --no-out-link -E 'import <nixpkgs/pkgs/tools/nix/info/multiuser.nix>' 2> /dev/null
| # Build with: | |
| # NIX_PATH=nixpkgs=$HOME/src/nixpkgs nix-build --no-link '<nixpkgs/nixos>' -A config.system.build.tarball -I nixos-config=thisfile.nix | |
| # You can also use | |
| # -A config.system.build.toplevel | |
| # to build something you can browse locally (that uses symlinks into your nix store). | |
| {config, pkgs, ...}: | |
| { | |
| # We need no bootloader, because the Chromebook can't use that anyway. | |
| boot.loader.grub.enable = false; |
| -- Creates the table recording the current migration. | |
| SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; | |
| BEGIN; | |
| -- Note: `create or replace function` cannot be run concurrently; postgres | |
| -- will error with "tuple concurrently updated" when that happens. | |
| -- That's why we wrap it in a transaction-level exclusive advisory lock. | |
| -- See http://stackoverflow.com/questions/40525684/tuple-concurrently-updated-when-creating-functions-in-postgresql-pl-pgsql/44101303 |
I believe the following is the best way to work with Nagle's algorithm / TCP_NODELAY / TCP_CORK.
It is described in this RedHat manual and the verdict is:
TCP_NODELAY = 1, always.writev(), prefer that.TCP_CORK = 1, then write the data, then set TCP_CORK = 0.| {-# LANGUAGE ScopedTypeVariables, BangPatterns #-} | |
| -- Example of how forM_ [1..N] is slow | |
| module Main (main) where | |
| import Prelude hiding (read) | |
| import Control.Monad | |
| import Data.Vector ((!), Vector) | |
| import qualified Data.Vector as V |
| import numpy as np | |
| import numpy.linalg | |
| # Relevant links: | |
| # - http://stackoverflow.com/a/32244818/263061 (solution with scale) | |
| # - "Least-Squares Rigid Motion Using SVD" (no scale but easy proofs and explains how weights could be added) | |
| # Rigidly (+scale) aligns two point clouds with know point-to-point correspondences | |
| # with least-squares error. |
| # This `firefox-vm.nix` builds a simple NixOS VM with XFCE and Firefox inside. | |
| # | |
| # Build and run it with: | |
| # | |
| # nix-build '<nixpkgs/nixos>' -A vm -I nixos-config=./firefox-vm.nix | |
| # result/bin/run-nixos-vm | |
| # | |
| # Log in as "root" with empty password. | |
| # | |
| # To delete the VM state (storage): |