Init new configuration

This commit is contained in:
Curt Spark 2024-08-05 17:36:13 +01:00
parent 33112e908a
commit 5a083da9bf
13 changed files with 698 additions and 134 deletions

3
README.org Normal file
View File

@ -0,0 +1,3 @@
* Bootstrap
Clone this git repository into directory ~/.config/home-manager

View File

@ -0,0 +1,130 @@
{ pkgs, ... }:
{
networking.computerName = "cspark-macos-desktop";
networking.hostName = "cspark-macos-desktop";
networking.localHostName = "cspark-macos-desktop";
nixpkgs.config.allowUnfree = true;
# Nix packages.
environment.systemPackages = with pkgs; [
git
unrar
pass
fastfetch
neovim
yt-dlp
qbittorrent
emacs
neovim
discord
];
# Homebrew configuration and packages.
homebrew.enable = true;
# Homebrew formulae
homebrew.brews = [
];
# Homebrew casks
homebrew.casks = [
"steam"
"librewolf"
# "eloston-chromium" # Ungoogled Chromium
"chromium"
# "blackhole-2ch" # Virtual Audio driver that I'm using alongside the builtin Mac audio routing (Multi-Output/Aggregate
];
services.yabai = {
enable = true;
config = {
external_bar = "off:40:0";
menubar_opacity = 1.0;
mouse_follows_focus = "off";
focus_follows_mouse = "off";
display_arrangement_order = "default";
window_origin_display = "default";
window_placement = "second_child";
window_zoom_persist = "on";
window_shadow = "on";
window_animation_duration = 0.0;
window_animation_easing = "ease_out_circ";
window_opacity_duration = 0.0;
active_window_opacity = 1.0;
normal_window_opacity = 0.90;
window_opacity = "off";
insert_feedback_color = "0xffd75f5f";
split_ratio = 0.50;
split_type = "auto";
auto_balance = "off";
top_padding = 12;
bottom_padding = 12;
left_padding = 12;
right_padding = 12;
window_gap = 06;
layout = "bsp";
mouse_modifier = "fn";
mouse_action1 = "move";
mouse_action2 = "resize";
mouse_drop_action = "swap";
};
};
services.skhd = {
enable = true;
skhdConfig = ''
cmd - return : open -a Terminal "`pwd`"
'';
};
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
# nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# Create /etc/zshrc that loads the nix-darwin environment.
# programs.zsh.enable = true; # default shell on catalina
# programs.fish.enable = true;
programs.bash = {
enable = true;
enableCompletion = true;
interactiveShellInit = ''
export PS1="\[\e[92;40m\]\h\[\e[m\]:\[\e[93m\]\W\[\e[m\] \\$ "
cd ~
neofetch
'';
};
environment.shellAliases = {
edit = "emacs -nw";
nix-darwin-rebuild-system-flake = "nix run nix-darwin -- switch --flake ~/.config/nix-darwin#desktop";
};
# Set Git commit hash for darwin-version.
system.configurationRevision = self.rev or self.dirtyRev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
# The platform the configuration will be used on.
nixpkgs.hostPlatform = "x86_64-darwin";
};
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#Curts-Mac-Pro
darwinConfigurations = {
desktop = nix-darwin.lib.darwinSystem {
specialArgs = {inherit inputs;};
modules = [
configuration
];
};
};
# Expose the package set, including overlays, for convenience.
darwinPackages = self.darwinConfigurations.desktop-macos.pkgs;
};

191
configurations/wsl/home.nix Normal file
View File

@ -0,0 +1,191 @@
{ 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" ];
};
};
}

View File

@ -0,0 +1,12 @@
set editing-mode vi
set show-mode-in-prompt on
set vi-ins-mode-string "\e[1;30;104mInsert\e[m \1\e[6 q\2"
set vi-cmd-mode-string "\e[1;30;107mNormal\e[m \1\e[2 q\2"
# Duration to wait before escaping out of Insert mode on Esc keypress
set keyseq-timeout 0
# optionally:
# switch to block cursor before executing a command
set keymap vi-insert
RETURN: "\e\n"

View File

@ -0,0 +1,8 @@
[Desktop Entry]
Name=NCMPCPP
Comment=Run ncurses music player CPP
Categories=Other;
Icon=konsole
Type=Application
Exec=sh -c "$TERM -e ncmpcpp"
Terminal=false

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Categories=Network;WebBrowser
Exec=vieb --enable-features=UseOzonePlatform --ozone-platform=wayland %U
GenericName=Vieb Web Browser
Icon=vieb
MimeType=text/html;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https
Name=Vieb Web Browser
Type=Application
Version=1.4

View File

@ -0,0 +1,10 @@
[Desktop Entry]
Name=Yazi File Manager
Icon=yazi
Comment=Blazing fast terminal file manager written in Rust, based on async I/O
Terminal=false
Exec=sh -c "$TERM -e yazi %u"
Type=Application
MimeType=inode/directory
Categories=Utility;Core;System;FileTools;FileManager;ConsoleOnly
Keywords=File;Manager;Explorer;Browser;Launcher

