CLEAN: nix develop

This commit is contained in:
DuN0z 2025-10-05 08:20:57 +02:00
parent daeb15f821
commit c495445e91
22 changed files with 439 additions and 423 deletions

View file

@ -22,16 +22,17 @@
home-manager, home-manager,
nur, nur,
... ...
} @ inputs: let }: let
mkUnstablePkgsWithNur = { system, config ? {} }: mkUnstablePkgsWithNur = {
system,
config ? {},
}:
import nixpkgs-unstable { import nixpkgs-unstable {
inherit system; inherit system;
overlays = [nur.overlays.default]; overlays = [nur.overlays.default];
config = config ; inherit config;
}; };
in in {
{
nixosConfigurations = { nixosConfigurations = {
pennsardin = nixpkgs-unstable.lib.nixosSystem { pennsardin = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";

View file

@ -1,4 +1,8 @@
{pkgs, nur, ... }: { {
pkgs,
nur,
...
}: {
programs.firefox = { programs.firefox = {
enable = true; enable = true;
languagePacks = ["fr"]; languagePacks = ["fr"];

View file

@ -1,20 +1,42 @@
# hm/desktop/bspwm.nix # hm/desktop/bspwm.nix
{ pkgs, lib, ... }:
{ {
pkgs,
lib,
...
}: {
imports = [ imports = [
../common/browser.nix ../common/browser.nix
]; ];
home.packages = with pkgs; [ home.packages = with pkgs; [
bspwm sxhkd xorg.xinit xterm alacritty rofi feh font-awesome bspwm
picom xorg.xset xidlehook betterlockscreen pywal16 imagemagick sxhkd
pulsemixer ranger jq file highlight unzip mpv xorg.xinit
xterm
alacritty
rofi
feh
font-awesome
picom
xorg.xset
xidlehook
betterlockscreen
pywal16
imagemagick
pulsemixer
ranger
jq
file
highlight
unzip
mpv
protonvpn-gui protonvpn-gui
]; ];
# Gère le ssh-agent proprement côté user # Gère le ssh-agent proprement côté user
services.ssh-agent.enable = true; services.ssh-agent.enable = true;
xsession.enable = true; xsession = {
enable = true;
xsession.windowManager.bspwm = { xsession.windowManager.bspwm = {
enable = true; enable = true;
@ -34,6 +56,7 @@
bspc monitor -d I II III IV V VI bspc monitor -d I II III IV V VI
''; '';
}; };
};
# xsession.initExtra = '' # xsession.initExtra = ''
# xset s 300 300 # xset s 300 300
@ -43,7 +66,8 @@
# xset dpms 0 0 500 # xset dpms 0 0 500
# ''; # '';
services.sxhkd = { services = {
sxhkd = {
enable = true; enable = true;
extraOptions = ["-m" "1"]; extraOptions = ["-m" "1"];
keybindings = { keybindings = {
@ -82,25 +106,7 @@
"super + t" = "bspc node -t tiled"; "super + t" = "bspc node -t tiled";
}; };
}; };
polybar = {
# xidlehook (user service)
systemd.user.services.xidlehook = {
Unit.Description = "Idle: lock at 5min, suspend at ~8min";
Service = {
ExecStart = ''
${pkgs.xidlehook}/bin/xidlehook \
--detect-sleep \
--not-when-fullscreen \
--timer 300 "${pkgs.betterlockscreen}/bin/betterlockscreen -l dim" "" \
--timer 500 "systemctl suspend" ""
'';
Restart = "always";
};
Install.WantedBy = [ "graphical-session.target" ];
};
# polybar (config intégrée pour démarrer simple)
services.polybar = {
enable = true; enable = true;
script = "polybar main &"; script = "polybar main &";
config = { config = {
@ -133,22 +139,48 @@
}; };
}; };
}; };
};
# alacritty # xidlehook (user service)
programs.alacritty = { systemd.user.services.xidlehook = {
Unit.Description = "Idle: lock at 5min, suspend at ~8min";
Service = {
ExecStart = ''
${pkgs.xidlehook}/bin/xidlehook \
--detect-sleep \
--not-when-fullscreen \
--timer 300 "${pkgs.betterlockscreen}/bin/betterlockscreen -l dim" "" \
--timer 500 "systemctl suspend" ""
'';
Restart = "always";
};
Install.WantedBy = ["graphical-session.target"];
};
programs = {
alacritty = {
enable = true; enable = true;
settings = { settings = {
general.import = ["~/.cache/wal/colors-alacritty.toml"]; general.import = ["~/.cache/wal/colors-alacritty.toml"];
font = { font = {
normal = { family = lib.mkForce "Iosevka Nerd Font"; style = "Regular"; }; normal = {
bold = { family = lib.mkForce "Iosevka Nerd Font"; style = "Bold"; }; family = lib.mkForce "Iosevka Nerd Font";
italic = { family = lib.mkForce "Iosevka Nerd Font"; style = "Italic"; }; style = "Regular";
};
bold = {
family = lib.mkForce "Iosevka Nerd Font";
style = "Bold";
};
italic = {
family = lib.mkForce "Iosevka Nerd Font";
style = "Italic";
};
size = lib.mkForce 9; size = lib.mkForce 9;
}; };
}; };
}; };
programs.rtorrent = { rtorrent = {
enable = true; enable = true;
extraConfig = '' extraConfig = ''
directory = /srv/raid directory = /srv/raid
@ -162,8 +194,9 @@
session = /home/lomig/.cache/rtorrent/session session = /home/lomig/.cache/rtorrent/session
''; '';
}; };
};
home.activation.createRtorrentSessionDir = lib.hm.dag.entryAfter ["writeBoundary"] '' home.activation.createRtorrentSessionDir = lib.hm.dag.entryAfter ["writeBoundary"] ''
mkdir -p ~/.cache/rtorrent/session mkdir -p ~/.cache/rtorrent/session
''; '';
} }

View file

@ -1,24 +1,35 @@
{ config, pkgs, ...}: {pkgs, ...}: {
{ boot = {
boot.loader.grub = { kernelPackages = pkgs.linuxPackages;
initrd.supportedFilesystems = ["ext4"];
loader.grub = {
enable = true; enable = true;
device = "/dev/vda"; device = "/dev/vda";
}; };
};
fileSystems."/" = { fileSystems = {
"/" = {
device = "/dev/vda1"; device = "/dev/vda1";
fsType = "ext4"; fsType = "ext4";
}; };
"/srv" = {
fileSystems."/srv" = {
device = "shared0"; device = "shared0";
fsType = "9p"; fsType = "9p";
options = ["trans=virtio" "version=9p2000.L" "rw"]; options = ["trans=virtio" "version=9p2000.L" "rw"];
neededForBoot = false; neededForBoot = false;
noCheck = true; noCheck = true;
}; };
};
systemd.services.mountShared = { networking = {
useDHCP = true;
useNetworkd = true;
hostName = "forbann";
};
systemd = {
services.mountShared = {
description = "Mount 9p shared folder"; description = "Mount 9p shared folder";
after = ["local-fs.target" "network.target"]; after = ["local-fs.target" "network.target"];
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
@ -28,17 +39,7 @@
RemainAfterExit = true; RemainAfterExit = true;
}; };
}; };
network = {
boot.kernelPackages = pkgs.linuxPackages ;
boot.initrd.supportedFilesystems = [ "ext4" ];
networking = {
useDHCP = true;
useNetworkd = true ;
hostName = "forbann" ;
};
systemd.network = {
enable = true; enable = true;
networks."10-eth0" = { networks."10-eth0" = {
matchConfig.Name = "eth0"; matchConfig.Name = "eth0";
@ -49,13 +50,15 @@
}; };
}; };
}; };
};
services.openssh.enable = true ; services = {
openssh.enable = true;
services.rtorrent = { rtorrent = {
enable = true; enable = true;
dataDir = "/home/vmuser/torrents"; dataDir = "/home/vmuser/torrents";
}; };
};
users.users.vmuser = { users.users.vmuser = {
isNormalUser = true; isNormalUser = true;

View file

@ -10,30 +10,27 @@
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;
boot.swraid.enable = true; boot.swraid.enable = true;
fileSystems = {
fileSystems."/" = "/" = {
{ device = "/dev/disk/by-uuid/b1a1ae71-4277-45d5-a3d2-f49354f263d4"; device = "/dev/disk/by-uuid/b1a1ae71-4277-45d5-a3d2-f49354f263d4";
fsType = "ext4"; fsType = "ext4";
}; };
"/boot" = {
fileSystems."/boot" = device = "/dev/disk/by-uuid/1DB2-7A0F";
{ device = "/dev/disk/by-uuid/1DB2-7A0F";
fsType = "vfat"; fsType = "vfat";
options = ["fmask=0077" "dmask=0077"]; options = ["fmask=0077" "dmask=0077"];
}; };
"/proc" = {
fileSystems."/proc" =
{
device = "proc"; device = "proc";
fsType = "proc"; fsType = "proc";
options = ["defaults" "hidepid=2"]; options = ["defaults" "hidepid=2"];
neededForBoot = true; neededForBoot = true;
}; };
"/srv/raid" = {
fileSystems."/srv/raid" = device = "/dev/disk/by-uuid/85f72160-4720-463a-9dc6-7c5216733f2b";
{ device = "/dev/disk/by-uuid/85f72160-4720-463a-9dc6-7c5216733f2b";
fsType = "btrfs"; fsType = "btrfs";
}; };
};
swapDevices = []; swapDevices = [];
@ -87,6 +84,5 @@
system.stateVersion = "25.05"; # pour éviter les hurlements inutiles system.stateVersion = "25.05"; # pour éviter les hurlements inutiles
} }
# vim: set ts=2 sw=2 sts=2 et : # vim: set ts=2 sw=2 sts=2 et :

View file

@ -1,14 +1,14 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
nix.settings.experimental-features = ["nix-command" "flakes"]; nix.settings.experimental-features = ["nix-command" "flakes"];
imports = imports = [
[ # Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware.nix ./hardware.nix
../../profiles/server-selfhosted.nix ../../profiles/server-selfhosted.nix
../../modules/services/ftp.nix ../../modules/services/ftp.nix

View file

@ -1,46 +1,43 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; boot = {
boot.initrd.kernelModules = [ ]; initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"];
boot.kernelModules = lib.mkAfter [ "kvm-intel" "tun" ]; initrd.kernelModules = [];
boot.extraModulePackages = [ ]; kernelModules = lib.mkAfter ["kvm-intel" "tun"];
extraModulePackages = [];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/f37e4afb-1ee2-4f70-a93c-398461405181";
fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems = {
{ device = "/dev/disk/by-uuid/111D-E5E8"; "/" = {
device = "/dev/disk/by-uuid/f37e4afb-1ee2-4f70-a93c-398461405181";
fsType = "ext4";
};
"/boot" = {
device = "/dev/disk/by-uuid/111D-E5E8";
fsType = "vfat"; fsType = "vfat";
options = ["fmask=0077" "dmask=0077"]; options = ["fmask=0077" "dmask=0077"];
}; };
"/srv" = {
fileSystems."/srv" = device = "/dev/disk/by-uuid/2ef442a9-0eab-4dc5-b17c-076e18a54873";
{ device = "/dev/disk/by-uuid/2ef442a9-0eab-4dc5-b17c-076e18a54873";
fsType = "btrfs"; fsType = "btrfs";
}; };
};
swapDevices = swapDevices = [
[ { device = "/dev/disk/by-uuid/c3a69154-ead9-4fcc-a9b1-3b741a42ee97"; } {device = "/dev/disk/by-uuid/c3a69154-ead9-4fcc-a9b1-3b741a42ee97";}
]; ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
# networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View file

@ -29,14 +29,13 @@
ovmf.packages = [pkgs.OVMFFull.fd]; ovmf.packages = [pkgs.OVMFFull.fd];
runAsRoot = false; runAsRoot = false;
swtpm.enable = true; swtpm.enable = true;
} else { }
else {
runAsRoot = false; runAsRoot = false;
swtpm.enable = true; swtpm.enable = true;
}; };
}; };
users.users.lomig.extraGroups = ["libvirtd" "kvm" "input"]; users.users.lomig.extraGroups = ["libvirtd" "kvm" "input"];
environment.etc."qemu/bridge.conf".text = '' environment.etc."qemu/bridge.conf".text = ''

View file

@ -1,8 +1,4 @@
{ {lib, ...}: {
config,
lib,
...
}: {
services = { services = {
xserver = { xserver = {
enable = true; enable = true;

View file

@ -1,6 +1,4 @@
# NixOS module Forgejo avec SQLite, SSH et reverse proxy Caddy {pkgs, ...}: {
{ config, pkgs, lib, ... }: {
# --- Utilisateur dédié --- # --- Utilisateur dédié ---
users.users.git = { users.users.git = {
isSystemUser = true; isSystemUser = true;
@ -11,7 +9,8 @@
users.groups.git = {}; users.groups.git = {};
# --- Forgejo --- # --- Forgejo ---
services.forgejo = { services = {
forgejo = {
enable = true; enable = true;
user = "git"; user = "git";
group = "git"; group = "git";
@ -37,16 +36,8 @@
}; };
}; };
}; };
openssh.enable = true;
# --- Ouvrir les ports nécessaires --- caddy = {
networking.firewall.allowedTCPPorts = [ 80 443 2222 ];
# --- Rediriger port SSH interne de Forgejo ---
services.openssh.enable = true;
networking.firewall.interfaces."eth0".allowedTCPPorts = [ 22 ]; # pour admin
# --- Caddy pour govel.porzh.me ---
services.caddy = {
enable = true; enable = true;
virtualHosts."govel.porzh.me" = { virtualHosts."govel.porzh.me" = {
extraConfig = '' extraConfig = ''
@ -54,7 +45,13 @@
''; '';
}; };
}; };
};
# --- Ouvrir les ports nécessaires ---
networking.firewall = {
allowedTCPPorts = [80 443 2222];
interfaces."eth0".allowedTCPPorts = [22];
};
# --- Pour que Forgejo génère les bonnes URLs Git --- # --- Pour que Forgejo génère les bonnes URLs Git ---
# networking.hostName = "git"; # non strictement obligatoire # networking.hostName = "git"; # non strictement obligatoire
@ -67,6 +64,4 @@
# --- Astuce : génère une paire de clés pour laccès SSH Git --- # --- Astuce : génère une paire de clés pour laccès SSH Git ---
# ssh-keygen -t ed25519 -f ~/.ssh/id_git_forgejo # ssh-keygen -t ed25519 -f ~/.ssh/id_git_forgejo
# puis ajoute la clé publique dans ton compte Forgejo # puis ajoute la clé publique dans ton compte Forgejo
} }

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }: { _: {
# ------------------------------------------------- # -------------------------------------------------
# 1⃣ Création de lutilisateur système dédié FTP # 1⃣ Création de lutilisateur système dédié FTP
# ------------------------------------------------- # -------------------------------------------------
@ -54,7 +54,6 @@ extraConfig = ''
pasv_min_port=40000 pasv_min_port=40000
pasv_max_port=40004 pasv_max_port=40004
''; '';
}; };
# ------------------------------------------------- # -------------------------------------------------
@ -66,4 +65,3 @@ extraConfig = ''
# allowedTCPPorts = [ 21 990 40000 40001 40002 40003 40004 ]; # allowedTCPPorts = [ 21 990 40000 40001 40002 40003 40004 ];
}; };
} }

View file

@ -32,6 +32,4 @@
}; };
}; };
}; };
} }

View file

@ -1,5 +1,4 @@
{ config, pkgs, ... }: _: {
{
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# 1⃣ Caddy (reverseproxy / serveur web statique) # 1⃣ Caddy (reverseproxy / serveur web statique)
# ----------------------------------------------------------------- # -----------------------------------------------------------------

View file

@ -1,6 +1,4 @@
{ config, pkgs, ... }: {pkgs, ...}: let
let
porzhSite = pkgs.stdenv.mkDerivation { porzhSite = pkgs.stdenv.mkDerivation {
pname = "porzh-site"; pname = "porzh-site";
version = "1.0"; version = "1.0";
@ -25,4 +23,3 @@ in {
}; };
}; };
} }