mirror of
https://github.com/nmasur/dotfiles
synced 2025-04-24 10:22:24 +00:00
Compare commits
4 Commits
9b97c9ac84
...
b06b6490f4
Author | SHA1 | Date | |
---|---|---|---|
|
b06b6490f4 | ||
|
514244476d | ||
|
47590abc3a | ||
|
f69d233c39 |
118
README.md
118
README.md
@ -6,21 +6,56 @@ hosts.
|
||||
They are organized and managed by [Nix](https://nixos.org), so some of the
|
||||
configuration may be difficult to translate to a non-Nix system.
|
||||
|
||||
However, some of the configurations are easier to lift directly:
|
||||
## System Features
|
||||
|
||||
- [Neovim](https://github.com/nmasur/dotfiles/tree/master/modules/common/neovim/config)
|
||||
- [Fish functions](https://github.com/nmasur/dotfiles/tree/master/modules/common/shell/fish/functions)
|
||||
- [More fish aliases](https://github.com/nmasur/dotfiles/blob/master/modules/common/shell/fish/default.nix)
|
||||
- [Git aliases](https://github.com/nmasur/dotfiles/blob/master/modules/common/shell/git.nix)
|
||||
- [Hammerspoon](https://github.com/nmasur/dotfiles/tree/master/modules/darwin/hammerspoon)
|
||||
| Feature | Program | Configuration |
|
||||
| --- | --- | --- |
|
||||
| OS | [NixOS](https://nixos.org) | [Link](./modules/nixos) |
|
||||
| Display Server | [X11](https://www.x.org/wiki/) | [Link](./modules/nixos/graphical/xorg.nix) |
|
||||
| Compositor | [Picom](https://github.com/yshui/picom) | [Link](./modules/nixos/graphical/picom.nix) |
|
||||
| Window Manager | [i3](https://i3wm.org/) | [Link](./modules/nixos/graphical/i3.nix) |
|
||||
| Panel | [Polybar](https://polybar.github.io/) | [Link](./modules/nixos/graphical/polybar.nix) |
|
||||
| Font | [Victor Mono](https://rubjo.github.io/victor-mono/) | [Link](./modules/nixos/graphical/fonts.nix) |
|
||||
| Launcher | [Rofi](https://github.com/davatorium/rofi) | [Link](./modules/nixos/graphical/rofi.nix) |
|
||||
|
||||
Try out my Neovim config (requires [nix](https://nixos.org/download.html)):
|
||||
## User Features
|
||||
|
||||
| Feature | Program | Configuration |
|
||||
| --- | --- | --- |
|
||||
| Dotfiles | [Home-Manager](https://github.com/nix-community/home-manager) | [Link](./modules/common) |
|
||||
| Terminal | [Kitty](https://sw.kovidgoyal.net/kitty/) | [Link](./modules/common/applications/kitty.nix) |
|
||||
| Shell | [Fish](https://fishshell.com/) | [Link](./modules/common/shell/fish) |
|
||||
| Shell Prompt | [Starship](https://starship.rs/) | [Link](./modules/common/shell/starhip.nix) |
|
||||
| Colorscheme | [Gruvbox](https://github.com/morhetz/gruvbox) | [Link](./colorscheme/gruvbox) |
|
||||
| Wallpaper | [Road](https://gitlab.com/exorcist365/wallpapers/-/blob/master/gruvbox/road.jpg) | [Link](./hosts/tempest/default.nix)
|
||||
| Text Editor | [Neovim](https://neovim.io/) | [Link](./modules/common/neovim/config) |
|
||||
| Browser | [Firefox](https://www.mozilla.org/en-US/firefox/new/) | [Link](./modules/common/applications/firefox.nix) |
|
||||
| E-Mail | [Aerc](https://aerc-mail.org/) | [Link](./modules/common/mail/aerc.nix) |
|
||||
| File Manager | [Nautilus](https://wiki.gnome.org/action/show/Apps/Files) | [Link](./modules/common/applications/nautilus.nix) |
|
||||
| PDF Reader | [Zathura](https://pwmt.org/projects/zathura/) | [Link](./modules/common/applications/media.nix) |
|
||||
| Video Player | [mpv](https://mpv.io/) | [Link](./modules/common/applications/media.nix) |
|
||||
|
||||
## macOS Features
|
||||
|
||||
| Feature | Program | Configuration |
|
||||
| --- | --- | --- |
|
||||
| Keybinds | [Hammerspoon](https://www.hammerspoon.org/) | [Link](./modules/darwin/hammerspoon) |
|
||||
|
||||
---
|
||||
|
||||
# Installation
|
||||
|
||||
Click [here](./docs/installation.md) for detailed installation instructions.
|
||||
|
||||
# Neovim
|
||||
|
||||
Try out my Neovim config with nix:
|
||||
|
||||
```bash
|
||||
nix run github:nmasur/dotfiles#neovim
|
||||
```
|
||||
|
||||
Or build it as a package (requires [nix](https://nixos.org/download.html)):
|
||||
Or build it as a package:
|
||||
|
||||
```bash
|
||||
nix build github:nmasur/dotfiles#neovim
|
||||
@ -30,73 +65,6 @@ If you already have a Neovim configuration, you may need to move it out of
|
||||
`~/.config/nvim` or set `XDG_CONFIG_HOME` to another value; otherwise both
|
||||
configs might conflict with each other.
|
||||
|
||||
---
|
||||
|
||||
# Full Installation
|
||||
|
||||
## NixOS - From Live Disk
|
||||
|
||||
Format drives and build system from any NixOS host, including the live
|
||||
installer disk:
|
||||
|
||||
**This will erase your drives; use at your own risk!**
|
||||
|
||||
```bash
|
||||
lsblk # Choose the disk you want to wipe
|
||||
nix-shell -p nixVersions.stable
|
||||
nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest
|
||||
```
|
||||
|
||||
## NixOS - From Existing System
|
||||
|
||||
If you're already running NixOS, you can switch to this configuration with the
|
||||
following command:
|
||||
|
||||
```bash
|
||||
nix-shell -p nixVersions.stable
|
||||
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#tempest
|
||||
```
|
||||
|
||||
## Windows - From NixOS WSL
|
||||
|
||||
After [installing NixOS on
|
||||
WSL](https://xeiaso.net/blog/nix-flakes-4-wsl-2022-05-01), you can switch to
|
||||
the WSL configuration:
|
||||
|
||||
```
|
||||
nix-shell -p nixVersions.stable
|
||||
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#hydra
|
||||
```
|
||||
|
||||
You should also download the
|
||||
[FiraCode](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.2.2/FiraCode.zip)
|
||||
font and install it on Windows. Install [Alacritty](https://alacritty.org/) and
|
||||
move the `windows/alacritty.yml` file to
|
||||
`C:\Users\<user>\AppData\Roaming\alacritty`.
|
||||
|
||||
## macOS
|
||||
|
||||
To get started on a bare macOS installation, first install Nix:
|
||||
|
||||
```bash
|
||||
sh -c "$(curl -L https://nixos.org/nix/install)"
|
||||
```
|
||||
|
||||
Then use Nix to build nix-darwin:
|
||||
|
||||
```bash
|
||||
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
|
||||
./result/bin/darwin-installer
|
||||
```
|
||||
|
||||
Then switch to the macOS configuration:
|
||||
|
||||
```bash
|
||||
darwin-rebuild switch --flake github:nmasur/dotfiles#lookingglass
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Flake Templates
|
||||
|
||||
You can also use the [templates](./templates/) as flakes for starting new
|
||||
|
67
docs/installation.md
Normal file
67
docs/installation.md
Normal file
@ -0,0 +1,67 @@
|
||||
[Back to README](../README.md)
|
||||
|
||||
---
|
||||
|
||||
# Installation
|
||||
|
||||
## NixOS - From Live Disk
|
||||
|
||||
Format drives and build system from any NixOS host, including the live
|
||||
installer disk:
|
||||
|
||||
**This will erase your drives; use at your own risk!**
|
||||
|
||||
```bash
|
||||
lsblk # Choose the disk you want to wipe
|
||||
nix-shell -p nixVersions.stable
|
||||
nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest
|
||||
```
|
||||
|
||||
## NixOS - From Existing System
|
||||
|
||||
If you're already running NixOS, you can switch to this configuration with the
|
||||
following command:
|
||||
|
||||
```bash
|
||||
nix-shell -p nixVersions.stable
|
||||
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#tempest
|
||||
```
|
||||
|
||||
## Windows - From NixOS WSL
|
||||
|
||||
After [installing NixOS on
|
||||
WSL](https://xeiaso.net/blog/nix-flakes-4-wsl-2022-05-01), you can switch to
|
||||
the WSL configuration:
|
||||
|
||||
```
|
||||
nix-shell -p nixVersions.stable
|
||||
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#hydra
|
||||
```
|
||||
|
||||
You should also download the
|
||||
[FiraCode](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.2.2/FiraCode.zip)
|
||||
font and install it on Windows. Install [Alacritty](https://alacritty.org/) and
|
||||
move the `windows/alacritty.yml` file to
|
||||
`C:\Users\<user>\AppData\Roaming\alacritty`.
|
||||
|
||||
## macOS
|
||||
|
||||
To get started on a bare macOS installation, first install Nix:
|
||||
|
||||
```bash
|
||||
sh -c "$(curl -L https://nixos.org/nix/install)"
|
||||
```
|
||||
|
||||
Then use Nix to build nix-darwin:
|
||||
|
||||
```bash
|
||||
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
|
||||
./result/bin/darwin-installer
|
||||
```
|
||||
|
||||
Then switch to the macOS configuration:
|
||||
|
||||
```bash
|
||||
darwin-rebuild switch --flake github:nmasur/dotfiles#lookingglass
|
||||
```
|
||||
|
16
flake.nix
16
flake.nix
@ -16,7 +16,7 @@
|
||||
# Used for Windows Subsystem for Linux compatibility
|
||||
wsl.url = "github:nix-community/NixOS-WSL";
|
||||
|
||||
# Used for user packages
|
||||
# Used for user packages and dotfiles
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/master";
|
||||
inputs.nixpkgs.follows =
|
||||
@ -121,6 +121,7 @@
|
||||
inputs.nur.overlay
|
||||
inputs.nix2vim.overlay
|
||||
(import ./overlays/neovim-plugins.nix inputs)
|
||||
(import ./overlays/lib.nix)
|
||||
(import ./overlays/calibre-web.nix)
|
||||
];
|
||||
|
||||
@ -133,6 +134,8 @@
|
||||
|
||||
in rec {
|
||||
|
||||
# Contains my full system builds, including home-manager
|
||||
# nixos-rebuild switch --flake .#tempest
|
||||
nixosConfigurations = {
|
||||
tempest = import ./hosts/tempest { inherit inputs globals overlays; };
|
||||
hydra = import ./hosts/hydra { inherit inputs globals overlays; };
|
||||
@ -140,6 +143,8 @@
|
||||
swan = import ./hosts/swan { inherit inputs globals overlays; };
|
||||
};
|
||||
|
||||
# Contains my full Mac system builds, including home-manager
|
||||
# darwin-rebuild switch --flake .#lookingglass
|
||||
darwinConfigurations = {
|
||||
lookingglass =
|
||||
import ./hosts/lookingglass { inherit inputs globals overlays; };
|
||||
@ -154,23 +159,24 @@
|
||||
darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home;
|
||||
};
|
||||
|
||||
# Disk formatting
|
||||
# Disk formatting, only used once
|
||||
diskoConfigurations = { root = import ./disks/root.nix; };
|
||||
|
||||
# Package servers into images with a generator
|
||||
# Other packages, such as system images or programs
|
||||
packages = forAllSystems (system: {
|
||||
|
||||
# Package servers into images with a generator
|
||||
aws = {
|
||||
"${system}" =
|
||||
import ./generators/aws { inherit inputs globals system overlays; };
|
||||
};
|
||||
|
||||
staff = {
|
||||
"${system}" = import ./generators/staff {
|
||||
inherit inputs globals system overlays;
|
||||
};
|
||||
};
|
||||
|
||||
# Package Neovim config into standalone package
|
||||
neovim = let pkgs = import nixpkgs { inherit system overlays; };
|
||||
in import ./modules/common/neovim/package {
|
||||
inherit pkgs;
|
||||
@ -180,6 +186,7 @@
|
||||
|
||||
});
|
||||
|
||||
# Programs that can be run by calling this flake
|
||||
apps = forAllSystems (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
@ -192,6 +199,7 @@
|
||||
};
|
||||
in import ./apps { inherit pkgs; });
|
||||
|
||||
# Development environments
|
||||
devShells = forAllSystems (system:
|
||||
let pkgs = import nixpkgs { inherit system overlays; };
|
||||
in {
|
||||
|
10
hosts/README.md
Normal file
10
hosts/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Hosts
|
||||
|
||||
| Host | Purpose |
|
||||
| --- | --- |
|
||||
| [flame](./flame/default.nix) | Oracle cloud server |
|
||||
| [hydra](./hydra/default.nix) | WSL config |
|
||||
| [lookingglass](./lookingglass/default.nix) | Work macOS |
|
||||
| [swan](./swan/default.nix) | Home NAS and server |
|
||||
| [tempest](./tempest/default.nix) | Desktop |
|
||||
|
8
modules/README.md
Normal file
8
modules/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Modules
|
||||
|
||||
| Module | Purpose |
|
||||
| --- | --- |
|
||||
| [common](./common/default.nix) | User programs and OS-agnostic configuration |
|
||||
| [darwin](./darwin/default.nix) | macOS-specific configuration |
|
||||
| [nixos](./nixos/default.nix) | NixOS-specific configuration |
|
||||
|
@ -1,19 +1,6 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
|
||||
# Quickly package shell scripts with their dependencies
|
||||
# From https://discourse.nixos.org/t/how-to-create-a-script-with-dependencies/7970/6
|
||||
mkScript = { name, file, env ? [ ] }:
|
||||
pkgs.writeScriptBin name ''
|
||||
for i in ${lib.concatStringsSep " " env}; do
|
||||
export PATH="$i/bin:$PATH"
|
||||
done
|
||||
|
||||
exec ${pkgs.bash}/bin/bash ${file} $@
|
||||
'';
|
||||
|
||||
in {
|
||||
{
|
||||
|
||||
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
|
||||
|
||||
@ -32,7 +19,7 @@ in {
|
||||
consul
|
||||
noti # Create notifications programmatically
|
||||
ipcalc # Make IP network calculations
|
||||
(mkScript {
|
||||
(pkgs.extraLib.mkScript {
|
||||
name = "ocr";
|
||||
file = ../../modules/common/shell/bash/scripts/ocr.sh;
|
||||
env = [ tesseract ];
|
||||
|
@ -17,6 +17,10 @@
|
||||
type = lib.types.str;
|
||||
description = "Command to use for choosing windows";
|
||||
};
|
||||
audioSwitchCommand = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Command to use for switching audio sink";
|
||||
};
|
||||
toggleBarCommand = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Command to hide and show the status bar.";
|
||||
|
@ -112,6 +112,8 @@ in {
|
||||
"exec --no-startup-id ${config.launcherCommand}";
|
||||
"${modifier}+Shift+s" =
|
||||
"exec --no-startup-id ${config.systemdSearch}";
|
||||
"${modifier}+Shift+a" =
|
||||
"exec --no-startup-id ${config.audioSwitchCommand}";
|
||||
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
|
||||
"${modifier}+Shift+c" = "reload";
|
||||
"${modifier}+Shift+r" = "restart";
|
||||
|
@ -1,6 +1,10 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
let
|
||||
|
||||
rofi = config.home-manager.users.${config.user}.programs.rofi.finalPackage;
|
||||
|
||||
in {
|
||||
|
||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
||||
|
||||
@ -148,14 +152,16 @@
|
||||
|
||||
};
|
||||
|
||||
launcherCommand = "${
|
||||
config.home-manager.users.${config.user}.programs.rofi.finalPackage
|
||||
}/bin/rofi -show run -modi run";
|
||||
launcherCommand = "${rofi}/bin/rofi -modes drun -show drun";
|
||||
systemdSearch = "${pkgs.rofi-systemd}/bin/rofi-systemd";
|
||||
altTabCommand = "${
|
||||
config.home-manager.users.${config.user}.programs.rofi.finalPackage
|
||||
}/bin/rofi -show window -modi window";
|
||||
|
||||
altTabCommand = "${rofi}/bin/rofi -show window -modi window";
|
||||
audioSwitchCommand = "${
|
||||
(pkgs.extraLib.mkScript {
|
||||
name = "switch-audio";
|
||||
file = ./rofi/pulse-sink.sh;
|
||||
env = [ pkgs.ponymix rofi ];
|
||||
})
|
||||
}/bin/switch-audio";
|
||||
};
|
||||
|
||||
}
|
||||
|
15
modules/nixos/graphical/rofi/pulse-sink.sh
Executable file
15
modules/nixos/graphical/rofi/pulse-sink.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Credit: https://gist.github.com/Nervengift/844a597104631c36513c
|
||||
|
||||
sink=$(
|
||||
ponymix -t sink list |
|
||||
awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}' |
|
||||
rofi -dmenu -p 'pulseaudio sink:' -location 6 -width 100 -theme-str 'inputbar { enabled: false; }' |
|
||||
grep -Po '[0-9]+(?=:)'
|
||||
) &&
|
||||
ponymix set-default -d "$sink" &&
|
||||
for input in $(ponymix list -t sink-input | grep -Po '[0-9]+(?=:)'); do
|
||||
echo "$input -> $sink"
|
||||
ponymix -t sink-input -d "$input" move "$sink"
|
||||
done
|
16
overlays/lib.nix
Normal file
16
overlays/lib.nix
Normal file
@ -0,0 +1,16 @@
|
||||
_final: prev: {
|
||||
extraLib = prev.lib // {
|
||||
|
||||
# Quickly package shell scripts with their dependencies
|
||||
# From https://discourse.nixos.org/t/how-to-create-a-script-with-dependencies/7970/6
|
||||
mkScript = { name, file, env ? [ ] }:
|
||||
prev.pkgs.writeScriptBin name ''
|
||||
for i in ${prev.lib.concatStringsSep " " env}; do
|
||||
export PATH="$i/bin:$PATH"
|
||||
done
|
||||
|
||||
exec ${prev.pkgs.bash}/bin/bash ${file} $@
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user