Compare commits

...

8 Commits

14 changed files with 214 additions and 65 deletions

74
README.md Normal file
View File

@ -0,0 +1,74 @@
# NixOS Configuration
Personal NixOS configuration for my machines, using Nix Flakes for reproducible and shareable setups.
## Repository Structure
- **flake.nix**: Main entry point for the Nix Flake, defining NixOS and home-manager configurations
- **hosts/**: Host-specific NixOS configurations
- **modules/**: Custom NixOS modules reusable across different hosts
- **programs/**: System-level programs shared across hosts
- **secrets/**: Encrypted secrets managed with sops-nix
- **system/**: Common system-level configurations shared across hosts
- **users/phundrak/**: Home-manager configuration for my user
- **users/modules/**: Custom user modules reusable across configurations
## Usage
### System Management
Update flake dependencies:
```bash
nix flake update
```
Build and switch to a new system configuration:
```bash
sudo nixos-rebuild switch --flake .#<hostname>
```
Using the Nix Helper (nh) tool:
```bash
# Build and activate a new configuration, making it the boot default
nh os switch
# Build a new configuration and make it the boot default
nh os boot
# Build and activate a new configuration (without making it the boot default)
nh os test
# Just build a new configuration
nh os build
```
### Home Configuration
Update and switch to a new home configuration:
```bash
nh home switch
```
Format Nix files (using Alejandra):
```bash
nix fmt
```
## Development
For development, a devShell is provided with linting tools and git hooks:
```bash
nix develop
```
This will set up an environment with:
- alejandra (formatting)
- commitizen (commit messages)
- deadnix (dead code detection)
- statix (linting)
- Other useful git hooks
## Contributing
Feel free to fork this repository and make your own changes. If you have any improvements or suggestions, please open an issue or submit a pull request.

View File

@ -1,37 +0,0 @@
#+title: NixOS Configuration
#+author: Lucien Cartier-Tilet <lucien@phundrak.com>
This repository contains the NixOS configuration for my personal
setup. It uses Nix Flakes to manache the configuration, making it
reproducible and easy to share across my different machines.
* Repository Structure
- =flake.nix= :: The main entry point for the Nix Flake. It defines my
NixOS configurations as well as a dev shell which installs the tools
needed for testing and building my configurations.
- =hosts/= :: Directory containing host-specific configurations. Each
host has its own directory with at least a =configuration.nix= file.
- =modules/= :: Custom NixOS modules that can be reused across different
hosts.
- =programs/= :: Programs shared across hosts at the system level that
are not made into configurable modules.
- =secrets/= :: Contains secret values that I cannot or will not share
publicly.
- =system/= :: Common system-level configuration shared across hosts
that are not made into configurable modules.
- =users/phundrak/= :: My home-manager configuration, containing
user-specific settings and applications.
- =users/modules/= :: Custom user NixOS modules that can be reused
across different users.
- =user/scripts/= :: Custom shell scripts shared across users.
* Updating and Rebuilding the Configuration
In this repository, there are two helper scripts:
- =update.sh= :: Updates the Flakes lockfile.
- =rebuild.sh= :: Rebuilds the configuration and switch to it
immediately.
* Contributing
Feel free to fork this repository and make your own changes. If you
have any improvements or suggestions, please open an issue or submit a
pull request.

69
flake.lock generated
View File

@ -88,6 +88,24 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": [
@ -290,17 +308,18 @@
},
"pumo-system-info": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1748127405,
"narHash": "sha256-5Xh7VXmjeK5m8Dxt2bti8A2HdkpmPftHc2+WXH3tQH8=",
"lastModified": 1748984111,
"narHash": "sha256-SP1/+cCHnPg0UqylHCzeKNx61wGapLrYRn5UKiiDicc=",
"ref": "refs/heads/develop",
"rev": "06fa652f9626590a9727f3ec8b48330ad3fcb78f",
"revCount": 6,
"rev": "f9fe233b6cb669a718a0ddb529793159d39ba32e",
"revCount": 9,
"type": "git",
"url": "https://labs.phundrak.com/phundrak/pumo-system-info"
},
@ -309,6 +328,26 @@
"url": "https://labs.phundrak.com/phundrak/pumo-system-info"
}
},
"quickshell": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1749772873,
"narHash": "sha256-ZsFQIs3ZpUud1QmR1TyhAW0LGbjHzCkA79YCLBbJ12A=",
"ref": "refs/heads/master",
"rev": "517143adf97fb0df7e9a7584061deecdffb19faf",
"revCount": 576,
"type": "git",
"url": "https://git.outfoxxed.me/outfoxxed/quickshell"
},
"original": {
"type": "git",
"url": "https://git.outfoxxed.me/outfoxxed/quickshell"
}
},
"root": {
"inputs": {
"devenv": "devenv",
@ -316,6 +355,7 @@
"nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs_4",
"pumo-system-info": "pumo-system-info",
"quickshell": "quickshell",
"sops-nix": "sops-nix",
"zen-browser": "zen-browser"
}
@ -328,11 +368,11 @@
]
},
"locked": {
"lastModified": 1748054080,
"narHash": "sha256-rwFiLLNCwkj9bqePtH1sMqzs1xmohE0Ojq249piMzF4=",
"lastModified": 1748918260,
"narHash": "sha256-KhXNXQ5IDLvwwYfJ0pXDjwIuisZ2qM6F7fcXjIGZy/4=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "2221d8d53c128beb69346fa3ab36da3f19bb1691",
"rev": "c9736155bc1eb7c7cf3a925920850e61c07ab22a",
"type": "github"
},
"original": {
@ -361,6 +401,21 @@
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"zen-browser": {
"inputs": {
"nixpkgs": [

View File

@ -20,6 +20,11 @@
inputs.nixpkgs.follows = "nixpkgs";
};
quickshell = {
url = "git+https://git.outfoxxed.me/outfoxxed/quickshell";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";

View File

@ -14,6 +14,7 @@
../../modules/ssh.nix
../../modules/endlessh.nix
../../programs/nano.nix
./services
];
system = {

View File

@ -0,0 +1,3 @@
{
imports = [./nextcloud-cron.nix];
}

View File

@ -0,0 +1,22 @@
{pkgs, ...}: {
systemd = {
timers."nextcloud-cron" = {
wantedBy = [""];
timerConfig = {
OnBootSec = "5m";
OnUnitActiveSec = "5m";
Unit = "nextcloud-cron.service";
};
};
services."nextcloud-cron" = {
script = ''
set -eu
${pkgs.docker}/bin/docker exec -u www-data -it nextcloud-nextcloud-1 php /var/www/html/cron.php
'';
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
};
}

View File

@ -50,7 +50,7 @@ in {
input = {
kb_layout = "fr";
kb_variant = "bepo_afnor";
kb_options = "caps:ctrl_modifier";
# kb_options = "caps:ctrl_modifier";
numlock_by_default = true;
follow_mouse = 1;
touchpad.natural_scroll = false;
@ -77,21 +77,11 @@ in {
new_status = "inherit";
};
workspace = [
"2, layoutopt:orientation:bottom"
"4, layoutopt:orientation:bottom"
"1, layoutopt:orientation:bottom"
];
decoration = {
rounding = 5;
# blur = {
# enable = true;
# size = 9;
# passes = 1;
# };
# shadow = {
# enable = true;
# color = "rgba(2e3440aa)";
# range = 4;
# render_power = 3;
# };
};
animations = {
enabled = true;

25
users/modules/ollama.nix Normal file
View File

@ -0,0 +1,25 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.modules.ollama;
in {
options.modules.ollama = {
enable = mkEnableOption "Enables Ollama";
gpu = mkOption {
type = types.nullOr types.enum ["none" "amd" "nvidia"];
example = "amd";
default = "none";
description = "Which type of GPU should be used for hardware acceleration";
};
};
config.services.ollama = mkIf cfg.enable {
inherit (cfg) enable;
environmentVariables = {
OLLAMA_CONTEXT_LENGTH = "8192";
};
};
}

View File

@ -12,6 +12,7 @@ in {
options.modules.vcs = {
git = {
enable = mkEnableOption "enables git";
cliff = mkEnableOption "enables git-cliff support";
sendmail = {
enable = mkOption {
type = types.bool;
@ -94,7 +95,7 @@ in {
'');
modules = {
git = mkIf cfg.git.enable {
inherit (cfg.git) enable sendmail browser completeConfig emacs mergeTool;
inherit (cfg.git) enable cliff sendmail browser completeConfig emacs mergeTool;
inherit (cfg) email name editor;
publicKeyFile = cfg.publicKey.file;
};

View File

@ -17,6 +17,7 @@ in {
type = types.str;
default = "Lucien Cartier-Tilet";
};
cliff = mkEnableOption "enables git-cliff support";
sendmail = {
enable = mkOption {
type = types.bool;
@ -77,6 +78,7 @@ in {
};
config = lib.mkIf cfg.enable {
programs.git-cliff.enable = cfg.cliff;
programs.git = let
smtpEmail =
if (cfg.sendmail.user == null)

View File

@ -83,7 +83,7 @@ in {
};
"group/audio" = {
modules = ["mpris" "pulseaudio" "pulseaudio/slider"];
modules = ["pulseaudio" "pulseaudio/slider" "mpris"];
orientation = "inherit";
drawer.transition-duration = 300;
};

View File

@ -9,16 +9,17 @@
./packages.nix
./email.nix
../modules/emacs.nix
../modules/emoji.nix
../modules/hyprland.nix
../modules/kdeconnect.nix
../modules/kitty.nix
../modules/hyprland.nix
../modules/mbsync.nix
../modules/mpd.nix
../modules/mpv.nix
../modules/ollama.nix
../modules/qt.nix
../modules/wofi.nix
../modules/yt-dlp.nix
../modules/emoji.nix
../modules/qt.nix
];
config = let
@ -55,6 +56,7 @@
bat.extras = true;
packages.emacsPackage = emacsPkg;
mopidy.enable = true;
ollama.enable = true;
emacs = {
enable = true;
@ -87,6 +89,7 @@
integration = true;
pkg = emacsPkg;
};
cliff = true;
sendmail = {
enable = true;
passwordFile = config.sops.secrets.emailPassword.path;

View File

@ -21,8 +21,13 @@ in {
[
flatpak
# LSP server for Nix
nil
# LSP servers
bash-language-server
docker-language-server
kdePackages.qtdeclarative # For QML LSP
nil # Nix
python3 # for Emacs and LSP
yaml-language-server # Yaml (Docker, GitHub Actions, ...)
# Terminal stuff
duf
@ -63,6 +68,7 @@ in {
watchmate
inputs.zen-browser.packages.${system}.default
inputs.pumo-system-info.packages.${system}.default
inputs.quickshell.packages.${system}.default
# Games
atlauncher
@ -93,7 +99,6 @@ in {
grype # Vulnerability scanner for container images and filesystems
podman-desktop
podman-compose
python3 # for Emacs and LSP
tectonic # better LaTeX engine
virt-manager
zeal