View File

@ -0,0 +1,3 @@
#!/bin/sh
systemctl --user restart mpd-discord-rpc.service

View File

@ -0,0 +1,31 @@
# mpdcron configuration file
[main]
# Path to the PID file, by default the PID file is MPDCRON_DIR/mpdcron.pid
# pidfile = /path/to/mpdcron.pid
# Wait this many seconds after sending signal to kill the daemon.
# Default is 3 seconds.
killwait = 3
# Logging level, default is 0
# 0: Warnings and errors only
# 1: Info and below
# 2: Debug and below
loglevel = 0
[mpd]
# Semicolon delimited list of events to wait for.
# By default mpdcron waits for all events.
# Valid events are:
# database: Song database has been updated.
# stored_playlist: A stored playlist has been modified, created,
# deleted or renamed.
# playlist: The queue has been modified.
# player: The player state has been changed: play, stop, pause, seek, ...
# mixer: The volume has been modified.
# output: An audio output device has been enabled or disabled.
# options: Options have changed: crossfade, random, repeat, ...
# update: A database update has started or finished.
events = player
# Interval in seconds to reconnect to mpd after an error or disconnect.
reconnect = 5
# Timeout in milliseconds for mpd timeout, 0 for default timeout of
# libmpdclient.
timeout = 0

View File

