Skip to content

Instantly share code, notes, and snippets.

View infinisil's full-sized avatar

Silvan Mosberger infinisil

  • Tweag
  • Switzerland
View GitHub Profile

Moved to

@infinisil
infinisil / default.nix
Last active December 31, 2023 17:25
LookingGrimm
{
system ? builtins.currentSystem,
pkgs ?
import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/tarball/cfc3698c31b1fb9cdcf10f36c9643460264d0ca8";
sha256 = "1xn1k48w678hjkrx434n995i68jwkxrwpncyjzrmfz0i9p2y7igh";
}) {
config = {};
overlays = [];
inherit system;
@infinisil
infinisil / builtins-local-paths.md
Last active November 20, 2023 23:20
Tutorial on outdated practices regarding using builtins on local paths

Setting up a local experiment

To experiment with source file selection, we'll set up a local project.

To start out, create a new directory, enter it, and set up niv to manage the Nixpkgs dependency:

$ mkdir select
$ cd select
$ nix-shell -p niv --run "niv init --nixpkgs nixos/nixpkgs --nixpkgs-branch nixos-unstable"
@infinisil
infinisil / nix-instantiate-pure
Created November 10, 2023 07:03
Hacky nix-instantiate with convenient pure evaluation mode
#!/usr/bin/env bash
# This is emulating flake's pure evaluation mode
purePathExpr() {
local arg=$1
if [[ -f "$arg" ]]; then
root=$(dirname "$arg")
else
root=$arg
fi
(import <nixpkgs/lib>).evalModules {
modules = [
./generic.nix
./specific1.nix
./specific2.nix
];
}
{ pkgs, lib, config, ... }: with lib.types;
let
postgresqlInstanceType = submodule {
options.connectionString = lib.mkOption {
type = str;
};
};
(import <nixpkgs/lib>).evalModules {
modules = [
({ lib, config, ... }: {
options.foo = lib.mkOption {
type = lib.types.int;
};
options.bar = lib.mkOption {
default = { };

let with

Originally described in NixOS/rfcs#110 (comment)

{ pkgs, hello }:
let
  with pkgs;
  myHello = hello.override { ... };
in [
- [f3031298b22e](https://github.com/NixOS/nixpkgs/commit/f3031298b22ed05a0b46728fa4f053a990a562f1) [@marsam](https://github.com/marsam) - chipsec: disable on non-Linux
- [2cdc05763f4f](https://github.com/NixOS/nixpkgs/commit/2cdc05763f4f857d04ead6c53fe8be23ec441903) [@marsam](https://github.com/marsam) - chipsec: disable on non-Linux
- [7bfde4b33400](https://github.com/NixOS/nixpkgs/commit/7bfde4b33400c1a9b5655a5b13960011a0d6740c) [@zimbatm](https://github.com/zimbatm) - Revert "st: enable build on darwin (#98668)"
- [020ff6989a9e](https://github.com/NixOS/nixpkgs/commit/020ff6989a9ee98f779dc5f9f74b96c4a8090f72) [@NeQuissimus](https://github.com/NeQuissimus) - 1password: 1.1.1 -> 1.7.0
- [5ab14bf6ad62](https://github.com/NixOS/nixpkgs/commit/5ab14bf6ad62873e39a3593d158b599b86267274) [@NeQuissimus](https://github.com/NeQuissimus) - vivaldi: 3.3.2022.39-1 -> 3.3.2022.47-1
- [5d4cc0e25c15](https://github.com/NixOS/nixpkgs/commit/5d4cc0e25c1589f4248c4534260c86647bc4ae73) [@rickynils](https://github.com/rickynils)