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 / convert_url_files_to_bookmarks.sh
Created November 22, 2023 11:39 — forked from GeoffreyPlitt/convert_url_files_to_bookmarks.sh
Convert a folder of .URL files to a bookmarks.html file that can be imported into a browser
#!/bin/bash
#
# Run this script in a folder full of ".url" files, and pipe output to an HTML file.
# Example: ./convert_url_files_to_bookmarks.sh > bookmarks.html
echo "<!DOCTYPE NETSCAPE-Bookmark-file-1>"
echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">'
echo '<TITLE>Bookmarks</TITLE>'
echo '<H1>Bookmarks</H1>'
echo '<DL><p>'
@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
@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 / 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;
# 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
#!/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
@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).
@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 / 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 / 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;