Refactor flakes

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-04-27 21:13:58 +02:00
parent df6381db85
commit 5945a72b01
17 changed files with 304 additions and 102 deletions
+2
View File
@@ -119,6 +119,8 @@ sudo nixos-rebuild switch --flake ~/.config/nixos#yourhostname
- [THEMES](docs/THEMES.md): How themes work and how to create your own
- [WALLPAPERS](https://github.com/anotherhadi/awesome-wallpapers): An awesome
collection of wallpapers
- [NEOVIM](docs/NEOVIM.md): How to use the Neovim config in your own flake
- [GROUPS](docs/GROUPS.md): Reusable package groups (dev, cybersecurity)
- [CONTRIBUTING](docs/CONTRIBUTING.md): How to contribute
- [LICENSE](LICENSE): MIT License
+44
View File
@@ -0,0 +1,44 @@
# Groups
Groups are curated sets of packages exposed as flake outputs. Each group has two forms:
- **`homeManagerModules.<group>`** — full home-manager module (packages + files + systemd units)
- **`packages.<group>`** — standalone environment for `nix shell` (packages only)
## Available groups
- dev (go, bun, air, ...)
- cybersecurity (nmap, john, dirb, ffuf, ...)
For the Cybersecurity group, the home-manager module also sets up:
- `~/Cyber/wordlists/` with SecLists, fuzz4bounty, and hashcat rules
- `~/Cyber/tmp/` as a temporary workspace
## Use in another flake
Add this repo as an input:
```nix
inputs.nixy.url = "github:anotherhadi/nixy";
```
Import the home-manager module in your home configuration:
```nix
{ inputs, ... }: {
imports = [
inputs.nixy.homeManagerModules.cybersecurity
# inputs.nixy.homeManagerModules.dev
];
}
```
## Quick shell without installing
```sh
nix shell github:anotherhadi/nixy#cybersecurity
nix shell github:anotherhadi/nixy#dev
```
This drops you into a shell with all tools in `PATH`. No home-manager required, no wordlists or systemd units.
+46
View File
@@ -0,0 +1,46 @@
# Neovim
The Neovim configuration is built with [nvf](https://github.com/notashelf/nvf) and exposed as a standalone flake output.
It can be used in three ways: run it directly, import it into another flake's home-manager setup, or use it as part of this config.
## Run directly
No installation needed:
```sh
nix run github:anotherhadi/nixy#nvim
```
## Use in another flake
Add this repo as an input:
```nix
inputs.nixy.url = "github:anotherhadi/nixy";
```
Then import the home-manager module in your home configuration:
```nix
{ inputs, ... }: {
imports = [
inputs.nixy.inputs.nvf.homeManagerModules.default
inputs.nixy.homeManagerModules.nvim
];
}
```
> [!NOTE]
> The `nvf` home-manager module is required. It is re-exported via `inputs.nixy.inputs.nvf` so you don't need to declare it separately in your own flake.
## What's included
| File | Description |
| --------------- | ---------------------------------------------------------------------- |
| `options.nix` | Core settings: theme (catppuccin mocha), clipboard, indentation, folds |
| `languages.nix` | LSP, treesitter, formatters, diagnostics, and per-language config |
| `keymaps.nix` | All key mappings (leader: `space`) |
| `picker.nix` | Snacks picker + oil.nvim |
| `snacks.nix` | Snacks extras: image preview, zen mode, git signs, statuscolumn |
| `utils.nix` | Bufferline, lualine, copilot, lazygit, toggleterm, autocomplete |
| `mini.nix` | Mini.nvim suite: pairs, comment, icons, indentscope, diff, git |
+19 -63
View File
@@ -75,68 +75,24 @@
};
};
outputs = inputs @ {nixpkgs, ...}: {
nixosConfigurations = {
h-laptop =
# CHANGEME: This should match the 'hostname' in your variables.nix file
nixpkgs.lib.nixosSystem {
modules = [
{
nixpkgs.overlays = [
(final: prev: {
# FIXME: Workaround: Mesa crash with AMD GPU + Wayland + Qt 6.11.0
qutebrowser = prev.symlinkJoin {
name = "qutebrowser";
paths = [prev.qutebrowser];
buildInputs = [prev.makeWrapper];
postBuild = ''
wrapProgram $out/bin/qutebrowser \
--set LIBGL_ALWAYS_SOFTWARE 1
'';
};
})
];
_module.args = {
inherit inputs;
};
}
inputs.nixos-hardware.nixosModules.omen-16-n0005ne # CHANGEME: check https://github.com/NixOS/nixos-hardware
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
inputs.nix-index-database.nixosModules.default
./hosts/laptop/configuration.nix # CHANGEME: change the path to match your host folder
];
};
h-work = nixpkgs.lib.nixosSystem {
modules = [
{
nixpkgs.overlays = [];
_module.args = {
inherit inputs;
};
}
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
inputs.nix-index-database.nixosModules.default
./hosts/work/configuration.nix
];
};
# Jack is my server
jack = nixpkgs.lib.nixosSystem {
modules = [
{_module.args = {inherit inputs;};}
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
inputs.sops-nix.nixosModules.sops
inputs.nixarr.nixosModules.default
# inputs.eleakxir.nixosModules.eleakxir
inputs.nix-index-database.nixosModules.default
inputs.default-creds.nixosModules.default
./hosts/server/configuration.nix
];
};
outputs = inputs @ {nixpkgs, nixpkgs-stable, ...}: let
system = "x86_64-linux";
args = {
inherit inputs nixpkgs system;
pkgs = nixpkgs.legacyPackages.${system};
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
};
};
merge = nixpkgs.lib.foldl nixpkgs.lib.recursiveUpdate {};
in
merge [
(import ./home/programs/nvf/flake.nix args)
(import ./home/programs/group/flake.nix args)
{
nixosConfigurations = {
h-laptop = import ./hosts/laptop/flake.nix args;
h-work = import ./hosts/work/flake.nix args;
jack = import ./hosts/server/flake.nix args;
};
}
];
}
+69
View File
@@ -0,0 +1,69 @@
{
inputs,
pkgs,
pkgs-stable,
system,
...
}: {
packages.${system} = {
dev = pkgs.buildEnv {
name = "dev-tools";
paths =
(with pkgs; [
go
bun
nodejs
air
duckdb
claude-code
inputs.bun2nix.packages.${system}.default
])
++ (with pkgs-stable; [
docker
python3
jq
just
]);
};
cybersecurity = pkgs.buildEnv {
name = "cybersecurity-tools";
paths = with pkgs-stable; [
wireshark
nmap
john
hashcat
metasploit
haiti
hydra
dnsrecon
whois
dig
nosqli
jwt-cli
nuclei
caido
gobuster
dirb
ffuf
sqlmap
inetutils
samba
openvpn
mariadb
redis
];
};
};
homeManagerModules = {
dev = {
_module.args.pkgs-stable = pkgs-stable;
imports = [./dev.nix];
};
cybersecurity = {
_module.args.pkgs-stable = pkgs-stable;
imports = [./cybersecurity.nix];
};
};
}
+20 -10
View File
@@ -1,21 +1,31 @@
# NVF is a Neovim configuration that provides a minimal setup with essential plugins and configurations.
{
inputs,
pkgs,
...
}: {
imports = [
inputs.nvf.homeManagerModules.default
./options.nix
./languages.nix
./picker.nix
./snacks.nix
./keymaps.nix
./utils.nix
./mini.nix
imports = [inputs.nvf.homeManagerModules.default];
# Packages needed by snacks image preview
home.packages = with pkgs; [
imagemagick
tree-sitter
ghostscript
tectonic
mermaid-cli
];
programs.nvf = {
enable = true;
settings = {
imports = [
./options.nix
./languages.nix
./picker.nix
./snacks.nix
./keymaps.nix
./utils.nix
./mini.nix
];
};
};
}
+32
View File
@@ -0,0 +1,32 @@
{
inputs,
pkgs,
system,
...
}: let
nvimConfig = inputs.nvf.lib.neovimConfiguration {
inherit pkgs;
modules = [
./options.nix
./languages.nix
./picker.nix
./snacks.nix
./keymaps.nix
./utils.nix
./mini.nix
];
};
in {
packages.${system}.nvim = nvimConfig.neovim;
apps.${system}.nvim = {
type = "app";
program = "${nvimConfig.neovim}/bin/nvim";
};
defaultApp.${system} = {
type = "app";
program = "${nvimConfig.neovim}/bin/nvim";
};
homeManagerModules.nvim = {imports = [./default.nix];};
}
+8 -9
View File
@@ -1,10 +1,9 @@
{
programs.nvf.settings.vim = {
vim = {
globals.mapleader = " ";
binds = {
whichKey = {
enable = true;
# TODO: registers
register = {};
};
};
@@ -63,18 +62,18 @@
}
{
key = "<MiddleMouse>";
mode = ["n" "i" "v"]; # Normal, Insert, Visual
action = "<nop>"; # No Operation
silent = true;
}
{
key = "<2-MiddleMouse>"; # Désactive aussi le double clic molette
mode = ["n" "i" "v"];
action = "<nop>";
silent = true;
}
{
key = "<3-MiddleMouse>"; # Désactive aussi le double clic molette
key = "<2-MiddleMouse>";
mode = ["n" "i" "v"];
action = "<nop>";
silent = true;
}
{
key = "<3-MiddleMouse>";
mode = ["n" "i" "v"];
action = "<nop>";
silent = true;
+2 -3
View File
@@ -3,7 +3,7 @@
pkgs,
...
}: {
programs.nvf.settings.vim = {
vim = {
diagnostics = {
enable = true;
config = {
@@ -26,7 +26,6 @@
''
function(diagnostic)
return string.format("%s", diagnostic.message)
--return string.format("%s (%s)", diagnostic.message, diagnostic.source)
end
'';
};
@@ -41,7 +40,7 @@
context.enable = true;
highlight.enable = true;
grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
typescript # in language settings only tsx gets enabled, not typescript
typescript
];
};
lsp = {
+1 -2
View File
@@ -1,8 +1,7 @@
{
programs.nvf.settings.vim.mini = {
vim.mini = {
starter.enable = true;
comment.enable = true;
# cursorword.enable = true;
icons.enable = true;
indentscope.enable = true;
notify.enable = true;
+3 -4
View File
@@ -1,9 +1,8 @@
{lib, ...}: {
programs.nvf.settings.vim = {
vim = {
viAlias = false;
vimAlias = true;
withNodeJs = true;
# syntaxHighlighting = true;
options = {
autoindent = true;
smartindent = true;
@@ -19,8 +18,8 @@
wrap = false;
};
globals = {
navic_silence = true; # navic tries to attach multiple LSPs and fails
suda_smart_edit = 1; # use super user write automatically
navic_silence = true;
suda_smart_edit = 1;
neovide_scale_factor = 0.7;
neovide_cursor_animation_length = 0.1;
neovide_cursor_short_animation_length = 0;
+1 -1
View File
@@ -1,5 +1,5 @@
{
programs.nvf.settings.vim = {
vim = {
utility = {
oil-nvim.enable = true;
snacks-nvim = {
+2 -9
View File
@@ -1,12 +1,5 @@
{pkgs, ...}: {
home.packages = with pkgs; [
imagemagick
tree-sitter
ghostscript
tectonic
mermaid-cli
];
programs.nvf.settings.vim.utility.snacks-nvim = {
{
vim.utility.snacks-nvim = {
enable = true;
setupOpts = {
image = {
+1 -1
View File
@@ -1,5 +1,5 @@
{pkgs, ...}: {
programs.nvf.settings.vim = {
vim = {
undoFile.enable = true;
utility = {
motion.flash-nvim.enable = true;
+27
View File
@@ -0,0 +1,27 @@
{inputs, nixpkgs, ...}:
nixpkgs.lib.nixosSystem {
modules = [
{
nixpkgs.overlays = [
(final: prev: {
# FIXME: Workaround: Mesa crash with AMD GPU + Wayland + Qt 6.11.0
qutebrowser = prev.symlinkJoin {
name = "qutebrowser";
paths = [prev.qutebrowser];
buildInputs = [prev.makeWrapper];
postBuild = ''
wrapProgram $out/bin/qutebrowser \
--set LIBGL_ALWAYS_SOFTWARE 1
'';
};
})
];
_module.args = {inherit inputs;};
}
inputs.nixos-hardware.nixosModules.omen-16-n0005ne
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
inputs.nix-index-database.nixosModules.default
./configuration.nix
];
}
+14
View File
@@ -0,0 +1,14 @@
{inputs, nixpkgs, ...}:
nixpkgs.lib.nixosSystem {
modules = [
{_module.args = {inherit inputs;};}
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
inputs.sops-nix.nixosModules.sops
inputs.nixarr.nixosModules.default
# inputs.eleakxir.nixosModules.eleakxir
inputs.nix-index-database.nixosModules.default
inputs.default-creds.nixosModules.default
./configuration.nix
];
}
+13
View File
@@ -0,0 +1,13 @@
{inputs, nixpkgs, ...}:
nixpkgs.lib.nixosSystem {
modules = [
{
nixpkgs.overlays = [];
_module.args = {inherit inputs;};
}
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
inputs.nix-index-database.nixosModules.default
./configuration.nix
];
}