{ config, pkgs, home, ... }: let homedir = "/home/cspark"; in { # 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}!" # '') # Scripts to bind/unbind usbkey from usbip server (pkgs.writeShellScriptBin "usbip_usbkey_bind" '' USBKEYBUSID="$(echo `grep 0930 /sys/bus/usb/devices/*/idVendor | cut -d '/' -f 6`)" sudo usbip bind -b $USBKEYBUSID '') (pkgs.writeShellScriptBin "usbip_usbkey_unbind" '' USBKEYBUSID="$(echo `grep 0930 /sys/bus/usb/devices/*/idVendor | cut -d '/' -f 6`)" sudo usbip unbind -b $USBKEYBUSID '') ]; # 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 # ''; # MPDCRON Configuration ".mpdcron/mpdcron.conf".source = ./resources/home-manager/.mpdcron/mpdcron.conf; ".mpdcron/hooks/player".source = ./resources/home-manager/.mpdcron/hooks/player; }; # Have to enable the mpd and mpd-discord-rpc user services manually for now services.mpd = { enable = true; musicDirectory = "${homedir}/Spool2_Secret/Music/Flac"; network.startWhenNeeded = true; extraConfig = '' audio_output { type "pipewire" name "PipeWire Output" } ''; }; services.mpd-discord-rpc.enable = true; programs.ncmpcpp.enable = true; # 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/cspark/etc/profile.d/hm-session-vars.sh # home.sessionVariables = { # EDITOR = "emacs"; }; programs.bash = { # bashrcExtra = "fastfetch"; shellAliases = { nix-rebuild-system-flake = "home-manager switch --flake ~/.config/home-manager#wsl"; }; initExtra = '' [ -z "$(ps -f ''${PPID} | grep nvim)" ] && nvim +terminal ''; bashrcExtra = '' # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color|*-256color) color_prompt=yes;; esac # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt #force_color_prompt=yes if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi if [ "$color_prompt" = yes ]; then PS1="''${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ " else PS1="''${debian_chroot:+($debian_chroot)}\u@\h:\w\$ " fi unset color_prompt force_color_prompt # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' #alias dir='dir --color=auto' #alias vdir='vdir --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi ''; }; # Emacs Config Init Service systemd.user.services.emacs-config-initialiser = let script = pkgs.writeShellScript "emacs-config-initialiser-script" '' if [[ ! -d $HOME/.emacs.d ]]; then mkdir -p $HOME/.emacs.d git clone https://git.cspark.dev/cspark/Emacs-Configuration $HOME/.emacs.d else exit 0 fi ''; in { Unit = { Description = "Initialises default emacs configuration if not available"; }; Service = { ExecStart = "${script}"; }; Install = { WantedBy = [ "default.target" ]; }; }; # Neovim Config Init Service systemd.user.services.neovim-config-initialiser = let script = pkgs.writeShellScript "neovim-config-initialiser-script" '' if [[ ! -d $HOME/.config/nvim ]]; then mkdir -p $HOME/.config/nvim git clone https://git.cspark.dev/cspark/Neovim-Configuration $HOME/.config/nvim else exit 0 fi ''; in { Unit = { Description = "Initialises default neovim configuration if not available"; }; Service = { ExecStart = "${script}"; }; Install = { WantedBy = [ "default.target" ]; }; }; }