Compare commits

..

No commits in common. "b06b6490f4b5a99b22d2f7b256cff3e7d4fc36e3" and "9b97c9ac845890718da70b29e7086e314cb437cc" have entirely different histories.

11 changed files with 102 additions and 193 deletions

118
README.md
View File

@ -6,56 +6,21 @@ hosts.
They are organized and managed by [Nix](https://nixos.org), so some of the 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. configuration may be difficult to translate to a non-Nix system.
## System Features However, some of the configurations are easier to lift directly:
| Feature | Program | Configuration | - [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)
| OS | [NixOS](https://nixos.org) | [Link](./modules/nixos) | - [More fish aliases](https://github.com/nmasur/dotfiles/blob/master/modules/common/shell/fish/default.nix)
| Display Server | [X11](https://www.x.org/wiki/) | [Link](./modules/nixos/graphical/xorg.nix) | - [Git aliases](https://github.com/nmasur/dotfiles/blob/master/modules/common/shell/git.nix)
| Compositor | [Picom](https://github.com/yshui/picom) | [Link](./modules/nixos/graphical/picom.nix) | - [Hammerspoon](https://github.com/nmasur/dotfiles/tree/master/modules/darwin/hammerspoon)
| 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) |
## User Features Try out my Neovim config (requires [nix](https://nixos.org/download.html)):
| 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 ```bash
nix run github:nmasur/dotfiles#neovim nix run github:nmasur/dotfiles#neovim
``` ```
Or build it as a package: Or build it as a package (requires [nix](https://nixos.org/download.html)):
```bash ```bash
nix build github:nmasur/dotfiles#neovim nix build github:nmasur/dotfiles#neovim
@ -65,6 +30,73 @@ 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 `~/.config/nvim` or set `XDG_CONFIG_HOME` to another value; otherwise both
configs might conflict with each other. 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 # Flake Templates
You can also use the [templates](./templates/) as flakes for starting new You can also use the [templates](./templates/) as flakes for starting new

View File

@ -1,67 +0,0 @@
[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
```

View File

@ -16,7 +16,7 @@
# Used for Windows Subsystem for Linux compatibility # Used for Windows Subsystem for Linux compatibility
wsl.url = "github:nix-community/NixOS-WSL"; wsl.url = "github:nix-community/NixOS-WSL";
# Used for user packages and dotfiles # Used for user packages
home-manager = { home-manager = {
url = "github:nix-community/home-manager/master"; url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = inputs.nixpkgs.follows =
@ -121,7 +121,6 @@
inputs.nur.overlay inputs.nur.overlay
inputs.nix2vim.overlay inputs.nix2vim.overlay
(import ./overlays/neovim-plugins.nix inputs) (import ./overlays/neovim-plugins.nix inputs)
(import ./overlays/lib.nix)
(import ./overlays/calibre-web.nix) (import ./overlays/calibre-web.nix)
]; ];
@ -134,8 +133,6 @@
in rec { in rec {
# Contains my full system builds, including home-manager
# nixos-rebuild switch --flake .#tempest
nixosConfigurations = { nixosConfigurations = {
tempest = import ./hosts/tempest { inherit inputs globals overlays; }; tempest = import ./hosts/tempest { inherit inputs globals overlays; };
hydra = import ./hosts/hydra { inherit inputs globals overlays; }; hydra = import ./hosts/hydra { inherit inputs globals overlays; };
@ -143,8 +140,6 @@
swan = import ./hosts/swan { inherit inputs globals overlays; }; swan = import ./hosts/swan { inherit inputs globals overlays; };
}; };
# Contains my full Mac system builds, including home-manager
# darwin-rebuild switch --flake .#lookingglass
darwinConfigurations = { darwinConfigurations = {
lookingglass = lookingglass =
import ./hosts/lookingglass { inherit inputs globals overlays; }; import ./hosts/lookingglass { inherit inputs globals overlays; };
@ -159,24 +154,23 @@
darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home; darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home;
}; };
# Disk formatting, only used once # Disk formatting
diskoConfigurations = { root = import ./disks/root.nix; }; diskoConfigurations = { root = import ./disks/root.nix; };
# Other packages, such as system images or programs # Package servers into images with a generator
packages = forAllSystems (system: { packages = forAllSystems (system: {
# Package servers into images with a generator
aws = { aws = {
"${system}" = "${system}" =
import ./generators/aws { inherit inputs globals system overlays; }; import ./generators/aws { inherit inputs globals system overlays; };
}; };
staff = { staff = {
"${system}" = import ./generators/staff { "${system}" = import ./generators/staff {
inherit inputs globals system overlays; inherit inputs globals system overlays;
}; };
}; };
# Package Neovim config into standalone package
neovim = let pkgs = import nixpkgs { inherit system overlays; }; neovim = let pkgs = import nixpkgs { inherit system overlays; };
in import ./modules/common/neovim/package { in import ./modules/common/neovim/package {
inherit pkgs; inherit pkgs;
@ -186,7 +180,6 @@
}); });
# Programs that can be run by calling this flake
apps = forAllSystems (system: apps = forAllSystems (system:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
@ -199,7 +192,6 @@
}; };
in import ./apps { inherit pkgs; }); in import ./apps { inherit pkgs; });
# Development environments
devShells = forAllSystems (system: devShells = forAllSystems (system:
let pkgs = import nixpkgs { inherit system overlays; }; let pkgs = import nixpkgs { inherit system overlays; };
in { in {

View File

@ -1,10 +0,0 @@
# 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 |

View File

@ -1,8 +0,0 @@
# 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 |

View File

@ -1,6 +1,19 @@
{ config, pkgs, lib, ... }: { 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 { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
@ -19,7 +32,7 @@
consul consul
noti # Create notifications programmatically noti # Create notifications programmatically
ipcalc # Make IP network calculations ipcalc # Make IP network calculations
(pkgs.extraLib.mkScript { (mkScript {
name = "ocr"; name = "ocr";
file = ../../modules/common/shell/bash/scripts/ocr.sh; file = ../../modules/common/shell/bash/scripts/ocr.sh;
env = [ tesseract ]; env = [ tesseract ];

View File

@ -17,10 +17,6 @@
type = lib.types.str; type = lib.types.str;
description = "Command to use for choosing windows"; 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 { toggleBarCommand = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "Command to hide and show the status bar."; description = "Command to hide and show the status bar.";

View File

@ -112,8 +112,6 @@ in {
"exec --no-startup-id ${config.launcherCommand}"; "exec --no-startup-id ${config.launcherCommand}";
"${modifier}+Shift+s" = "${modifier}+Shift+s" =
"exec --no-startup-id ${config.systemdSearch}"; "exec --no-startup-id ${config.systemdSearch}";
"${modifier}+Shift+a" =
"exec --no-startup-id ${config.audioSwitchCommand}";
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}"; "Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
"${modifier}+Shift+c" = "reload"; "${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart"; "${modifier}+Shift+r" = "restart";

View File

@ -1,10 +1,6 @@
{ config, pkgs, lib, ... }: { 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) { config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
@ -152,16 +148,14 @@ in {
}; };
launcherCommand = "${rofi}/bin/rofi -modes drun -show drun"; launcherCommand = "${
config.home-manager.users.${config.user}.programs.rofi.finalPackage
}/bin/rofi -show run -modi run";
systemdSearch = "${pkgs.rofi-systemd}/bin/rofi-systemd"; systemdSearch = "${pkgs.rofi-systemd}/bin/rofi-systemd";
altTabCommand = "${rofi}/bin/rofi -show window -modi window"; altTabCommand = "${
audioSwitchCommand = "${ config.home-manager.users.${config.user}.programs.rofi.finalPackage
(pkgs.extraLib.mkScript { }/bin/rofi -show window -modi window";
name = "switch-audio";
file = ./rofi/pulse-sink.sh;
env = [ pkgs.ponymix rofi ];
})
}/bin/switch-audio";
}; };
} }

View File

@ -1,15 +0,0 @@
#!/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

View File

@ -1,16 +0,0 @@
_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} $@
'';
};
}