Skip to content

Instantly share code, notes, and snippets.

View nixinator's full-sized avatar
❄️
nix-build -E "with import <nixpkgs> {}; callPackage ./default.nix {}"

Lee Hughes nixinator

❄️
nix-build -E "with import <nixpkgs> {}; callPackage ./default.nix {}"
View GitHub Profile
@nixinator
nixinator / shit.sh
Created September 27, 2021 16:16
runner get it
#!/bin/sh
registration_url="https://api.github.com/repos/ArdanaLabs/DanaSwapStats/actions/runners/registration-token"
echo "Requesting registration URL at '${registration_url}'"
payload=$(curl -sX POST -H "Authorization: token ${GITHUB_PAT}" ${registration_url})
#export RUNNER_TOKEN=$(echo $payload | jq .token --raw-output)
echo RUNNER_TOKEN=$(echo $payload | jq .token --raw-output)
@nixinator
nixinator / xreadkeys.c
Created November 15, 2021 10:23 — forked from javiercantero/xreadkeys.c
A X11/Xlib program that reads the KeyPress and KeyRelease events from the window and prints them to the standard output. Used to debug the keyboard within X.
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
Display *display;
Window window;
XEvent event;
int s;
@nixinator
nixinator / start-nixos-containers.sh
Created November 29, 2021 23:47
start nixos containers manually
for i in $(nixos-container list); do nixos-container start $i && sleep 10; done
@nixinator
nixinator / gist:3cfc531ac662ced3a16ae9ea86c6d447
Last active December 3, 2021 00:02
The missing syntactic sugar to actually get many default.nix examples to run.
nix-build -E "with import <nixpkgs> {}; callPackage ./default.nix {}"
#the greatest thing about nix code is there so many ways to exectute it, the worse thing about nix code is that there are so many ways to exectute it
@nixinator
nixinator / gist:61b9e76d2ced6bda9c2d6acc66e3a24e
Last active December 3, 2021 02:16
nix-shell with a local checkout of nixpkgs
nix-shell -p hello /path/to/a/local/checkout/of/nixpkgs
(i don't think this actually works).
however
nix-shell -p hello -I nixpkgs=/path/to/a/local/checkout/of/nixpkgs
(definity works).
#!/bin/sh
sudo -s
parted /dev/vda -- mklabel msdos
parted /dev/vda -- mkpart primary 1MiB -2GiB
parted /dev/vda -- mkpart primary linux-swap -2GiB 100%
mkfs.xfs -L nixos /dev/vda1
mkswap -L swap /dev/vda2
swapon /dev/vda2
# 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
@nixinator
nixinator / gist:08a9b9a64b96b406ee2701cc09858650
Created February 4, 2022 11:39
nix flake for build a single package from nixpkgs, this builds an unfree package.
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
};
outputs = { self, nixpkgs }:
let
myNixpkgs = import nixpkgs { config.allowUnfree = true; system = "x86_64-linux"; };
in
{
packages.x86_64-linux.cudaThing = myNixpkgs.python3Packages.tensorflowWithCuda;
@nixinator
nixinator / gist:973acec14021073576a6e5bcc6808c7d
Created February 4, 2022 11:43
build without cache old tooling
nix-build '<nixpkgs>' -A openscad --option build-use-substitutes false
@nixinator
nixinator / flake.nix
Created March 24, 2023 04:31
lief try building this
[nix-shell:~/src/cowsay]$ cat flake.nix
{
description = "A simple script that runs cowsay";
outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux = self.packages.x86_64-linux.my-script;
packages.x86_64-linux.my-script =
let