Update formatter

This commit is contained in:
Victor Mignot 2024-04-11 20:15:47 +02:00
parent 72483ad795
commit 3a154a8225
Signed by: dala
GPG key ID: 5E7F2CE1BEAFED3D
29 changed files with 490 additions and 398 deletions

View file

@ -1,6 +1,18 @@
{ pkgs, config, lib, ... }:
{ {
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; pkgs,
config,
lib,
...
}:
{
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@ -45,7 +57,7 @@
hwAccelerationGPU = "intel"; hwAccelerationGPU = "intel";
/* System secrets */ # System secrets
sops = { sops = {
gnupg.sshKeyPaths = [ ]; gnupg.sshKeyPaths = [ ];
age = { age = {

View file

@ -48,11 +48,11 @@
services.jackett = { services.jackett = {
enable = true; enable = true;
package = pkgs.jackett.overrideAttrs(_: _: { doCheck = false; }); package = pkgs.jackett.overrideAttrs (_: _: { doCheck = false; });
openFirewall = true; openFirewall = true;
}; };
systemd.services.delugedweb.requires = ["deluged-proxy.service"]; systemd.services.delugedweb.requires = [ "deluged-proxy.service" ];
systemd.services.deluged.bindsTo = [ "wireguard-wg1.service" ]; systemd.services.deluged.bindsTo = [ "wireguard-wg1.service" ];
systemd.services.deluged.requires = [ "network-online.target" ]; systemd.services.deluged.requires = [ "network-online.target" ];
systemd.services.deluged.serviceConfig.NetworkNamespacePath = "/var/run/netns/wg1ns"; systemd.services.deluged.serviceConfig.NetworkNamespacePath = "/var/run/netns/wg1ns";
@ -66,8 +66,14 @@
systemd.services.deluged-proxy = { systemd.services.deluged-proxy = {
description = "Proxy for deluge-web to deluged in network namespace"; description = "Proxy for deluge-web to deluged in network namespace";
requires = [ "deluged.service" "deluged-proxy.socket" ]; requires = [
after = [ "deluged.service" "deluged-proxy.socket" ]; "deluged.service"
"deluged-proxy.socket"
];
after = [
"deluged.service"
"deluged-proxy.socket"
];
unitConfig.JoinsNamespaceOf = "deluged.service"; unitConfig.JoinsNamespaceOf = "deluged.service";
serviceConfig = { serviceConfig = {
User = "deluge"; User = "deluge";

View file

@ -1,33 +1,33 @@
{ config, extraInfo, ... }: { config, extraInfo, ... }:
{ {
services.nginx.virtualHosts.${extraInfo.nextcloudURI} = { services.nginx.virtualHosts.${extraInfo.nextcloudURI} = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
}; };
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
datadir = "/srv/nextcloud"; datadir = "/srv/nextcloud";
https = true; https = true;
hostName = extraInfo.nextcloudURI; hostName = extraInfo.nextcloudURI;
extraAppsEnable = true; extraAppsEnable = true;
extraApps = {}; extraApps = { };
database.createLocally = true; database.createLocally = true;
configureRedis = true; configureRedis = true;
config = { config = {
dbtype = "pgsql"; dbtype = "pgsql";
adminuser = "dala";
adminpassFile = config.sops.secrets.nextcloud_admin_pw.path;
};
caching = { adminuser = "dala";
redis = true; adminpassFile = config.sops.secrets.nextcloud_admin_pw.path;
memcached = true; };
apcu = true;
}; caching = {
}; redis = true;
memcached = true;
apcu = true;
};
};
} }

View file

@ -1,10 +1,13 @@
{ config, pkgs, extraInfo, ... }:
{ {
networking.firewall.allowedUDPPorts = [ config,
51821 pkgs,
]; extraInfo,
...
}:
{
networking.firewall.allowedUDPPorts = [ 51821 ];
/* Wireguard */ # Wireguard
networking.wireguard.interfaces.wg0 = { networking.wireguard.interfaces.wg0 = {
ips = [ "10.100.0.6/8" ]; ips = [ "10.100.0.6/8" ];
@ -52,7 +55,6 @@
ip netns exec wg1ns ip link set lo up ip netns exec wg1ns ip link set lo up
''; '';
postShutdown = '' postShutdown = ''
ip netns del wg1ns ip netns del wg1ns
''; '';

View file

@ -1,16 +1,27 @@
{ pkgs, config, lib, extraInfo, ... }:
{ {
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" ]; pkgs,
config,
lib,
extraInfo,
...
}:
{
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
];
boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
/* Meta */ # Meta
isProfessional = false; isProfessional = false;
/* Volumes */ # Volumes
luksDevices = [ luksDevices = [
{ {
name = "crypted-nixos"; name = "crypted-nixos";
@ -47,25 +58,24 @@
swapDeviceUUID = "5fe5e76b-df3d-43ce-abf9-d2b63078df09"; swapDeviceUUID = "5fe5e76b-df3d-43ce-abf9-d2b63078df09";
# Linux kernel
/* Linux kernel */
useLatestKernel = true; useLatestKernel = true;
/* Custom udev rules for Nucleo's stlink interface */ # Custom udev rules for Nucleo's stlink interface
services.udev.extraRules = '' services.udev.extraRules = ''
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b",MODE="660",GROUP="dialout",TAG+="uaccess" ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b",MODE="660",GROUP="dialout",TAG+="uaccess"
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748",MODE="660",GROUP="dialout",TAG+="uaccess" ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748",MODE="660",GROUP="dialout",TAG+="uaccess"
''; '';
/* Nix */ # Nix
allowUnfreePackages = true; allowUnfreePackages = true;
/* Hardware acceleration */ # Hardware acceleration
hwAccelerationGPU = "amd"; hwAccelerationGPU = "amd";
keymap = "fr"; keymap = "fr";
/* System secrets */ # System secrets
sops = { sops = {
gnupg.sshKeyPaths = [ ]; gnupg.sshKeyPaths = [ ];
age = { age = {
@ -76,7 +86,7 @@
secrets.wg0_private = { }; secrets.wg0_private = { };
}; };
/* Wireguard */ # Wireguard
networking.wg-quick.interfaces.wg0 = { networking.wg-quick.interfaces.wg0 = {
address = [ "10.100.0.4/8" ]; address = [ "10.100.0.4/8" ];
dns = [ "10.100.0.1" ]; dns = [ "10.100.0.1" ];
@ -103,11 +113,20 @@
]; ];
}; };
/* User config */ # User config
machineUsers = { machineUsers = {
dala = { dala = {
description = "Dala"; description = "Dala";
groups = [ "wheel" "video" "audio" "seat" "keys" "lp" "dialout" "network" ]; groups = [
"wheel"
"video"
"audio"
"seat"
"keys"
"lp"
"dialout"
"network"
];
uid = 1000; uid = 1000;
shell = pkgs.fish; shell = pkgs.fish;
enableHomeManagerProfile = true; enableHomeManagerProfile = true;

View file

@ -23,55 +23,59 @@
extra-config.url = "git+ssh://git@git.sr.ht/~dala/extra-config"; extra-config.url = "git+ssh://git@git.sr.ht/~dala/extra-config";
}; };
outputs = { self, nixpkgs-unstable, nixpkgs-stable, home-manager, sops-nix, flake-utils, extra-config }: outputs =
{
self,
nixpkgs-unstable,
nixpkgs-stable,
home-manager,
sops-nix,
flake-utils,
extra-config,
}:
let let
machines = import ./machines.nix; machines = import ./machines.nix;
in in
{ {
nixosConfigurations = builtins.mapAttrs nixosConfigurations = builtins.mapAttrs (
(name: value: name: value:
let let
nixpkgs = nixpkgs = if value.nixpkgsUnstable then nixpkgs-unstable else nixpkgs-stable;
if value.nixpkgsUnstable in
then nixpkgs-unstable nixpkgs.lib.nixosSystem {
else nixpkgs-stable; system = value.system;
in
nixpkgs.lib.nixosSystem {
system = value.system;
specialArgs = { specialArgs = {
machineInfos = { machineInfos = {
hostname = name; hostname = name;
} // value; } // value;
sopsHmModule = sops-nix.homeManagerModules.sops; sopsHmModule = sops-nix.homeManagerModules.sops;
extraInfo = extra-config.extraSecrets; extraInfo = extra-config.extraSecrets;
}; };
modules = [ modules = [
./configurations/${name} ./configurations/${name}
./modules/common ./modules/common
(if (value.machineType == "workstation") (if (value.machineType == "workstation") then ./modules/workstation else ./modules/server)
then ./modules/workstation (
else ./modules/server) if (value.machineType == "workstation" && value.enableHomeManager) then
(if (value.machineType == "workstation" && value.enableHomeManager) home-manager.nixosModules.home-manager
then home-manager.nixosModules.home-manager else
else { }) { }
sops-nix.nixosModules.sops )
]; sops-nix.nixosModules.sops
} ];
) }
machines; ) machines;
formatter = builtins.listToAttrs (map formatter = builtins.listToAttrs (
(system: map (system: {
{ name = system;
name = system; value = nixpkgs-unstable.legacyPackages.${system}.nixfmt-rfc-style;
value = nixpkgs-unstable.legacyPackages.${system}.nixpkgs-fmt; }) flake-utils.lib.defaultSystems
} );
)
flake-utils.lib.defaultSystems);
hydraJobs = { hydraJobs = {
nixos = builtins.mapAttrs (_: cfg: cfg.config.system.build.toplevel) self.nixosConfigurations; nixos = builtins.mapAttrs (_: cfg: cfg.config.system.build.toplevel) self.nixosConfigurations;

View file

@ -46,15 +46,15 @@ in
}; };
config = { config = {
boot.initrd.luks.devices = builtins.listToAttrs (map boot.initrd.luks.devices = builtins.listToAttrs (
(fs: { map (fs: {
name = fs.name; name = fs.name;
value = { value = {
device = "/dev/disk/by-uuid/${fs.deviceUUID}"; device = "/dev/disk/by-uuid/${fs.deviceUUID}";
preLVM = fs.isPreLVM; preLVM = fs.isPreLVM;
}; };
}) }) config.luksDevices
config.luksDevices); );
boot.loader.systemd-boot.enable = config.enableDefaultSystemdBoot; boot.loader.systemd-boot.enable = config.enableDefaultSystemdBoot;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;

View file

@ -1,4 +1,11 @@
{ lib, config, pkgs, machineInfos, modulesPath, ... }: {
lib,
config,
pkgs,
machineInfos,
modulesPath,
...
}:
with lib; with lib;
{ {
imports = [ imports = [
@ -13,7 +20,10 @@ with lib;
]; ];
options.machineType = mkOption { options.machineType = mkOption {
type = types.enum [ "workstation" "server" ]; type = types.enum [
"workstation"
"server"
];
default = "workstation"; default = "workstation";
example = "server"; example = "server";
description = '' description = ''
@ -46,7 +56,9 @@ with lib;
virtualisation.docker.enable = config.enableDocker; virtualisation.docker.enable = config.enableDocker;
# Only enable fish shell if there is at least one user using it. # Only enable fish shell if there is at least one user using it.
programs.fish.enable = builtins.any (user: user.shell == pkgs.fish) (builtins.attrValues config.machineUsers); programs.fish.enable = builtins.any (user: user.shell == pkgs.fish) (
builtins.attrValues config.machineUsers
);
# We always want to disable the X server as only workstation use windows manager # We always want to disable the X server as only workstation use windows manager
# and they always use wayland. # and they always use wayland.

View file

@ -24,7 +24,6 @@ let
The volume filesystem. The volume filesystem.
''; '';
}; };
}; };
}; };
in in
@ -50,15 +49,15 @@ in
}; };
config = { config = {
fileSystems = builtins.listToAttrs (map fileSystems = builtins.listToAttrs (
(fs: { map (fs: {
name = fs.mountpoint; name = fs.mountpoint;
value = { value = {
device = "/dev/disk/by-uuid/${fs.deviceUUID}"; device = "/dev/disk/by-uuid/${fs.deviceUUID}";
fsType = fs.fsType; fsType = fs.fsType;
}; };
}) }) config.filesystems
config.filesystems); );
swapDevices = mkIf (config.swapDeviceUUID != null) [ swapDevices = mkIf (config.swapDeviceUUID != null) [
{ device = "/dev/disk/by-uuid/${config.swapDeviceUUID}"; } { device = "/dev/disk/by-uuid/${config.swapDeviceUUID}"; }

View file

@ -1,8 +1,19 @@
{ lib, config, pkgs, ... }: {
lib,
config,
pkgs,
...
}:
with lib; with lib;
{ {
options.hwAccelerationGPU = mkOption { options.hwAccelerationGPU = mkOption {
type = types.nullOr (types.enum [ "nvidia" "intel" "amd" ]); type = types.nullOr (
types.enum [
"nvidia"
"intel"
"amd"
]
);
default = null; default = null;
example = "nvidia"; example = "nvidia";
description = '' description = ''
@ -11,9 +22,7 @@ with lib;
}; };
config = { config = {
boot.kernelParams = mkIf (config.hwAccelerationGPU == "intel") [ boot.kernelParams = mkIf (config.hwAccelerationGPU == "intel") [ "i915.enable_guc=2" ];
"i915.enable_guc=2"
];
hardware.opengl = { hardware.opengl = {
enable = config.hwAccelerationGPU != null; enable = config.hwAccelerationGPU != null;
@ -30,8 +39,6 @@ with lib;
]; ];
}; };
services.xserver.videoDrivers = mkIf (config.hwAccelerationGPU == "nvidia") [ services.xserver.videoDrivers = mkIf (config.hwAccelerationGPU == "nvidia") [ "nouveau" ];
"nouveau"
];
}; };
} }

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }: {
lib,
config,
pkgs,
...
}:
with lib; with lib;
{ {
options.useLatestKernel = mkOption { options.useLatestKernel = mkOption {

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
with lib; with lib;
{ {
options.allowUnfreePackages = mkOption { options.allowUnfreePackages = mkOption {

View file

@ -3,48 +3,34 @@ with lib;
let let
userModule = types.submodule { userModule = types.submodule {
options = { options = {
description = mkOption { description = mkOption { type = types.str; };
type = types.str;
};
groups = mkOption { groups = mkOption { type = types.listOf types.str; };
type = types.listOf types.str;
};
uid = mkOption { uid = mkOption { type = types.nullOr types.int; };
type = types.nullOr types.int;
};
shell = mkOption { shell = mkOption { type = types.package; };
type = types.package;
};
enableHomeManagerProfile = mkOption { enableHomeManagerProfile = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
}; };
homeManagerConfig = mkOption { homeManagerConfig = mkOption { default = { }; };
default = { };
};
}; };
}; };
in in
{ {
options.machineUsers = mkOption { options.machineUsers = mkOption { type = types.attrsOf userModule; };
type = types.attrsOf userModule;
};
config = { config = {
users.users = builtins.mapAttrs users.users = builtins.mapAttrs (name: value: {
(name: value: { isNormalUser = true;
isNormalUser = true; home = "/home/${name}";
home = "/home/${name}"; description = value.description;
description = value.description; extraGroups = value.groups;
extraGroups = value.groups; shell = value.shell;
shell = value.shell; uid = mkIf (value.uid != null) value.uid;
uid = mkIf (value.uid != null) value.uid; }) config.machineUsers;
})
config.machineUsers;
}; };
} }

View file

@ -1,4 +1,11 @@
{ lib, config, pkgs, machineInfos, sopsHmModule, ... }: {
lib,
config,
pkgs,
machineInfos,
sopsHmModule,
...
}:
with lib; with lib;
{ {
@ -30,18 +37,20 @@ with lib;
keymap = config.keymap; keymap = config.keymap;
nvidiaGPU = (config.hwAccelerationGPU == "nvidia"); nvidiaGPU = (config.hwAccelerationGPU == "nvidia");
}; };
home-manager.users = builtins.mapAttrs home-manager.users = builtins.mapAttrs (
(name: value: name: value:
mkIf value.enableHomeManagerProfile ({ mkIf value.enableHomeManagerProfile (
{
home.username = name; home.username = name;
home.homeDirectory = "/home/${name}"; home.homeDirectory = "/home/${name}";
home.stateVersion = machineInfos.stateVersion; home.stateVersion = machineInfos.stateVersion;
programs.home-manager.enable = true; programs.home-manager.enable = true;
enableFishShell = value.shell == pkgs.fish; enableFishShell = value.shell == pkgs.fish;
isProfessional = config.isProfessional; isProfessional = config.isProfessional;
} // value.homeManagerConfig) }
// value.homeManagerConfig
) )
config.machineUsers; ) config.machineUsers;
programs.dconf.enable = true; programs.dconf.enable = true;
security.polkit.enable = true; security.polkit.enable = true;

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; with lib;
let let
usersHasSway = builtins.any usersHasSway = builtins.any (user: config.home-manager.users.${user}.desktop.enableSwayStack) (
(user: builtins.attrNames config.machineUsers
config.home-manager.users.${user}.desktop.enableSwayStack );
)
(builtins.attrNames config.machineUsers);
in in
{ {
programs.sway = mkIf usersHasSway { programs.sway = mkIf usersHasSway {

View file

@ -1,4 +1,9 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
{ {
options = { options = {
@ -28,9 +33,7 @@ with lib;
}; };
config.home.packages = with pkgs; [ config.home.packages = with pkgs; [
(mkIf config.communication.discord.enable (discord.override { (mkIf config.communication.discord.enable (discord.override { nss = nss_latest; }))
nss = nss_latest;
}))
(mkIf config.communication.slack.enable slack) (mkIf config.communication.slack.enable slack)
(mkIf config.communication.weechat.enable weechat) (mkIf config.communication.weechat.enable weechat)
(mkIf config.communication.matrix.enable element) (mkIf config.communication.matrix.enable element)

View file

@ -18,7 +18,6 @@ let
yubico-pam yubico-pam
yubikey-manager yubikey-manager
]; ];
in in
{ {
imports = [ imports = [
@ -33,29 +32,30 @@ in
./helix.nix ./helix.nix
]; ];
options.isProfessional = mkOption { options.isProfessional = mkOption { type = types.bool; };
type = types.bool;
};
config = { config = {
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
home.packages = with pkgs; [ home.packages =
htop with pkgs;
firefox [
autojump htop
nextcloud-client firefox
keepassxc autojump
ranger nextcloud-client
libreoffice keepassxc
tldr ranger
zathura libreoffice
lazygit tldr
easyeffects zathura
] ++ multimediaPackages lazygit
++ soundPackages easyeffects
++ yubikeyTools; ]
++ multimediaPackages
++ soundPackages
++ yubikeyTools;
# XDG-Mime configuration # XDG-Mime configuration
xdg.mime.enable = true; xdg.mime.enable = true;
@ -70,5 +70,4 @@ in
"text/html" = "firefox.desktop"; "text/html" = "firefox.desktop";
}; };
}; };
} }

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }: {
lib,
config,
pkgs,
...
}:
with lib; with lib;
let let
desktopPackages = with pkgs; [ desktopPackages = with pkgs; [
@ -36,7 +41,7 @@ in
config = mkIf config.desktop.enableSwayStack { config = mkIf config.desktop.enableSwayStack {
home.packages = desktopPackages; home.packages = desktopPackages;
dconf = { dconf = {
enable = true; enable = true;
settings."org/gnome/desktop/interface".color-scheme = "prefer-dark"; settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";

View file

@ -1,4 +1,11 @@
{ config, pkgs, lib, keymap, nvidiaGPU, ... }: {
config,
pkgs,
lib,
keymap,
nvidiaGPU,
...
}:
with lib; with lib;
let let
isQwerty = keymap == "us"; isQwerty = keymap == "us";
@ -6,26 +13,16 @@ let
rendererLine = if nvidiaGPU then "export WLR_RENDERER=vulkan" else ""; rendererLine = if nvidiaGPU then "export WLR_RENDERER=vulkan" else "";
monitorModule = types.submodule { monitorModule = types.submodule {
options = { options = {
name = mkOption { name = mkOption { type = types.str; };
type = types.str; resolution = mkOption { type = types.str; };
}; position = mkOption { type = types.str; };
resolution = mkOption { defaultWorkspace = mkOption { type = types.int; };
type = types.str;
};
position = mkOption {
type = types.str;
};
defaultWorkspace = mkOption {
type = types.int;
};
}; };
}; };
in in
{ {
options = { options = {
desktop.monitors = mkOption { desktop.monitors = mkOption { type = types.listOf monitorModule; };
type = types.listOf monitorModule;
};
}; };
config.wayland.windowManager.sway = mkIf config.desktop.enableSwayStack { config.wayland.windowManager.sway = mkIf config.desktop.enableSwayStack {
@ -53,7 +50,7 @@ in
xkb_layout = keymap; xkb_layout = keymap;
xkb_options = mkIf isQwerty "compose:ralt"; xkb_options = mkIf isQwerty "compose:ralt";
}; };
"12951:6519:ZSA_Technology_Labs_Voyager" = { "12951:6519:ZSA_Technology_Labs_Voyager" = {
xkb_layout = "us"; xkb_layout = "us";
xkb_options = "compose:ralt"; xkb_options = "compose:ralt";
@ -65,24 +62,23 @@ in
"xcursor_theme" = "Nordzy-cursors"; "xcursor_theme" = "Nordzy-cursors";
}; };
}; };
output = builtins.listToAttrs output =
(builtins.map builtins.listToAttrs (
(monitor: { builtins.map (monitor: {
name = monitor.name; name = monitor.name;
value = { value = {
resolution = monitor.resolution; resolution = monitor.resolution;
position = monitor.position; position = monitor.position;
}; };
}) }) config.desktop.monitors
config.desktop.monitors) // { )
"*".bg = "/home/dala/Perso/wallpapers/tanuki.jpg fill"; // {
}; "*".bg = "/home/dala/Perso/wallpapers/tanuki.jpg fill";
workspaceOutputAssign = map };
(monitor: { workspaceOutputAssign = map (monitor: {
output = monitor.name; output = monitor.name;
workspace = builtins.toString monitor.defaultWorkspace; workspace = builtins.toString monitor.defaultWorkspace;
}) }) config.desktop.monitors;
config.desktop.monitors;
startup = [ startup = [
{ {
command = '' command = ''
@ -134,9 +130,7 @@ in
modifier = "${modifier} normal"; modifier = "${modifier} normal";
}; };
bars = [{ bars = [ { command = "${pkgs.waybar}/bin/waybar"; } ];
command = "${pkgs.waybar}/bin/waybar";
}];
keybindings = { keybindings = {
"${modifier}+Return" = "exec ${terminal}"; "${modifier}+Return" = "exec ${terminal}";
@ -218,8 +212,8 @@ in
"${modifier}+r" = "mode resize"; "${modifier}+r" = "mode resize";
"XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume 0 +5%"; #increase sound volume "XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume 0 +5%"; # increase sound volume
"XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume 0 -5%"; #decrease sound volume "XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume 0 -5%"; # decrease sound volume
"XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute 0 toggle"; # mute sound "XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute 0 toggle"; # mute sound
"XF86MonBrightnessUp" = "exec --no-startup-id light -A 10"; "XF86MonBrightnessUp" = "exec --no-startup-id light -A 10";

View file

@ -5,136 +5,136 @@ with lib;
enable = true; enable = true;
#systemd.enable = false; #systemd.enable = false;
settings = [{ settings = [
layer = "top"; {
position = "top"; layer = "top";
height = 30; position = "top";
height = 30;
modules-left = [ modules-left = [
"sway/workspaces" "sway/workspaces"
"sway/mode" "sway/mode"
]; ];
modules-center = [ modules-center = [ "sway/window" ];
"sway/window"
];
modules-right = [ modules-right = [
"memory" "memory"
"cpu" "cpu"
"pulseaudio" "pulseaudio"
"network" "network"
"battery" "battery"
"tray" "tray"
"sway/language" "sway/language"
"clock" "clock"
]; ];
"sway/workspaces" = { "sway/workspaces" = {
"disable-scroll" = true; "disable-scroll" = true;
"all-outputs" = false; "all-outputs" = false;
"format" = "{icon}"; "format" = "{icon}";
"format-icons" = { "format-icons" = {
"1:term" = ""; "1:term" = "";
"2:web" = ""; "2:web" = "";
"3:email" = ""; "3:email" = "";
"4:im" = ""; "4:im" = "";
"5:dev" = ""; "5:dev" = "";
"6:music" = ""; "6:music" = "";
"7:graph" = ""; "7:graph" = "";
"8:any" = ""; "8:any" = "";
"9:any" = ""; "9:any" = "";
"10:aux" = ""; "10:aux" = "";
}; };
};
"tray" = {
"icon-size" = 18;
"spacing" = 12;
};
"memory" = {
"format" = "{percentage:3}% <big>󰍛</big>";
"states" = {
"warning" = 70;
"critical" = 90;
};
};
"cpu" = {
"format" = "{usage:3}% <big></big>";
"states" = {
"warning" = 70;
"critical" = 90;
};
};
"pulseaudio" = {
"format" = "{volume:3}% <big>{icon}</big>";
"format-bluetooth" = "<big>{icon}</big>";
"format-muted" = "<big>󰝟<\big>";
"format-icons" = {
"headphone" = "";
"hands-free" = "";
"headset" = "";
"phone" = "";
"portable" = "";
"car" = "";
"default" = [ "" ];
}; };
"on-click" = "pavucontrol"; "tray" = {
"on-scroll-up" = "pamixer -ui 2 && pamixer --get-volume > $SWAYSOCK.wob"; "icon-size" = 18;
"on-scroll-down" = "pamixer -ud 2 && pamixer --get-volume > $SWAYSOCK.wob"; "spacing" = 12;
};
"network" = {
"format-wifi" = "{essid} <big></big>";
"format-ethernet" = "<big></big>";
"format-disconnected" = "<big>󰌙</big>";
"format-linked" = "<big></big>";
"format-alt" = "{ifname}: {ipaddr}/{cidr}";
"tooltip-format-ethernet" = "<big></big> {bandwidthDownBits} <big></big> {bandwidthUpBits}";
"tooltip-format-wifi" = "<big></big>{bandwidthDownBits} <big></big> {bandwidthUpBits}";
};
"battery" = {
"states" = {
"5pct" = 5;
"10pct" = 10;
"20pct" = 20;
"30pct" = 30;
"40pct" = 40;
"50pct" = 50;
"60pct" = 60;
"70pct" = 70;
"80pct" = 80;
"90pct" = 90;
"full" = 100;
}; };
"format" = "{capacity:3}% <big>{icon}</big>"; "memory" = {
"format-icons" = { "format" = "{percentage:3}% <big>󰍛</big>";
"5pct" = "󰂃"; "states" = {
"10pct" = "󰁺"; "warning" = 70;
"20pct" = "󰁻"; "critical" = 90;
"30pct" = "󰁼"; };
"40pct" = "󰁽";
"50pct" = "󰁾";
"60pct" = "󰁿";
"70pct" = "󰂀";
"80pct" = "󰂁";
"90pct" = "󰂂";
"full" = "󰁹";
}; };
"on-click" = "notify-send -u low -t 3000 'Battery Status' \"$(acpi)\"";
};
"clock" = { "cpu" = {
"format-alt" = "{:%A, %B %d}"; "format" = "{usage:3}% <big></big>";
"tooltip-format" = "<big>{:%Y %B}</big>\n<tt>{calendar}</tt>"; "states" = {
}; "warning" = 70;
}]; "critical" = 90;
};
};
"pulseaudio" = {
"format" = "{volume:3}% <big>{icon}</big>";
"format-bluetooth" = "<big>{icon}</big>";
"format-muted" = "<big>󰝟<\big>";
"format-icons" = {
"headphone" = "";
"hands-free" = "";
"headset" = "";
"phone" = "";
"portable" = "";
"car" = "";
"default" = [ "" ];
};
"on-click" = "pavucontrol";
"on-scroll-up" = "pamixer -ui 2 && pamixer --get-volume > $SWAYSOCK.wob";
"on-scroll-down" = "pamixer -ud 2 && pamixer --get-volume > $SWAYSOCK.wob";
};
"network" = {
"format-wifi" = "{essid} <big></big>";
"format-ethernet" = "<big></big>";
"format-disconnected" = "<big>󰌙</big>";
"format-linked" = "<big></big>";
"format-alt" = "{ifname}: {ipaddr}/{cidr}";
"tooltip-format-ethernet" = "<big></big> {bandwidthDownBits} <big></big> {bandwidthUpBits}";
"tooltip-format-wifi" = "<big></big>{bandwidthDownBits} <big></big> {bandwidthUpBits}";
};
"battery" = {
"states" = {
"5pct" = 5;
"10pct" = 10;
"20pct" = 20;
"30pct" = 30;
"40pct" = 40;
"50pct" = 50;
"60pct" = 60;
"70pct" = 70;
"80pct" = 80;
"90pct" = 90;
"full" = 100;
};
"format" = "{capacity:3}% <big>{icon}</big>";
"format-icons" = {
"5pct" = "󰂃";
"10pct" = "󰁺";
"20pct" = "󰁻";
"30pct" = "󰁼";
"40pct" = "󰁽";
"50pct" = "󰁾";
"60pct" = "󰁿";
"70pct" = "󰂀";
"80pct" = "󰂁";
"90pct" = "󰂂";
"full" = "󰁹";
};
"on-click" = "notify-send -u low -t 3000 'Battery Status' \"$(acpi)\"";
};
"clock" = {
"format-alt" = "{:%A, %B %d}";
"tooltip-format" = "<big>{:%Y %B}</big>\n<tt>{calendar}</tt>";
};
}
];
style = '' style = ''
@keyframes blink-warning { @keyframes blink-warning {

View file

@ -1,4 +1,9 @@
{ pkgs, config, lib, ... }: {
pkgs,
config,
lib,
...
}:
with lib; with lib;
{ {
programs.wofi = mkIf config.desktop.enableSwayStack { programs.wofi = mkIf config.desktop.enableSwayStack {

View file

@ -1,9 +1,12 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; with lib;
{ {
imports = [ imports = [ ./embedded.nix ];
./embedded.nix
];
options.development.enableGit = mkOption { options.development.enableGit = mkOption {
type = types.bool; type = types.bool;

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }: {
lib,
config,
pkgs,
...
}:
with lib; with lib;
{ {
options.development.embedded.enableTools = mkOption { options.development.embedded.enableTools = mkOption {

View file

@ -1,9 +1,12 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
{ {
options.enableFishShell = mkOption { options.enableFishShell = mkOption { type = types.bool; };
type = types.bool;
};
config.programs.fish = mkIf config.enableFishShell { config.programs.fish = mkIf config.enableFishShell {
enable = true; enable = true;

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; with lib;
{ {
options.enableGPGKeyring = mkOption { options.enableGPGKeyring = mkOption {

View file

@ -1,7 +1,5 @@
{ lib, config, ... }: { lib, config, ... }:
with lib; with lib;
{ {
programs.helix.settings = mkIf config.programs.helix.enable { programs.helix.settings = mkIf config.programs.helix.enable { theme = "nord"; };
theme = "nord";
};
} }

View file

@ -1,4 +1,9 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
with lib; with lib;
let let
mailAccountModule = types.submodule { mailAccountModule = types.submodule {
@ -7,21 +12,13 @@ let
default = false; default = false;
}; };
mailAddress = mkOption { mailAddress = mkOption { type = types.str; };
type = types.str;
};
mailPasswdEval = mkOption { mailPasswdEval = mkOption { type = types.str; };
type = types.str;
};
imapHost = mkOption { imapHost = mkOption { type = types.str; };
type = types.str;
};
smtpHost = mkOption { smtpHost = mkOption { type = types.str; };
type = types.str;
};
}; };
defaultExtraMailboxes = [ defaultExtraMailboxes = [
@ -50,39 +47,35 @@ in
config = mkIf (!hasNoAddress) { config = mkIf (!hasNoAddress) {
accounts.email.accounts = builtins.mapAttrs accounts.email.accounts = builtins.mapAttrs (name: value: {
(name: value: { primary = value.isPrimary;
primary = value.isPrimary; address = value.mailAddress;
address = value.mailAddress; userName = value.mailAddress;
userName = value.mailAddress; realName = "Victor Mignot";
realName = "Victor Mignot"; imap.host = value.imapHost;
imap.host = value.imapHost; smtpHost = value.smtpHost;
smtpHost = value.smtpHost; passwordCommand = value.mailPasswdEval;
passwordCommand = value.mailPasswdEval; inherit signature;
inherit signature;
mbsync = { mbsync = {
enable = true; enable = true;
create = "both"; create = "both";
expunge = "both"; expunge = "both";
patterns = [ "*" ]; patterns = [ "*" ];
subFolders = "Verbatim"; subFolders = "Verbatim";
}; };
msmtp.enable = true; msmtp.enable = true;
neomutt = { neomutt = {
enable = true; enable = true;
mailboxName = "${name}/Inbox"; mailboxName = "${name}/Inbox";
extraMailboxes = map extraMailboxes = map (mb: {
(mb: { mailbox = mb;
mailbox = mb; name = "${name}/${mb}";
name = "${name}/${mb}"; }) defaultExtraMailboxes;
}) };
defaultExtraMailboxes; }) config.communication.mailAccounts;
};
})
config.communication.mailAccounts;
services.mbsync.enable = true; services.mbsync.enable = true;
programs.mbsync.enable = true; programs.mbsync.enable = true;

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }: {
lib,
config,
pkgs,
...
}:
with lib; with lib;
{ {
options.desktop.enableNeovim = mkOption { options.desktop.enableNeovim = mkOption {
@ -61,7 +66,7 @@ with lib;
vim.keymap.set('n', '<C-t>', ':NERDTreeToggle<CR>', { desc = 'Toogle NERDTree pane' }) vim.keymap.set('n', '<C-t>', ':NERDTreeToggle<CR>', { desc = 'Toogle NERDTree pane' })
vim.keymap.set('n', '<C-s>', ':NERDTreeFind<CR>', { desc = 'Search file in NERDTree' }) vim.keymap.set('n', '<C-s>', ':NERDTreeFind<CR>', { desc = 'Search file in NERDTree' })
vim.keymap.set('n', '<C-f>', ':NERDTreeFocus<CR>', { desc = 'Focus on the NERDTreePane' }) vim.keymap.set('n', '<C-f>', ':NERDTreeFocus<CR>', { desc = 'Focus on the NERDTreePane' })
-- Keep the same NERDTree pane on each window -- Keep the same NERDTree pane on each window
vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*", command = "if getcmdwintype() == \'\' | silent NERDTreeMirror | endif" }) vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*", command = "if getcmdwintype() == \'\' | silent NERDTreeMirror | endif" })
''; '';
@ -101,7 +106,7 @@ with lib;
type = "lua"; type = "lua";
config = '' config = ''
local telescope = require('telescope.builtin') local telescope = require('telescope.builtin')
vim.keymap.set('n', 'ff', telescope.find_files, { desc = 'Search file with Telescope' }) vim.keymap.set('n', 'ff', telescope.find_files, { desc = 'Search file with Telescope' })
vim.keymap.set('n', 'fg', telescope.live_grep, { desc = 'Live grep with Telescope'}) vim.keymap.set('n', 'fg', telescope.live_grep, { desc = 'Live grep with Telescope'})
vim.keymap.set('n', 'fb', telescope.buffers, { desc = 'Search amongst current buffers (opened files)'}) vim.keymap.set('n', 'fb', telescope.buffers, { desc = 'Search amongst current buffers (opened files)'})
@ -131,7 +136,7 @@ with lib;
config = '' config = ''
let g:vimtex_view_method = 'zathura' let g:vimtex_view_method = 'zathura'
let g:vimtex_compiler_method = 'tectonic' let g:vimtex_compiler_method = 'tectonic'
let g:vimtex_compiler_tectonic = { let g:vimtex_compiler_tectonic = {
\'out_dir' : ' ', \'out_dir' : ' ',
\'hooks' : [], \'hooks' : [],

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }: {
lib,
config,
pkgs,
...
}:
with lib; with lib;
let let
tmuxExtraConfig = '' tmuxExtraConfig = ''