@ -1,5 +1,25 @@
{ {
"nodes": { "nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1722630065,
"narHash": "sha256-QfM/9BMRkCmgWzrPDK+KbgJOUlSJnfX4OvsUupEUZvA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "afc892db74d65042031a093adb6010c4c3378422",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nix-darwin": { "nix-darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -7,11 +27,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1711763326, "lastModified": 1722609272,
"narHash": "sha256-sXcesZWKXFlEQ8oyGHnfk4xc9f2Ip0X/+YZOq3sKviI=", "narHash": "sha256-Kkb+ULEHVmk07AX+OhwyofFxBDpw+2WvsXguUS2m6e4=",
"owner": "LnL7", "owner": "LnL7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "36524adc31566655f2f4d55ad6b875fb5c1a4083", "rev": "f7142b8024d6b70c66fd646e1d099d3aa5bfec49",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -22,22 +42,23 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1711715736, "lastModified": 1722630782,
"narHash": "sha256-9slQ609YqT9bT/MNX9+5k5jltL9zgpn36DpFB7TkttM=", "narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=",
"owner": "NixOS", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "807c549feabce7eddbf259dbdcec9e0600a0660d", "rev": "d04953086551086b44b6f3c6b7eeb26294f207da",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "nixos",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }

166
flake.nix
View File

@ -1,138 +1,54 @@
{ {
description = "Nix-Darwin Configuration Flake"; description = "NixOS/Home Manager Configuration for my personal machines";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nix-darwin.url = "github:LnL7/nix-darwin"; home-manager = {
nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = inputs@{ self, nix-darwin, nixpkgs }: outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, ... }:
let let
configuration = { pkgs, ... }: { system = "x86_64-linux";
networking.computerName = "cspark-macos-desktop"; pkgs = nixpkgs.legacyPackages.${system};
networking.hostName = "cspark-macos-desktop"; in {
networking.localHostName = "cspark-macos-desktop"; defaultPackage.x86_64-linux = home-manager.defaultPackage.x86_64-linux;
defaultPackage.x86_64-darwin = home-manager.defaultPackage.x86_64-darwin;
nixpkgs.config.allowUnfree = true;
# Nix packages. homeConfigurations = {
environment.systemPackages = with pkgs; [ wsl = home-manager.lib.homeManagerConfiguration {
git inherit pkgs;
unrar
pass
neofetch
neovim
yt-dlp
qbittorrent
emacs
discord
];
# Homebrew configuration and packages. # Specify your home configuration modules here, for example,
homebrew.enable = true; # the path to your home.nix.
# Homebrew formulae modules = [
homebrew.brews = [ ./global-home.nix
]; ./configurations/wsl/home.nix
# Homebrew casks ];
homebrew.casks = [
"steam"
"librewolf"
# "eloston-chromium" # Ungoogled Chromium
"chromium"
# "blackhole-2ch" # Virtual Audio driver that I'm using alongside the builtin Mac audio routing (Multi-Output/Aggregate
];
services.yabai = { # Optionally use extraSpecialArgs
enable = true; # to pass through arguments to home.nix
config = { };
external_bar = "off:40:0";
menubar_opacity = 1.0;
mouse_follows_focus = "off";
focus_follows_mouse = "off";
display_arrangement_order = "default";
window_origin_display = "default";
window_placement = "second_child";
window_zoom_persist = "on";
window_shadow = "on";
window_animation_duration = 0.0;
window_animation_easing = "ease_out_circ";
window_opacity_duration = 0.0;
active_window_opacity = 1.0;
normal_window_opacity = 0.90;
window_opacity = "off";
insert_feedback_color = "0xffd75f5f";
split_ratio = 0.50;
split_type = "auto";
auto_balance = "off";
top_padding = 12;
bottom_padding = 12;
left_padding = 12;
right_padding = 12;
window_gap = 06;
layout = "bsp";
mouse_modifier = "fn";
mouse_action1 = "move";
mouse_action2 = "resize";
mouse_drop_action = "swap";
};
}; };
services.skhd = { # Build darwin flake using:
enable = true; # $ darwin-rebuild build --flake .#Curts-Mac-Pro
skhdConfig = '' darwinConfigurations = {
cmd - return : open -a Terminal "`pwd`" desktop = nix-darwin.lib.darwinSystem {
''; specialArgs = {inherit inputs;};
modules = [
./global-home.nix
./configurations/macos/home.nix
];
};
}; };
# Expose the package set, including overlays, for convenience.
# Auto upgrade nix package and the daemon service. darwinPackages = self.darwinConfigurations.desktop-macos.pkgs;
services.nix-daemon.enable = true;
# nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# Create /etc/zshrc that loads the nix-darwin environment.
# programs.zsh.enable = true; # default shell on catalina
# programs.fish.enable = true;
programs.bash = {
enable = true;
enableCompletion = true;
interactiveShellInit = ''
export PS1="\[\e[92;40m\]\h\[\e[m\]:\[\e[93m\]\W\[\e[m\] \\$ "
cd ~
neofetch
'';
};
environment.shellAliases = {
edit = "emacs -nw";
nix-darwin-rebuild-system-flake = "nix run nix-darwin -- switch --flake ~/.config/nix-darwin#desktop";
};
# Set Git commit hash for darwin-version.
system.configurationRevision = self.rev or self.dirtyRev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
# The platform the configuration will be used on.
nixpkgs.hostPlatform = "x86_64-darwin";
}; };
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#Curts-Mac-Pro
darwinConfigurations = {
desktop = nix-darwin.lib.darwinSystem {
specialArgs = {inherit inputs;};
modules = [
configuration
];
};
};
# Expose the package set, including overlays, for convenience.
darwinPackages = self.darwinConfigurations.desktop-macos.pkgs;
};
} }

218
global-home.nix Normal file
View File

@ -0,0 +1,218 @@
{ config, pkgs, ... }:
let
homedir = "/home/cspark";
in
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "cspark";
home.homeDirectory = "${homedir}";
# 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.11"; # Please read the comment before changing.
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# 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?
# (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:
# (writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
# Scripts to replace user utils with ones that can interface with the neovim inbuilt terminal
(pkgs.writeShellScriptBin "cd-nvim" ''
if [ $1 ]; then
builtin cd "''$(realpath "$1")" && printf "\033]7;file://''${PWD}\033\\"
else
builtin cd "''${HOME}" && printf "\033]7;file://''${PWD}\033\\"
fi
'')
fastfetch
neovim
emacs-gtk
ffmpeg
mpdcron
pass
ripgrep
yazi
ncdu
];
# 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
# '';
# ".local/share/applications/ncmpcpp.desktop".text = ''
# [Desktop Entry]
# Name=NCMPCPP
# Comment=Run ncurses music player CPP
# Categories=Other;
# Icon=konsole
# Type=Application
# Exec=konsole -e ncmpcpp
# Terminal=false
# '';
# Inputrc file for VI mode
".inputrc".source = ./global-resources/home-manager/.inputrc;
};
# 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" ];
};
};
# MPDCRON to automate MPD related events, using it to automatically restart mpd-discord-rpc service to solve issues
systemd.user.services.mpdcron = let
script = pkgs.writeShellScript "mpdcron-script"
''
mpdcron -n
'';
in
{
Unit = {
Description = "Start MPDCRON on boot";
};
Service = {
ExecStart = "${script}";
Environment = "PATH=${pkgs.mpdcron}/bin:${pkgs.systemd}/bin";
};
Install = {
WantedBy = [ "default.target" ];
};
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. 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
#
# Add custom directories to $PATH
home.sessionPath = [
"$HOME/.dotnet/tools"
];
home.sessionVariables = {
# EDITOR = "emacsclient -nw";
EDITOR = "nvim";
# Dotnet path not found fix
DOTNET_ROOT = "${pkgs.dotnet-sdk}";
};
programs.bash = {
enable = true;
enableCompletion = true;
initExtra = ''
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
fastfetch
'';
shellAliases = {
sudo = "sudo ";
doas = "doas ";
edit = "$EDITOR";
cd = "source cd-nvim";
};
};
programs.git = {
enable = true;
userName = "cspark";
userEmail = "git@cspark.dev";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}

View File

@ -0,0 +1,12 @@
set editing-mode vi
set show-mode-in-prompt on
set vi-ins-mode-string "\e[1;30;104mInsert\e[m \1\e[6 q\2"
set vi-cmd-mode-string "\e[1;30;107mNormal\e[m \1\e[2 q\2"
# Duration to wait before escaping out of Insert mode on Esc keypress
set keyseq-timeout 0
# optionally:
# switch to block cursor before executing a command
set keymap vi-insert
RETURN: "\e\n"