Skip to content

Instantly share code, notes, and snippets.

@FlorianDevP
FlorianDevP / configuration.nix
Last active April 30, 2025 11:38
WSL NixOS configuration
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
# NixOS-WSL specific options are documented on the NixOS-WSL repository:
# https://github.com/nix-community/NixOS-WSL
{ config, lib, pkgs, ... }:
{
@FlorianDevP
FlorianDevP / home.nix
Last active April 30, 2025 11:36
NixOS Home Manager config
{ config, pkgs, ... }:
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "nixos";
home.homeDirectory = "/home/nixos";
imports = [
# https://github.com/nix-community/nixos-vscode-server
@FlorianDevP
FlorianDevP / normalize.ts
Created November 18, 2024 16:35
Typescript - normalize a function or value union into just the value
function normalize<
I,
T extends Exclude<I, Function>,
F extends Extract<I, (...args: any) => T>
>(funcOrVal: I, ...args: Parameters<F>): T {
return funcOrVal instanceof Function ? funcOrVal(...args) : funcOrVal;
}
// with only one type parameter
function normalize<I>(