Skip to content

Instantly share code, notes, and snippets.

View Frontear's full-sized avatar

Ali Rizvi Frontear

View GitHub Profile
@Frontear
Frontear / flake.nix
Last active April 21, 2024 05:42
little devshell to try and build a flutter environment
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, ... } @ inputs:
let
# https://ayats.org/blog/no-flake-utils
eachSystem = function: inputs.nixpkgs.lib.genAttrs [
"x86_64-linux"
@Frontear
Frontear / benchmarks.md
Last active August 13, 2025 17:10
Lix/Nix/Nix-Super Benchmarks

Benchmarking Nix (and its derivatives)

The configuration used for testing was my own, and can be found at Frontear/dotfiles. To test in much the same way, the following command was used to run 10 isolated benchmarks:

# This was run within the root of my repo.
# To obtain working versions of the other nix* derivatives, use `nix shell` so that there is no overhead in processing the store.

for i in $(seq 1 10); do
 time nix eval '.#nixosConfigurations.LAPTOP-3DT4F02.config.system.build.toplevel.drvPath' --no-eval-cache
@Frontear
Frontear / transform.py
Created August 12, 2025 00:03
A quick python script I wrote to transform the base16 colors of the onedark theme
#!/usr/bin/env python3
import yaml
import colorsys
def hex2rgb(hex: str) -> tuple[int]:
return tuple(int(hex[i:i+2], 16) for i in (0, 2, 4))
def rgb2hex(rgb: tuple[int]):
return "%x%x%x" % rgb
@Frontear
Frontear / results.md
Last active October 8, 2025 14:01
Some of the erroneous behavior of Nix

String interpolating a relative or absolute path value will cause Nix to copy the contents at that path to the store before constructing the string. (NixOS/nix#9428)

  • This has I/O implications for evaluation times, especially for large files/directories
  • This will error out if the path does not exist or if the user lacks permissions to view it
  • In a flake-controlled project (which is already copied as part of evaluation), this creates duplicate store objects

Solutions:

  • Avoid string interpolating path values. Use builtins.toString if you need the values to be a string.
  • Avoid using path values in general, and prefer using a generic string ("/var/empty" instead of /var/empty)