Skip to content

Instantly share code, notes, and snippets.

@cleverca22
cleverca22 / 32bit-simple-test.nix
Last active September 8, 2019 12:43
patchelf util
with import <nixpkgs> { system = "i686-linux"; };
runCommandCC "filename" { buildInputs = [ gcc ]; } ''
cat <<EOF > $out
#!${stdenv.shell}
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath ${lib.makeLibraryPath [ zlib ]} \$1
EOF
chmod +x $out
''
# nix-repl
Welcome to Nix version 1.11.7. Type :? for help.
nix-repl> :l <nixpkgs>
Added 7228 variables.
nix-repl> builtins.unsafeGetAttrPos "writeText" pkgs
{ column = 3; file = "/nix/store/1hlbyz4ni8axnncpqvdjmi2fvcf90y49-nixos-17.09pre102667.2839b10/nixos/pkgs/build-support/trivial-builders.nix"; line = 52; }
nix-repl>
with import <nixpkgs> {};
let vendorgl = (linuxPackages.nvidia_x11.override {
libsOnly = true;
kernel = null;
}).overrideAttrs (oldAttrs: rec {
name = "nvidia-x11-367.27-${pkgs.linuxPackages.kernel.version}";
src = fetchurl {
url = "http://download.nvidia.com/XFree86/Linux-x86_64/367.27/NVIDIA-Linux-x86_64-367.27.run";
sha256 = "0000000000000000000000000000000000000000000000000000";
{
allowUnfree = true;
packageOverrides = pkgs: {
foo = pkgs.foo.override { stdenv = pkgs.clangStdenv; };
};
}
{ ... }:
{
nix = {
binaryCaches = [ "http://cache.earthtools.ca" ];
binaryCachePublicKeys = [ "c2d.localnet-1:YTVKcy9ZO3tqPNxRqeYEYxSpUH5C8ykZ9ImUKuugf4c=" ];
};
}
@cleverca22
cleverca22 / shell.nix
Created March 8, 2017 01:24 — forked from spacekitteh/shell.nix
trying to figure out nix shell
{ pkgs ? import <nixpkgs> {}, pkgs_i686 ? pkgs.pkgsi686Linux }:
rec {
myGit = pkgs.git.overrideDerivation (attrs: {
src = ./.;
withManual = false;
guiSupport = false;
tcl=null;
});
env = runCommand "env" { buildInputs = [ myGit ]; } "";
let
pkgs = import <nixpkgs> {};
callPackage = pkgs.newScope self;
self = {
foo = callPackage ./foo {};
};
in self
packageOverrides = pkgs: rec {
linux_4_4 = pkgs.linux_4_4.override {
extraConfig = ''
SCHEDSTATS y
LATENCYTOP y
'';
};
};
[clever@amd-nixos:/tmp/mnt]$ mkdir nix/store -pv
mkdir: created directory 'nix'
mkdir: created directory 'nix/store'
[clever@amd-nixos:/tmp/mnt]$ for x in $(nix-store -qR $(realpath /run/current-system/sw/bin/bash)); do nix-store --dump $x | nix-store --restore /tmp/mnt/$x ; done
[clever@amd-nixos:/tmp/mnt]$ ls nix/store/
2bid4ynk163hmypgz7b4aanq2i0d41c3-ncurses-6.0 cg0gxn11n6sadfrw3p7l8rh053gn3f0z-bash-4.4-p5 wxdn46939hsihi92z1f4shkal5nd6p3n-readline-7.0p0
3v5m2gn0kmxrg9xia0nqa491hmplvz2d-bash-4.4-p5 kk71vkqipf30qc165718jmp0s8cggn2y-glibc-2.24
@cleverca22
cleverca22 / 0_reuse_code.js
Created February 20, 2017 21:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console