Skip to content

Instantly share code, notes, and snippets.

View LnL7's full-sized avatar
❄️
1970 /nix/store

Daiderd Jordan LnL7

❄️
1970 /nix/store
View GitHub Profile
@LnL7
LnL7 / nix.conf
Created December 2, 2019 19:45
sandboxing on darwin
sandbox = true
extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/env

Nix Flake MVP

Goals

  • To provide Nix repositories with an easy and standard way to reference other Nix repositories.

  • To allow such references to be queried and updated automatically.

  • To provide a replacement for nix-channel, NIX_PATH and Hydra

from __future__ import print_function
import sys
import tokenize
_is_declarative = True
with (getattr(tokenize, 'open', open))('setup.py') as setup_py:
_lines = []
for line in setup_py:
if _is_declarative and line.strip() not in ['import setuptools', 'from setuptools import setup', 'setup()', '']:
@LnL7
LnL7 / configure.sh
Last active June 9, 2020 20:13
darwin nix-daemon distributed builds
#!/usr/bin/env bash
sudo mkdir -p /run/nix/current-load
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo curl -fsSL -o /Library/LaunchDaemons/org.nixos.nix-daemon.plist https://gist.github.com/LnL7/ba2eac19e77cd6b4bb02c8de03bf5f4e/raw/69722c2b13c4eb022a1312cd6891838b413e1f96/org.nixos.nix-daemon.plist
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist
# Configure /etc/nix/machines
# Make sure root can ssh to the builder (known_hosts etc.)
@LnL7
LnL7 / authorized_keys
Last active May 2, 2018 15:22
Distributed builds setup (single user setup only)
command="/nix/var/nix/profiles/default/bin/nix-store --serve --write" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFiwKsqtlnuDyF+c9AJO+krQQmvWRtdvEM3d2FMwYOU0sVU1gGHXHpdb/QtvZyZV+bvSro+UfedJW+FaLMd+twun4llp/mlOEzKX6mz1xY6OtGIVc1a5wb2MY2Eb6aptlJUNzW469HqdvJKGlEOEcOt1b74WBERry5vNzGlS8MWX1qdjKlsnuQg6Xeb0XLLM7gi6S8x+H4ZuFtkjdaTC6Je+Gi61O1n845L767tOTHJZUDhCLPbwdg1zpwD+lMI10QgkPkgc9uatXkjvCcX8O51WxB2UTp4w4NwP/Lp5BZV/SgcbMUjhKNVtRDqH1CdRgQMg5Bo5WIyYatx/nAdb4P insecure docker key
@danbst
danbst / README.md
Last active March 7, 2020 21:32
nixq - jq but with Nix syntax

nixq - jq but with Nix syntax

Familliar syntax and all of <nixpkgs/lib> and builtins in your hands.

Now going through jq tutorial:

Identity filter

$ # jq
{ config, lib, pkgs, ...}:
with lib;
{
nix.package = pkgs.nixUnstable;
nix.trustedUsers = [ "hydra" ];
nix.binaryCaches = [ "http://cache.example.org" "https://cache.nixos.org" ];
nix.buildMachines = [
@LnL7
LnL7 / configuration.nix
Created September 16, 2017 22:05
nixos vagrant configuration
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
self: super:
{
# Install overlay:
# $ mkdir -p ~/.config/nixpkgs/overlays
# $ curl https://gist.githubusercontent.com/LnL7/570349866bb69467d0caf5cb175faa74/raw/3f3d53fe8e8713ee321ee894ecf76edbcb0b3711/lnl-overlay.nix -o ~/.config/nixpkgs/overlays/lnl.nix
userPackages = super.userPackages or {} // {
# Example:
hello = self.hello;
@LnL7
LnL7 / configuration.nix
Last active April 7, 2024 01:08
NixOS configuration overlays
{ config, pkgs, ... }:
let
# Import unstable channel.
# sudo nix-channel --add http://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable
# sudo nix-channel --update nixpkgs-unstable
unstable = import <nixpkgs-unstable> {};
in
{