mirror of
https://github.com/Cian-H/My_NixOS_Config.git
synced 2026-04-29 10:51:42 +01:00
Compare commits
127 Commits
5883819835
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 69a1f4364b | |||
| 36c0541d61 | |||
| 1a5c582aca | |||
| 58950a3a81 | |||
| 4d5a66d21b | |||
| 96abb9ca7a | |||
| ac37790efd | |||
| 8bc8cfeb7c | |||
| cf2c5a4269 | |||
| d7dfb807a6 | |||
| acbe360b55 | |||
| 0f9cdba39f | |||
| 85a598dd06 | |||
| 6dd23701d7 | |||
| 4b1cfdd845 | |||
| 7cd07d90f2 | |||
| 077f266b51 | |||
| c264f0867f | |||
| e08fe8a195 | |||
| c1200dcf1e | |||
| cc9e3c1927 | |||
| bc5be7c553 | |||
| b4cc636160 | |||
| 9332df2a8d | |||
| cf76e1f8c2 | |||
| da05b15ff0 | |||
| e24b3e722e | |||
| cbcfd5c482 | |||
| 75705ebced | |||
| 2ce738fc0e | |||
| c4d74f74b8 | |||
| ea35fe339b | |||
| 3cf2747833 | |||
| 1b5084c36c | |||
| 62622d8484 | |||
| af45dc34cf | |||
| 3d2516aa83 | |||
| 5d15ebe2d2 | |||
| e8becbb9b4 | |||
| 25e607b05f | |||
| 11dbca9a25 | |||
| 705861861c | |||
| af9e6c1f99 | |||
| 60c8c0e805 | |||
| 052957dda2 | |||
| a99d56674a | |||
| 0ee99ecacc | |||
| 5961834ac1 | |||
| 43890000f1 | |||
| c9dd770fe7 | |||
| d25930beda | |||
| 2e1da650f1 | |||
| 1bed7f9a24 | |||
| 0bdb2cd9c7 | |||
| a2ccb82883 | |||
| 313788b705 | |||
| 10f251232f | |||
| da96083321 | |||
| 1e7dc1c592 | |||
| 973d334944 | |||
| 22bc6e1411 | |||
| 4a57caf66f | |||
| f9ff10b687 | |||
| bfb58ab2d1 | |||
| 845f148529 | |||
| dbe307daa8 | |||
| a6f9f11759 | |||
| 60c06f47f6 | |||
| 71ef3cd92e | |||
| 15a6a14b7e | |||
| 1c5319f82f | |||
| 0d644d769c | |||
| 1d8ce0dd02 | |||
| 0303c204e4 | |||
| 6bbff50ba0 | |||
| 82ef0d74d6 | |||
| 74a6017de2 | |||
| 0016ae4a8a | |||
| 4e68cd734b | |||
| dadbcbb9ea | |||
| 9670b914e2 | |||
| 4f11e3f493 | |||
| 8296de917d | |||
| a81bce828a | |||
| 7cb86d6f50 | |||
| a62f8fdcf4 | |||
| 4375c0629b | |||
| 4286f74af8 | |||
| ddd249b6df | |||
| 94e38cbe84 | |||
| c2ec4c2e8a | |||
| 954652802d | |||
| 3cbadd49ef | |||
| 7add6b42cb | |||
| fc6dc5fcc4 | |||
| 0d151652da | |||
| 6c74c6aac0 | |||
| f610ea778d | |||
| a2306cccd4 | |||
| 717a6ee2f4 | |||
| 7c8d91d0bf | |||
| 7074d8f426 | |||
| 0c22cb09ff | |||
| 8126c81e97 | |||
| 4b56d75dd6 | |||
| 375e0882fe | |||
| 5db7b3c3ea | |||
| 9fdf746aff | |||
| 92e51c4ec0 | |||
| 4b6c081bdd | |||
| 0c7a0e0414 | |||
| c3ba099953 | |||
| 94f550cc9d | |||
| 1c71c860c6 | |||
| 6f8e075aac | |||
| 59b814dcbd | |||
| 0a994a3013 | |||
| 8ecc67c56e | |||
| dfa280fffd | |||
| 338337b880 | |||
| c24b894ccc | |||
| e591a1edcb | |||
| 4c58524477 | |||
| fe046cdb52 | |||
| 77ad9d9147 | |||
| 8ab6f627f0 | |||
| 6929b99a34 |
@@ -1 +1,2 @@
|
||||
nix.conf
|
||||
.direnv
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
# **My NixOS Configuration ❄️**
|
||||
|
||||
This repository contains my personal declarative configuration for NixOS systems and Home Manager profiles. It uses **Nix Flakes** for reproducibility and dependency management.
|
||||
|
||||
## **🖥️ Hosts**
|
||||
|
||||
| Hostname | Type | Description | Key Features |
|
||||
| :---- | :---- | :---- | :---- |
|
||||
| **worklaptop** | Laptop | Personal workstation | Hyprland (UWSM), Nvidia Prime, Dev Tools, Gaming |
|
||||
| **homeserver** | Server | Headless Homelab | Podman Containers, Caddy Reverse Proxy, Gitea, Nextcloud |
|
||||
| **core** | Profile | Generic Home Manager config | Base CLI tools, Shell config, Dotfiles (Distro-agnostic) |
|
||||
|
||||
## **✨ Features**
|
||||
|
||||
* **Flakes:** Fully flake-enabled configuration.
|
||||
* **Shell:** [Nushell](https://www.nushell.sh/) configured as the default user shell with carapace and starship integration.
|
||||
* **Core Profile:** A core configuration is available for bootstrapping new machines or for use on non-NixOS Linux distributions, providing a consistent shell and CLI environment without system-level dependencies.
|
||||
* **Window Manager:** Hyprland with uwsm (Universal Wayland Session Manager) on the laptop.
|
||||
* **Secrets:** [Sops-nix](https://github.com/Mic92/sops-nix) implementation using Age encryption for managing sensitive data (API keys, database passwords).
|
||||
* **Containers:** Declarative OCI containers using Podman (replacing Docker) for homeserver services.
|
||||
* **Automation:** A justfile is included to simplify system updates and garbage collection.
|
||||
* **Theming:** Centralized TokyoNight theme definition passed as specialArgs to Home Manager modules.
|
||||
* **Dotfiles:** Dotfiles are managed via a git submodule mapped to home-manager/core/dotfiles.
|
||||
|
||||
## **📂 Structure**
|
||||
|
||||
.
|
||||
├── .github/ \# GitHub Actions (Submodule sync)
|
||||
├── flake.nix \# Entrypoint & Input definitions
|
||||
├── flake.lock \# Pinned dependency versions
|
||||
├── justfile \# Command runner for system maintenance
|
||||
├── nixos/ \# System-level configurations
|
||||
│ ├── core/ \# Shared system modules
|
||||
│ ├── homeserver/ \# Server-specific hardware & services
|
||||
│ └── worklaptop/ \# Laptop-specific hardware & services
|
||||
├── home-manager/ \# User-level configurations
|
||||
│ ├── core/ \# Shared user modules (dotfiles, shell, etc.)
|
||||
│ ├── homeserver/ \# Server user config
|
||||
│ └── worklaptop/ \# Laptop user config (Hyprland, Theming)
|
||||
└── secrets.yaml \# Encrypted secrets (SOPS)
|
||||
|
||||
## **🚀 Bootstrap / Installation**
|
||||
|
||||
1. **Clone the repository:**
|
||||
git clone \--recursive \[https://github.com/Cian-H/my\_nixos\_config.git\](https://github.com/Cian-H/my\_nixos\_config.git) /home/cianh/my\_nixos\_config
|
||||
cd my\_nixos\_config
|
||||
|
||||
2. **Setup Secrets:**
|
||||
Place your Age private key in the appropriate location (defined in home-manager/\<host\>.nix):
|
||||
* Target: \~/.config/sops/age/keys.txt
|
||||
3. **Apply Configuration:**
|
||||
* **NixOS System:**
|
||||
sudo nixos-rebuild switch \--flake .\#\<hostname\>
|
||||
|
||||
* **Home Manager (Specific Host):**
|
||||
home-manager switch \--flake .\#cianh@\<hostname\>
|
||||
|
||||
* **Home Manager (Core/Generic):**
|
||||
home-manager switch \--flake .\#cianh@core
|
||||
|
||||
## **🛠️ Management (Justfile)**
|
||||
|
||||
I use just to abstract away common nixos-rebuild and home-manager commands.
|
||||
|
||||
| Command | Description |
|
||||
| :---- | :---- |
|
||||
| just update | Updates both System and Home Manager (pulls git & updates flake). |
|
||||
| just update-root | Updates only the NixOS system configuration. |
|
||||
| just update-home | Updates only the Home Manager configuration. |
|
||||
| just install-home | Installs the generic core Home Manager profile. |
|
||||
| just quick-update | Rebuilds configuration *without* pulling git or updating flake inputs. |
|
||||
| just cleanup \<days\> | Garbage collects generations older than \<days\> and optimizes store. |
|
||||
| just repl | Opens a Nix REPL loaded with the flake context. |
|
||||
|
||||
**Example:**
|
||||
|
||||
\# Full system update
|
||||
just update
|
||||
|
||||
\# Quick rebuild after changing a config file
|
||||
just quick-update
|
||||
|
||||
## **🔒 Secrets Management**
|
||||
|
||||
Secrets are managed via sops-nix.
|
||||
|
||||
* **Config:** .sops.yaml
|
||||
* **Key:** keys.txt (Age key)
|
||||
|
||||
To edit secrets:
|
||||
|
||||
sops home-manager/secrets.yaml
|
||||
|
||||
## **📦 Server Services (Homeserver)**
|
||||
|
||||
The homeserver runs services via Podman, orchestrated in home-manager/homeserver/containers.nix.
|
||||
|
||||
Key services include:
|
||||
|
||||
* **Proxy:** Caddy
|
||||
* **Cloud:** Nextcloud (with Redis & MariaDB)
|
||||
* **Code:** Gitea
|
||||
* **Productivity:** Vikunja
|
||||
* **Media:** Jellyfin
|
||||
|
||||
## **🔗 Submodules**
|
||||
|
||||
This repo uses a submodule for raw dotfiles.
|
||||
|
||||
* **Path:** home-manager/core/dotfiles
|
||||
* **Source:** https://github.com/Cian-H/dotfiles.git
|
||||
|
||||
If the folder is empty, initialize it:
|
||||
|
||||
git submodule update \--init \--recursive
|
||||
|
||||
Generated
+349
-42
@@ -1,5 +1,40 @@
|
||||
{
|
||||
"nodes": {
|
||||
"elephant": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770910218,
|
||||
"narHash": "sha256-IyHoHbhLFuIgFG+n7dqHwJaXuNnRaEsxCfAsfudV1KY=",
|
||||
"owner": "abenz1267",
|
||||
"repo": "elephant",
|
||||
"rev": "c354a596ec7a7e34e9c26478dc7ef9680bc23e6d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "abenz1267",
|
||||
"repo": "elephant",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1767039857,
|
||||
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -7,11 +42,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764536451,
|
||||
"narHash": "sha256-BgtcUkBfItu9/yU14IgUaj4rYOanTOUZjUfBP20/ZB4=",
|
||||
"lastModified": 1775425411,
|
||||
"narHash": "sha256-KY6HsebJHEe5nHOWP7ur09mb0drGxYSzE3rQxy62rJo=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "3fdd076e08049a9c7a83149b270440d9787d2df5",
|
||||
"rev": "0d02ec1d0a05f88ef9e74b516842900c41f0f2fe",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -24,16 +59,17 @@
|
||||
"home-manager_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixers-repo",
|
||||
"zen-browser",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1762964643,
|
||||
"narHash": "sha256-RYHN8O/Aja59XDji6WSJZPkJpYVUfpSkyH+PEupBJqM=",
|
||||
"lastModified": 1771756436,
|
||||
"narHash": "sha256-Tl2I0YXdhSTufGqAaD1ySh8x+cvVsEI1mJyJg12lxhI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "827f2a23373a774a8805f84ca5344654c31f354b",
|
||||
"rev": "5bd3589390b431a63072868a90c0f24771ff4cbb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -44,7 +80,7 @@
|
||||
},
|
||||
"hyprcursor-phinger": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1763845612,
|
||||
@@ -60,7 +96,79 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixers-repo": {
|
||||
"inputs": {
|
||||
"elephant": "elephant",
|
||||
"flake-compat": "flake-compat",
|
||||
"hyprcursor-phinger": "hyprcursor-phinger",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"walker": "walker",
|
||||
"zen-browser": "zen-browser"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1772125727,
|
||||
"narHash": "sha256-J41Xm8ewrCn16r0bDtOX+qu+uhNiOp9EAvy4FJ6mhKY=",
|
||||
"owner": "Cian-H",
|
||||
"repo": "Nixers",
|
||||
"rev": "918d6b2bf5fbe032fda2bf989e0716de4d68e057",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Cian-H",
|
||||
"repo": "Nixers",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1764242076,
|
||||
"narHash": "sha256-sKoIWfnijJ0+9e4wRvIgm/HgE27bzwQxcEmo2J/gNpI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2fad6eac6077f03fe109c4d4eb171cf96791faa4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1771369470,
|
||||
"narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0182a361324364ae3f436a63005877674cf45efb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable_2": {
|
||||
"locked": {
|
||||
"lastModified": 1776877367,
|
||||
"narHash": "sha256-EHq1/OX139R1RvBzOJ0aMRT3xnWyqtHBRUBuO1gFzjI=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0726a0ecb6d4e08f6adced58726b95db924cef57",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1762977756,
|
||||
"narHash": "sha256-4PqRErxfe+2toFJFgcRKZ0UI9NSIOJa+7RXVtBhy4KE=",
|
||||
@@ -76,29 +184,13 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1764242076,
|
||||
"narHash": "sha256-sKoIWfnijJ0+9e4wRvIgm/HgE27bzwQxcEmo2J/gNpI=",
|
||||
"lastModified": 1771714954,
|
||||
"narHash": "sha256-nhZJPnBavtu40/L2aqpljrfUNb2rxmWTmSjK2c9UKds=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2fad6eac6077f03fe109c4d4eb171cf96791faa4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1764494334,
|
||||
"narHash": "sha256-x2xCEXUlU4Ap56+t5HaoReOQ/bV/bIQ5rzTn/m+V3HQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d542db745310b6929708d9abea513f3ff19b1341",
|
||||
"rev": "afbbf774e2087c3d734266c22f96fca2e78d3620",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -108,13 +200,45 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1764445028,
|
||||
"narHash": "sha256-ik6H/0Zl+qHYDKTXFPpzuVHSZE+uvVz2XQuQd1IVXzo=",
|
||||
"lastModified": 1768564909,
|
||||
"narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a09378c0108815dbf3961a0e085936f4146ec415",
|
||||
"rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1777077449,
|
||||
"narHash": "sha256-AIiMJiqvGrN4HyLEbKAoCSRRYn0rnlW5VbKNIMIYqm4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a4bf06618f0b5ee50f14ed8f0da77d34ecc19160",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-25.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_6": {
|
||||
"locked": {
|
||||
"lastModified": 1775888245,
|
||||
"narHash": "sha256-nwASzrRDD1JBEu/o8ekKYEXm/oJW6EMCzCRdrwcLe90=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "13043924aaa7375ce482ebe2494338e058282925",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -124,26 +248,84 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_7": {
|
||||
"locked": {
|
||||
"lastModified": 1776877367,
|
||||
"narHash": "sha256-wMN1gM00sUQ2KC9CNr/XEOGdfOrl67PabIRv9AYayTo=",
|
||||
"rev": "0726a0ecb6d4e08f6adced58726b95db924cef57",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre985613.0726a0ecb6d4/nixexprs.tar.xz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
|
||||
}
|
||||
},
|
||||
"noctalia": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"noctalia-qs": "noctalia-qs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1777253304,
|
||||
"narHash": "sha256-XqSHEKEW5pSAx9MoMo8mKPgkjoy4FEhZ4x0a6hGYrSI=",
|
||||
"owner": "noctalia-dev",
|
||||
"repo": "noctalia-shell",
|
||||
"rev": "6773c4750a12c9e9af9c4ce2365e083f1d0d0ad8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "noctalia-dev",
|
||||
"repo": "noctalia-shell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"noctalia-qs": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"noctalia",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems_3",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1777167795,
|
||||
"narHash": "sha256-VHdtmxVX7oF2+FxYQQPARQmtaHw23FoTBiTaH6ucOEg=",
|
||||
"owner": "noctalia-dev",
|
||||
"repo": "noctalia-qs",
|
||||
"rev": "697db4c14e27d841956ff76887fc312443e6fb17",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "noctalia-dev",
|
||||
"repo": "noctalia-qs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"hyprcursor-phinger": "hyprcursor-phinger",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"nixers-repo": "nixers-repo",
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable_2",
|
||||
"noctalia": "noctalia",
|
||||
"sops-nix": "sops-nix",
|
||||
"zen-browser": "zen-browser"
|
||||
"spicetify-nix": "spicetify-nix"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
"nixpkgs": "nixpkgs_6"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764483358,
|
||||
"narHash": "sha256-EyyvCzXoHrbL467YSsQBTWWg4sR96MH1sPpKoSOelB4=",
|
||||
"lastModified": 1777338324,
|
||||
"narHash": "sha256-bc+ZZCmOTNq86/svGnw0tVpH7vJaLYvGLLKFYP08Q8E=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "5aca6ff67264321d47856a2ed183729271107c9c",
|
||||
"rev": "8eaee5c45428b28b8c47a83e4c09dccec5f279b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -152,19 +334,144 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"spicetify-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_7",
|
||||
"systems": "systems_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1777183994,
|
||||
"narHash": "sha256-zahis/vVFOsWv/HeyHbU13jxnrCC+ppIg49xG+viWxg=",
|
||||
"owner": "Gerg-L",
|
||||
"repo": "spicetify-nix",
|
||||
"rev": "501256c3e670ca1679501ce3839ea805df00d8ba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Gerg-L",
|
||||
"repo": "spicetify-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1689347949,
|
||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1689347949,
|
||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1689347949,
|
||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_4": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"noctalia",
|
||||
"noctalia-qs",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1775636079,
|
||||
"narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"walker": {
|
||||
"inputs": {
|
||||
"elephant": [
|
||||
"nixers-repo",
|
||||
"elephant"
|
||||
],
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1771062828,
|
||||
"narHash": "sha256-y1jBFFO0u+V21y3YldHZozrDwVJVrdC+o3c4M8/rasU=",
|
||||
"owner": "abenz1267",
|
||||
"repo": "walker",
|
||||
"rev": "19b1104585305e0806b842af341630f72038a4b9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "abenz1267",
|
||||
"repo": "walker",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"zen-browser": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager_2",
|
||||
"nixpkgs": [
|
||||
"nixers-repo",
|
||||
"nixpkgs-unstable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764534155,
|
||||
"narHash": "sha256-HQyLJT0ikblWDR/8pzDJ7WYEZoFzkUrgwZk/f+JULBI=",
|
||||
"lastModified": 1771876204,
|
||||
"narHash": "sha256-nTX+Qa3W+xsFxBl+lr4RsWvC4vgZocLt/qDeIvnf4+w=",
|
||||
"owner": "0xc000022070",
|
||||
"repo": "zen-browser-flake",
|
||||
"rev": "fb066e133e614c024a470608ff56585c4f707b44",
|
||||
"rev": "2f951adfab1f5a090fe5ea4c5eaf11efca7f1039",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -1,50 +1,115 @@
|
||||
{
|
||||
description = "Cian-H's nix config";
|
||||
|
||||
# Add cachix binary cache to prevent massive compilation times
|
||||
nixConfig = {
|
||||
extra-substituters = ["https://noctalia.cachix.org"];
|
||||
extra-trusted-public-keys = ["noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4="];
|
||||
};
|
||||
|
||||
inputs = {
|
||||
# Nixpkgs
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||
# Nixpkgs-unstable
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
# Nixers
|
||||
nixers-repo.url = "github:Cian-H/Nixers";
|
||||
# Home manager
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.11";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
# Add sops for secret management
|
||||
sops-nix.url = "github:Mic92/sops-nix";
|
||||
# add phinger hyprcursor flake
|
||||
hyprcursor-phinger.url = "github:jappie3/hyprcursor-phinger";
|
||||
# add zen browser flake
|
||||
zen-browser = {
|
||||
url = "github:0xc000022070/zen-browser-flake";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
# Add Noctalia input
|
||||
noctalia = {
|
||||
url = "github:noctalia-dev/noctalia-shell";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# Add spicetify input
|
||||
spicetify-nix.url = "github:Gerg-L/spicetify-nix";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-unstable,
|
||||
nixers-repo,
|
||||
home-manager,
|
||||
...
|
||||
} @ inputs: let
|
||||
inherit (self) outputs;
|
||||
worklaptopTheme = {
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
nixers,
|
||||
}: {
|
||||
gtkTheme = {
|
||||
name = "Tokyonight-Dark";
|
||||
package = pkgs.tokyonight-gtk-theme;
|
||||
};
|
||||
qtTheme = {
|
||||
name = "Kvantum-Tokyo-Night";
|
||||
package = nixers.tokyonight-kvantum-theme;
|
||||
};
|
||||
iconTheme = {
|
||||
name = "Papirus-Dark";
|
||||
package = pkgs.papirus-icon-theme;
|
||||
};
|
||||
cursorTheme = {
|
||||
name = "phinger-cursors-dark";
|
||||
package = pkgs.phinger-cursors;
|
||||
};
|
||||
fonts = {
|
||||
serif = "NotoSerifNerdFont";
|
||||
sansSerif = "NotoSansNerdFont";
|
||||
monospace = "MonaspiceArNerdFontMono";
|
||||
};
|
||||
wallpaperSource = "/home/cianh/Pictures/Wallpapers/City_1_Upscaled.png";
|
||||
wallpaper = "/var/lib/AccountsService/wallpaper/cianh";
|
||||
avatarSource = "/home/cianh/Pictures/face.png";
|
||||
avatar = "/var/lib/AccountsService/icons/cianh";
|
||||
};
|
||||
in {
|
||||
# A temporary devshell for running system management functions
|
||||
devShells."x86_64-linux".default = let
|
||||
pkgs = import nixpkgs {system = "x86_64-linux";};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
packages = [
|
||||
pkgs.babashka
|
||||
(pkgs.python3.withPackages (ps: with ps; [typer rich]))
|
||||
];
|
||||
};
|
||||
|
||||
# NixOS configuration entrypoint
|
||||
# Available through 'nixos-rebuild --flake .#your-hostname'
|
||||
nixosConfigurations = {
|
||||
worklaptop = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit inputs outputs;
|
||||
unstablePkgs = inputs.nixpkgs-unstable.legacyPackages.x86_64-linux;
|
||||
worklaptop = let
|
||||
pkgs = import nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
cudaSupport = true;
|
||||
allowUnfreePredicate = _: true;
|
||||
};
|
||||
};
|
||||
in
|
||||
nixpkgs.lib.nixosSystem {
|
||||
specialArgs = let
|
||||
unstablePkgs = inputs.nixpkgs-unstable.legacyPackages.x86_64-linux;
|
||||
nixers = inputs.nixers-repo.packages.x86_64-linux;
|
||||
in {
|
||||
inherit inputs outputs unstablePkgs nixers;
|
||||
theme = worklaptopTheme {inherit pkgs unstablePkgs nixers;};
|
||||
};
|
||||
modules = [
|
||||
./nixos/worklaptop.nix
|
||||
];
|
||||
};
|
||||
modules = [
|
||||
./nixos/worklaptop.nix
|
||||
];
|
||||
};
|
||||
homeserver = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit inputs outputs;
|
||||
unstablePkgs = inputs.nixpkgs-unstable.legacyPackages.x86_64-linux;
|
||||
nixers = inputs.nixers-repo.packages.x86_64-linux;
|
||||
};
|
||||
modules = [
|
||||
./nixos/homeserver.nix
|
||||
@@ -55,7 +120,7 @@
|
||||
# Standalone home-manager configuration entrypoint
|
||||
# Available through 'home-manager --flake .#your-username@your-hostname'
|
||||
homeConfigurations = {
|
||||
"cianh@core" = home-manager.lib.homeManagerConfiguration {
|
||||
"cianh@core" = let
|
||||
pkgs = import nixpkgs {
|
||||
# Home-manager requires 'pkgs' instance
|
||||
system = "x86_64-linux";
|
||||
@@ -65,49 +130,58 @@
|
||||
allowUnfreePredicate = _: true;
|
||||
};
|
||||
};
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs;
|
||||
unstablePkgs = import nixpkgs-unstable {
|
||||
# We also need to do the same for unstable
|
||||
system = "x86_64-linux";
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnfreePredicate = _: true;
|
||||
in
|
||||
home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs;
|
||||
unstablePkgs = import nixpkgs-unstable {
|
||||
# We also need to do the same for unstable
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnfreePredicate = _: true;
|
||||
};
|
||||
};
|
||||
nixers = inputs.nixers-repo.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
};
|
||||
modules = [
|
||||
./home-manager/core.nix
|
||||
];
|
||||
};
|
||||
modules = [
|
||||
./home-manager/core.nix
|
||||
];
|
||||
};
|
||||
"cianh@worklaptop" = home-manager.lib.homeManagerConfiguration {
|
||||
"cianh@worklaptop" = let
|
||||
pkgs = import nixpkgs {
|
||||
# Home-manager requires 'pkgs' instance
|
||||
system = "x86_64-linux";
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
cudaSupport = true;
|
||||
# Workaround for https://github.com/nix-community/home-manager/issues/2942
|
||||
allowUnfreePredicate = _: true;
|
||||
};
|
||||
};
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs;
|
||||
unstablePkgs = import nixpkgs-unstable {
|
||||
# We also need to do the same for unstable
|
||||
system = "x86_64-linux";
|
||||
cudaSupport = true;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnfreePredicate = _: true;
|
||||
in
|
||||
home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
|
||||
extraSpecialArgs = let
|
||||
unstablePkgs = import nixpkgs-unstable {
|
||||
system = "x86_64-linux";
|
||||
cudaSupport = true;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnfreePredicate = _: true;
|
||||
};
|
||||
};
|
||||
nixers = inputs.nixers-repo.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
in {
|
||||
inherit inputs outputs unstablePkgs nixers;
|
||||
theme = worklaptopTheme {inherit pkgs unstablePkgs nixers;};
|
||||
};
|
||||
|
||||
modules = [
|
||||
./home-manager/worklaptop.nix
|
||||
];
|
||||
};
|
||||
modules = [
|
||||
./home-manager/worklaptop.nix
|
||||
];
|
||||
};
|
||||
"cianh@homeserver" = home-manager.lib.homeManagerConfiguration {
|
||||
"cianh@homeserver" = let
|
||||
pkgs = import nixpkgs {
|
||||
# Home-manager requires 'pkgs' instance
|
||||
system = "x86_64-linux";
|
||||
@@ -117,21 +191,25 @@
|
||||
allowUnfreePredicate = _: true;
|
||||
};
|
||||
};
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs;
|
||||
unstablePkgs = import nixpkgs-unstable {
|
||||
# We also need to do the same for unstable
|
||||
system = "x86_64-linux";
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnfreePredicate = _: true;
|
||||
in
|
||||
home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs;
|
||||
unstablePkgs = import nixpkgs-unstable {
|
||||
# We also need to do the same for unstable
|
||||
system = "x86_64-linux";
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnfreePredicate = _: true;
|
||||
};
|
||||
};
|
||||
nixers = inputs.nixers-repo.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
};
|
||||
modules = [
|
||||
./home-manager/homeserver.nix
|
||||
];
|
||||
};
|
||||
modules = [
|
||||
./home-manager/homeserver.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
./core/packages.nix
|
||||
./core/programs.nix
|
||||
./core/services.nix
|
||||
inputs.hyprcursor-phinger.homeManagerModules.hyprcursor-phinger
|
||||
inputs.nixers-repo.homeManagerModules.hyprcursor-phinger
|
||||
];
|
||||
|
||||
nix = {
|
||||
|
||||
Submodule home-manager/core/dotfiles updated: 8bd730eed5...edbf7712cb
@@ -6,63 +6,123 @@
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
...
|
||||
}: {
|
||||
home.file = {
|
||||
".bashrc" = lib.mkIf (!config.programs.bash.enable) {
|
||||
source = ./dotfiles/dot_bashrc;
|
||||
};
|
||||
"nushell" = {
|
||||
source = ./dotfiles/dot_config/nushell;
|
||||
target = ".config/nushell";
|
||||
recursive = true;
|
||||
};
|
||||
"nvim" = {
|
||||
source = ./dotfiles/dot_config/nvim;
|
||||
target = ".config/nvim";
|
||||
recursive = true;
|
||||
};
|
||||
"pypoetry" = {
|
||||
source = ./dotfiles/dot_config/pypoetry;
|
||||
target = ".config/pypoetry";
|
||||
recursive = true;
|
||||
};
|
||||
"Thunar" = {
|
||||
source = ./dotfiles/dot_config/Thunar;
|
||||
target = ".config/Thunar";
|
||||
};
|
||||
"rye" = {
|
||||
source = ./dotfiles/dot_config/.rye;
|
||||
target = ".config/.rye";
|
||||
}: let
|
||||
noctaliaPlugins = [
|
||||
"keybind-cheatsheet"
|
||||
"privacy-indicator"
|
||||
"screen-toolkit"
|
||||
];
|
||||
|
||||
makeNoctaliaEntries = plugin: let
|
||||
pluginSource = ./dotfiles/dot_config/noctalia/plugins-repo + "/${plugin}";
|
||||
in {
|
||||
name = "noctalia-plugin-${plugin}";
|
||||
value = {
|
||||
source = pluginSource;
|
||||
target = ".config/noctalia/plugins/${plugin}";
|
||||
recursive = true;
|
||||
};
|
||||
};
|
||||
|
||||
noctaliaPluginFiles = builtins.listToAttrs (map makeNoctaliaEntries noctaliaPlugins);
|
||||
in {
|
||||
home.file =
|
||||
{
|
||||
".bashrc".source = ./dotfiles/dot_bashrc;
|
||||
".zshrc".source = ./dotfiles/dot_zshrc;
|
||||
"nushell" = {
|
||||
source = ./dotfiles/dot_config/nushell;
|
||||
target = ".config/nushell/my_config";
|
||||
recursive = true;
|
||||
};
|
||||
"fish" = {
|
||||
source = ./dotfiles/dot_config/fish;
|
||||
target = ".config/fish";
|
||||
recursive = true;
|
||||
};
|
||||
"nvim" = {
|
||||
source = lib.cleanSourceWith {
|
||||
src = ./dotfiles/dot_config/nvim;
|
||||
filter = name: type: let
|
||||
baseName = baseNameOf name;
|
||||
in
|
||||
! (
|
||||
(lib.hasPrefix "*/nvim/*" name)
|
||||
|| (lib.hasPrefix "." baseName)
|
||||
|| (lib.hasPrefix "devenv" baseName)
|
||||
|| (lib.hasSuffix ".toml" baseName)
|
||||
|| (lib.hasSuffix ".yml" baseName)
|
||||
);
|
||||
};
|
||||
target = ".config/nvim";
|
||||
recursive = true;
|
||||
};
|
||||
"noctalia" = {
|
||||
source = lib.cleanSourceWith {
|
||||
src = ./dotfiles/dot_config/noctalia;
|
||||
filter = name: type: let
|
||||
baseName = baseNameOf name;
|
||||
in
|
||||
! (
|
||||
(lib.hasInfix "/plugins/" name)
|
||||
|| (lib.hasInfix "/plugins-repo/" name)
|
||||
# || (lib.hasInfix "/plugins-settings/" name)
|
||||
);
|
||||
};
|
||||
target = ".config/noctalia";
|
||||
recursive = true;
|
||||
};
|
||||
"noctalia-cli" = {
|
||||
source = ./dotfiles/dot_local/bin/executable_noctalia-cli;
|
||||
target = ".local/bin/noctalia-cli";
|
||||
executable = true;
|
||||
};
|
||||
"pypoetry" = {
|
||||
source = ./dotfiles/dot_config/pypoetry;
|
||||
target = ".config/pypoetry";
|
||||
recursive = true;
|
||||
};
|
||||
"Thunar" = {
|
||||
source = ./dotfiles/dot_config/Thunar;
|
||||
target = ".config/Thunar";
|
||||
};
|
||||
"rye" = {
|
||||
source = ./dotfiles/dot_config/.rye;
|
||||
target = ".config/.rye";
|
||||
recursive = true;
|
||||
};
|
||||
}
|
||||
// noctaliaPluginFiles;
|
||||
|
||||
# Move across noctalia plugin settings as a writable overlay
|
||||
home.activation.overlayNoctaliaSettings = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
mkdir -p "$HOME/.config/noctalia/plugins"
|
||||
cp -rL --no-preserve=mode "$HOME/.config/noctalia/plugins-settings/"* "$HOME/.config/noctalia/plugins/"
|
||||
'';
|
||||
|
||||
xdg.configFile = {
|
||||
"bat".source = ./dotfiles/dot_config/bat;
|
||||
"path.env".source = ./dotfiles/dot_config/path.env;
|
||||
"fastfetch".source = ./dotfiles/dot_config/fastfetch;
|
||||
"helix".source = ./dotfiles/dot_config/helix;
|
||||
"home-manager".source = ./dotfiles/dot_config/home-manager;
|
||||
"hypr" = {
|
||||
source = ./dotfiles/dot_config/hypr;
|
||||
recursive = true;
|
||||
# Here, we use OnChange, because we don't want the config to be mutable but we do want it to
|
||||
# manage modifiable state at runtime
|
||||
onChange = ''
|
||||
rm -f ${config.xdg.configHome}/hypr/inputs.conf
|
||||
cp ${config.xdg.configHome}/hypr/HomeManagerInit_inputs.conf ${config.xdg.configHome}/hypr/inputs.conf
|
||||
chmod u+w ${config.xdg.configHome}/hypr/inputs.conf
|
||||
'';
|
||||
};
|
||||
"hypr".source = ./dotfiles/dot_config/hypr;
|
||||
"just".source = ./dotfiles/dot_config/just;
|
||||
"kitty".source = ./dotfiles/dot_config/kitty;
|
||||
"ghostty".source = ./dotfiles/dot_config/ghostty;
|
||||
"micro".source = ./dotfiles/dot_config/micro;
|
||||
"niri".source = ./dotfiles/dot_config/niri;
|
||||
"nushell/lsp.nu".text = ''
|
||||
source ~/.config/nushell/my_config/lsp.nu
|
||||
'';
|
||||
"neovide".source = ./dotfiles/dot_config/neovide;
|
||||
"glow".source = ./dotfiles/dot_config/glow;
|
||||
"glamour".source = ./dotfiles/dot_config/glamour;
|
||||
"starship.toml".source = ./dotfiles/dot_config/starship.toml;
|
||||
"elephant/websearch.toml".source = ./dotfiles/dot_config/elephant/websearch.toml;
|
||||
"walker".source = ./dotfiles/dot_config/walker;
|
||||
"waybar".source = ./dotfiles/dot_config/waybar;
|
||||
"euporie".source = ./dotfiles/dot_config/euporie;
|
||||
# "euporie".source = ./dotfiles/dot_config/euporie;
|
||||
"bottom".source = ./dotfiles/dot_config/bottom;
|
||||
"swaync".source = ./dotfiles/dot_config/swaync;
|
||||
"zellij".source = ./dotfiles/dot_config/zellij;
|
||||
@@ -73,7 +133,6 @@
|
||||
"hg".source = ./dotfiles/dot_config/hg;
|
||||
"stylua.toml".source = ./dotfiles/dot_config/stylua.toml;
|
||||
"electron-flags.conf".source = ./dotfiles/dot_config/electron-flags.conf;
|
||||
"Kvantum".source = ./dotfiles/dot_config/Kvantum;
|
||||
"foot".source = ./dotfiles/dot_config/foot;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,6 +12,41 @@
|
||||
];
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
nushell = let
|
||||
pkgStream = unstablePkgs;
|
||||
in {
|
||||
enable = true;
|
||||
package = pkgStream.nushell;
|
||||
plugins = with pkgStream.nushellPlugins; [
|
||||
# bson
|
||||
# desktop_notifications
|
||||
formats
|
||||
gstat
|
||||
# highlight
|
||||
polars
|
||||
query
|
||||
# semver
|
||||
];
|
||||
extraConfig = ''
|
||||
source ~/.config/nushell/my_config/config.nu
|
||||
'';
|
||||
extraEnv = ''
|
||||
source ~/.config/nushell/my_config/env.nu
|
||||
'';
|
||||
};
|
||||
git.enable = true;
|
||||
carapace = {
|
||||
enable = true;
|
||||
enableNushellIntegration = true;
|
||||
};
|
||||
zoxide = {
|
||||
enable = true;
|
||||
enableNushellIntegration = true;
|
||||
};
|
||||
lazygit = {
|
||||
enable = true;
|
||||
package = unstablePkgs.lazygit;
|
||||
enableNushellIntegration = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
"yazi/plugins/chmod.yazi".source = ../dotfiles/dot_config/yazi/plugins/core/chmod.yazi;
|
||||
"yazi/plugins/full-border.yazi".source = ../dotfiles/dot_config/yazi/plugins/core/full-border.yazi;
|
||||
"yazi/plugins/git.yazi".source = ../dotfiles/dot_config/yazi/plugins/core/git.yazi;
|
||||
"yazi/plugins/glow.yazi".source = ../dotfiles/dot_config/yazi/plugins/glow.yazi;
|
||||
"yazi/plugins/hexyl.yazi".source = ../dotfiles/dot_config/yazi/plugins/hexyl.yazi;
|
||||
"yazi/plugins/max-preview.yazi".source = ../dotfiles/dot_config/yazi/plugins/max-preview.yazi;
|
||||
"yazi/plugins/mime-ext.yazi".source = ../dotfiles/dot_config/yazi/plugins/core/mime-ext.yazi;
|
||||
|
||||
@@ -10,5 +10,9 @@
|
||||
home = {
|
||||
username = "cianh";
|
||||
homeDirectory = "/home/cianh";
|
||||
shell.enableNushellIntegration = true;
|
||||
sessionPath = [
|
||||
"$HOME/.local/bin"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
imports = [
|
||||
./core.nix
|
||||
./homeserver/packages.nix
|
||||
./homeserver/programs.nix
|
||||
./homeserver/containers.nix
|
||||
inputs.sops-nix.homeManagerModules.sops
|
||||
];
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
imports = [
|
||||
./containers/media.nix
|
||||
./containers/monitoring.nix
|
||||
# ./containers/metrics.nix
|
||||
./containers/caddy.nix
|
||||
./containers/work_tools.nix
|
||||
./containers/nextcloud.nix
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
volumes = [
|
||||
"/home/cianh/caddy/config:/etc/caddy"
|
||||
"/home/cianh/caddy/data:/data:Z"
|
||||
"/home/cianh/caddy/logs:/var/log/caddy"
|
||||
"/home/cianh/caddy/placeholder_site:/var/www/site:Z"
|
||||
"/home/cianh/blog:/var/www/blog:Z"
|
||||
"/home/cianh/Nextcloud:/var/www/nextcloud:Z"
|
||||
"/home/cianh/goaccess/site:/var/www/goaccess:Z"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
"gitea-net"
|
||||
"proxy-net"
|
||||
];
|
||||
ports = [
|
||||
"3000:3000"
|
||||
"2222:22"
|
||||
];
|
||||
environment = {
|
||||
TZ = "Europe/Dublin";
|
||||
};
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
jellyfin = {
|
||||
image = "docker.io/jellyfin/jellyfin:latest";
|
||||
autoUpdate = "registry";
|
||||
ports = ["8096:8096/tcp"];
|
||||
network = [
|
||||
"proxy-net"
|
||||
];
|
||||
volumes = [
|
||||
"/home/cianh/TV_Archive/data:/media:Z"
|
||||
"/home/cianh/TV_Archive/jf_config:/config:Z"
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
inputs,
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
...
|
||||
}: {
|
||||
services.podman = {
|
||||
containers = {
|
||||
goaccess = {
|
||||
image = "docker.io/allinurl/goaccess:latest";
|
||||
exec = "--output=/var/www/goaccess/index.html --log-file=/var/log/caddy/access.log --log-format=CADDY --tz=Europe/Dublin --anonymize-ip --real-time-html --ws-url=wss://metrics.bulba.space:443/ws --port=7890 --origin=metrics.bulba.space";
|
||||
autoUpdate = "registry";
|
||||
network = [
|
||||
"proxy-net"
|
||||
];
|
||||
volumes = [
|
||||
"/home/cianh/caddy/logs:/var/log/caddy:Z"
|
||||
"/home/cianh/goaccess/site:/var/www/goaccess"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
{
|
||||
inputs,
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
...
|
||||
}: {
|
||||
services.podman = {
|
||||
networks = {
|
||||
grafana-net = {};
|
||||
};
|
||||
containers = {
|
||||
grafana = {
|
||||
image = "docker.io/grafana/grafana:latest";
|
||||
autoUpdate = "registry";
|
||||
network = ["grafana-net"];
|
||||
ports = ["3100:3000"];
|
||||
user = "1000:1000";
|
||||
volumes = [
|
||||
"/home/cianh/grafana:/var/lib/grafana:Z"
|
||||
];
|
||||
};
|
||||
prometheus = {
|
||||
image = "docker.io/prom/prometheus:latest";
|
||||
autoUpdate = "registry";
|
||||
network = [
|
||||
"grafana-net"
|
||||
"proxy-net"
|
||||
];
|
||||
volumes = [
|
||||
"/home/cianh/prometheus/:/etc/prometheus/"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -19,9 +19,6 @@
|
||||
"nextcloud-net"
|
||||
"proxy-net"
|
||||
];
|
||||
ports = [
|
||||
"9000:9000"
|
||||
];
|
||||
environment = {
|
||||
NEXTCLOUD_URL = "nextcloud.bulba.space";
|
||||
TRUSTED_DOMAINS = "nextcloud.bulba.space";
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
volumes = [
|
||||
"/home/cianh/vikunja/files:/app/vikunja/files"
|
||||
];
|
||||
ports = ["3456:3456"];
|
||||
extraPodmanArgs = ["--userns=keep-id"];
|
||||
extraConfig = {
|
||||
Unit = {
|
||||
After = "podman-vikunja-db.service";
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
home.packages = [
|
||||
(pkgs.python3.withPackages (
|
||||
python-pkgs: [
|
||||
python-pkgs.pip
|
||||
python-pkgs.pkginfo
|
||||
python-pkgs.python-lsp-server
|
||||
python-pkgs.setuptools
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
inputs,
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
...
|
||||
}: {
|
||||
programs = {
|
||||
bash.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -14,5 +14,6 @@
|
||||
./worklaptop/programs.nix
|
||||
./worklaptop/defaultapps.nix
|
||||
./worklaptop/theming.nix
|
||||
inputs.nixers-repo.homeManagerModules.walker
|
||||
];
|
||||
}
|
||||
|
||||
@@ -5,33 +5,40 @@
|
||||
config,
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
nixers,
|
||||
...
|
||||
}: let
|
||||
# Patch vivaldi to ensure reliability on wayland
|
||||
vivaldi-wayland = pkgs.symlinkJoin {
|
||||
name = "vivaldi-wayland";
|
||||
paths = [pkgs.vivaldi];
|
||||
buildInputs = [pkgs.makeWrapper];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/vivaldi \
|
||||
--set NIXOS_OZONE_WL 1 \
|
||||
--add-flags "--ozone-platform=wayland --enable-features=UseOzonePlatform --ozone-platform-hint=auto"
|
||||
'';
|
||||
};
|
||||
in {
|
||||
home.packages = [
|
||||
pkgs.bitwarden-desktop
|
||||
pkgs.blueman
|
||||
pkgs.babashka
|
||||
pkgs.bat-extras.batman
|
||||
pkgs.bat-extras.batdiff
|
||||
pkgs.bat-extras.batgrep
|
||||
pkgs.bat-extras.prettybat
|
||||
pkgs.broot
|
||||
pkgs.clapper
|
||||
pkgs.cliphist
|
||||
pkgs.distrobox
|
||||
pkgs.dvc
|
||||
pkgs.feh
|
||||
pkgs.git-lfs
|
||||
pkgs.go
|
||||
unstablePkgs.gurk-rs
|
||||
pkgs.has
|
||||
pkgs.hyperfine
|
||||
pkgs.imagemagick
|
||||
pkgs.jujutsu
|
||||
pkgs.kubectl
|
||||
pkgs.lnav
|
||||
pkgs.lynx
|
||||
pkgs.minikube
|
||||
unstablePkgs.mission-center
|
||||
pkgs.neovide
|
||||
pkgs.nix-output-monitor
|
||||
pkgs.nix-tree
|
||||
pkgs.nh
|
||||
pkgs.nodejs_24
|
||||
pkgs.nwg-look
|
||||
unstablePkgs.obsidian
|
||||
pkgs.onlyoffice-desktopeditors
|
||||
@@ -41,23 +48,31 @@ in {
|
||||
unstablePkgs.podman-desktop
|
||||
unstablePkgs.podman-tui
|
||||
pkgs.popsicle
|
||||
pkgs.smile
|
||||
nixers.python-env
|
||||
nixers.rbw-autofill
|
||||
unstablePkgs.ruff
|
||||
pkgs.signal-desktop
|
||||
pkgs.sshs
|
||||
unstablePkgs.uv
|
||||
pkgs.vial
|
||||
vivaldi-wayland
|
||||
nixers.vivaldi-wayland
|
||||
unstablePkgs.visidata
|
||||
pkgs.vivaldi-ffmpeg-codecs
|
||||
nixers.walker-obsidian-search
|
||||
pkgs.warpinator
|
||||
pkgs.xarchiver
|
||||
pkgs.yubikey-agent
|
||||
pkgs.yubikey-manager
|
||||
pkgs.zathura
|
||||
pkgs.zettlr
|
||||
pkgs.zeal
|
||||
unstablePkgs.zed-editor
|
||||
unstablePkgs.zotero
|
||||
inputs.zen-browser.packages.x86_64-linux.default
|
||||
nixers.zen-browser
|
||||
# theming
|
||||
pkgs.adwaita-icon-theme
|
||||
pkgs.gtk-engine-murrine
|
||||
pkgs.gtk_engines
|
||||
pkgs.phinger-cursors
|
||||
pkgs.tokyonight-gtk-theme
|
||||
pkgs.hicolor-icon-theme
|
||||
# Backend dev tools
|
||||
pkgs.lua54Packages.lua
|
||||
pkgs.luajitPackages.luarocks
|
||||
|
||||
@@ -5,17 +5,61 @@
|
||||
config,
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
nixers,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
inputs.noctalia.homeModules.default
|
||||
inputs.spicetify-nix.homeManagerModules.default
|
||||
];
|
||||
|
||||
programs = {
|
||||
nix-your-shell = {
|
||||
enable = true;
|
||||
enableNushellIntegration = true;
|
||||
};
|
||||
waybar = {
|
||||
direnv = {
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
enableNushellIntegration = true;
|
||||
};
|
||||
noctalia-shell.enable = true;
|
||||
walker = {
|
||||
enable = true;
|
||||
runAsService = true;
|
||||
};
|
||||
rbw = {
|
||||
enable = true;
|
||||
settings = {
|
||||
email = "chughes000@gmail.com";
|
||||
pinentry = nixers.rbw-autofill;
|
||||
};
|
||||
};
|
||||
hyprcursor-phinger.enable = true;
|
||||
spicetify = let
|
||||
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.hostPlatform.system};
|
||||
in {
|
||||
enable = true;
|
||||
theme = {
|
||||
name = "TokyoNight";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "evening-hs";
|
||||
repo = "Spotify-Tokyo-Night-Theme";
|
||||
rev = "main";
|
||||
hash = "sha256-cLj9v8qtHsdV9FfzV2Qf4pWO8AOBXu51U/lUMvdEXAk=";
|
||||
};
|
||||
appendName = false;
|
||||
injectCss = true;
|
||||
replaceColors = true;
|
||||
overwriteAssets = true;
|
||||
};
|
||||
colorScheme = "Night";
|
||||
enabledExtensions = with spicePkgs.extensions; [
|
||||
adblock
|
||||
shuffle
|
||||
hidePodcasts
|
||||
fullAppDisplay
|
||||
trashbin
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,8 +8,26 @@
|
||||
...
|
||||
}: {
|
||||
services = {
|
||||
swaync.enable = true;
|
||||
pueue.enable = true;
|
||||
hyprpaper.enable = true;
|
||||
};
|
||||
# Custom version of ghostty service, to stop closing during update
|
||||
systemd.user.services."app-com.mitchellh.ghostty" = {
|
||||
Unit = {
|
||||
Description = "Ghostty Terminal Emulator";
|
||||
X-SwitchMethod = "keep-old";
|
||||
After = ["graphical-session.target"];
|
||||
PartOf = ["graphical-session.target"];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${lib.getExe config.programs.ghostty.package}";
|
||||
Environment = "WAYLAND_DISPLAY=wayland-1";
|
||||
Type = "notify";
|
||||
ReloadSignal = "SIGUSR2";
|
||||
KillMode = "mixed";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = ["graphical-session.target"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,22 +5,23 @@
|
||||
config,
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
theme,
|
||||
...
|
||||
}: {
|
||||
# GTK theming
|
||||
gtk = {
|
||||
enable = true;
|
||||
iconTheme = {
|
||||
name = "Tokyonight-Light";
|
||||
package = pkgs.tokyonight-gtk-theme;
|
||||
name = theme.iconTheme.name;
|
||||
package = theme.iconTheme.package;
|
||||
};
|
||||
theme = {
|
||||
name = "Tokyonight-Dark";
|
||||
package = pkgs.tokyonight-gtk-theme;
|
||||
name = theme.gtkTheme.name;
|
||||
package = theme.gtkTheme.package;
|
||||
};
|
||||
cursorTheme = {
|
||||
name = "phinger-cursors-dark";
|
||||
package = pkgs.phinger-cursors;
|
||||
name = theme.cursorTheme.name;
|
||||
package = theme.cursorTheme.package;
|
||||
};
|
||||
gtk2.extraConfig = ''
|
||||
gtk-theme-name="Tokyonight-Dark"
|
||||
@@ -38,13 +39,34 @@
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# QT theming
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme.name = "kvantum";
|
||||
style.name = "kvantum";
|
||||
};
|
||||
|
||||
xdg.configFile."Kvantum/kvantum.kvconfig".text = ''
|
||||
[General]
|
||||
theme=${theme.qtTheme.name}
|
||||
'';
|
||||
|
||||
# dconf theming settings
|
||||
dconf.settings = {
|
||||
"org/gnome/desktop/interface" = {
|
||||
color-scheme = "prefer-dark";
|
||||
gtk-theme = "Tokyonight-Dark";
|
||||
icon-theme = "Tokyonight-Light";
|
||||
cursor-theme = "phinger-cursors-dark";
|
||||
gtk-theme = theme.gtkTheme.name;
|
||||
icon-theme = theme.iconTheme.name;
|
||||
cursor-theme = theme.cursorTheme.name;
|
||||
};
|
||||
};
|
||||
|
||||
# Ensure theming packages are installed
|
||||
home.packages = [
|
||||
theme.gtkTheme.package
|
||||
theme.qtTheme.package
|
||||
theme.iconTheme.package
|
||||
theme.cursorTheme.package
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,31 +1,118 @@
|
||||
set shell := ["bash", "-c"]
|
||||
|
||||
git := "true"
|
||||
flake := "true"
|
||||
flatpak := "true"
|
||||
|
||||
# Show this interactive menu
|
||||
default:
|
||||
@just --list
|
||||
@just --choose
|
||||
|
||||
prebuild:
|
||||
git pull --recurse
|
||||
git submodule update --remote --recursive
|
||||
nix flake update
|
||||
|
||||
_update-root:
|
||||
if `/usr/bin/env grep -Rq "nixos" /etc/*-release`; then \
|
||||
sudo nixos-rebuild switch --flake .?submodules=1#$HOSTNAME; \
|
||||
_git-sync:
|
||||
@if [ -n "$(git status --porcelain)" ]; then \
|
||||
echo ">> Stashing local changes..."; \
|
||||
git stash; \
|
||||
git pull --ff-only --recurse-submodules; \
|
||||
git submodule update --remote --recursive; \
|
||||
git stash pop; \
|
||||
else \
|
||||
git pull --ff-only --recurse-submodules; \
|
||||
git submodule update --remote --recursive; \
|
||||
fi
|
||||
|
||||
_flake-update:
|
||||
nix flake update
|
||||
|
||||
# Sync git and update flake inputs (override with git=false or flake=false)
|
||||
prebuild:
|
||||
@if [ "{{git}}" == "true" ]; then \
|
||||
echo ">> Syncing Git..."; \
|
||||
just _git-sync; \
|
||||
fi
|
||||
@if [ "{{flake}}" == "true" ]; then \
|
||||
echo ">> Updating Flake..."; \
|
||||
just _flake-update; \
|
||||
fi
|
||||
|
||||
_update-root:
|
||||
@if [ -f /etc/NIXOS ] && grep -q "nixos" /etc/os-release 2>/dev/null; then \
|
||||
sudo nixos-rebuild switch --flake .?submodules=1#$(hostname); \
|
||||
fi
|
||||
|
||||
# Rebuild and switch NixOS system configuration
|
||||
update-root: prebuild _update-root
|
||||
|
||||
# Install Home Manager standalone (useful for initial non-NixOS setup)
|
||||
install-home:
|
||||
home-manager switch --flake .?submodules=1#$USER@core \
|
||||
home-manager switch --flake .?submodules=1#$(whoami)@core \
|
||||
--extra-experimental-features nix-command \
|
||||
--extra-experimental-features flakes
|
||||
|
||||
_update-home:
|
||||
home-manager switch --flake .?submodules=1#$USER@$HOSTNAME \
|
||||
|| home-manager switch --flake .?submodules=1#$USER@core
|
||||
home-manager switch --flake .?submodules=1#$(whoami)@$(hostname) \
|
||||
|| home-manager switch --flake .?submodules=1#$(whoami)@core
|
||||
|
||||
# Rebuild and switch Home Manager configuration
|
||||
update-home: prebuild _update-home
|
||||
|
||||
update: prebuild _update-root _update-home
|
||||
# Quick update skipping git and flake syncs
|
||||
quick-update:
|
||||
just git=false flake=false update
|
||||
|
||||
cleanup:
|
||||
# Update the system without fetching the latest git commits
|
||||
nogit-update:
|
||||
just git=false update
|
||||
|
||||
# Update and clean up Flatpak packages
|
||||
update-flatpaks:
|
||||
@if [ "{{flatpak}}" == "true" ] && command -v flatpak &> /dev/null; then \
|
||||
echo ">> Updating Flatpaks..."; \
|
||||
flatpak update -y; \
|
||||
flatpak uninstall --unused -y; \
|
||||
else \
|
||||
echo ">> Flatpak not found or disabled. Skipping."; \
|
||||
fi
|
||||
|
||||
# View the 5 most recent NixOS and Home Manager generations
|
||||
history:
|
||||
@echo ">> System Generations:"
|
||||
@nix-env -p /nix/var/nix/profiles/system --list-generations | tail -n 5
|
||||
@echo "\n>> Home Manager Generations:"
|
||||
@home-manager generations | head -n 5
|
||||
|
||||
# Open a Nix REPL loaded with the current flake
|
||||
repl:
|
||||
nix repl --file flake.nix
|
||||
|
||||
# Fully update the system, home-manager, and flatpaks
|
||||
update: prebuild _update-root _update-home update-flatpaks
|
||||
|
||||
# Preview system changes without activating them
|
||||
dry-run: prebuild
|
||||
sudo nixos-rebuild dry-activate --flake .?submodules=1#$(hostname)
|
||||
|
||||
# Run Nix and Flatpak garbage collection. Optionally specify age (e.g., 'just cleanup 7d')
|
||||
cleanup days="":
|
||||
@if [ -n "{{days}}" ]; then \
|
||||
echo ">> Deleting system generations older than {{days}}..."; \
|
||||
sudo nix-collect-garbage --delete-older-than {{days}}; \
|
||||
fi
|
||||
@echo ">> Cleaning Nix Store..."
|
||||
nix-store --gc
|
||||
nix-store --optimise
|
||||
@if command -v flatpak &> /dev/null; then \
|
||||
echo ">> Cleaning unused Flatpaks..."; \
|
||||
flatpak uninstall --unused -y; \
|
||||
fi
|
||||
|
||||
# Open the editor (nvim, yazi, or heh) for a target
|
||||
edit target:
|
||||
@direnv exec . scripts/edit.py "{{target}}"
|
||||
|
||||
# Edit packages.nix for a specific system/user (run 'just packages help' for flags)
|
||||
packages *flags:
|
||||
@direnv exec . scripts/packages.bb {{flags}}
|
||||
|
||||
# Bootstrap a fresh system from the repo
|
||||
bootstrap:
|
||||
@direnv exec . scripts/bootstrap.py
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
environment.systemPackages = [
|
||||
pkgs.atuin
|
||||
pkgs.bat
|
||||
pkgs.bitwarden-cli
|
||||
pkgs.bottom
|
||||
pkgs.delta
|
||||
pkgs.dust
|
||||
@@ -25,6 +24,7 @@
|
||||
pkgs.glab
|
||||
pkgs.glow
|
||||
pkgs.gnupg
|
||||
pkgs.heh
|
||||
pkgs.hexyl
|
||||
pkgs.killall
|
||||
pkgs.libsecret
|
||||
@@ -37,16 +37,19 @@
|
||||
pkgs.passh
|
||||
pkgs.pkg-config
|
||||
pkgs.pueue
|
||||
pkgs.rbw
|
||||
pkgs.ripgrep
|
||||
pkgs.rm-improved
|
||||
pkgs.starship
|
||||
pkgs.tealdeer
|
||||
pkgs.wget
|
||||
pkgs.wl-clipboard
|
||||
pkgs.wtype
|
||||
pkgs.xclip
|
||||
pkgs.xcp
|
||||
pkgs.zellij
|
||||
pkgs.zoxide
|
||||
unstablePkgs.binsider
|
||||
unstablePkgs.just
|
||||
unstablePkgs.neovim
|
||||
unstablePkgs.nushell
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
users.users = {
|
||||
cianh = {
|
||||
isNormalUser = true;
|
||||
linger = true;
|
||||
hashedPasswordFile = "/etc/hashedPasswordFile";
|
||||
description = "Cian Hughes";
|
||||
extraGroups = ["networkmanager" "wheel" "docker" "podman" "nixcfg"];
|
||||
|
||||
+16
-5
@@ -75,10 +75,15 @@
|
||||
blacklistedKernelModules = ["nouveau"];
|
||||
};
|
||||
|
||||
networking.hostName = "worklaptop"; # Define your hostname.
|
||||
|
||||
# Enable networking
|
||||
networking.networkmanager.enable = true;
|
||||
# Configure networking
|
||||
networking = {
|
||||
hostName = "worklaptop"; # Define your hostname.
|
||||
wireless.iwd.enable = true;
|
||||
networkmanager = {
|
||||
enable = true;
|
||||
wifi.backend = "iwd";
|
||||
};
|
||||
};
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Europe/Dublin";
|
||||
@@ -138,8 +143,14 @@
|
||||
stateVersion = "23.11"; # Did you read the comment?
|
||||
autoUpgrade.enable = true;
|
||||
autoUpgrade.dates = "weekly";
|
||||
activationScripts.diff = ''
|
||||
if [[ -e /run/current-system ]]; then
|
||||
${pkgs.nushell}/bin/nu -c "let diff_closure = (${pkgs.nix}/bin/nix store diff-closures /run/current-system '$systemConfig'); let table = (\$diff_closure | lines | where \$it =~ KiB | where \$it =~ → | parse -r '^(?<Package>\S+): (?<Old>[^,]+)(?:.*) → (?<New>[^,]+)(?:.*), (?<DiffBin>.*)$' | insert Diff { get DiffBin | ansi strip | into filesize } | sort-by -r Diff | reject DiffBin); if (\$table | get Diff | is-not-empty) { print \"\"; \$table | append [[Package Old New Diff]; [\"\" \"\" \"\" \"\"]] | append [[Package Old New Diff]; [\"\" \"\" \"Total:\" (\$table | get Diff | math sum) ]] | print; print \"\" }"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
zramSwap.enable = true; # enable RAM compression
|
||||
|
||||
# Set user config settings
|
||||
users.defaultUserShell = pkgs.nushell;
|
||||
users.defaultUserShell = unstablePkgs.nushell;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
config,
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
nixers,
|
||||
...
|
||||
}: {
|
||||
environment.systemPackages = [
|
||||
pkgs.cargo
|
||||
pkgs.flatpak
|
||||
pkgs.gdm
|
||||
pkgs.greetd
|
||||
pkgs.grim
|
||||
pkgs.grub2_efi
|
||||
pkgs.nix-ld
|
||||
@@ -20,7 +21,9 @@
|
||||
pkgs.qmk
|
||||
pkgs.qmk-udev-rules
|
||||
pkgs.qmk_hid
|
||||
pkgs.regreet
|
||||
pkgs.seahorse
|
||||
nixers.walker
|
||||
pkgs.wayland
|
||||
pkgs.wayland-utils
|
||||
pkgs.xfce.thunar
|
||||
@@ -28,14 +31,9 @@
|
||||
pkgs.xh
|
||||
unstablePkgs.ghostty
|
||||
unstablePkgs.hyprland
|
||||
unstablePkgs.hyprlock
|
||||
unstablePkgs.hyprpaper
|
||||
unstablePkgs.hyprpicker
|
||||
unstablePkgs.hyprshot
|
||||
unstablePkgs.kitty
|
||||
unstablePkgs.libnotify
|
||||
unstablePkgs.swaynotificationcenter
|
||||
unstablePkgs.waybar
|
||||
unstablePkgs.wofi
|
||||
];
|
||||
}
|
||||
|
||||
+104
-59
@@ -4,66 +4,111 @@
|
||||
config,
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
theme,
|
||||
...
|
||||
}: {
|
||||
}: let
|
||||
username = "cianh";
|
||||
in {
|
||||
# Activate DEs
|
||||
programs.uwsm.enable = true;
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
withUWSM = true;
|
||||
xwayland.enable = true;
|
||||
programs = {
|
||||
uwsm = {
|
||||
enable = true;
|
||||
waylandCompositors.hyprland.binPath = lib.mkForce "/run/current-system/sw/bin/start-hyprland";
|
||||
};
|
||||
regreet = {
|
||||
enable = true;
|
||||
theme = {
|
||||
name = theme.gtkTheme.name;
|
||||
package = theme.gtkTheme.package;
|
||||
};
|
||||
cursorTheme = {
|
||||
name = theme.cursorTheme.name;
|
||||
package = theme.cursorTheme.package;
|
||||
};
|
||||
iconTheme = {
|
||||
name = theme.iconTheme.name;
|
||||
package = theme.iconTheme.package;
|
||||
};
|
||||
font = {
|
||||
name = "Noto Sans";
|
||||
size = 16;
|
||||
package = pkgs.noto-fonts;
|
||||
};
|
||||
settings = {
|
||||
GTK.application_prefer_dark_theme = true;
|
||||
appearance.greeting_msg = "Hello ${username}, welcome back to '${config.networking.hostName}'!";
|
||||
background = {
|
||||
path = theme.wallpaper;
|
||||
fit = "Cover";
|
||||
};
|
||||
};
|
||||
};
|
||||
hyprland = {
|
||||
enable = true;
|
||||
withUWSM = true;
|
||||
xwayland.enable = true;
|
||||
};
|
||||
iio-hyprland.enable = true;
|
||||
|
||||
# Enable my preferred DE utilities
|
||||
thunar = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
pkgs.xfce.thunar-volman
|
||||
pkgs.xfce.thunar-archive-plugin
|
||||
pkgs.xfce.thunar-media-tags-plugin
|
||||
];
|
||||
};
|
||||
xfconf.enable = true;
|
||||
|
||||
# Disable automatically activated programs i dont want
|
||||
foot.enable = false;
|
||||
|
||||
# Lets also activate some handy devenv tools
|
||||
direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
nix-ld = {
|
||||
enable = true;
|
||||
libraries = [
|
||||
pkgs.acl
|
||||
pkgs.alsa-lib
|
||||
pkgs.at-spi2-core
|
||||
pkgs.attr
|
||||
pkgs.bzip2
|
||||
pkgs.curl
|
||||
pkgs.dbus
|
||||
pkgs.eget
|
||||
pkgs.expat
|
||||
pkgs.glib
|
||||
pkgs.libsodium
|
||||
pkgs.libssh
|
||||
pkgs.libxml2
|
||||
pkgs.nspr
|
||||
pkgs.nss
|
||||
pkgs.openssl
|
||||
pkgs.pango
|
||||
pkgs.stdenv.cc
|
||||
pkgs.systemd
|
||||
pkgs.util-linux
|
||||
pkgs.vulkan-loader
|
||||
pkgs.xz
|
||||
pkgs.zlib
|
||||
pkgs.zstd
|
||||
];
|
||||
};
|
||||
|
||||
seahorse.enable = true; # enable the graphical frontend
|
||||
gnupg.agent = {
|
||||
enable = true;
|
||||
pinentryPackage = pkgs.pinentry-gnome3;
|
||||
enableSSHSupport = true;
|
||||
};
|
||||
virt-manager.enable = true;
|
||||
yubikey-touch-detector = {
|
||||
enable = true;
|
||||
libnotify = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Enable my preferred DE utilities
|
||||
programs.thunar.enable = true;
|
||||
programs.thunar.plugins = [
|
||||
pkgs.xfce.thunar-volman
|
||||
pkgs.xfce.thunar-archive-plugin
|
||||
pkgs.xfce.thunar-media-tags-plugin
|
||||
];
|
||||
programs.xfconf.enable = true;
|
||||
|
||||
# Disable automatically activated programs i dont want
|
||||
programs.foot.enable = false;
|
||||
|
||||
# Lets also activate some handy devenv tools
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
libraries = [
|
||||
pkgs.acl
|
||||
pkgs.alsa-lib
|
||||
pkgs.at-spi2-core
|
||||
pkgs.attr
|
||||
pkgs.bzip2
|
||||
pkgs.curl
|
||||
pkgs.dbus
|
||||
pkgs.eget
|
||||
pkgs.expat
|
||||
pkgs.glib
|
||||
pkgs.libsodium
|
||||
pkgs.libssh
|
||||
pkgs.libxml2
|
||||
pkgs.nspr
|
||||
pkgs.nss
|
||||
pkgs.openssl
|
||||
pkgs.pango
|
||||
pkgs.stdenv.cc
|
||||
pkgs.systemd
|
||||
pkgs.util-linux
|
||||
pkgs.vulkan-loader
|
||||
pkgs.xz
|
||||
pkgs.zlib
|
||||
pkgs.zstd
|
||||
];
|
||||
};
|
||||
|
||||
programs.seahorse.enable = true; # enable the graphical frontend
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
pinentryPackage = pkgs.pinentry-gnome3;
|
||||
enableSSHSupport = true;
|
||||
};
|
||||
programs.virt-manager.enable = true;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
config,
|
||||
pkgs,
|
||||
unstablePkgs,
|
||||
theme,
|
||||
...
|
||||
}: {
|
||||
services = {
|
||||
displayManager.defaultSession = "hyprland-uwsm";
|
||||
desktopManager.gnome.enable = false;
|
||||
displayManager.gdm.enable = true;
|
||||
displayManager.gdm.enable = false;
|
||||
greetd.enable = true;
|
||||
xserver = {
|
||||
videoDrivers = ["nvidia"]; # or "nvidiaLegacy470 etc.
|
||||
enable = true;
|
||||
@@ -18,6 +20,9 @@
|
||||
variant = "";
|
||||
};
|
||||
};
|
||||
resolved.enable = true;
|
||||
upower.enable = true;
|
||||
tuned.enable = true;
|
||||
pulseaudio.enable = false;
|
||||
pipewire = {
|
||||
enable = true;
|
||||
@@ -32,30 +37,48 @@
|
||||
# Enable flatpaks
|
||||
flatpak.enable = true;
|
||||
|
||||
# Add guix, as it is a common tool for reproducibility in comp sci
|
||||
guix.enable = true;
|
||||
|
||||
# Enable the OpenSSH daemon and other remote tools.
|
||||
openssh.enable = true;
|
||||
|
||||
gnome.gnome-keyring.enable = true;
|
||||
pcscd.enable = true;
|
||||
udev = {
|
||||
packages = [
|
||||
pkgs.yubikey-personalization
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Add custom services
|
||||
systemd.services = {
|
||||
setup-user-icon = {
|
||||
description = "Set user profile icon";
|
||||
wantedBy = ["multi-user.target"];
|
||||
greetd = {
|
||||
after = ["setup-user-vars.service"];
|
||||
requires = ["setup-user-vars.service"];
|
||||
};
|
||||
setup-user-vars = {
|
||||
description = "Set user profile vars";
|
||||
wantedBy = [
|
||||
"multi-user.target"
|
||||
"graphical-session.target"
|
||||
];
|
||||
after = ["home.mount"];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = ''
|
||||
${pkgs.bash}/bin/bash -c " \
|
||||
mkdir -p /var/lib/AccountsService/{icons,users} && \
|
||||
cp /home/cianh/Pictures/face.png /var/lib/AccountsService/icons/cianh && \
|
||||
echo '[User]\nSession=\nIcon=/var/lib/AccountsService/icons/cianh\nSystemAccount=false' > /var/lib/AccountsService/users/cianh && \
|
||||
mkdir -p /var/lib/AccountsService/{icons,users,wallpaper} && \
|
||||
cp ${theme.avatarSource} ${theme.avatar} && \
|
||||
echo '[User]\nSession=\nIcon=${theme.avatar}\nSystemAccount=false' > /var/lib/AccountsService/users/cianh && \
|
||||
chown root:root /var/lib/AccountsService/users/cianh && \
|
||||
chmod 0600 /var/lib/AccountsService/users/cianh && \
|
||||
chown root:root /var/lib/AccountsService/icons/cianh && \
|
||||
chmod 0444 /var/lib/AccountsService/icons/cianh \
|
||||
chown root:root ${theme.avatar} && \
|
||||
chmod 0444 ${theme.avatar} && \
|
||||
cp ${theme.wallpaperSource} ${theme.wallpaper} && \
|
||||
chown root:root ${theme.wallpaper} && \
|
||||
chmod 0444 ${theme.wallpaper} \
|
||||
"
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -3,13 +3,17 @@
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
theme,
|
||||
...
|
||||
}: {
|
||||
# GTK theming
|
||||
environment.sessionVariables.GTK_THEME = "Tokyonight-Dark";
|
||||
# Session Variable for GTK
|
||||
environment.sessionVariables.GTK_THEME = theme.gtkTheme.name;
|
||||
|
||||
# Delegate QT theming to kvantum
|
||||
environment.sessionVariables.QT_STYLE_OVERRIDE = "kvantum";
|
||||
# QT config
|
||||
qt = {
|
||||
enable = true;
|
||||
style = "kvantum";
|
||||
};
|
||||
|
||||
# Fonts
|
||||
fonts = {
|
||||
@@ -18,9 +22,9 @@
|
||||
|
||||
fontconfig = {
|
||||
defaultFonts = {
|
||||
serif = ["NotoSerifNerdFont"];
|
||||
sansSerif = ["NotoSansNerdFont"];
|
||||
monospace = ["MonaspiceArNerdFontMono"];
|
||||
serif = [theme.fonts.serif];
|
||||
sansSerif = [theme.fonts.sansSerif];
|
||||
monospace = [theme.fonts.monospace];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -49,5 +53,10 @@
|
||||
# Adwaita (i love gnome, but god damn is adwaita annoying on other DEs)
|
||||
pkgs.adwaita-icon-theme
|
||||
pkgs.libadwaita
|
||||
# My theme packages set at the top level
|
||||
theme.gtkTheme.package
|
||||
theme.qtTheme.package
|
||||
theme.iconTheme.package
|
||||
theme.cursorTheme.package
|
||||
];
|
||||
}
|
||||
|
||||
Executable
+216
@@ -0,0 +1,216 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import socket
|
||||
import getpass
|
||||
import shutil
|
||||
|
||||
REPO_URL = "https://github.com/Cian-H/My_NixOS_Config"
|
||||
TARGET_DIR = os.path.expanduser("~/.config/nix")
|
||||
|
||||
|
||||
def command_exists(cmd: str) -> bool:
|
||||
"""Check if a command is available on the system."""
|
||||
return shutil.which(cmd) is not None
|
||||
|
||||
|
||||
def check_preconditions(target_dir: str):
|
||||
"""Ensure the system is in a valid state to begin bootstrapping."""
|
||||
if not command_exists("git"):
|
||||
print(
|
||||
"Error: 'git' is not installed. Please install git before bootstrapping.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
if os.path.exists(target_dir):
|
||||
print(
|
||||
f"Error: {target_dir} already exists. Aborting bootstrap.", file=sys.stderr
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def clone_repository(repo_url: str, target_dir: str):
|
||||
"""Clone the configuration repository and enter the directory."""
|
||||
print(f">> Cloning {repo_url} into {target_dir}...")
|
||||
try:
|
||||
subprocess.run(["git", "clone", "--recursive", repo_url, target_dir], check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
print("Error: Failed to clone repository.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
os.chdir(target_dir)
|
||||
|
||||
|
||||
def detect_nixos() -> bool:
|
||||
"""Check if the current host system is NixOS."""
|
||||
if os.path.exists("/etc/os-release"):
|
||||
with open("/etc/os-release", "r") as f:
|
||||
if "ID=nixos" in f.read():
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def has_config(sys_name: str, is_nixos: bool) -> bool:
|
||||
"""Determine if system configuration directories exist for the given hostname."""
|
||||
has_nixos_dir = os.path.isdir(f"nixos/{sys_name}")
|
||||
has_hm_dir = os.path.isdir(f"home-manager/{sys_name}")
|
||||
return (has_nixos_dir and has_hm_dir) if is_nixos else has_hm_dir
|
||||
|
||||
|
||||
def get_available_systems() -> list:
|
||||
"""Discover existing system configurations in the repository."""
|
||||
opts = set()
|
||||
if os.path.exists("nixos"):
|
||||
opts.update([d for d in os.listdir("nixos") if os.path.isdir(f"nixos/{d}")])
|
||||
if os.path.exists("home-manager"):
|
||||
opts.update(
|
||||
[
|
||||
d
|
||||
for d in os.listdir("home-manager")
|
||||
if os.path.isdir(f"home-manager/{d}")
|
||||
]
|
||||
)
|
||||
|
||||
# Filter out base/core directories and hidden folders, then sort for consistent output
|
||||
return sorted([o for o in opts if o not in ["core"] and not o.startswith(".")])
|
||||
|
||||
|
||||
def setup_new_config(target_sys: str, target_dir: str, is_nixos: bool):
|
||||
"""Create boilerplate directories for a missing system and open an editor."""
|
||||
print(">> Creating directories...")
|
||||
if is_nixos:
|
||||
os.makedirs(f"nixos/{target_sys}", exist_ok=True)
|
||||
os.makedirs(f"home-manager/{target_sys}", exist_ok=True)
|
||||
|
||||
if command_exists("yazi"):
|
||||
print(">> Opening yazi. Please add your configs and exit yazi when finished.")
|
||||
subprocess.run(["yazi", target_dir])
|
||||
else:
|
||||
print(
|
||||
f">> Yazi not found. Please manually configure your files in {target_dir} in another terminal."
|
||||
)
|
||||
input("Press Enter when you have finished adding your configurations...")
|
||||
|
||||
|
||||
def prompt_for_existing_config(current_sys: str, current_user: str) -> tuple[str, str]:
|
||||
"""Prompt the user to select an existing configuration from the repo."""
|
||||
opts = get_available_systems()
|
||||
if not opts:
|
||||
print(
|
||||
"Error: No existing configurations found. Cannot proceed.", file=sys.stderr
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
print("\nAvailable systems:")
|
||||
for o in opts:
|
||||
print(f" - {o}")
|
||||
|
||||
chosen_sys = input(f"\nEnter system to use [default: {current_sys}]: ").strip()
|
||||
if chosen_sys:
|
||||
if chosen_sys not in opts:
|
||||
print(f"Error: '{chosen_sys}' is not a valid option.")
|
||||
sys.exit(1)
|
||||
target_sys = chosen_sys
|
||||
else:
|
||||
target_sys = current_sys
|
||||
# Failsafe: if they press enter, but the default hostname isn't actually a valid config
|
||||
if target_sys not in opts:
|
||||
print(
|
||||
f"Error: Default '{target_sys}' is not in available systems. You must type a valid option."
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
chosen_user = input(
|
||||
f"Enter user configuration to use [default: {current_user}]: "
|
||||
).strip()
|
||||
target_user = chosen_user if chosen_user else current_user
|
||||
|
||||
return target_sys, target_user
|
||||
|
||||
|
||||
def resolve_configuration(
|
||||
target_sys: str, target_user: str, target_dir: str, is_nixos: bool
|
||||
) -> tuple[str, str]:
|
||||
"""Ensure a valid configuration target exists, prompting the user for resolution if necessary."""
|
||||
if has_config(target_sys, is_nixos):
|
||||
return target_sys, target_user
|
||||
|
||||
print(
|
||||
f"\n>> Configuration for system '{target_sys}' (user: '{target_user}') not found."
|
||||
)
|
||||
ans = (
|
||||
input("Do you want to create the missing directories now? [y/N]: ")
|
||||
.strip()
|
||||
.lower()
|
||||
)
|
||||
|
||||
if ans == "y":
|
||||
setup_new_config(target_sys, target_dir, is_nixos)
|
||||
return target_sys, target_user
|
||||
|
||||
ans = (
|
||||
input("Do you want to switch to one of the existing configs instead? [y/N]: ")
|
||||
.strip()
|
||||
.lower()
|
||||
)
|
||||
if ans == "y":
|
||||
return prompt_for_existing_config(target_sys, target_user)
|
||||
|
||||
print(
|
||||
"Error: Cannot proceed without a valid configuration. Aborting.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def execute_installation(target_sys: str, target_user: str, is_nixos: bool):
|
||||
"""Execute the final NixOS or Home Manager commands to build the system."""
|
||||
print(
|
||||
f"\n>> Proceeding with installation for user '{target_user}' on system '{target_sys}'..."
|
||||
)
|
||||
try:
|
||||
if is_nixos:
|
||||
print(
|
||||
">> [NixOS detected] Performing full system and home-manager install..."
|
||||
)
|
||||
subprocess.run(
|
||||
["sudo", "nixos-rebuild", "switch", "--flake", f".#{target_sys}"],
|
||||
check=True,
|
||||
)
|
||||
subprocess.run(
|
||||
["home-manager", "switch", "--flake", f".#{target_user}@{target_sys}"],
|
||||
check=True,
|
||||
)
|
||||
else:
|
||||
print(">> [Non-NixOS detected] Performing home-manager install only...")
|
||||
subprocess.run(
|
||||
["home-manager", "switch", "--flake", f".#{target_user}@{target_sys}"],
|
||||
check=True,
|
||||
)
|
||||
print("\n>> Bootstrap complete! Welcome to your new environment.")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"\nError: Command '{' '.join(e.cmd)}' failed with exit status {e.returncode}.", file=sys.stderr)
|
||||
sys.exit(e.returncode)
|
||||
|
||||
|
||||
def main():
|
||||
"""Main orchestration loop."""
|
||||
check_preconditions(TARGET_DIR)
|
||||
clone_repository(REPO_URL, TARGET_DIR)
|
||||
|
||||
is_nixos = detect_nixos()
|
||||
hostname = socket.gethostname()
|
||||
username = getpass.getuser()
|
||||
|
||||
# The returned tuple contains the final resolved system/user strings
|
||||
final_sys, final_user = resolve_configuration(
|
||||
hostname, username, TARGET_DIR, is_nixos
|
||||
)
|
||||
|
||||
execute_installation(final_sys, final_user, is_nixos)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
import typer
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import mimetypes
|
||||
|
||||
|
||||
def is_text_file(filepath: str):
|
||||
mime_type, _ = mimetypes.guess_type(filepath)
|
||||
if mime_type:
|
||||
return mime_type.startswith("text/")
|
||||
|
||||
try:
|
||||
with open(filepath, "rb") as f:
|
||||
chunk = f.read(1024)
|
||||
if b"\0" in chunk:
|
||||
return False # Null bytes usually mean binary
|
||||
return True
|
||||
except IsADirectoryError:
|
||||
return False
|
||||
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
|
||||
@app.command()
|
||||
def edit(target: Path = typer.Argument(..., help="File or directory to edit")):
|
||||
if not target.exists():
|
||||
subprocess.run(["nvim", str(target)])
|
||||
return
|
||||
|
||||
if target.is_dir():
|
||||
subprocess.run(["yazi", str(target)])
|
||||
return
|
||||
|
||||
if is_text_file(str(target)):
|
||||
subprocess.run(["nvim", str(target)])
|
||||
else:
|
||||
subprocess.run(["heh", str(target)])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app()
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bb
|
||||
|
||||
(require '[babashka.cli :as cli]
|
||||
'[babashka.fs :as fs]
|
||||
'[babashka.process :refer [shell]]
|
||||
'[clojure.string :as str])
|
||||
|
||||
(defn get-hostname []
|
||||
(let [env-host (System/getenv "HOSTNAME")
|
||||
etc-host (try (str/trim (slurp "/etc/hostname")) (catch Exception _ nil))
|
||||
java-host (try (.getHostName (java.net.InetAddress/getLocalHost)) (catch Exception _ nil))]
|
||||
(first (remove str/blank? [env-host etc-host java-host "default-system"]))))
|
||||
|
||||
(def cli-spec
|
||||
{:spec {:home {:coerce :boolean :desc "Edit home-manager config instead of NixOS config"}
|
||||
:sys {:desc "Specify system (defaults to current hostname)"}
|
||||
:user {:default (System/getProperty "user.name")
|
||||
:desc "Specify user (defaults to current user)"}
|
||||
:update {:coerce :boolean :default true
|
||||
:desc "Run auto-update after editing"}
|
||||
:help {:alias :h :coerce :boolean :desc "Show this help message"}}})
|
||||
|
||||
(let [opts (cli/parse-opts *command-line-args* cli-spec)]
|
||||
|
||||
(when (:help opts)
|
||||
(println "Usage: just packages [OPTIONS]")
|
||||
(println (cli/format-opts cli-spec))
|
||||
(System/exit 0))
|
||||
|
||||
(let [sys (let [s (:sys opts)]
|
||||
(if (str/blank? s) (get-hostname) s))
|
||||
target (if (:home opts)
|
||||
(str "home-manager/" sys "/packages.nix")
|
||||
(str "nixos/" sys "/packages.nix"))]
|
||||
|
||||
(if-not (fs/exists? target)
|
||||
(do
|
||||
(binding [*out* *err*]
|
||||
(println (str ">> Error: Target file does not exist: " target))
|
||||
(println ">> Please ensure this system profile has been bootstrapped or configured first."))
|
||||
(System/exit 1))
|
||||
(do
|
||||
(println ">> Editing" target "...")
|
||||
(shell "just" "edit" target)
|
||||
|
||||
(if (:update opts)
|
||||
(do
|
||||
(println ">> Applying updates...")
|
||||
(shell "just" "quick-update"))
|
||||
(println ">> Skipping update (no-update provided)."))))))
|
||||
Reference in New Issue
Block a user