Skip to content

Instantly share code, notes, and snippets.

@ihaveamac
Created November 11, 2023 04:05
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/5e612065f259996bd65fa715cb35a23b to your computer and use it in GitHub Desktop.
Save ihaveamac/5e612065f259996bd65fa715cb35a23b 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;
#programs.neovim.withPython3 = 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 filetype python set expandtab ts=4 sw=4 ai
autocmd filetype json set expandtab ts=2 sw=2
autocmd filetype nix set expandtab ts=2 sw=2 ai
'';
};
# The home.packages option allows you to install Nix packages into your
# environment.
#home.packages = [ cleaninty.cleaninty ] ++ (with pkgs; [
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}!"
# '')
pv
wget
lua
dos2unix
xz
tree
jo
jq
groff
flac
bat
yt-dlp
ffmpeg
curl
aria2
jigdo # for debian
s3cmd
megatools
squashfsTools
zstd
lua
qrencode
zsh-syntax-highlighting
doctl
pandoc
colordiff
rar
gist
];
# 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;
".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;
}
{ 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 ]
else
lib.info "steamdeck environment" [ ./steamdeck.nix ]
else
lib.warn "unknown environment" [ ]);
}
{ config, pkgs, ... }:
{
home.username = "ianburgwin";
home.homeDirectory = "/Users/ianburgwin";
home.packages = with pkgs; [
gnutar
mas
p7zip
ifuse
qemu
];
}
{ 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