Skip to content

Instantly share code, notes, and snippets.

@5310
Last active July 2, 2024 12:18
Show Gist options
  • Save 5310/75a93fb19f402a274c36838e2b7a4350 to your computer and use it in GitHub Desktop.
Save 5310/75a93fb19f402a274c36838e2b7a4350 to your computer and use it in GitHub Desktop.
Fledgling Nixpkgs config using Flakes and Home Manager #dotfiles
- Installed using the [Determinate Systems Installer](https://github.com/DeterminateSystems/nix-installer)
- Specifically for the Steam Deck using the `deck` profile: `... install steam-deck`
- NixGL set up and working!
{
description = "Home Manager configuration of deck";
inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixGL = {
url = "github:nix-community/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, nixGL, ... }@inputs:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [
nixGL.overlay
];
};
in {
homeConfigurations."deck" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [ ./home.nix ];
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
extraSpecialArgs = {
inherit inputs;
};
};
};
}
{ inputs, config, pkgs, ... }:
{
# Allow non-free packages
nixpkgs = {
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
};
};
# NixGL integration into Home Manager,
# courtesy @Smon@github @giggio@github
# https://github.com/nix-community/home-manager/issues/3968#issuecomment-2135919008
nixGL.prefix = "${inputs.nixGL.packages."${pkgs.system}".nixGLIntel}/bin/nixGLIntel";
# FIXME: Remove this once this patch (#5355) is merged
imports = [
(builtins.fetchurl {
url = "https://raw.githubusercontent.com/Smona/home-manager/nixgl-compat/modules/misc/nixgl.nix";
sha256 = "e9f7da06111c7e669dbeef47f1878ed245392d4e7250237eaf791b734899be3c";
})
];
# # Wrap packages with it under home.packages like so:
# # (config.lib.nixGL.wrap <pkgname>)
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "deck";
home.homeDirectory = "/home/deck";
# 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 = "24.05"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = with pkgs; lib.lists.flatten [
hello
nano
curl
wget
#
git
git-lfs
#
zellij
atuin
nushell # $ nu
starship
micro
#
bat
#bottom # $ btm
broot # $ br
btop
eza
du-dust # $ dust
fastfetch
fd
fzf
pueue
ripgrep # $ rg
zoxide # $ z
#
#podman
podman-tui
#distrobox
#caddy
#sozu
nodejs # $ node, npm, npx
#
amdgpu_top
(with rocmPackages; [
rocminfo
])
# # 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}!"
# '')
] ++ (
# # The following wraps graphical apps that require GPUs to work
builtins.map
config.lib.nixGL.wrap
[
#kitty
mypaint
#systemdgenie
#obs-studio
]
);
programs.obs-studio = {
enable = true;
package = config.lib.nixGL.wrap pkgs.obs-studio;
plugins = with pkgs.obs-studio-plugins; [
obs-move-transition
obs-pipewire-audio-capture
obs-vkcapture #(pkgs.callPackage ./obs-vkcapture.nix { })
obs-gstreamer
];
};
# 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
# '';
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. These will be explicitly sourced when using a
# shell provided by Home Manager. If you don't want to manage your shell
# through Home Manager then you have to manually source 'hm-session-vars.sh'
# located at either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/deck/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
EDITOR = "micro";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Enable XDG integration
xdg.enable = true;
# BUG: Disable XDG mimetypes integration, because without it Dolphin hangs
# [https://github.com/nix-community/home-manager/issues/4941#issuecomment-2052696388]
# due to a cyclical inheritence in kmimetypefinder5/6, to this day
# [https://bugs.kde.org/show_bug.cgi?id=477298#c6]
xdg.mime.enable = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment