Skip to content

Instantly share code, notes, and snippets.

@Xe Xe/configuration.nix Secret
Created May 6, 2020

Embed
What would you like to do?
{ pkgs, lib, ... }:
let
dwm = with pkgs;
let name = "dwm-6.2";
in stdenv.mkDerivation {
inherit name;
src = fetchurl {
url = "https://dl.suckless.org/dwm/${name}.tar.gz";
sha256 = "03hirnj8saxnsfqiszwl2ds7p0avg20izv9vdqyambks00p2x44p";
};
buildInputs = with pkgs; [ xorg.libX11 xorg.libXinerama xorg.libXft ];
prePatch = ''sed -i "s@/usr/local@$out@" config.mk'';
postPatch = ''
cp ${./dwm/config.h} ./config.h
'';
patches = [ ./dwm/autostart.patch ];
buildPhase = " make ";
meta = {
homepage = "https://suckless.org/";
description = "Dynamic window manager for X";
license = stdenv.lib.licenses.mit;
maintainers = with stdenv.lib.maintainers; [ viric ];
platforms = with stdenv.lib.platforms; all;
};
};
sm64pc = with pkgs;
let
baserom = fetchurl {
url = "http://127.0.0.1:9001/baserom.us.z64";
sha256 = "148xna5lq2s93zm0mi2pmb98qb5n9ad6sv9dky63y4y68drhgkhp";
};
in stdenv.mkDerivation rec {
pname = "sm64pc";
version = "latest";
buildInputs = [
gnumake
python3
audiofile
pkg-config
SDL2
libusb1
glfw3
libgcc
xorg.libX11
xorg.libXrandr
libpulseaudio
alsaLib
glfw
libGL
unixtools.hexdump
];
src = fetchgit {
url = "https://tulpa.dev/saved/sm64pc";
rev = "c69c75bf9beed9c7f7c8e9612e5e351855065120";
sha256 = "148pk9iqpcgzwnxlcciqz0ngy6vsvxiv5lp17qg0bs7ph8ly3k4l";
};
buildPhase = ''
chmod +x ./extract_assets.py
cp ${baserom} ./baserom.us.z64
make
'';
installPhase = ''
mkdir -p $out/bin
cp ./build/us_pc/sm64.us.f3dex2e $out/bin/sm64pc
'';
meta = with stdenv.lib; {
description = "Super Mario 64 PC port, requires rom :)";
};
};
in {
environment.systemPackages = with pkgs; [ hack-font st dwm sm64pc ];
networking.hostName = "its-a-me";
users.users.mario = { isNormalUser = true; };
system.activationScripts = {
base-dirs = {
text = ''
mkdir -p /nix/var/nix/profiles/per-user/mario
'';
deps = [ ];
};
};
services.xserver.windowManager.session = lib.singleton {
name = "dwm";
start = ''
${dwm}/bin/dwm &
waitPID=$!
'';
};
services.xserver.enable = true;
services.xserver.displayManager.defaultSession = "none+dwm";
services.xserver.displayManager.lightdm.enable = true;
services.xserver.displayManager.lightdm.autoLogin.enable = true;
services.xserver.displayManager.lightdm.autoLogin.user = "mario";
imports = [ <home-manager/nixos> ];
home-manager.users.mario = { config, pkgs, ... }: {
home.file = {
".dwm/autostart.sh" = {
executable = true;
text = ''
#!/bin/sh
export LIBGL_ALWAYS_SOFTWARE=1
${sm64pc}/bin/sm64pc
'';
};
};
};
hardware.pulseaudio.enable = true;
virtualisation.virtualbox.guest.enable = true;
virtualisation.vmware.guest.enable = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.