Skip to content

Instantly share code, notes, and snippets.

@ihaveamac
Created November 17, 2023 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ihaveamac/3fedd7b12db2892297ac87e70b2451ca to your computer and use it in GitHub Desktop.
Save ihaveamac/3fedd7b12db2892297ac87e70b2451ca to your computer and use it in GitHub Desktop.
{ config, pkgs, ... }:
{
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "23.05"; # Please read the comment before changing.
programs.ripgrep.enable = true;
programs.neovim = {
enable = true;
withPython3 = false;
plugins = with pkgs.vimPlugins; [
{ plugin = vim-surround; }
{ plugin = vim-toml; }
{ plugin = vim-numbertoggle; }
{ plugin = vim-auto-save; }
{ plugin = mediawiki-vim; }
{ plugin = vim-gitgutter; }
{ plugin = vim-commentary; }
];
extraConfig = ''
let mapleader = ';'
set nocompatible
set ruler
set showcmd
set mouse=a
set backspace=indent,eol,start
syntax on
filetype off
set number relativenumber
set scrolloff=6
autocmd filetype python nnoremap ;r :term python3 %<cr>
nnoremap ;t :term<cr> i
autocmd BufNewFile,BufRead *.plist set syntax=xml
autocmd BufNewFile,BufRead *.service set syntax=dosini
autocmd BufNewFile,BufRead *.ini.example set syntax=dosini
autocmd BufNewFile,BufRead *.spec set syntax=python
autocmd BufNewFile,BufRead *.gm9 set syntax=sh
autocmd BufNewFile,BufRead Dockerfile* set syntax=dockerfile
autocmd BufNewFile,BufRead *.dockerfile set syntax=dockerfile
autocmd filetype python set expandtab tabstop=4 shiftwidth=4 autoindent
autocmd filetype json set expandtab tabstop=2 shiftwidth=2
autocmd filetype nix set expandtab tabstop=2 shiftwidth=2 autoindent
'';
};
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = with pkgs; [
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
(pkgs.writeShellScriptBin "update-home-manager" ''
sudo nix-channel --update && nix-channel --update && home-manager switch
'')
pv
wget
#dos2unix
xz
tree
#jo
#jq
#groff
#flac
bat
#yt-dlp
#ffmpeg
curl
aria2
s3cmd
#megatools
#squashfsTools
zstd
# lua
#qrencode
zsh-syntax-highlighting
# doctl
#pandoc
colordiff
#rar
gist
neofetch
#(pkgs.callPackage ./deriv-ctrtool.nix {})
#(pkgs.callPackage ./deriv-makerom.nix {})
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
#".ideavimrc".source = ./ideavimrc;
".pypirc".source = ./pypirc;
".gist".source = ./gist;
".s3cfg".source = ./s3cfg;
#".3ds" = {
# recursive = true;
# source = ./dot3ds;
#};
};
# You can also manage environment variables but you will have to manually
# source
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/ianburgwin/etc/profile.d/hm-session-vars.sh
#
# if you don't want to manage your shell through Home Manager.
home.sessionVariables = {
EDITOR = "nvim";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
nixpkgs.config.allowUnfree = true;
}
{ lib, pkgs, stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "3dstool";
version = "1.2.6-dev";
src = fetchFromGitHub {
owner = "dnasdw";
repo = "3dstool";
rev = "master";
sha256 = "sha256-5gKdLxIwi6vqP5VOUHXPaTM1MC5HTMOg+UKo75hQ1AQ=";
};
# some day i need to figure out how to remove the openldap dependency
buildInputs = [ pkgs.openssl pkgs.iconv pkgs.curl pkgs.openldap ];
nativeBuildInputs = [ pkgs.cmake ];
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" "CXX=${stdenv.cc.targetPrefix}c++" ];
cmakeFlags = [ "-DUSE_DEP=OFF" "-DCMAKE_CXX_COMPILER=${pkgs.clang}/bin/clang++" ];
enableParallelBuilding = true;
installPhase = "
mkdir $out/bin -p
cp ../bin/Release/3dstool $out/bin/
";
}
{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "ctrtool";
version = "1.2.0";
src = fetchFromGitHub {
owner = "3DSGuy";
repo = "Project_CTR";
rev = "ctrtool-v${version}";
sha256 = "sha256-wjU/DJHrAHE3MSB7vy+swUDVPzw0Jrv4ymOjhfr0BBk=";
};
sourceRoot = "source/ctrtool";
preBuild = ''
make -j deps CC=${stdenv.cc.targetPrefix}cc CXX=${stdenv.cc.targetPrefix}c++
'';
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" "CXX=${stdenv.cc.targetPrefix}c++" ];
enableParallelBuilding = true;
installPhase = "
mkdir $out/bin -p
cp bin/ctrtool $out/bin/
";
meta = with lib; {
license = licenses.mit;
description = "A tool to extract data from a 3ds rom";
platforms = platforms.all;
maintainers = [ maintainers.marius851000 ];
};
}
{ lib, pkgs, stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "makerom";
version = "0.18.4";
src = fetchFromGitHub {
owner = "3DSGuy";
repo = "Project_CTR";
rev = "makerom-v${version}";
sha256 = "sha256-XGktRr/PY8LItXsN1sTJNKcPIfnTnAUQHx7Om/bniXg=";
};
buildInputs = [ pkgs.iconv ];
sourceRoot = "source/makerom";
preBuild = ''
make -j deps CC=${stdenv.cc.targetPrefix}cc CXX=${stdenv.cc.targetPrefix}c++
'';
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" "CXX=${stdenv.cc.targetPrefix}c++" ];
enableParallelBuilding = true;
installPhase = "
mkdir $out/bin -p
cp bin/makerom $out/bin/
";
meta = with lib; {
license = licenses.mit;
description = "make 3ds roms";
platforms = platforms.all;
maintainers = [ maintainers.marius851000 ];
};
}
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
dos2unix
jo
jq
groff
flac
yt-dlp
ffmpeg
megatools
squashfsTools
qrencode
# doctl
pandoc
rar
imagemagick
];
home.file = {
".ideavimrc".source = ./ideavimrc;
".3ds" = {
recursive = true;
source = ./dot3ds;
};
};
}
{ config, pkgs, home, lib, ... }:
let
myenv = builtins.getEnv "MYENV";
in
{
imports = [ ./core.nix ]
# ++ (if myenv != ""
# then
# if myenv == "MACBOOK" then lib.info "macbook environment" [ ./macbook.nix ./desktop.nix ] else [];
# if myenv == "STEAMDECK" then lib.info "steamdeck environment" [ ./steamdeck.nix ./desktop.nix ] else [];
# else
# lib.warn "unknown environment" [ ]);
++ (if myenv == "MACBOOK" then
lib.info "macbook environment" [ ./macbook.nix ./desktop.nix ]
else if myenv == "STEAMDECK" then
lib.info "steamdeck environment" [ ./steamdeck.nix ./desktop.nix ]
else
lib.warn "unknown environment" [ ]);
}
{ config, pkgs, ... }:
{
home.username = "ianburgwin";
home.homeDirectory = "/Users/ianburgwin";
home.packages = with pkgs; [
gnutar
mas
p7zip
ifuse
qemu
cabextract
doctl
jigdo # for debian
(pkgs.callPackage ./deriv-ctrtool.nix {})
(pkgs.callPackage ./deriv-makerom.nix {})
(pkgs.callPackage ./deriv-3dstool.nix {})
];
}
{ config, pkgs, ... }:
let
#proxy_env = config.networking.proxy.envVars;
#settingsFormat = pkgs.formats.json {};
#daemonSettingsFile = settingsFormat.generate "daemon.json" cfg.daemon.settings;
in
{
home.username = "deck";
home.homeDirectory = "/home/deck";
programs.firefox = {
enable = true;
};
# workaround tray.target missing
# https://github.com/nix-community/home-manager/issues/2064#issuecomment-887300055
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = [ "graphical-session-pre.target" ];
};
};
services.syncthing = {
enable = true;
# tray.enable is not useful here because it errors out in Game Mode
# separately, it doesn't seem to work that way either...
};
home.packages = with pkgs; [
inetutils
# firefox
# discord # did not work in Steam
keepassxc
docker
docker-compose
];
systemd.user.services.docker = {
#wantedBy = [ "default.target" ];
#description = "Docker Application Container Engine (Rootless)";
# needs newuidmap from pkgs.shadow
#path = [ "/run/wrappers" ];
#environment = proxy_env;
Unit = {
Description = "Docker Application Container Engine (Rootless)";
# docker-rootless doesn't support running as root.
ConditionUser = "!root";
StartLimitInterval = "60s";
};
Service = {
Type = "notify";
#ExecStart = "${pkgs.docker}/bin/dockerd-rootless --config-file=${daemonSettingsFile}";
ExecStart = "${pkgs.docker}/bin/dockerd-rootless";
ExecReload = "${pkgs.procps}/bin/kill -s HUP $MAINPID";
TimeoutSec = 0;
RestartSec = 2;
Restart = "always";
StartLimitBurst = 3;
LimitNOFILE = "infinity";
LimitNPROC = "infinity";
LimitCORE = "infinity";
Delegate = true;
NotifyAccess = "all";
KillMode = "mixed";
};
Install = {
WantedBy = [ "default.target" ];
};
};
home.sessionVariables = {
DOCKER_HOST = "unix://$XDG_RUNTIME_DIR/docker.sock";
};
home.file = {
".local/share/applications/org.mozilla.firefox.desktop".text = ''
[Desktop Entry]
Type=Application
Hidden=true
Name=Install Firefox
Icon=/usr/share/icons/hicolor/scalable/apps/install-firefox.svg
Exec=xdg-open appstream://org.mozilla.firefox
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https
'';
".mozilla/native-messaging-hosts/org.kde.plasma.browser_integration.json".source = "${pkgs.plasma-browser-integration}/lib/mozilla/native-messaging-hosts/org.kde.plasma.browser_integration.json";
".config/environment.d/00-nix-xdgdata.conf".text = ''
XDG_DATA_DIRS=$HOME/.nix-profile/share:$XDG_DATA_DIRS
DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
MYENV=STEAMDECK
'';
# why does environment.d not wanna work?!?!?
".config/plasma-workspace/env/nix-xdg.sh" = {
text = ''
export XDG_DATA_DIRS="$HOME/.nix-profile/share:$XDG_DATA_DIRS"
'';
executable = true;
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment