Do the same as the nix-info script, which nix-build
s 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
-- Shows how to implement an `instance Eq` for a GADT wrapped in an existential type. | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE TypeOperators #-} | |
import Data.Type.Equality | |
-- | A GADT. The example would also work if it had more than 1 type parameter. |
# 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; |
(bootloader) product:sunfish | |
(bootloader) serialno:17191JEC203691 | |
(bootloader) variant:SM7 UFS | |
(bootloader) max-download-size:0x10000000 | |
(bootloader) slot-suffixes:_a,_b | |
(bootloader) version-bootloader:s5-0.5-10252351 | |
(bootloader) version-baseband:g7150-00112-230505-B-10075601 | |
(bootloader) secure-boot:PRODUCTION | |
(bootloader) secure:yes | |
(bootloader) hw-revision:MP1.0 |
Do the same as the nix-info script, which nix-build
s 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
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. |
{ config, lib, pkgs, ... }: | |
with lib; | |
let | |
cfg = config.services.ceph-benaco; | |
inherit (pkgs.callPackage ../helpers.nix {}) ensureUnitExists; | |
in |
#!/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. |
#!/usr/bin/env python3 | |
# How to use: | |
# | |
# Ubuntu 16.04: apt install -y python-boto OR apt install -y python3-boto | |
# | |
# Specify the default profile on aws/boto profile files or use the optional AWS_PROFILE env var: | |
# AWS_PROFILE=example ./dehydrated -c -d example.com -t dns-01 -k /etc/dehydrated/hooks/route53.py | |
# | |
# Manually specify hosted zone: |
{ | |
# Inspired by https://github.com/NixOS/nixpkgs/blob/3dea1972737f5ce7b2c5461fe20370bad10aae03/nixos/modules/system/boot/systemd.nix#L202 | |
makePython3JobScriptWithPythonPackages = name: packagesSelectionFun: text: | |
let | |
shellEscape = (import <nixpkgs/nixos/modules/system/boot/systemd-lib.nix> (with pkgs; { inherit config pkgs lib; })).shellEscape; | |
mkScriptName = s: (builtins.replaceStrings [ "\\" ] [ "-" ] (shellEscape s) ); | |
x = pkgs.writeTextFile { name = "unit-script.py"; executable = true; destination = "/bin/${mkScriptName name}"; text = "#!/usr/bin/env python3\n${text}"; }; | |
deriv = pkgs.stdenv.mkDerivation { | |
name = mkScriptName name; | |
buildInputs = [ (pkgs.python36.withPackages (pythonPackages: packagesSelectionFun pythonPackages)) ]; |