mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-23 16:29:42 -04:00
Compare commits
25 commits
ac95d1c23d
...
c008858b2e
| Author | SHA1 | Date | |
|---|---|---|---|
| c008858b2e | |||
| fbf89ec334 | |||
| db768be61c | |||
| 1f3697d930 | |||
| 2c21f2acea | |||
| 77b5f7cfc4 | |||
| a383cfc95f | |||
| 9ff0b408a4 | |||
| 8544f3dd1e | |||
| 50160384aa | |||
| 163a62ece8 | |||
| ffec915e9a | |||
| 5ace95d238 | |||
| 80736f1a40 | |||
| d681b68180 | |||
| f0fd20e993 | |||
| 9736dc185d | |||
| c8548cef8d | |||
| e99867fe09 | |||
| fc722e69d4 | |||
| 1b31bfd35c | |||
| 16f5d539ed | |||
| e74eea84a6 | |||
| 86209ebcf1 | |||
| 14efa80cab |
142 changed files with 697 additions and 1659 deletions
8
.gitmodules
vendored
8
.gitmodules
vendored
|
|
@ -1,15 +1,15 @@
|
|||
[submodule "nvim"]
|
||||
path = src/user/modules/utils/modules/neovim/config/nvim
|
||||
path = user/modules/neovim/nvim
|
||||
url = https://github.com/itme-brain/nvim.git
|
||||
|
||||
[submodule "vim"]
|
||||
path = src/user/modules/utils/modules/vim/vim
|
||||
path = user/modules/vim/vim
|
||||
url = https://github.com/itme-brain/vim.git
|
||||
|
||||
[submodule "git"]
|
||||
path = src/user/modules/git/git
|
||||
path = user/modules/git/git
|
||||
url = https://github.com/itme-brain/git.git
|
||||
|
||||
[submodule "bash"]
|
||||
path = src/user/modules/bash/config/bash
|
||||
path = user/modules/bash/bash
|
||||
url = https://github.com/itme-brain/bash.git
|
||||
|
|
|
|||
191
README.md
191
README.md
|
|
@ -1,23 +1,27 @@
|
|||
# My Nix Configurations 💻
|
||||
# NixOS Configuration
|
||||
|
||||
My modular Nix configs 🔥
|
||||
Modular NixOS flake configuration with home-manager integration.
|
||||
|
||||
## Requirements ⚙️
|
||||
## Requirements
|
||||
|
||||
- [Nix 2.0 & Flakes enabled](https://nixos.wiki/wiki/Flakes#Enable_flakes_permanently_in_NixOS)
|
||||
- [Nix with Flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes_permanently_in_NixOS)
|
||||
- [NixOS](https://www.nixos.org/) for system configurations
|
||||
- [Nix Home-Manager](https://nix-community.github.io/home-manager/index.xhtml#sec-flakes-standalone) for user configurations
|
||||
- [Home-Manager](https://nix-community.github.io/home-manager/) for user configurations
|
||||
|
||||
## Flake Endpoints ❄️
|
||||
## Flake Outputs
|
||||
|
||||
NixOS Configurations: `desktop` · `workstation` · `server` (wip) · `vm` · `wsl`
|
||||
| Configuration | Description |
|
||||
|---------------|-------------|
|
||||
| `desktop` | Primary workstation |
|
||||
| `server` | Home server |
|
||||
| `wsl` | Windows Subsystem for Linux |
|
||||
|
||||
## Fresh Install 🚀
|
||||
## Fresh Install
|
||||
|
||||
From the NixOS live installer:
|
||||
|
||||
```bash
|
||||
# Enable flakes (not enabled by default on installer)
|
||||
# Enable flakes
|
||||
echo "experimental-features = nix-command flakes" | sudo tee -a /etc/nix/nix.conf
|
||||
|
||||
# Clone repo
|
||||
|
|
@ -29,117 +33,90 @@ nix develop
|
|||
just install desktop
|
||||
```
|
||||
|
||||
Replace `desktop` with `workstation` or `vm` as needed.
|
||||
|
||||
## Getting Started 🔧
|
||||
## Getting Started
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules git@github.com:itme-brain/nixos.git
|
||||
cd nixos
|
||||
nix develop
|
||||
just
|
||||
```
|
||||
|
||||
Enter the dev shell with `nix develop`, then run `just` to see available project scripts.
|
||||
**Note:** Replace `hardware.nix` in `system/machines/<machine>` with output from `nixos-generate-config` for your hardware.
|
||||
|
||||
Useful resources:
|
||||
- [nixpkgs Packages](https://search.nixos.org/packages) 📦️
|
||||
- [nixpkgs Options](https://search.nixos.org/options?) 🔍️
|
||||
- [Home-Manager Options](https://mipmip.github.io/home-manager-option-search/) ☕️
|
||||
|
||||
⚠️ Be sure to tailor any hardware settings to your own — replace the `hardware.nix` in `src/system/machines/<machine>` with output from `nixos-generate-config`
|
||||
|
||||
## Submodules 🔗
|
||||
|
||||
Standalone portable configurations maintained as separate repos. Each can be cloned independently on any system — NixOS or not.
|
||||
|
||||
| Submodule | Purpose | Repo | Standalone Install |
|
||||
|-----------|---------|------|--------------------|
|
||||
| **nvim** | Full IDE (LSP, treesitter, telescope) | [itme-brain/nvim](https://github.com/itme-brain/nvim) | `git clone git@github.com:itme-brain/nvim.git ~/.config/nvim` |
|
||||
| **vim** | Lightweight editor for headless servers | [itme-brain/vim](https://github.com/itme-brain/vim) | `git clone git@github.com:itme-brain/vim.git ~/.vim` |
|
||||
|
||||
```bash
|
||||
# Update a submodule
|
||||
cd <submodule-path>
|
||||
git add . && git commit -m "your changes" && git push
|
||||
cd /path/to/nixos
|
||||
git add <submodule-path> && git commit -m "Update <name> submodule"
|
||||
|
||||
# Pull submodule updates from remote
|
||||
git submodule update --remote
|
||||
git add <submodule-path> && git commit -m "Update <name> submodule"
|
||||
```
|
||||
|
||||
## Directory Structure 🗂️
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
.
|
||||
├── flake.nix # Flake entrypoint - defines all NixOS configurations
|
||||
├── flake.nix
|
||||
├── flake.lock
|
||||
├── justfile # Project scripts (via `just`)
|
||||
├── system.configs -> src/system/machines/ # Symlink for quick access
|
||||
├── user.configs -> src/user/config/ # Symlink for quick access
|
||||
└── src/
|
||||
├── system/ # System-level (NixOS) configuration
|
||||
│ ├── machines/ # Per-machine NixOS configurations
|
||||
│ │ ├── desktop/ # Desktop config (flake: nixosConfigurations.desktop)
|
||||
│ │ │ ├── default.nix # Machine entry point
|
||||
│ │ │ ├── hardware.nix # Machine-specific hardware config
|
||||
│ │ │ ├── system.nix # System-level settings
|
||||
│ │ │ └── modules/
|
||||
│ │ │ ├── disko/ # Disk partitioning (disko)
|
||||
│ │ │ └── home-manager/ # Home-manager integration + home.nix
|
||||
│ │ ├── workstation/ # Workstation config (same structure as desktop)
|
||||
│ │ ├── server/ # Server config (no disko)
|
||||
│ │ ├── vm/ # VM config
|
||||
│ │ ├── wsl/ # WSL config (includes wsl module)
|
||||
│ │ └── laptop/ # Laptop config (stub)
|
||||
│ └── modules/ # Shared system modules (imported by machines)
|
||||
│ ├── default.nix
|
||||
│ ├── bitcoin/ # Bitcoin node + electrum server
|
||||
│ ├── forgejo/ # Self-hosted Forgejo
|
||||
│ └── nginx/ # Nginx reverse proxy
|
||||
│
|
||||
└── user/ # User-level (home-manager) configuration
|
||||
├── default.nix # User module entry point
|
||||
├── config/ # User identity & settings
|
||||
│ ├── default.nix # Common user variables (username, email, etc.)
|
||||
│ ├── bookmarks/ # Browser bookmarks
|
||||
│ ├── keys/ # Public keys
|
||||
│ │ ├── pgp/ # PGP public keys
|
||||
│ │ └── ssh/ # SSH public keys
|
||||
│ ├── nvim # Symlink to neovim submodule config
|
||||
│ └── vim # Symlink to vim submodule config
|
||||
└── modules/ # Home-manager modules
|
||||
├── bash/ # Shell config (aliases, prompt, bashrc)
|
||||
├── git/ # Git config + helper scripts
|
||||
├── tmux/ # Tmux config
|
||||
├── security/ # Security tools (GPG)
|
||||
├── utils/ # CLI utilities
|
||||
│ └── modules/
|
||||
│ ├── dev/ # Dev tools (penpot, PCB design)
|
||||
│ ├── email/ # Email client (aerc)
|
||||
│ ├── irc/ # IRC client
|
||||
│ ├── neovim/ # Neovim (config is a git submodule)
|
||||
│ └── vim/ # Vim lightweight (config is a git submodule)
|
||||
└── gui/ # GUI applications
|
||||
├── modules/
|
||||
│ ├── alacritty/ # Terminal emulator
|
||||
│ ├── browsers/ # Firefox & Chromium
|
||||
│ ├── corn/ # Corn app
|
||||
│ ├── fun/ # Discord, etc.
|
||||
│ ├── utils/ # GUI utilities
|
||||
│ └── writing/ # Writing tools
|
||||
└── wm/ # Window managers
|
||||
├── hyprland/ # Hyprland (Wayland) + waybar, rofi
|
||||
├── sway/ # Sway (Wayland) + rofi
|
||||
├── i3/ # i3 (X11) + rofi
|
||||
└── shared/ # Shared WM config (mimeapps)
|
||||
├── justfile
|
||||
│
|
||||
├── system/
|
||||
│ ├── keys/ # Machine SSH keys
|
||||
│ │ └── desktop/
|
||||
│ └── machines/
|
||||
│ ├── desktop/
|
||||
│ │ ├── default.nix # Machine entry point
|
||||
│ │ ├── hardware.nix # Hardware config
|
||||
│ │ ├── system.nix # System settings
|
||||
│ │ └── modules/
|
||||
│ │ ├── disko/ # Disk partitioning
|
||||
│ │ └── home-manager/ # Home-manager integration
|
||||
│ ├── server/ # Server (same structure)
|
||||
│ └── wsl/ # WSL (same structure)
|
||||
│
|
||||
└── user/
|
||||
├── default.nix # User options (name, email, keys)
|
||||
├── home.nix # Shared home-manager defaults
|
||||
├── bookmarks/
|
||||
├── keys/
|
||||
│ ├── age/
|
||||
│ ├── pgp/
|
||||
│ └── ssh/
|
||||
└── modules/
|
||||
├── bash/bash/ # Shell (submodule)
|
||||
├── git/git/ # Git (submodule)
|
||||
├── neovim/nvim/ # Neovim (submodule)
|
||||
├── vim/vim/ # Vim (submodule)
|
||||
├── tmux/
|
||||
├── dev/ # CLI dev tools
|
||||
├── security/
|
||||
│ ├── gpg/
|
||||
│ └── yubikey/
|
||||
├── utils/
|
||||
│ ├── dev/ # Dev tools (claude-code, direnv, etc.)
|
||||
│ ├── email/
|
||||
│ ├── irc/
|
||||
│ └── writing/
|
||||
└── gui/
|
||||
├── default.nix # Browser-focused mimeApps
|
||||
├── wm/
|
||||
│ ├── hyprland/
|
||||
│ └── sway/
|
||||
├── browsers/
|
||||
├── alacritty/
|
||||
├── dev/
|
||||
│ ├── pcb/ # Arduino, KiCad
|
||||
│ └── design/ # Penpot
|
||||
├── corn/
|
||||
├── fun/
|
||||
└── utils/
|
||||
```
|
||||
|
||||
### How it works
|
||||
## Architecture
|
||||
|
||||
**flake.nix** defines NixOS configurations (desktop, workstation, server, wsl) that each reference a machine under `src/system/machines/`. Each machine's `default.nix` pulls in its own `hardware.nix`, `system.nix`, and per-machine modules (disko, home-manager).
|
||||
**flake.nix** defines NixOS configurations that reference machines under `system/machines/`.
|
||||
Each machine imports its hardware, system settings, and home-manager config.
|
||||
|
||||
The **system layer** (`src/system/`) handles NixOS-level concerns: hardware, bootloader, networking, and system services. Shared modules in `src/system/modules/` can be imported by any machine.
|
||||
**user/home.nix** provides shared defaults for all users:
|
||||
- Essential packages
|
||||
- Default modules
|
||||
|
||||
The **user layer** (`src/user/`) handles home-manager configuration. `src/user/config/` defines user identity (name, email, keys), while `src/user/modules/` contains modular home-manager configs for individual tools. Each machine's `home-manager/home.nix` selects which user modules to enable.
|
||||
**Machine home.nix** imports user defaults and enables machine-specific modules.
|
||||
|
||||
Root symlinks `system.configs` and `user.configs` provide quick access to machine definitions and user config from the repo root.
|
||||
## Resources
|
||||
|
||||
- [nixpkgs Packages](https://search.nixos.org/packages)
|
||||
- [nixpkgs Options](https://search.nixos.org/options)
|
||||
- [Home-Manager Options](https://home-manager-options.extranix.com)
|
||||
|
|
|
|||
6
flake.lock
generated
6
flake.lock
generated
|
|
@ -102,11 +102,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1772822230,
|
||||
"narHash": "sha256-yf3iYLGbGVlIthlQIk5/4/EQDZNNEmuqKZkQssMljuw=",
|
||||
"lastModified": 1773375660,
|
||||
"narHash": "sha256-SEzUWw2Rf5Ki3bcM26nSKgbeoqi2uYy8IHVBqOKjX3w=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "71caefce12ba78d84fe618cf61644dce01cf3a96",
|
||||
"rev": "3e20095fe3c6cbb1ddcef89b26969a69a1570776",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
60
flake.nix
60
flake.nix
|
|
@ -22,66 +22,36 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, nur, home-manager, nixos-wsl, disko, ... }:
|
||||
outputs = { nixpkgs, nur, ... }@inputs:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs {
|
||||
mkPkgs = system: import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
nvidia.acceptLicense = true;
|
||||
nvidia.acceptLicense = true;
|
||||
};
|
||||
overlays = [
|
||||
nur.overlays.default
|
||||
];
|
||||
};
|
||||
|
||||
mkSystem = { path, system ? "x86_64-linux" }:
|
||||
let pkgs = mkPkgs system;
|
||||
in nixpkgs.lib.nixosSystem {
|
||||
inherit system pkgs;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ path ];
|
||||
};
|
||||
|
||||
in
|
||||
with pkgs;
|
||||
{
|
||||
nixosConfigurations = {
|
||||
desktop = nixpkgs.lib.nixosSystem {
|
||||
inherit system pkgs;
|
||||
modules = [
|
||||
disko.nixosModules.disko
|
||||
./src/system/machines/desktop
|
||||
home-manager.nixosModules.home-manager
|
||||
(import ./src/system/machines/desktop/modules/home-manager)
|
||||
];
|
||||
};
|
||||
|
||||
workstation = nixpkgs.lib.nixosSystem {
|
||||
inherit system pkgs;
|
||||
modules = [
|
||||
./src/system/machines/workstation
|
||||
home-manager.nixosModules.home-manager
|
||||
(import ./src/system/machines/workstation/modules/home-manager)
|
||||
];
|
||||
};
|
||||
|
||||
server = nixpkgs.lib.nixosSystem {
|
||||
inherit system pkgs;
|
||||
modules = [
|
||||
disko.nixosModules.disko
|
||||
./src/system/machines/server
|
||||
home-manager.nixosModules.home-manager
|
||||
(import ./src/system/machines/server/modules/home-manager)
|
||||
];
|
||||
};
|
||||
|
||||
wsl = nixpkgs.lib.nixosSystem {
|
||||
inherit system pkgs;
|
||||
modules = [
|
||||
./src/system/machines/wsl
|
||||
nixos-wsl.nixosModules.wsl
|
||||
(import ./src/system/machines/wsl/modules/wsl)
|
||||
home-manager.nixosModules.home-manager
|
||||
(import ./src/system/machines/wsl/modules/home-manager)
|
||||
];
|
||||
};
|
||||
desktop = mkSystem { path = ./system/machines/desktop; };
|
||||
server = mkSystem { path = ./system/machines/server; };
|
||||
wsl = mkSystem { path = ./system/machines/wsl; };
|
||||
};
|
||||
|
||||
devShells.${system}.default = mkShell {
|
||||
devShells.x86_64-linux.default = with mkPkgs "x86_64-linux"; mkShell {
|
||||
name = "devShell";
|
||||
packages = [
|
||||
just
|
||||
|
|
|
|||
10
justfile
10
justfile
|
|
@ -1,5 +1,5 @@
|
|||
SYSTEM := "$(echo $HOSTNAME)"
|
||||
VALID_SYSTEMS := "desktop workstation server wsl vm laptop"
|
||||
VALID_SYSTEMS := "desktop server wsl"
|
||||
|
||||
# Print this list
|
||||
default:
|
||||
|
|
@ -10,7 +10,7 @@ default:
|
|||
_validate SYSTEM:
|
||||
#!/usr/bin/env bash
|
||||
case "{{SYSTEM}}" in
|
||||
desktop|workstation|server|wsl|vm|laptop) ;;
|
||||
desktop|server|wsl) ;;
|
||||
*) echo "Error: Unknown system '{{SYSTEM}}'. Use one of: {{VALID_SYSTEMS}}"; exit 1 ;;
|
||||
esac
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ out SYSTEM="desktop": (_validate SYSTEM)
|
|||
|
||||
# Test switch into the next generation
|
||||
[group('nixos')]
|
||||
test SYSTEM="desktop": (_validate SYSTEM)
|
||||
test SYSTEM=SYSTEM: (_validate SYSTEM)
|
||||
@echo "Testing switching to next NixOS generation for {{SYSTEM}}..."
|
||||
@sudo nixos-rebuild test --flake .#{{SYSTEM}}
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ partition SYSTEM:
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DISKO_CONFIG="./src/system/machines/{{SYSTEM}}/modules/disko/default.nix"
|
||||
DISKO_CONFIG="./system/machines/{{SYSTEM}}/modules/disko/default.nix"
|
||||
|
||||
if [[ ! -f "$DISKO_CONFIG" ]]; then
|
||||
echo "Error: No disko config for '{{SYSTEM}}'"
|
||||
|
|
@ -172,7 +172,7 @@ install SYSTEM:
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DISKO_CONFIG="./src/system/machines/{{SYSTEM}}/modules/disko/default.nix"
|
||||
DISKO_CONFIG="./system/machines/{{SYSTEM}}/modules/disko/default.nix"
|
||||
|
||||
if [[ ! -f "$DISKO_CONFIG" ]]; then
|
||||
echo "Error: No disko config for '{{SYSTEM}}'"
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
machines = mkOption {
|
||||
description = "Machine Configurations";
|
||||
type = types.attrs;
|
||||
default = {
|
||||
keys = import ./keys { inherit lib; };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# Desktop Keys
|
||||
|
||||
ssh.pub.key - ~/.ssh/id_rsa
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../../user/config
|
||||
../../config
|
||||
./hardware.nix
|
||||
./system.nix
|
||||
./modules/disko
|
||||
];
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.extraSpecialArgs = {
|
||||
monitors = config.monitors;
|
||||
};
|
||||
home-manager.users.${config.user.name} = {
|
||||
imports = [ ../../../../../user ];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
enableDefaultConfig = false;
|
||||
matchBlocks = {
|
||||
"*" = {
|
||||
serverAliveInterval = 60;
|
||||
serverAliveCountMax = 3;
|
||||
};
|
||||
"server" = {
|
||||
hostname = "192.168.0.154";
|
||||
user = "bryan";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.stateVersion = "23.11";
|
||||
|
||||
home.username = "${config.user.name}";
|
||||
home.homeDirectory = "/home/${config.user.name}";
|
||||
|
||||
modules = {
|
||||
user = {
|
||||
bash.enable = true;
|
||||
git.enable = true;
|
||||
|
||||
security = {
|
||||
enable = true;
|
||||
gpg.enable = true;
|
||||
};
|
||||
|
||||
tmux.enable = true;
|
||||
|
||||
utils = {
|
||||
enable = true;
|
||||
dev = {
|
||||
enable = true;
|
||||
};
|
||||
irc.enable = true;
|
||||
neovim.enable = true;
|
||||
vim.enable = false;
|
||||
};
|
||||
|
||||
gui = {
|
||||
wm.hyprland.enable = true;
|
||||
|
||||
browser = {
|
||||
firefox.enable = true;
|
||||
};
|
||||
|
||||
alacritty.enable = true;
|
||||
corn.enable = true;
|
||||
fun.enable = true;
|
||||
utils.enable = true;
|
||||
writing.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
#TODO: nixify the shitty laptop
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../../user/config
|
||||
../../config
|
||||
./hardware.nix
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./home
|
||||
];
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${config.user.name} = {
|
||||
imports = [ ../../../../../user ];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
home.stateVersion = "25.11";
|
||||
|
||||
home.username = "${config.user.name}";
|
||||
home.homeDirectory = "/home/${config.user.name}";
|
||||
|
||||
modules = {
|
||||
user = {
|
||||
bash.enable = true;
|
||||
git.enable = true;
|
||||
tmux.enable = true;
|
||||
|
||||
security = {
|
||||
gpg.enable = true;
|
||||
};
|
||||
|
||||
utils = {
|
||||
enable = true;
|
||||
vim.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../../user/config
|
||||
../../config
|
||||
./hardware.nix
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
{ config, lib, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "sd_mod" "sr_mod" ];
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./home
|
||||
];
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
{ disk ? "/dev/vda" }:
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
one = {
|
||||
type = "disk";
|
||||
device = disk;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "200M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
primary = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "vm";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
lvm_vg = {
|
||||
vm = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "defaults" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${config.user.name} = {
|
||||
imports = [ ../../../../../user ];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
home.stateVersion = "23.11";
|
||||
|
||||
home.username = "${config.user.name}";
|
||||
home.homeDirectory = "/home/${config.user.name}";
|
||||
|
||||
modules = {
|
||||
user = {
|
||||
bash.enable = true;
|
||||
git.enable = true;
|
||||
|
||||
security = {
|
||||
gpg.enable = true;
|
||||
};
|
||||
|
||||
utils = {
|
||||
enable = true;
|
||||
vim.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
{ system.stateVersion = "23.11";
|
||||
|
||||
imports = [ ../../modules ];
|
||||
|
||||
users.users = {
|
||||
${config.user.name} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = config.user.groups;
|
||||
openssh.authorizedKeys.keys = [ "${config.user.keys.ssh.yubikey}" ];
|
||||
};
|
||||
};
|
||||
|
||||
nix = {
|
||||
channel.enable = false;
|
||||
package = pkgs.nixVersions.stable;
|
||||
extraOptions = "experimental-features = nix-command flakes";
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
trusted-users = [ "${config.user.name}" ];
|
||||
};
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
};
|
||||
|
||||
boot.loader = {
|
||||
timeout = null;
|
||||
grub = {
|
||||
enable = true;
|
||||
useOSProber = true;
|
||||
devices = [ "nodev" ];
|
||||
efiSupport = true;
|
||||
configurationLimit = 3;
|
||||
splashImage = null;
|
||||
};
|
||||
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
};
|
||||
};
|
||||
|
||||
#fonts.packages = with pkgs; [
|
||||
# terminus_font
|
||||
# terminus-nerdfont
|
||||
#];
|
||||
|
||||
security.sudo = {
|
||||
wheelNeedsPassword = false;
|
||||
execWheelOnly = true;
|
||||
};
|
||||
|
||||
time = {
|
||||
timeZone = "America/New_York";
|
||||
hardwareClockInLocalTime = false;
|
||||
};
|
||||
|
||||
services.timesyncd = lib.mkDefault {
|
||||
enable = true;
|
||||
servers = [
|
||||
"0.pool.ntp.org"
|
||||
"1.pool.ntp.org"
|
||||
"2.pool.ntp.org"
|
||||
"3.pool.ntp.org"
|
||||
];
|
||||
};
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
useXkbConfig = true;
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = "vm";
|
||||
useDHCP = lib.mkDefault true;
|
||||
networkmanager.enable = true;
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ 22 80 443 ];
|
||||
};
|
||||
};
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
startWhenNeeded = true;
|
||||
settings = {
|
||||
X11Forwarding = false;
|
||||
PasswordAuthentication = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../../user/config
|
||||
../../config
|
||||
./hardware.nix
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||
kernelModules = [ "dm-snapshot" ];
|
||||
};
|
||||
extraModulePackages = [ ];
|
||||
kernelParams = [ "intel_iommu=on" ];
|
||||
kernelModules = [
|
||||
"kvm-intel"
|
||||
"virtio"
|
||||
"vfio-pci"
|
||||
"coretemp"
|
||||
|
||||
"ipmi_devintf"
|
||||
"ipmi_si"
|
||||
];
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
ipmitool
|
||||
ipmicfg
|
||||
ipmiutil
|
||||
ipmiview
|
||||
|
||||
linuxHeaders
|
||||
|
||||
vulkan-headers
|
||||
vulkan-loader
|
||||
vulkan-tools
|
||||
vulkan-extension-layer
|
||||
|
||||
mesa
|
||||
mesa-demos
|
||||
|
||||
libGL
|
||||
];
|
||||
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "/dev/disk/by-uuid/6e964c61-ea77-48cc-b495-6a8516b8e756";
|
||||
fsType = "xfs";
|
||||
};
|
||||
|
||||
"/home" = {
|
||||
device = "/dev/disk/by-uuid/db504fb8-14f8-4292-b745-32d6255c4893";
|
||||
fsType = "xfs";
|
||||
};
|
||||
|
||||
"/boot" = {
|
||||
device = "/dev/disk/by-uuid/61E7-6E56";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
"/var/lib/libvirt/images" = {
|
||||
device = "/home/VMs";
|
||||
options = [ "bind" ];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /home/VMs 0755 root root"
|
||||
];
|
||||
|
||||
virtualisation.libvirtd = {
|
||||
enable = true;
|
||||
qemu = {
|
||||
runAsRoot = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ];
|
||||
|
||||
hardware = {
|
||||
graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
|
||||
nvidia = {
|
||||
open = false;
|
||||
powerManagement.enable = false;
|
||||
powerManagement.finegrained = false;
|
||||
modesetting.enable = true;
|
||||
nvidiaSettings = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
|
||||
version = "550.120";
|
||||
sha256_64bit = "sha256-gBkoJ0dTzM52JwmOoHjMNwcN2uBN46oIRZHAX8cDVpc=";
|
||||
settingsSha256 = "sha256-fPfIPwpIijoUpNlAUt9C8EeXR5In633qnlelL+btGbU=";
|
||||
persistencedSha256 = lib.fakeSha256;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
{ disk }:
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
one = {
|
||||
type = "disk";
|
||||
device = disk;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
primary = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "nix";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
lvm_vg = {
|
||||
nix = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
size = "5%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "defaults" ];
|
||||
};
|
||||
};
|
||||
home = {
|
||||
size = "100%FREE";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/home";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${config.user.name} = {
|
||||
imports = [ ../../../../../user ];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
home.stateVersion = "23.11";
|
||||
|
||||
home.username = "${config.user.name}";
|
||||
home.homeDirectory = "/home/${config.user.name}";
|
||||
|
||||
modules = {
|
||||
user = {
|
||||
bash.enable = true;
|
||||
git.enable = true;
|
||||
|
||||
security = {
|
||||
enable = true;
|
||||
gpg.enable = true;
|
||||
};
|
||||
|
||||
tmux.enable = true;
|
||||
|
||||
utils = {
|
||||
enable = true;
|
||||
dev = {
|
||||
enable = true;
|
||||
};
|
||||
email.enable = true;
|
||||
neovim.enable = true;
|
||||
vim.enable = true;
|
||||
};
|
||||
|
||||
gui = {
|
||||
wm.i3.enable = true;
|
||||
|
||||
browser = {
|
||||
chromium.enable = true;
|
||||
};
|
||||
|
||||
alacritty.enable = true;
|
||||
utils.enable = true;
|
||||
writing.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
{ pkgs, lib, config, home-manager, ... }:
|
||||
|
||||
with lib;
|
||||
{
|
||||
system.stateVersion = "23.11";
|
||||
|
||||
users.users = {
|
||||
${config.user.name} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = config.user.groups
|
||||
++ [ "video" "audio" "kvm" "libvirtd" "dialout" ];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"${config.user.keys.ssh.yubikey}"
|
||||
"${config.user.keys.ssh.work}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nix = {
|
||||
channel.enable = false;
|
||||
package = pkgs.nixVersions.stable;
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
keep-going = true
|
||||
'';
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
trusted-users = [ "${config.user.name}" ];
|
||||
substitute = true;
|
||||
max-jobs = "auto";
|
||||
};
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
};
|
||||
|
||||
boot.loader = {
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 5;
|
||||
memtest86.enable = true;
|
||||
};
|
||||
timeout = null;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
git
|
||||
usbutils
|
||||
];
|
||||
|
||||
fonts.packages = with pkgs; [
|
||||
terminus_font
|
||||
terminus-nerdfont
|
||||
];
|
||||
|
||||
security = {
|
||||
sudo = {
|
||||
wheelNeedsPassword = false;
|
||||
execWheelOnly = true;
|
||||
};
|
||||
polkit.enable = true;
|
||||
};
|
||||
|
||||
time = {
|
||||
timeZone = "America/New_York";
|
||||
hardwareClockInLocalTime = true;
|
||||
};
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
useXkbConfig = true;
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = "workstation";
|
||||
useDHCP = lib.mkDefault true;
|
||||
networkmanager.enable = true;
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ 22 80 443 ];
|
||||
};
|
||||
};
|
||||
|
||||
programs.i3lock = {
|
||||
enable = true;
|
||||
package = pkgs.i3lock-fancy;
|
||||
};
|
||||
|
||||
services = {
|
||||
xserver.enable = true;
|
||||
displayManager.ly.enable = true;
|
||||
|
||||
teamviewer.enable = true;
|
||||
|
||||
timesyncd = lib.mkDefault {
|
||||
enable = true;
|
||||
servers = [
|
||||
"0.pool.ntp.org"
|
||||
"1.pool.ntp.org"
|
||||
"2.pool.ntp.org"
|
||||
"3.pool.ntp.org"
|
||||
];
|
||||
};
|
||||
|
||||
pipewire = {
|
||||
enable = true;
|
||||
audio.enable = true;
|
||||
|
||||
wireplumber.enable = true;
|
||||
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
};
|
||||
|
||||
openssh = {
|
||||
enable = true;
|
||||
startWhenNeeded = false;
|
||||
settings = {
|
||||
X11Forwarding = false;
|
||||
PasswordAuthentication = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../../user/config
|
||||
../../config
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
<<<<<<<< HEAD:src/system/machines/wsl/modules/home-manager/default.nix
|
||||
./home.nix
|
||||
========
|
||||
./c-lightning-REST
|
||||
>>>>>>>> lightning:src/system/modules/bitcoin/modules/clightning/plugins/default.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${config.user.name} = {
|
||||
imports = [ ../../../../../user ];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
home.stateVersion = "23.11";
|
||||
|
||||
home.username = "${config.user.name}";
|
||||
home.homeDirectory = "/home/${config.user.name}";
|
||||
|
||||
modules = {
|
||||
user = {
|
||||
bash.enable = true;
|
||||
git.enable = true;
|
||||
|
||||
security = {
|
||||
enable = true;
|
||||
gpg.enable = true;
|
||||
};
|
||||
|
||||
tmux.enable = true;
|
||||
|
||||
utils = {
|
||||
enable = true;
|
||||
dev.enable = true;
|
||||
email.enable = true;
|
||||
irc.enable = true;
|
||||
neovim.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.system.frigate;
|
||||
nginx = config.modules.system.nginx;
|
||||
domain = "ramos.codes";
|
||||
|
||||
in
|
||||
{
|
||||
options.modules.system.frigate = {
|
||||
enable = mkEnableOption "Enable Frigate NVR";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.frigate = {
|
||||
enable = true;
|
||||
hostname = "frigate.${domain}";
|
||||
# vaapiDriver = "i965"; # Haswell only supports H.264, not HEVC
|
||||
settings = {
|
||||
mqtt.enabled = false;
|
||||
# ffmpeg.hwaccel_args = "preset-vaapi"; # Disabled - camera uses HEVC which Haswell can't decode
|
||||
record.enabled = true;
|
||||
cameras = {
|
||||
doorbell = {
|
||||
enabled = true;
|
||||
detect.enabled = false;
|
||||
ffmpeg.inputs = [{
|
||||
path = "rtsp://admin:ocu?u3Su@192.168.1.167/cam/realmonitor?channel=1&subtype=0";
|
||||
roles = [ "record" ];
|
||||
}];
|
||||
};
|
||||
living_room = {
|
||||
enabled = false;
|
||||
detect.enabled = false;
|
||||
ffmpeg.inputs = [{
|
||||
path = "rtsp://admin:ocu?u3Su@192.168.1.147/cam/realmonitor?channel=1&subtype=0";
|
||||
roles = [ "record" ];
|
||||
}];
|
||||
};
|
||||
kitchen = {
|
||||
enabled = false;
|
||||
detect.enabled = false;
|
||||
ffmpeg.inputs = [{
|
||||
path = "rtsp://admin:ocu?u3Su@192.168.1.147/cam/realmonitor?channel=2&subtype=0";
|
||||
roles = [ "record" ];
|
||||
}];
|
||||
};
|
||||
parking_lot = {
|
||||
enabled = true;
|
||||
detect.enabled = false;
|
||||
ffmpeg.inputs = [{
|
||||
path = "rtsp://admin:ocu?u3Su@192.168.1.194/cam/realmonitor?channel=1&subtype=0";
|
||||
roles = [ "record" ];
|
||||
}];
|
||||
};
|
||||
porch = {
|
||||
enabled = false;
|
||||
detect.enabled = false;
|
||||
ffmpeg.inputs = [{
|
||||
path = "rtsp://admin:ocu?u3Su@192.168.0.43/cam/realmonitor?channel=1&subtype=0";
|
||||
roles = [ "record" ];
|
||||
}];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Add SSL to frigate's nginx virtualHost
|
||||
services.nginx.virtualHosts."frigate.${domain}" = mkIf nginx.enable {
|
||||
useACMEHost = domain;
|
||||
forceSSL = true;
|
||||
};
|
||||
|
||||
# Bind mount caches into the 3TB frigate LVM volume
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/lib/frigate/cache 0750 frigate frigate -"
|
||||
"d /var/lib/frigate/nginx-cache 0750 nginx nginx -"
|
||||
];
|
||||
|
||||
fileSystems."/var/cache/frigate" = {
|
||||
device = "/var/lib/frigate/cache";
|
||||
options = [ "bind" ];
|
||||
};
|
||||
|
||||
fileSystems."/var/cache/nginx/frigate" = {
|
||||
device = "/var/lib/frigate/nginx-cache";
|
||||
options = [ "bind" ];
|
||||
};
|
||||
|
||||
# Backup recordings/database, exclude caches
|
||||
modules.system.backup = {
|
||||
paths = [ "/var/lib/frigate" ];
|
||||
exclude = [ "*/cache" "*/nginx-cache" ];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
../modules/bash/config/bash/
|
||||
|
|
@ -1 +0,0 @@
|
|||
../modules/git/git/
|
||||
|
|
@ -1 +0,0 @@
|
|||
../modules/utils/modules/neovim/config/nvim
|
||||
|
|
@ -1 +0,0 @@
|
|||
../modules/utils/modules/vim/vim/
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 79eb823bbb9ff88f284ae055fe1de954df8bf2e0
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
tmux = config.modules.user.tmux;
|
||||
gui = config.modules.user.gui.wm;
|
||||
sway = config.modules.user.gui.wm.sway;
|
||||
hyprland = config.modules.user.gui.wm.hyprland;
|
||||
|
||||
wm = {
|
||||
enable = builtins.any (mod: mod.enable or false) (builtins.attrValues gui);
|
||||
};
|
||||
|
||||
in
|
||||
''
|
||||
case $- in
|
||||
*i*)
|
||||
${optionalString wm.enable ''
|
||||
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
|
||||
${optionalString sway.enable ''
|
||||
exec sway
|
||||
''
|
||||
}
|
||||
${optionalString hyprland.enable ''
|
||||
exec Hyprland
|
||||
''
|
||||
}
|
||||
exit 0
|
||||
fi
|
||||
''}
|
||||
${optionalString tmux.enable ''
|
||||
if [ -z "$DISPLAY" ] && [ -z "$TMUX" ] && [ -z "$SSH_TTY" ]; then
|
||||
exec tmux
|
||||
fi
|
||||
''}
|
||||
;;
|
||||
esac
|
||||
''
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.user.gui.wm.sway;
|
||||
modifier = config.wayland.windowManager.sway.config.modifier;
|
||||
|
||||
wallpaper = builtins.fetchurl {
|
||||
url = "https://images6.alphacoders.com/117/1174033.png";
|
||||
sha256 = "1ph5m9s57076jx6042iipqx2ifzadmd5z4lf5l49wgq4jb92mp16";
|
||||
};
|
||||
|
||||
barStatus = pkgs.writeShellScript "status.sh" ''
|
||||
#!/usr/bin/env bash
|
||||
while :; do
|
||||
echo "$(ip -4 addr show eno1 | awk '/inet / {print $2}' | cut -d'/' -f1) | $(free -h | awk '/^Mem/ {print $3}') | $(date +'%I:%M:%S %p') | $(date +'%m-%d-%Y')"; sleep 1;
|
||||
done
|
||||
'';
|
||||
|
||||
in
|
||||
{ options.modules.user.gui.wm.i3 = { enable = mkEnableOption "Enable i3 WM"; };
|
||||
config = mkIf cfg.enable {
|
||||
xsession = {
|
||||
enable = true;
|
||||
windowManager.i3 = {
|
||||
config = {
|
||||
defaultWorkspace = "workspace number 1";
|
||||
|
||||
fonts = {
|
||||
names = [ "Terminus" ];
|
||||
};
|
||||
|
||||
modifier = "Mod1";
|
||||
menu = "rofi -show drun -show-icons -drun-icon-theme Qogir -font 'Noto Sans 14'";
|
||||
terminal = "${pkgs.alacritty}/bin/alacritty";
|
||||
|
||||
bars = [
|
||||
{
|
||||
position = "top";
|
||||
statusCommand = "${barStatus}";
|
||||
fonts = {
|
||||
names = [ "Terminus" ];
|
||||
size = 12.0;
|
||||
};
|
||||
colors = {
|
||||
background = "#0A0E14";
|
||||
statusline = "#FFFFFF";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
gaps = {
|
||||
smartGaps = false;
|
||||
inner = 10;
|
||||
};
|
||||
|
||||
floating = {
|
||||
titlebar = false;
|
||||
border = 0;
|
||||
criteria = [
|
||||
{
|
||||
title = "Android Emulator";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
window = {
|
||||
titlebar = false;
|
||||
border= 0;
|
||||
};
|
||||
|
||||
keybindings = lib.mkOptionDefault {
|
||||
"${modifier}+q" = "kill";
|
||||
"Print" = "exec grim ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png";
|
||||
"${modifier}+Shift+Print" = "exec grim -g \"$(slurp)\" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png";
|
||||
"${modifier}+Print" = ''exec sh -c 'grim -g "$(swaymsg -t get_tree | jq -j '"'"'.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'"'"')" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png' '';
|
||||
"${modifier}+Shift+f" = "exec alacritty -e sh -c 'EDITOR=nvim ranger'";
|
||||
"${modifier}+Shift+d" = "exec rofi -modi emoji -show emoji";
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
exec_always ${pkgs.autotiling}/bin/autotiling -sr "1.61"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
programs.rofi = import ./config/rofi { inherit pkgs config lib; };
|
||||
|
||||
home.file.".config/rofi" = {
|
||||
source = ./config/rofi/config;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
xdg = {
|
||||
portal = {
|
||||
enable = true;
|
||||
extraPortals = with pkgs; [
|
||||
xdg-desktop-portal-gtk
|
||||
];
|
||||
config.common.default = "*";
|
||||
};
|
||||
};
|
||||
|
||||
gtk = {
|
||||
enable = true;
|
||||
theme.package = pkgs.juno-theme;
|
||||
theme.name = "Juno-ocean";
|
||||
iconTheme.package = pkgs.qogir-icon-theme;
|
||||
iconTheme.name = "Qogir";
|
||||
};
|
||||
|
||||
qt = {
|
||||
enable = true;
|
||||
style.package = pkgs.juno-theme;
|
||||
platformTheme.name = "gtk";
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
pavucontrol
|
||||
xdg-utils
|
||||
wl-clipboard
|
||||
autotiling
|
||||
|
||||
grim
|
||||
jq
|
||||
slurp
|
||||
|
||||
ranger
|
||||
highlight
|
||||
|
||||
nerd-fonts.terminess-ttf
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-color-emoji
|
||||
];
|
||||
|
||||
programs = {
|
||||
imv.enable = true;
|
||||
};
|
||||
|
||||
fonts.fontconfig.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
let
|
||||
browser = config.programs;
|
||||
|
||||
fileTypes = [
|
||||
"text/html" "application/pdf" "application/xml"
|
||||
"image/png" "image/svg+xml" "image/jpg"
|
||||
"image/jpeg" "image/gif" "image/webp"
|
||||
"image/avif" "image/bmp" "image/tiff"
|
||||
];
|
||||
|
||||
defaultBrowser = if browser.firefox.enable then
|
||||
"firefox.desktop"
|
||||
else if browser.brave.enable then
|
||||
"brave-browser.desktop"
|
||||
else if browser.chromium.enable then
|
||||
"chromium.desktop"
|
||||
else null;
|
||||
|
||||
in
|
||||
{
|
||||
xdg.mimeApps = lib.optionalAttrs (defaultBrowser != null && config.xdg.portal.enable) {
|
||||
enable = true;
|
||||
defaultApplications = builtins.listToAttrs (
|
||||
map (type: {
|
||||
name = type;
|
||||
value = [ defaultBrowser ];
|
||||
}) fileTypes
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
configuration {
|
||||
font: "SF Pro Rounded 10";
|
||||
show-icons: true;
|
||||
kb-cancel: "Escape,Alt+F1";
|
||||
}
|
||||
|
||||
@theme "~/.config/rofi/material-ocean.rasi"
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
* {
|
||||
background: #0f111a;
|
||||
foreground: #f1f1f1;
|
||||
selected: #ff4151;
|
||||
}
|
||||
|
||||
window {
|
||||
transparency: "real";
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
padding: 4px 4px 6px 6px;
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
}
|
||||
|
||||
textbox-prompt-colon {
|
||||
expand: false;
|
||||
background-color: @background;
|
||||
padding: 4px 0px 0px 6px;
|
||||
}
|
||||
|
||||
inputbar {
|
||||
children: [ textbox-prompt-colon, entry ];
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
expand: false;
|
||||
border: 0px 0px 0px 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding: 0px 0px 4px 0px;
|
||||
position: center;
|
||||
}
|
||||
|
||||
entry {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
placeholder-color: @foreground;
|
||||
expand: true;
|
||||
horizontal-align: 0;
|
||||
blink: true;
|
||||
padding: 4px 0px 0px 4px;
|
||||
}
|
||||
|
||||
case-indicator {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
spacing: 0;
|
||||
}
|
||||
|
||||
listview {
|
||||
background-color: @background;
|
||||
columns: 1;
|
||||
spacing: 5px;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
layout: vertical;
|
||||
}
|
||||
|
||||
mainbox {
|
||||
background-color: @background;
|
||||
children: [ inputbar, listview ];
|
||||
spacing: 5px;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
element {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
orientation: horizontal;
|
||||
border-radius: 4px;
|
||||
padding: 6px 6px 6px 6px;
|
||||
}
|
||||
|
||||
element-text, element-icon {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
|
||||
element-icon {
|
||||
size: 18px;
|
||||
border: 4px;
|
||||
}
|
||||
|
||||
element selected {
|
||||
background-color: @selected;
|
||||
text-color: @background;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
}
|
||||
|
|
@ -1,183 +0,0 @@
|
|||
{ pkgs, config, ... }:
|
||||
let
|
||||
inherit (config.lib.formats.rasi) mkLiteral;
|
||||
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
package = pkgs.rofi;
|
||||
location = "center";
|
||||
terminal = "\${pkgs.alacritty}/bin/alacritty";
|
||||
plugins = with pkgs; [
|
||||
rofi-emoji
|
||||
];
|
||||
|
||||
#theme = {
|
||||
# "*" = {
|
||||
# nord0 = mkLiteral "#2e3440";
|
||||
# nord1 = mkLiteral "#3b4252";
|
||||
# nord2 = mkLiteral "#434c5e";
|
||||
# nord3 = mkLiteral "#4c566a";
|
||||
# nord4 = mkLiteral "#d8dee9";
|
||||
# nord5 = mkLiteral "#e5e9f0";
|
||||
# nord6 = mkLiteral "#eceff4";
|
||||
# nord7 = mkLiteral "#8fbcbb";
|
||||
# nord8 = mkLiteral "#88c0d0";
|
||||
# nord9 = mkLiteral "#81a1c1";
|
||||
# nord10 = mkLiteral "#5e81ac";
|
||||
# nord11 = mkLiteral "#bf616a";
|
||||
# nord12 = mkLiteral "#d08770";
|
||||
# nord13 = mkLiteral "#ebcb8b";
|
||||
# nord14 = mkLiteral "#a3be8c";
|
||||
# nord15 = mkLiteral "#b48ead";
|
||||
# spacing = 2;
|
||||
# background-color = mkLiteral "var(nord1)";
|
||||
# background = mkLiteral "var(nord1)";
|
||||
# foreground = mkLiteral "var(nord4)";
|
||||
# normal-background = mkLiteral "var(background)";
|
||||
# normal-foreground = mkLiteral "var(foreground)";
|
||||
# alternate-normal-background = mkLiteral "var(background)";
|
||||
# alternate-normal-foreground = mkLiteral "var(foreground)";
|
||||
# selected-normal-background = mkLiteral "var(nord8)";
|
||||
# selected-normal-foreground = mkLiteral "var(background)";
|
||||
# active-background = mkLiteral "var(background)";
|
||||
# active-foreground = mkLiteral "var(nord10)";
|
||||
# alternate-active-background = mkLiteral "var(background)";
|
||||
# alternate-active-foreground = mkLiteral "var(nord10)";
|
||||
# selected-active-background = mkLiteral "var(nord10)";
|
||||
# selected-active-foreground = mkLiteral "var(background)";
|
||||
# urgent-background = mkLiteral "var(background)";
|
||||
# urgent-foreground = mkLiteral "var(nord11)";
|
||||
# alternate-urgent-background = mkLiteral "var(background)";
|
||||
# alternate-urgent-foreground = mkLiteral "var(nord11)";
|
||||
# selected-urgent-background = mkLiteral "var(nord11)";
|
||||
# selected-urgent-foreground = mkLiteral "var(background)";
|
||||
# };
|
||||
#
|
||||
# element = {
|
||||
# padding = mkLiteral "0px 0px 0px 7px";
|
||||
# spacing = mkLiteral "5px";
|
||||
# border = 0;
|
||||
# cursor = mkLiteral "pointer";
|
||||
# };
|
||||
|
||||
# "element normal.normal" = {
|
||||
# background-color = mkLiteral "var(normal-background)";
|
||||
# text-color = mkLiteral "var(normal-foreground)";
|
||||
# };
|
||||
|
||||
# "element normal.urgent" = {
|
||||
# background-color = mkLiteral "var(urgent-background)";
|
||||
# text-color = mkLiteral "var(urgent-foreground)";
|
||||
# };
|
||||
|
||||
# "element normal.active" = {
|
||||
# background-color = mkLiteral "var(active-background)";
|
||||
# text-color = mkLiteral "var(active-foreground)";
|
||||
# };
|
||||
|
||||
# "element selected.normal" = {
|
||||
# background-color = mkLiteral "var(selected-normal-background)";
|
||||
# text-color = mkLiteral "var(selected-normal-foreground)";
|
||||
# };
|
||||
|
||||
# "element selected.urgent" = {
|
||||
# background-color = mkLiteral "var(selected-urgent-background)";
|
||||
# text-color = mkLiteral "var(selected-urgent-foreground)";
|
||||
# };
|
||||
|
||||
# "element selected.active" = {
|
||||
# background-color = mkLiteral "var(selected-active-background)";
|
||||
# text-color = mkLiteral "var(selected-active-foreground)";
|
||||
# };
|
||||
|
||||
# "element alternate.normal" = {
|
||||
# background-color = mkLiteral "var(alternate-normal-background)";
|
||||
# text-color = mkLiteral "var(alternate-normal-foreground)";
|
||||
# };
|
||||
|
||||
# "element alternate.urgent" = {
|
||||
# background-color = mkLiteral "var(alternate-urgent-background)";
|
||||
# text-color = mkLiteral "var(alternate-urgent-foreground)";
|
||||
# };
|
||||
|
||||
# "element alternate.active" = {
|
||||
# background-color = mkLiteral "var(alternate-active-background)";
|
||||
# text-color = mkLiteral "var(alternate-active-foreground)";
|
||||
# };
|
||||
|
||||
# "element-text" = {
|
||||
# background-color = mkLiteral "rgba(0, 0, 0, 0%)";
|
||||
# text-color = mkLiteral "inherit";
|
||||
# highlight = mkLiteral "inherit";
|
||||
# cursor = mkLiteral "inherit";
|
||||
# };
|
||||
|
||||
# "element-icon" = {
|
||||
# background-color = mkLiteral "rgba(0, 0, 0, 0%)";
|
||||
# size = mkLiteral "1.0000em";
|
||||
# text-color = mkLiteral "inherit";
|
||||
# cursor = mkLiteral "inherit";
|
||||
# };
|
||||
|
||||
# window = {
|
||||
# padding = 0;
|
||||
# border = 0;
|
||||
# background-color = mkLiteral "var(background)";
|
||||
# };
|
||||
|
||||
# mainbox = {
|
||||
# padding = 0;
|
||||
# border = 0;
|
||||
# };
|
||||
|
||||
# message = {
|
||||
# margin = mkLiteral "0px 7px";
|
||||
# };
|
||||
|
||||
# textbox = {
|
||||
# text-color = mkLiteral "var(foreground)";
|
||||
# };
|
||||
|
||||
# listview = {
|
||||
# margin = mkLiteral "0px 0px 5px";
|
||||
# scrollbar = true;
|
||||
# spacing = mkLiteral "2px";
|
||||
# fixed-height = 0;
|
||||
# };
|
||||
|
||||
# scrollbar = {
|
||||
# padding = 0;
|
||||
# handle-width = mkLiteral "14px";
|
||||
# border = 0;
|
||||
# handle-color = mkLiteral "var(nord3)";
|
||||
# };
|
||||
|
||||
# button = {
|
||||
# spacing = 0;
|
||||
# text-color = mkLiteral "var(normal-foreground)";
|
||||
# cursor = mkLiteral "pointer";
|
||||
# };
|
||||
|
||||
# "button selected" = {
|
||||
# background-color = mkLiteral "var(selected-normal-background)";
|
||||
# text-color = mkLiteral "var(selected-normal-foreground)";
|
||||
# };
|
||||
|
||||
# inputbar = {
|
||||
# padding = mkLiteral "7px";
|
||||
# margin = mkLiteral "7px";
|
||||
# spacing = 0;
|
||||
# text-color = mkLiteral "var(normal-foreground)";
|
||||
# background-color = mkLiteral "var(nord3)";
|
||||
# children = [ "entry" ];
|
||||
# };
|
||||
|
||||
# entry = {
|
||||
# spacing = 0;
|
||||
# cursor = mkLiteral "text";
|
||||
# text-color = mkLiteral "var(normal-foreground)";
|
||||
# background-color = mkLiteral "var(nord3)";
|
||||
# };
|
||||
#};
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.user.security;
|
||||
pass = pkgs.pass.withExtensions (exts: with exts; [
|
||||
pass-audit
|
||||
pass-otp
|
||||
pass-update
|
||||
#pass-tomb
|
||||
]);
|
||||
|
||||
in
|
||||
{ options.modules.user.security = { enable = mkEnableOption "Enable security module"; };
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
pass
|
||||
wireguard-tools
|
||||
ipscan
|
||||
yubikey-manager
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.user.utils;
|
||||
|
||||
in
|
||||
{ options.modules.user.utils = { enable = mkEnableOption "user.utils"; };
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
wget curl fastfetch
|
||||
unzip fping calc fd pciutils
|
||||
rsync zip lshw wireshark
|
||||
calcurse
|
||||
];
|
||||
|
||||
programs.bash.shellAliases = {
|
||||
calendar = "${pkgs.calcurse}/bin/calcurse";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
#TODO: Create a penpot derivation and properly fix the script
|
||||
''
|
||||
function penpot() {
|
||||
case "$1" in
|
||||
run)
|
||||
sudo docker compose -p penpot -f ~/Documents/tools/penpot/docker-compose.yaml up -d >/dev/null 2>&1
|
||||
nohup bash -c '(sleep 10 && if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
xdg-open "http://localhost:9001"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
open "http://localhost:9001"
|
||||
fi)' >/dev/null 2>&1 &
|
||||
echo "Started penpot on http://localhost:9001"
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping penpot"
|
||||
sudo docker compose -p penpot -f ~/Documents/tools/penpot/docker-compose.yaml down >/dev/null 2>&1
|
||||
;;
|
||||
update)
|
||||
sudo docker compose -f ~/Documents/tools/penpot/docker-compose.yaml pull
|
||||
echo "Updated penpot!"
|
||||
;;
|
||||
help)
|
||||
xdg-open "https://help.penpot.app/"
|
||||
echo "Opened penpot help page in your browser."
|
||||
;;
|
||||
*)
|
||||
echo "Usage: penpot {run|stop|update|help}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
''
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 64b4c545481b593d2859bfb3e1c10cd91742213f
|
||||
|
|
@ -1 +0,0 @@
|
|||
src/system/machines/
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
{ lib }:
|
||||
{ lib, ... }:
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
let
|
||||
extractName = filename:
|
||||
let
|
||||
# Remove .key extension
|
||||
noKey = lib.removeSuffix ".key" filename;
|
||||
# Remove .pub/.priv/.public/.private markers
|
||||
noKey = removeSuffix ".key" filename;
|
||||
noMarkers = replaceStrings
|
||||
[ ".pub" ".priv" ".public" ".private" ]
|
||||
[ "" "" "" "" ]
|
||||
|
|
@ -23,11 +22,22 @@ let
|
|||
value = readFile "${dir}/${subdir}/${file}";
|
||||
}) (filter (file:
|
||||
(readDir "${dir}/${subdir}").${file} == "regular" &&
|
||||
lib.hasSuffix ".key" file
|
||||
hasSuffix ".key" file
|
||||
) (attrNames (readDir "${dir}/${subdir}")))
|
||||
);
|
||||
}) (filter (node: (readDir dir).${node} == "directory") (attrNames (readDir dir)))
|
||||
)
|
||||
);
|
||||
|
||||
in
|
||||
constructKeys ./.
|
||||
{
|
||||
options = {
|
||||
machines = mkOption {
|
||||
description = "Machine Configurations";
|
||||
type = types.attrs;
|
||||
default = {
|
||||
keys = constructKeys ./.;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
14
system/machines/desktop/default.nix
Normal file
14
system/machines/desktop/default.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.disko.nixosModules.disko
|
||||
(import ./modules/disko)
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
(import ./modules/home-manager)
|
||||
../../../user
|
||||
../../keys
|
||||
./hardware.nix
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -50,6 +50,8 @@ with lib;
|
|||
|
||||
cudaPackages.cudatoolkit
|
||||
cudaPackages.cudnn
|
||||
|
||||
nvidia-vaapi-driver
|
||||
];
|
||||
|
||||
hardware = {
|
||||
|
|
@ -70,6 +72,9 @@ with lib;
|
|||
};
|
||||
};
|
||||
|
||||
# Despite confusing name, this configures userspace nvidia libraries
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
virtualisation.libvirtd = {
|
||||
enable = true;
|
||||
qemu = {
|
||||
54
system/machines/desktop/modules/home-manager/home.nix
Normal file
54
system/machines/desktop/modules/home-manager/home.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.extraSpecialArgs = {
|
||||
monitors = config.monitors;
|
||||
};
|
||||
home-manager.users.${config.user.name} = {
|
||||
imports = [
|
||||
../../../../../user
|
||||
../../../../../user/home.nix
|
||||
../../../../../user/modules
|
||||
];
|
||||
|
||||
home.stateVersion = "23.11";
|
||||
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
enableDefaultConfig = false;
|
||||
matchBlocks = {
|
||||
"*" = {
|
||||
serverAliveInterval = 60;
|
||||
serverAliveCountMax = 3;
|
||||
};
|
||||
"server" = {
|
||||
hostname = "192.168.0.154";
|
||||
user = "bryan";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Machine-specific modules
|
||||
modules.user = {
|
||||
vim.enable = false;
|
||||
security.yubikey.enable = true;
|
||||
|
||||
utils = {
|
||||
dev.enable = true;
|
||||
irc.enable = true;
|
||||
writing.enable = true;
|
||||
};
|
||||
|
||||
gui = {
|
||||
wm.hyprland.enable = true;
|
||||
browser.firefox.enable = true;
|
||||
alacritty.enable = true;
|
||||
corn.enable = true;
|
||||
fun.enable = true;
|
||||
utils.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
14
system/machines/server/default.nix
Normal file
14
system/machines/server/default.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.disko.nixosModules.disko
|
||||
(import ./modules/disko)
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
(import ./modules/home-manager)
|
||||
../../../user
|
||||
../../keys
|
||||
./hardware.nix
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
./modules/disko
|
||||
];
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot = {
|
||||
initrd = {
|
||||
|
|
@ -3,12 +3,14 @@ let
|
|||
let
|
||||
entries = builtins.readDir dir;
|
||||
names = builtins.attrNames entries;
|
||||
|
||||
|
||||
isModuleDir = path:
|
||||
builtins.pathExists path &&
|
||||
builtins.readFileType path == "directory" &&
|
||||
builtins.baseNameOf path != "config" &&
|
||||
builtins.baseNameOf path != "plugins";
|
||||
builtins.baseNameOf path != "plugins" &&
|
||||
builtins.baseNameOf path != "home-manager" &&
|
||||
builtins.baseNameOf path != "disko";
|
||||
isModule = file: file == "default.nix";
|
||||
isNix = file: builtins.match ".*\\.nix" file != null && file != "default.nix";
|
||||
|
||||
188
system/machines/server/modules/frigate/default.nix
Normal file
188
system/machines/server/modules/frigate/default.nix
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.system.frigate;
|
||||
nginx = config.modules.system.nginx;
|
||||
domain = "ramos.codes";
|
||||
|
||||
in
|
||||
{
|
||||
options.modules.system.frigate = {
|
||||
enable = mkEnableOption "Enable Frigate NVR";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# go2rtc service (required - NixOS frigate doesn't bundle it)
|
||||
services.go2rtc = {
|
||||
enable = true;
|
||||
settings = {
|
||||
rtsp.listen = ":8554";
|
||||
webrtc.listen = ":8555";
|
||||
streams = {
|
||||
doorbell = "rtsp://admin:ocu%3Fu3Su@192.168.1.167/cam/realmonitor?channel=1&subtype=0#backchannel=1";
|
||||
doorbell_sub = "rtsp://admin:ocu%3Fu3Su@192.168.1.167/cam/realmonitor?channel=1&subtype=1";
|
||||
living_room = "rtsp://admin:ocu%3Fu3Su@192.168.1.147/cam/realmonitor?channel=1&subtype=0#backchannel=1";
|
||||
living_room_sub = "rtsp://admin:ocu%3Fu3Su@192.168.1.147/cam/realmonitor?channel=1&subtype=1";
|
||||
kitchen = "rtsp://admin:ocu%3Fu3Su@192.168.1.147/cam/realmonitor?channel=2&subtype=0#backchannel=1";
|
||||
kitchen_sub = "rtsp://admin:ocu%3Fu3Su@192.168.1.147/cam/realmonitor?channel=2&subtype=1";
|
||||
parking_lot = "rtsp://admin:ocu%3Fu3Su@192.168.1.194/cam/realmonitor?channel=1&subtype=0";
|
||||
parking_lot_sub = "rtsp://admin:ocu%3Fu3Su@192.168.1.194/cam/realmonitor?channel=1&subtype=1";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.frigate = {
|
||||
enable = true;
|
||||
hostname = "frigate.${domain}";
|
||||
vaapiDriver = "i965"; # Haswell iGPU for H.264 decode
|
||||
settings = {
|
||||
mqtt.enabled = false;
|
||||
|
||||
ffmpeg = {
|
||||
hwaccel_args = "preset-vaapi"; # VAAPI for H.264 substream detection
|
||||
input_args = "preset-rtsp-restream"; # TCP transport for go2rtc
|
||||
};
|
||||
|
||||
detect.enabled = true;
|
||||
|
||||
record = {
|
||||
enabled = true;
|
||||
# 24/7 recording - needs better hardware
|
||||
# retain = {
|
||||
# days = 14;
|
||||
# mode = "all";
|
||||
# };
|
||||
};
|
||||
cameras = {
|
||||
doorbell = {
|
||||
enabled = true;
|
||||
detect = {
|
||||
enabled = true;
|
||||
width = 640;
|
||||
height = 480;
|
||||
};
|
||||
ffmpeg.inputs = [
|
||||
{
|
||||
path = "rtsp://127.0.0.1:8554/doorbell";
|
||||
roles = [ "record" ];
|
||||
}
|
||||
{
|
||||
path = "rtsp://127.0.0.1:8554/doorbell_sub";
|
||||
roles = [ "detect" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
living_room = {
|
||||
enabled = true;
|
||||
detect.enabled = false; # Disable in GUI
|
||||
audio.enabled = true;
|
||||
motion.mask = [ "0.969,0.078,0.846,0.075,0.845,0.034,0.97,0.037" ];
|
||||
ffmpeg.inputs = [
|
||||
{
|
||||
path = "rtsp://127.0.0.1:8554/living_room";
|
||||
roles = [ "record" ];
|
||||
}
|
||||
{
|
||||
path = "rtsp://127.0.0.1:8554/living_room_sub";
|
||||
roles = [ "detect" "audio" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
kitchen = {
|
||||
enabled = true;
|
||||
detect.enabled = false; # Disable in GUI
|
||||
audio.enabled = true;
|
||||
motion.mask = [ "0.847,0.072,0.846,0.029,0.969,0.032,0.969,0.072" ];
|
||||
ffmpeg.inputs = [
|
||||
{
|
||||
path = "rtsp://127.0.0.1:8554/kitchen";
|
||||
roles = [ "record" ];
|
||||
}
|
||||
{
|
||||
path = "rtsp://127.0.0.1:8554/kitchen_sub";
|
||||
roles = [ "detect" "audio" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
parking_lot = {
|
||||
enabled = true;
|
||||
detect = {
|
||||
enabled = true;
|
||||
width = 640;
|
||||
height = 480;
|
||||
};
|
||||
motion.mask = [ "0.811,0.109,0.954,0.111,0.959,0.065,0.811,0.055" ];
|
||||
zones.Car = {
|
||||
coordinates = "0.299,0.438,0.191,0.951,0.453,0.964,0.453,0.437";
|
||||
loitering_time = 5;
|
||||
};
|
||||
ffmpeg.inputs = [
|
||||
{
|
||||
path = "rtsp://127.0.0.1:8554/parking_lot";
|
||||
roles = [ "record" ];
|
||||
}
|
||||
{
|
||||
path = "rtsp://127.0.0.1:8554/parking_lot_sub";
|
||||
roles = [ "detect" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Add SSL to frigate's nginx virtualHost
|
||||
services.nginx.virtualHosts."frigate.${domain}" = mkIf nginx.enable {
|
||||
useACMEHost = domain;
|
||||
forceSSL = true;
|
||||
locations."/go2rtc/" = {
|
||||
proxyPass = "http://127.0.0.1:1984/";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Frigate segment cache in RAM (reduces disk writes)
|
||||
fileSystems."/var/cache/frigate" = {
|
||||
device = "tmpfs";
|
||||
fsType = "tmpfs";
|
||||
options = [ "size=512M" "mode=0755" ];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
# Set ownership after tmpfs mount
|
||||
"d /var/cache/frigate 0750 frigate frigate -"
|
||||
# Create log directories for Frigate API (NixOS uses journald, but API expects these)
|
||||
"d /dev/shm/logs 0755 frigate frigate -"
|
||||
"d /dev/shm/logs/frigate 0755 frigate frigate -"
|
||||
"d /dev/shm/logs/nginx 0755 frigate frigate -"
|
||||
"d /dev/shm/logs/go2rtc 0755 frigate frigate -"
|
||||
];
|
||||
|
||||
# Pipe journald logs to files for Frigate GUI
|
||||
systemd.services.frigate-log-pipe = {
|
||||
description = "Pipe logs to /dev/shm for Frigate GUI";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "frigate.service" "go2rtc.service" "nginx.service" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "always";
|
||||
ExecStart = pkgs.writeShellScript "frigate-log-pipe" ''
|
||||
while true; do
|
||||
${pkgs.systemd}/bin/journalctl -u frigate -n 500 -o cat > /dev/shm/logs/frigate/current 2>/dev/null
|
||||
${pkgs.systemd}/bin/journalctl -u go2rtc -n 500 -o cat > /dev/shm/logs/go2rtc/current 2>/dev/null
|
||||
${pkgs.systemd}/bin/journalctl -u nginx -n 500 -o cat > /dev/shm/logs/nginx/current 2>/dev/null
|
||||
chown frigate:frigate /dev/shm/logs/*/current
|
||||
sleep 5
|
||||
done
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# Backup recordings/database
|
||||
modules.system.backup = {
|
||||
paths = [ "/var/lib/frigate" ];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
23
system/machines/server/modules/home-manager/default.nix
Normal file
23
system/machines/server/modules/home-manager/default.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${config.user.name} = {
|
||||
imports = [
|
||||
../../../../../user
|
||||
../../../../../user/home.nix
|
||||
../../../../../user/modules
|
||||
];
|
||||
|
||||
home.stateVersion = "25.11";
|
||||
|
||||
# Machine-specific modules
|
||||
modules.user = {
|
||||
neovim.enable = false;
|
||||
vim.enable = true;
|
||||
tmux.enable = false;
|
||||
utils.dev.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
69
system/machines/server/modules/webdav/default.nix
Normal file
69
system/machines/server/modules/webdav/default.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.system.webdav;
|
||||
domain = "ramos.codes";
|
||||
|
||||
in
|
||||
{
|
||||
options.modules.system.webdav = {
|
||||
enable = mkEnableOption "WebDAV server for phone backups";
|
||||
|
||||
directory = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/seedvault";
|
||||
description = "Directory to store backups";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Create backup directory
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${cfg.directory} 0750 webdav webdav -"
|
||||
];
|
||||
|
||||
services.webdav = {
|
||||
enable = true;
|
||||
# Credentials in /var/lib/webdav/env:
|
||||
# WEBDAV_USERNAME=seedvault
|
||||
# WEBDAV_PASSWORD=your-secure-password
|
||||
environmentFile = "/var/lib/webdav/env";
|
||||
settings = {
|
||||
address = "127.0.0.1";
|
||||
port = 8090;
|
||||
directory = cfg.directory;
|
||||
behindProxy = true;
|
||||
permissions = "CRUD"; # Create, Read, Update, Delete
|
||||
users = [
|
||||
{
|
||||
username = "{env}WEBDAV_USERNAME";
|
||||
password = "{env}WEBDAV_PASSWORD";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."backup.${domain}" = {
|
||||
useACMEHost = domain;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:8090";
|
||||
extraConfig = ''
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# WebDAV needs these
|
||||
proxy_pass_request_headers on;
|
||||
proxy_set_header Destination $http_destination;
|
||||
|
||||
# Large file uploads for backups
|
||||
client_max_body_size 0;
|
||||
proxy_request_buffering off;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -2,13 +2,14 @@
|
|||
|
||||
{ system.stateVersion = "25.11";
|
||||
|
||||
imports = [ ../../modules ];
|
||||
imports = [ ./modules ];
|
||||
|
||||
modules.system = {
|
||||
nginx.enable = true;
|
||||
forgejo.enable = true;
|
||||
frigate.enable = true;
|
||||
immich.enable = true;
|
||||
webdav.enable = false;
|
||||
# bitcoin = {
|
||||
# enable = true;
|
||||
# electrum.enable = true;
|
||||
13
system/machines/wsl/default.nix
Normal file
13
system/machines/wsl/default.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.nixos-wsl.nixosModules.wsl
|
||||
(import ./modules/wsl)
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
(import ./modules/home-manager)
|
||||
../../../user
|
||||
../../keys
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
24
system/machines/wsl/modules/home-manager/home.nix
Normal file
24
system/machines/wsl/modules/home-manager/home.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${config.user.name} = {
|
||||
imports = [
|
||||
../../../../../user
|
||||
../../../../../user/home.nix
|
||||
../../../../../user/modules
|
||||
];
|
||||
|
||||
home.stateVersion = "23.11";
|
||||
|
||||
# Machine-specific modules
|
||||
modules.user = {
|
||||
utils = {
|
||||
dev.enable = true;
|
||||
email.enable = true;
|
||||
irc.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
imports = [ ../../../../../user/config ];
|
||||
imports = [ ../../../../../user ];
|
||||
|
||||
wsl = rec {
|
||||
enable = true;
|
||||
defaultUser = lib.mkDefault config.user.name;
|
||||
nativeSystemd = true;
|
||||
useWindowsDriver = true;
|
||||
|
||||
wslConf = {
|
||||
|
|
@ -1 +0,0 @@
|
|||
src/user/config/
|
||||
|
|
@ -1,10 +1,6 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
modules = config.modules.user;
|
||||
|
||||
in
|
||||
{
|
||||
options = {
|
||||
user = mkOption {
|
||||
38
user/home.nix
Normal file
38
user/home.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
|
||||
let
|
||||
pass = pkgs.pass.withExtensions (exts: with exts; [
|
||||
pass-audit
|
||||
pass-otp
|
||||
pass-update
|
||||
pass-tomb
|
||||
]);
|
||||
|
||||
in
|
||||
{
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
home.username = config.user.name;
|
||||
home.homeDirectory = "/home/${config.user.name}";
|
||||
|
||||
# Essential packages for all users
|
||||
home.packages = with pkgs; [
|
||||
pass
|
||||
wget curl fastfetch fd
|
||||
unzip zip rsync
|
||||
calc calcurse
|
||||
];
|
||||
|
||||
programs.bash.shellAliases = {
|
||||
cal = "${pkgs.calcurse}/bin/calcurse";
|
||||
calendar = "${pkgs.calcurse}/bin/calcurse";
|
||||
};
|
||||
|
||||
# Default modules for all users (machines can override with mkForce false)
|
||||
modules.user = {
|
||||
bash.enable = lib.mkDefault true;
|
||||
git.enable = lib.mkDefault true;
|
||||
neovim.enable = lib.mkDefault true;
|
||||
security.gpg.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
1
user/modules/bash/bash
Submodule
1
user/modules/bash/bash
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit a90d89277c4bbd363d6929f434eef633bea439f5
|
||||
|
|
@ -10,12 +10,10 @@ in
|
|||
programs.bash = {
|
||||
enable = true;
|
||||
initExtra = "source ~/.config/bash/bashrc";
|
||||
profileExtra = import ./config/shellHook.nix { inherit lib config; };
|
||||
};
|
||||
|
||||
# .bashrc
|
||||
|
||||
home.file.".config/bash" = {
|
||||
source = ./config/bash;
|
||||
source = ./bash;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
|
|
@ -3,7 +3,7 @@ let
|
|||
let
|
||||
entries = builtins.readDir dir;
|
||||
names = builtins.attrNames entries;
|
||||
|
||||
|
||||
excludedDirs = [ "config" "scripts" ];
|
||||
isSubmodule = path:
|
||||
builtins.pathExists "${path}/.git" &&
|
||||
|
|
@ -14,7 +14,6 @@ let
|
|||
!(builtins.elem (builtins.baseNameOf path) excludedDirs) &&
|
||||
!(isSubmodule path);
|
||||
isModule = file: file == "default.nix";
|
||||
isNix = file: builtins.match ".*\\.nix" file != null && file != "default.nix";
|
||||
|
||||
in
|
||||
builtins.concatMap (name:
|
||||
|
|
@ -25,15 +24,11 @@ let
|
|||
mkModules path false
|
||||
else if isModule name && !isRoot then
|
||||
[ dir ]
|
||||
else if isNix name then
|
||||
[ path ]
|
||||
else
|
||||
[]
|
||||
) names;
|
||||
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./config
|
||||
] ++ mkModules ./. true;
|
||||
imports = mkModules ./. true;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue