Skip to content

Instantly share code, notes, and snippets.

View ppenguin's full-sized avatar

ppenguin ppenguin

View GitHub Profile
{pkgs, ...}: let
nu-grammar = pkgs.tree-sitter.buildGrammar {
language = "nu";
version = "0.0.0+rev=358c4f5";
src = pkgs.fetchFromGitHub {
owner = "nushell";
repo = "tree-sitter-nu";
rev = "2d0dd587dbfc3363d2af4e4141833e718647a67e";
hash = "sha256-A0Lpsx0VFRYUWetgX3Bn5osCsLQrZzg90unGg9kTnVg=";
};
@Pablo1107
Pablo1107 / README.md
Created June 3, 2023 20:24
Setup gvfs to work with Nautilus in Non-NixOS using Home Manager

Installing Nautilus directly from Nixpkgs in Non-NixOS systems have no support for mounting sftps and other features that needs gvfs.

The solution for this is to install gnome3.gvfs in your packages list and then setup the env variable like this:

home.packages = with pkgs; [
  gnome3.gvfs
  gnome3.nautilus
];
@Scoder12
Scoder12 / json2nix.py
Last active March 24, 2024 22:19
Converts JSON objects into nix (hackishly).
"""Converts JSON objects into nix (hackishly)."""
import sys
import json
INDENT = " " * 2
def strip_comments(t):
@MicahParks
MicahParks / go get private GitLab with group and subgroup (Golang modules).md
Last active January 12, 2024 05:43
go get private GitLab with group and subgroup (Golang modules)

Problem

The go command line tool needs to be able to fetch dependencies from your private GitLab, but authenticaiton is required.

This assumes your private GitLab is hosted at privategitlab.company.com.

Environment variables

The following environment variables are recommended:

export GO111MODULE=on
export GOPRIVATE=privategitlab.company.com
@walkermalling
walkermalling / luks-encrypted-root-on-nixos.org
Last active April 7, 2024 22:29
Nix Setup with LUKS encrypted root

Setting up NixOs with LUKS encrypted root

Here are my working notes on getting a system up and running.

WARNING: You can run into a hidden problem that will prevent a correct partition setup and /etc/nixos/configuration.nix from working: if you are setting up a UEFI system, then you need to make sure you boot into the NixOS installation from the UEFI partition of the bootable media. You may have to enter your BIOS boot selection menu to verify this. For example, if you setup a NixOS installer image on a flash drive, your BIOS menu may display several boot options from that flash drive: choose the one explicitly labeled with “UEFI”.

References

I used these resources:

@mtunjic
mtunjic / disable.sh
Last active March 31, 2024 18:12
Disable bunch of #$!@ in Catalina
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
self: super:
{
# Install overlay:
# $ mkdir -p ~/.config/nixpkgs/overlays
# $ curl https://gist.githubusercontent.com/LnL7/570349866bb69467d0caf5cb175faa74/raw/3f3d53fe8e8713ee321ee894ecf76edbcb0b3711/lnl-overlay.nix -o ~/.config/nixpkgs/overlays/lnl.nix
userPackages = super.userPackages or {} // {
# Example:
hello = self.hello;
@SLonger
SLonger / multipart_upload.go
Last active December 27, 2023 16:27 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang) , client create http request instead of html form.
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@mattdenner
mattdenner / README.markdown
Last active March 5, 2024 19:33
Suspend and then hibernate after 60 minutes

I found a post about suspending and then going into hibernate that included a really clever script. Turns out that with NixOS this is even esaier to coordinate as you have systemd so can have a before and after service. I just include this in my /etc/nixos/configuration.nix file and nixos-rebuild; then a systemctl suspend or a close of the lid will cause the hibernate timer to be set.

@wjordan
wjordan / dockerize.sh
Last active June 22, 2020 15:47
Dockerize: A tiny replacement for Dockerfiles
#!/bin/sh
####
# Dockerize: A tiny replacement for Dockerfiles
# This script leverages `docker run` and `docker commit` to provide a usable workaround for
# restrictions of `docker build` and Dockerfile syntax to strictly host-independent builds.
#
# See these discussions:
# https://github.com/docker/docker/pull/1124
# https://github.com/docker/docker/issues/3156
# https://github.com/docker/docker/issues/3949