Compare commits

...

3 commits

Author SHA1 Message Date
Victor Mignot d15039bc13
Update flake.lock 2024-08-01 21:58:06 +02:00
Victor Mignot a09c389ddf
Add dev env 2024-08-01 21:56:09 +02:00
Victor Mignot 0f0409a489
Rework modules 2024-08-01 21:40:51 +02:00
37 changed files with 516 additions and 687 deletions

View file

@ -53,7 +53,7 @@
};
};
machineUsers = {
my.users = {
dala = {
description = "Dala";
groups = [ "wheel" ];

View file

@ -32,7 +32,7 @@
swapDevices = [ { device = "/dev/disk/by-uuid/a7c628ab-c5cb-4094-89d0-19b153fbead4"; } ];
hwAccelerationGPU = "intel";
my.hardware.gpu = "intel";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -15,11 +15,7 @@
deployment.targetHost = null;
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
useLatestKernel = true;
isProfessional = false;
allowUnfreePackages = true;
keymap = "us";
console.keyMap = "us";
sops = {
gnupg.sshKeyPaths = [ ];
@ -31,7 +27,7 @@
secrets.wg0_private = { };
};
machineUsers = {
my.users = {
dala = {
description = "Dala";
groups = [
@ -45,10 +41,10 @@
uid = 1000;
shell = pkgs.fish;
enableHomeManagerProfile = true;
homeManagerConfig = {
hmConfig = {
programs.helix.enable = true;
desktop.monitors = [
my.communications.matrix-client.enable = true;
my.desktop.sway.monitors = [
{
name = "Chimei Innolux Corporation 0x14C9 Unknown";
resolution = "1920x1080@60.008Hz";
@ -57,7 +53,7 @@
}
];
nixpkgs.config.allowUnfree = true;
development.embedded.enableTools = true;
my.development.embedded-tools.enable = true;
};
};
};

View file

@ -13,7 +13,7 @@
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
hwAccelerationGPU = "intel";
my.hardware.gpu = "intel";
boot.initrd.luks.devices = {
crypted-nixos = {

View file

@ -9,15 +9,9 @@
imports = [ ./hardware.nix ];
# Meta
isProfessional = false;
deployment.targetHost = null;
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
# Linux kernel
useLatestKernel = true;
# Custom udev rules for Nucleo's stlink interface
services.udev.extraRules = ''
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b",MODE="660",GROUP="dialout",TAG+="uaccess"
@ -25,15 +19,7 @@
'';
# Nix
allowUnfreePackages = true;
# Hardware acceleration
hwAccelerationGPU = "nvidia";
# Enable Docker
enableDocker = true;
keymap = "fr";
nixpkgs.config.allowUnfree = true;
# System secrets
sops = {
@ -66,7 +52,7 @@
};
# User config
machineUsers = {
my.users = {
dala = {
description = "Dala";
groups = [
@ -82,10 +68,9 @@
];
uid = 1000;
shell = pkgs.fish;
enableHomeManagerProfile = true;
homeManagerConfig = {
hmConfig = {
programs.helix.enable = true;
desktop.monitors = [
my.desktop.sway.monitors = [
{
name = "Iiyama North America PL2470H 0x0000047B";
resolution = "1920x1080@165.003Hz";
@ -101,7 +86,7 @@
];
nixpkgs.config.allowUnfree = true;
development.embedded.enableTools = true;
my.development.embedded-tools.enable = true;
};
};
};

View file

@ -41,5 +41,6 @@
swapDevices = [ { device = "/dev/disk/by-uuid/5fe5e76b-df3d-43ce-abf9-d2b63078df09"; } ];
my.hardware.gpu = "nvidia";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -10,11 +10,11 @@
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
boot.loader.grub.enable = false;
enableSystemdBoot = false;
my.systemd-boot.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
boot.loader.generic-extlinux-compatible.enable = true;
machineUsers = {
my.users = {
dala = {
description = "Dala";
groups = [ "wheel" ];

View file

@ -204,11 +204,11 @@
]
},
"locked": {
"lastModified": 1722321190,
"narHash": "sha256-WeVWVRqkgrbLzmk6FfJoloJ7Xe7HWD27Pv950IUG2kI=",
"lastModified": 1722462338,
"narHash": "sha256-ss0G8t8RJVDewA3MyqgAlV951cWRK6EtVhVKEZ7J5LU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "4fcd54df7cbb1d79cbe81209909ee8514d6b17a4",
"rev": "6e090576c4824b16e8759ebca3958c5b09659ee8",
"type": "github"
},
"original": {
@ -346,11 +346,11 @@
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1722221733,
"narHash": "sha256-sga9SrrPb+pQJxG1ttJfMPheZvDOxApFfwXCFO0H9xw=",
"lastModified": 1722372011,
"narHash": "sha256-B2xRiC3NEJy/82ugtareBkRqEkPGpMyjaLxaR8LBxNs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "12bf09802d77264e441f48e25459c10c93eada2e",
"rev": "cf05eeada35e122770c5c14add958790fcfcbef5",
"type": "github"
},
"original": {
@ -378,11 +378,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1722185531,
"narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=",
"lastModified": 1722421184,
"narHash": "sha256-/DJBI6trCeVnasdjUo9pbnodCLZcFqnVZiLUfqLH4jA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d",
"rev": "9f918d616c5321ad374ae6cb5ea89c9e04bf3e58",
"type": "github"
},
"original": {

View file

@ -51,6 +51,7 @@
}:
let
machines = import ./machines.nix;
my = import ./modules;
lixModules = {
stable = lix-module-stable;
unstable = lix-module-unstable;
@ -66,13 +67,7 @@
imports = [
lixModules.${config.nixpkgs}.nixosModules.default
./configurations/${name}
(if (config.type == "workstation") then ./modules/workstation else ./modules/server)
(
if (config.type == "workstation" && config.enableHomeManager) then
home-manager.nixosModules.home-manager
else
{ }
)
(if config.enableHomeManager then home-manager.nixosModules.home-manager else { })
(if (config.system == "x86_64-linux") then lanzaboote.nixosModules.lanzaboote else { })
];
@ -111,15 +106,45 @@
defaults =
{ ... }:
{
imports = [ sops-nix.nixosModules.sops ];
imports = [
sops-nix.nixosModules.sops
my.modules
];
};
} // machinesNodes;
formatter = builtins.listToAttrs (
map (system: {
map (
system:
let
pkgs = import nixpkgsVersions.unstable { inherit system; };
in
{
name = system;
value = nixpkgsVersions.unstable.legacyPackages.${system}.nixfmt-rfc-style;
}) flake-utils.lib.defaultSystems
value = pkgs.nixfmt-rfc-style;
}
) flake-utils.lib.defaultSystems
);
devShells = builtins.listToAttrs (
map (
system:
let
pkgs = import nixpkgsVersions.unstable { inherit system; };
in
{
name = system;
value = pkgs.mkShell {
name = "Nix development environment";
packages = with pkgs; [
colmena
nixfmt-rfc-style
nil
];
};
}
) flake-utils.lib.defaultSystems
);
};
}

View file

@ -1,6 +1,5 @@
{
london = {
type = "workstation";
nixpkgs = "unstable";
system = "x86_64-linux";
enableHomeManager = true;
@ -9,7 +8,6 @@
};
camelot = {
type = "server";
nixpkgs = "stable";
system = "x86_64-linux";
enableHomeManager = false;
@ -18,7 +16,6 @@
};
fuyuki = {
type = "workstation";
nixpkgs = "unstable";
system = "x86_64-linux";
enableHomeManager = true;
@ -27,7 +24,6 @@
};
okeanos = {
type = "server";
nixpkgs = "stable";
system = "aarch64-linux";
enableHomeManager = false;

View file

@ -7,7 +7,7 @@
}:
with lib;
{
options.enableSystemdBoot = mkOption {
options.my.systemd-boot.enable = mkOption {
type = types.bool;
default = true;
example = false;
@ -17,13 +17,13 @@ with lib;
'';
};
config.environment.systemPackages = lib.mkIf config.enableSystemdBoot [ pkgs.sbctl ];
config.environment.systemPackages = lib.mkIf config.my.systemd-boot.enable [ pkgs.sbctl ];
config.boot =
{
loader.systemd-boot.enable = false;
}
// (
if config.enableSystemdBoot then
if config.my.systemd-boot.enable then
{
lanzaboote = {
enable = true;

View file

@ -17,34 +17,12 @@ with lib;
(modulesPath + "/installer/scan/not-detected.nix")
];
options.isProfessional = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Whether or not this machine is used for professionnal purposes.
'';
};
options.enableDocker = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Whether or not to enable the docker stack.
'';
};
config = {
virtualisation.docker.enable = config.enableDocker;
# 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
builtins.attrValues config.my.users
);
# We always want to disable the X server as only workstation use windows manager
# and they always use wayland.
services.xserver.enable = false;
};
}

View file

@ -6,11 +6,12 @@
...
}:
let
gpu = config.my.hardware.gpu;
hwAccelerationOptionPath = if (machineProps == "unstable") then "graphics" else "opengl";
in
with lib;
{
options.hwAccelerationGPU = mkOption {
options.my.hardware.gpu = mkOption {
type = types.nullOr (
types.enum [
"nvidia"
@ -26,14 +27,14 @@ with lib;
};
config = {
boot.kernelParams = mkIf (config.hwAccelerationGPU == "intel") [ "i915.enable_guc=2" ];
boot.kernelParams = mkIf (gpu == "intel") [ "i915.enable_guc=2" ];
# Small hack as this option path changes between 24.05 and unstable
hardware.${hwAccelerationOptionPath} = {
enable = config.hwAccelerationGPU != null;
enable = gpu != null;
extraPackages = with pkgs; [
(mkIf (config.hwAccelerationGPU == "intel") intel-media-driver)
(mkIf (config.hwAccelerationGPU == "intel") intel-compute-runtime)
(mkIf (gpu == "intel") intel-media-driver)
(mkIf (gpu == "intel") intel-compute-runtime)
];
};
};

View file

@ -1,58 +1,7 @@
{ lib, ... }:
{
lib,
config,
pkgs,
...
}:
with lib;
{
options.useLatestKernel = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Whether or not to use the latest Linux kernel version.
'';
};
options.consoleFont = mkOption {
type = types.str;
default = "Lat2-Terminus16";
description = ''
The font to use in the Linux console.
'';
};
options.timeZone = mkOption {
type = types.str;
default = "Europe/Paris";
description = ''
The system time zone.
'';
};
options.locale = mkOption {
type = types.str;
default = "en_US.utf8";
description = ''
The system locale.
'';
};
options.keymap = mkOption {
type = types.str;
default = "fr";
example = "fr";
description = ''
The keyboard map used.
'';
};
config = {
boot.kernelPackages = mkIf config.useLatestKernel pkgs.linuxPackages_latest;
time.timeZone = config.timeZone;
console.font = config.consoleFont;
console.keyMap = config.keymap;
i18n.defaultLocale = config.locale;
};
console.keyMap = lib.mkDefault "fr";
time.timeZone = lib.mkDefault "Europe/Paris";
console.font = lib.mkDefault "Lat2-Terminus16";
i18n.defaultLocale = lib.mkDefault "en_US.utf8";
}

View file

@ -6,15 +6,6 @@
}:
with lib;
{
options.allowUnfreePackages = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Whether the system can use unfree derivations.
'';
};
config = {
nix = {
settings.sandbox = true;
@ -25,7 +16,5 @@ with lib;
experimental-features = nix-command flakes
'';
};
nixpkgs.config.allowUnfree = config.allowUnfreePackages;
};
}

View file

@ -11,17 +11,12 @@ let
shell = mkOption { type = types.package; };
enableHomeManagerProfile = mkOption {
type = types.bool;
default = false;
};
homeManagerConfig = mkOption { default = { }; };
hmConfig = mkOption { default = { }; };
};
};
in
{
options.machineUsers = mkOption { type = types.attrsOf userModule; };
options.my.users = mkOption { type = types.attrsOf userModule; };
config = {
users.users = builtins.mapAttrs (name: value: {
@ -31,6 +26,6 @@ in
extraGroups = value.groups;
shell = value.shell;
uid = mkIf (value.uid != null) value.uid;
}) config.machineUsers;
}) config.my.users;
};
}

11
modules/default.nix Normal file
View file

@ -0,0 +1,11 @@
{
modules =
{ ... }:
{
imports = [
./common
./server
./workstation
];
};
}

View file

@ -1,34 +0,0 @@
{ lib, extraInfo, ... }:
with lib;
let
host = extraInfo.woodpeckerURI;
in
{
options.server.build.enable = mkOption {
type = types.bool;
default = false;
example = false;
description = ''
Enable the build server stack.
'';
};
config = lib.mkIf config.server.build.enable {
services.nginx.virtualHosts."${host}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:3007";
};
};
woodpecker-server = {
enable = true;
environment = {
WOODPECKER_HOST = "https://${domain}";
WOODPECKER_SERVER_ADDR = ":3007";
WOODPECKER_OPEN = "true";
};
};
};
}

View file

@ -1,7 +1,7 @@
{ lib, config, ... }:
with lib;
{
options.enableBluetooth = mkOption {
options.my.hardware.bluetooth.enable = mkOption {
type = types.bool;
default = true;
example = false;
@ -10,7 +10,7 @@ with lib;
'';
};
config = mkIf config.enableBluetooth {
config = mkIf config.my.hardware.bluetooth.enable {
hardware.bluetooth = {
enable = true;
};

View file

@ -16,43 +16,8 @@ with lib;
./bluetooth.nix
];
options.enableHomeManager = mkOption {
type = types.bool;
default = true;
example = false;
description = ''
Whether to install and use home-manager on this machine.
'';
};
config = {
enableHomeManager = machineProps.enableHomeManager;
home-manager.useGlobalPkgs = mkIf config.enableHomeManager true;
home-manager.useUserPackages = mkIf config.enableHomeManager true;
home-manager.sharedModules = mkIf config.enableHomeManager [
./home-manager
sopsHmModule
];
home-manager.extraSpecialArgs = {
keymap = config.keymap;
nvidiaGPU = (config.hwAccelerationGPU == "nvidia");
};
home-manager.users = builtins.mapAttrs (
name: value:
mkIf value.enableHomeManagerProfile (
config =
{
home.username = name;
home.homeDirectory = "/home/${name}";
home.stateVersion = machineProps.stateVersion;
programs.home-manager.enable = true;
enableFishShell = value.shell == pkgs.fish;
isProfessional = config.isProfessional;
}
// value.homeManagerConfig
)
) config.machineUsers;
programs.dconf.enable = true;
security.polkit.enable = true;
services.dbus.enable = true;
@ -60,5 +25,33 @@ with lib;
fonts.fontconfig.enable = true;
services.gnome.gnome-keyring.enable = true;
}
// (
if machineProps.enableHomeManager then
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.sharedModules = [
./home-manager
sopsHmModule
];
home-manager.extraSpecialArgs = {
keymap = config.console.keyMap;
isNvidiaGpu = (config.my.hardware.gpu == "nvidia");
};
home-manager.users = builtins.mapAttrs (
name: value:
{
home.username = name;
home.homeDirectory = "/home/${name}";
home.stateVersion = machineProps.stateVersion;
programs.home-manager.enable = true;
programs.fish.enable = value.shell == pkgs.fish;
}
// value.hmConfig
) config.my.users;
}
else
{ }
);
}

View file

@ -2,21 +2,26 @@
config,
lib,
pkgs,
machineProps,
...
}:
with lib;
let
usersHasSway = builtins.any (user: config.home-manager.users.${user}.desktop.enableSwayStack) (
builtins.attrNames config.machineUsers
);
anySwayUser =
if machineProps.enableHomeManager then
builtins.any (user: config.home-manager.users.${user}.my.desktop.sway.enable) (
builtins.attrNames config.my.users
)
else
false;
in
{
programs.sway = mkIf usersHasSway {
programs.sway = mkIf anySwayUser {
enable = true;
wrapperFeatures.gtk = true;
};
xdg.portal = mkIf usersHasSway {
xdg.portal = mkIf anySwayUser {
enable = true;
xdgOpenUsePortal = true;
wlr.enable = true;

View file

@ -4,38 +4,41 @@
config,
...
}:
let
commConfig = config.my.communications;
in
with lib;
{
options = {
communication.discord.enable = mkOption {
options.my.communications = {
discord.enable = mkOption {
type = types.bool;
default = !config.isProfessional;
example = true;
default = false;
};
communication.slack.enable = mkOption {
slack.enable = mkOption {
type = types.bool;
default = config.isProfessional;
example = true;
};
communication.weechat.enable = mkOption {
type = types.bool;
default = true;
default = false;
example = false;
};
communication.matrix.enable = mkOption {
irc.enable = mkOption {
type = types.bool;
default = !config.isProfessional;
default = false;
example = false;
};
matrix-client.enable = mkOption {
type = types.bool;
default = false;
example = false;
};
};
config.home.packages = with pkgs; [
(mkIf config.communication.discord.enable (discord.override { nss = nss_latest; }))
(mkIf config.communication.slack.enable slack)
(mkIf config.communication.weechat.enable weechat)
(mkIf config.communication.matrix.enable element)
(mkIf commConfig.discord.enable (discord.override { nss = nss_latest; }))
(mkIf commConfig.slack.enable slack)
(mkIf commConfig.irc.enable weechat)
(mkIf commConfig.matrix-client.enable element)
];
}

View file

@ -24,15 +24,12 @@ in
./desktop
./development
./fish.nix
./termux.nix
./gpg.nix
./communication.nix
./mail.nix
./helix.nix
];
options.isProfessional = mkOption { type = types.bool; };
config = {
fonts.fontconfig.enable = true;

View file

@ -1,14 +1,7 @@
{ config, lib, ... }:
with lib;
let
tmuxFix = {
env = {
TERM = "xterm-256color";
};
};
in
{
programs.alacritty = mkIf config.desktop.enableSwayStack {
programs.alacritty = {
enable = true;
settings = {
font = {
@ -83,6 +76,6 @@ in
window = {
opacity = 1;
};
} // tmuxFix;
};
};
}

View file

@ -1,77 +1,6 @@
{
lib,
config,
pkgs,
nvidiaGPU,
...
}:
with lib;
let
desktopPackages =
with pkgs;
[
grim
slurp
wl-clipboard
clipman
wf-recorder
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
qt5ct
libsForQt5.qtstyleplugin-kvantum
font-awesome
nordzy-cursor-theme
jetbrains-mono
xdg-utils
libnotify
adwaita-icon-theme
]
++ (
if nvidiaGPU then
[
vulkan-validation-layers
vulkan-headers
vulkan-caps-viewer
vulkan-extension-layer
vulkan-tools
]
else
[ ]
);
in
{
imports = [
./sway.nix
./sway
./alacritty.nix
./swaylock.nix
./waybar.nix
./wofi.nix
./mako.nix
];
options.desktop.enableSwayStack = mkOption {
type = types.bool;
default = true;
};
config = mkIf config.desktop.enableSwayStack {
home.packages = desktopPackages;
dconf = {
enable = true;
settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
};
# Theming GTK
gtk = {
enable = true;
theme = {
name = "Nordic-darker";
package = pkgs.nordic;
};
cursorTheme = {
name = "Nordzy-cursors";
package = pkgs.nordzy-cursor-theme;
};
};
};
}

View file

@ -1,257 +0,0 @@
{
config,
pkgs,
lib,
keymap,
nvidiaGPU,
...
}:
with lib;
let
isQwerty = keymap == "us";
wlrRendererLine = if nvidiaGPU then "export WLR_RENDERER=vulkan" else "";
gnomeSchema = "org.gnome.desktop.interface";
monitorModule = types.submodule {
options = {
name = mkOption { type = types.str; };
resolution = mkOption { type = types.str; };
position = mkOption { type = types.str; };
defaultWorkspace = mkOption { type = types.int; };
};
};
in
{
options = {
desktop.monitors = mkOption { type = types.listOf monitorModule; };
};
config.wayland.windowManager.sway = mkIf config.desktop.enableSwayStack {
enable = true;
systemd.enable = false;
checkConfig = false;
config = rec {
modifier = "Mod4";
left = "left";
right = "right";
up = "up";
down = "down";
terminal = "${pkgs.alacritty}/bin/alacritty";
menu = "${pkgs.wofi}/bin/wofi --show drun,run";
fonts = {
names = [ "pango:JetBrainsMono Nerd Font Mono" ];
size = 11.0;
};
input = {
"*" = {
xkb_layout = keymap;
xkb_options = mkIf isQwerty "compose:ralt";
};
"12951:6519:ZSA_Technology_Labs_Voyager" = {
xkb_layout = "us";
xkb_options = "compose:ralt";
};
"Synaptics TM3276-022" = {
dwt = "enabled";
tap = "enabled";
natural_scroll = "enabled";
middle_emulation = "enabled";
};
};
seat = {
"seat0" = {
"xcursor_theme" = "Nordzy-cursors";
};
};
output =
builtins.listToAttrs (
builtins.map (monitor: {
name = monitor.name;
value = {
resolution = monitor.resolution;
position = monitor.position;
};
}) config.desktop.monitors
)
// {
"*".bg = "/home/dala/Perso/wallpapers/tanuki.jpg fill";
};
workspaceOutputAssign = map (monitor: {
output = monitor.name;
workspace = builtins.toString monitor.defaultWorkspace;
}) config.desktop.monitors;
startup = [
{
command = ''
${pkgs.swayidle}/bin/swayidle -w \
timeout 1200 '${pkgs.swaylock}/bin/swaylock -f' \
timeout 1800 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
before-sleep '${pkgs.swaylock}/bin/swaylock -f'
'';
}
{ command = "${pkgs.nextcloud-client}/bin/nextcloud --background"; }
{ command = "${pkgs.keepassxc}/bin/keepassxc"; }
{
command = ''
${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist
'';
}
{
command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} gtk-theme 'Nordic'";
always = true;
}
{
command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} cursor-theme 'Nordzy-cursors'";
always = true;
}
{
command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} font-name 'JetBrainsMono Nerd Font Mono'";
always = true;
}
];
modes = {
resize = {
"Left" = "resize shrink width 10px";
"Down" = "resize grow height 10px";
"Up" = "resize shrink height 10px";
"Right" = "resize grow width 10px";
"Return" = "mode default";
"Escape" = "mode default";
};
};
gaps = {
inner = 5;
smartGaps = true;
};
floating = {
modifier = "${modifier} normal";
};
bars = [ { command = "${pkgs.waybar}/bin/waybar"; } ];
keybindings = {
"${modifier}+Return" = "exec ${terminal}";
"${modifier}+Shift+q" = "kill";
"${modifier}+d" = "exec ${menu}";
"${modifier}+Shift+r" = "reload";
"${modifier}+Shift+e" = "exec swaymsg exit";
"${modifier}+Shift+l" = "exec swaylock -f";
"${modifier}+Left" = "focus left";
"${modifier}+Down" = "focus down";
"${modifier}+Up" = "focus up";
"${modifier}+Right" = "focus right";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Right" = "move right";
"${modifier}+1" = "workspace 1";
"${modifier}+2" = "workspace 2";
"${modifier}+3" = "workspace 3";
"${modifier}+4" = "workspace 4";
"${modifier}+5" = "workspace 5";
"${modifier}+6" = "workspace 6";
"${modifier}+7" = "workspace 7";
"${modifier}+8" = "workspace 8";
"${modifier}+9" = "workspace 9";
"${modifier}+0" = "workspace 10";
"${modifier}+ampersand" = "workspace 1";
"${modifier}+eacute" = "workspace 2";
"${modifier}+quotedbl" = "workspace 3";
"${modifier}+apostrophe" = "workspace 4";
"${modifier}+parenleft" = "workspace 5";
"${modifier}+minus" = "workspace 6";
"${modifier}+egrave" = "workspace 7";
"${modifier}+underscore" = "workspace 8";
"${modifier}+ccedilla" = "workspace 9";
"${modifier}+agrave" = "workspace 10";
"${modifier}+Shift+1" = "move container to workspace 1";
"${modifier}+Shift+2" = "move container to workspace 2";
"${modifier}+Shift+3" = "move container to workspace 3";
"${modifier}+Shift+4" = "move container to workspace 4";
"${modifier}+Shift+5" = "move container to workspace 5";
"${modifier}+Shift+6" = "move container to workspace 6";
"${modifier}+Shift+7" = "move container to workspace 7";
"${modifier}+Shift+8" = "move container to workspace 8";
"${modifier}+Shift+9" = "move container to workspace 9";
"${modifier}+Shift+0" = "move container to workspace 10";
"${modifier}+Shift+ampersand" = "move container to workspace 1";
"${modifier}+Shift+eacute" = "move container to workspace 2";
"${modifier}+Shift+quotedbl" = "move container to workspace 3";
"${modifier}+Shift+apostrophe" = "move container to workspace 4";
"${modifier}+Shift+parenleft" = "move container to workspace 5";
"${modifier}+Shift+minus" = "move container to workspace 6";
"${modifier}+Shift+egrave" = "move container to workspace 7";
"${modifier}+Shift+underscore" = "move container to workspace 8";
"${modifier}+Shift+ccedilla" = "move container to workspace 9";
"${modifier}+Shift+agrave" = "move container to workspace 10";
"${modifier}+h" = "splith";
"${modifier}+v" = "splitv";
"${modifier}+s" = "layout stacking";
"${modifier}+w" = "layout tabbed";
"${modifier}+e" = "layout toggle split";
"${modifier}+f" = "fullscreen";
"${modifier}+Shift+space" = "floating toggle";
"${modifier}+space" = "focus mode_toggle";
"${modifier}+a" = "focus parent";
"${modifier}+Shift+parenright" = "move scratchpad";
"${modifier}+parenright" = "scratchpad show";
"${modifier}+r" = "mode resize";
"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
"XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute 0 toggle"; # mute sound
"XF86MonBrightnessUp" = "exec --no-startup-id light -A 10";
"XF86MonBrightnessDown" = "exec --no-startup-id light -U 10";
"Control+XF86AudioMute" = "exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"Print" = "exec grim -g \"$(${pkgs.slurp}/bin/slurp)\" -t png - | wl-copy --type image/png";
};
};
extraConfig = ''
for_window [class=".*"] inhibit_idle fullscreen
for_window [app_id=".*"] inhibit_idle fullscreen
default_border pixel
'';
xwayland = false;
extraSessionCommands = ''
${wlrRendererLine}
export WLR_NO_HARDWARE_CURSORS=1
export XDG_CURRENT_DESKTOP=sway
export _JAVA_AWT_WM_NONREPARENTING=1
export NIXOS_OZONE_WL=1
export QT_QPA_PLATFORM=wayland
export QT_QPA_PLATFORMTHEME=qt5ct
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export MOZ_ENABLE_WAYLAND=1
export SDL_VIDEODRIVER=wayland
'';
};
}

View file

@ -0,0 +1,321 @@
{
config,
pkgs,
lib,
keymap,
isNvidiaGpu,
...
}:
with lib;
let
isQwerty = keymap == "us";
wlrRendererLine = if isNvidiaGpu then "export WLR_RENDERER=vulkan" else "";
gnomeSchema = "org.gnome.desktop.interface";
monitorModule = types.submodule {
options = {
name = mkOption { type = types.str; };
resolution = mkOption { type = types.str; };
position = mkOption { type = types.str; };
defaultWorkspace = mkOption { type = types.int; };
};
};
desktopPackages =
with pkgs;
[
grim
slurp
wl-clipboard
clipman
wf-recorder
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
qt5ct
libsForQt5.qtstyleplugin-kvantum
font-awesome
nordzy-cursor-theme
jetbrains-mono
xdg-utils
libnotify
adwaita-icon-theme
]
++ (
if isNvidiaGpu then
[
vulkan-validation-layers
vulkan-headers
vulkan-caps-viewer
vulkan-extension-layer
vulkan-tools
]
else
[ ]
);
in
{
imports = [
./swaylock.nix
./waybar.nix
./wofi.nix
./mako.nix
];
options = {
my.desktop.sway = {
enable = mkOption {
type = types.bool;
default = true;
};
monitors = mkOption { type = types.listOf monitorModule; };
};
};
config = mkIf config.my.desktop.sway.enable {
home.packages = desktopPackages;
dconf = {
enable = true;
settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
};
# Theming GTK
gtk = {
enable = true;
theme = {
name = "Nordic-darker";
package = pkgs.nordic;
};
cursorTheme = {
name = "Nordzy-cursors";
package = pkgs.nordzy-cursor-theme;
};
};
wayland.windowManager.sway = {
enable = true;
systemd.enable = false;
checkConfig = false;
config = rec {
modifier = "Mod4";
left = "left";
right = "right";
up = "up";
down = "down";
terminal = "${pkgs.alacritty}/bin/alacritty";
menu = "${pkgs.wofi}/bin/wofi --show drun,run";
fonts = {
names = [ "pango:JetBrainsMono Nerd Font Mono" ];
size = 11.0;
};
input = {
"*" = {
xkb_layout = keymap;
xkb_options = mkIf isQwerty "compose:ralt";
};
"12951:6519:ZSA_Technology_Labs_Voyager" = {
xkb_layout = "us";
xkb_options = "compose:ralt";
};
"Synaptics TM3276-022" = {
dwt = "enabled";
tap = "enabled";
natural_scroll = "enabled";
middle_emulation = "enabled";
};
};
seat = {
"seat0" = {
"xcursor_theme" = "Nordzy-cursors";
};
};
output =
builtins.listToAttrs (
builtins.map (monitor: {
name = monitor.name;
value = {
resolution = monitor.resolution;
position = monitor.position;
};
}) config.my.desktop.sway.monitors
)
// {
"*".bg = "/home/dala/Perso/wallpapers/tanuki.jpg fill";
};
workspaceOutputAssign = map (monitor: {
output = monitor.name;
workspace = builtins.toString monitor.defaultWorkspace;
}) config.my.desktop.sway.monitors;
startup = [
{
command = ''
${pkgs.swayidle}/bin/swayidle -w \
timeout 1200 '${pkgs.swaylock}/bin/swaylock -f' \
timeout 1800 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
before-sleep '${pkgs.swaylock}/bin/swaylock -f'
'';
}
{ command = "${pkgs.nextcloud-client}/bin/nextcloud --background"; }
{ command = "${pkgs.keepassxc}/bin/keepassxc"; }
{
command = ''
${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist
'';
}
{
command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} gtk-theme 'Nordic'";
always = true;
}
{
command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} cursor-theme 'Nordzy-cursors'";
always = true;
}
{
command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} font-name 'JetBrainsMono Nerd Font Mono'";
always = true;
}
];
modes = {
resize = {
"Left" = "resize shrink width 10px";
"Down" = "resize grow height 10px";
"Up" = "resize shrink height 10px";
"Right" = "resize grow width 10px";
"Return" = "mode default";
"Escape" = "mode default";
};
};
gaps = {
inner = 5;
smartGaps = true;
};
floating = {
modifier = "${modifier} normal";
};
bars = [ { command = "${pkgs.waybar}/bin/waybar"; } ];
keybindings = {
"${modifier}+Return" = "exec ${terminal}";
"${modifier}+Shift+q" = "kill";
"${modifier}+d" = "exec ${menu}";
"${modifier}+Shift+r" = "reload";
"${modifier}+Shift+e" = "exec swaymsg exit";
"${modifier}+Shift+l" = "exec swaylock -f";
"${modifier}+Left" = "focus left";
"${modifier}+Down" = "focus down";
"${modifier}+Up" = "focus up";
"${modifier}+Right" = "focus right";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Right" = "move right";
"${modifier}+1" = "workspace 1";
"${modifier}+2" = "workspace 2";
"${modifier}+3" = "workspace 3";
"${modifier}+4" = "workspace 4";
"${modifier}+5" = "workspace 5";
"${modifier}+6" = "workspace 6";
"${modifier}+7" = "workspace 7";
"${modifier}+8" = "workspace 8";
"${modifier}+9" = "workspace 9";
"${modifier}+0" = "workspace 10";
"${modifier}+ampersand" = "workspace 1";
"${modifier}+eacute" = "workspace 2";
"${modifier}+quotedbl" = "workspace 3";
"${modifier}+apostrophe" = "workspace 4";
"${modifier}+parenleft" = "workspace 5";
"${modifier}+minus" = "workspace 6";
"${modifier}+egrave" = "workspace 7";
"${modifier}+underscore" = "workspace 8";
"${modifier}+ccedilla" = "workspace 9";
"${modifier}+agrave" = "workspace 10";
"${modifier}+Shift+1" = "move container to workspace 1";
"${modifier}+Shift+2" = "move container to workspace 2";
"${modifier}+Shift+3" = "move container to workspace 3";
"${modifier}+Shift+4" = "move container to workspace 4";
"${modifier}+Shift+5" = "move container to workspace 5";
"${modifier}+Shift+6" = "move container to workspace 6";
"${modifier}+Shift+7" = "move container to workspace 7";
"${modifier}+Shift+8" = "move container to workspace 8";
"${modifier}+Shift+9" = "move container to workspace 9";
"${modifier}+Shift+0" = "move container to workspace 10";
"${modifier}+Shift+ampersand" = "move container to workspace 1";
"${modifier}+Shift+eacute" = "move container to workspace 2";
"${modifier}+Shift+quotedbl" = "move container to workspace 3";
"${modifier}+Shift+apostrophe" = "move container to workspace 4";
"${modifier}+Shift+parenleft" = "move container to workspace 5";
"${modifier}+Shift+minus" = "move container to workspace 6";
"${modifier}+Shift+egrave" = "move container to workspace 7";
"${modifier}+Shift+underscore" = "move container to workspace 8";
"${modifier}+Shift+ccedilla" = "move container to workspace 9";
"${modifier}+Shift+agrave" = "move container to workspace 10";
"${modifier}+h" = "splith";
"${modifier}+v" = "splitv";
"${modifier}+s" = "layout stacking";
"${modifier}+w" = "layout tabbed";
"${modifier}+e" = "layout toggle split";
"${modifier}+f" = "fullscreen";
"${modifier}+Shift+space" = "floating toggle";
"${modifier}+space" = "focus mode_toggle";
"${modifier}+a" = "focus parent";
"${modifier}+Shift+parenright" = "move scratchpad";
"${modifier}+parenright" = "scratchpad show";
"${modifier}+r" = "mode resize";
"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
"XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute 0 toggle"; # mute sound
"XF86MonBrightnessUp" = "exec --no-startup-id light -A 10";
"XF86MonBrightnessDown" = "exec --no-startup-id light -U 10";
"Control+XF86AudioMute" = "exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"Print" = "exec grim -g \"$(${pkgs.slurp}/bin/slurp)\" -t png - | wl-copy --type image/png";
};
};
extraConfig = ''
for_window [class=".*"] inhibit_idle fullscreen
for_window [app_id=".*"] inhibit_idle fullscreen
default_border pixel
'';
xwayland = false;
extraSessionCommands = ''
${wlrRendererLine}
export WLR_NO_HARDWARE_CURSORS=1
export XDG_CURRENT_DESKTOP=sway
export _JAVA_AWT_WM_NONREPARENTING=1
export NIXOS_OZONE_WL=1
export QT_QPA_PLATFORM=wayland
export QT_QPA_PLATFORMTHEME=qt5ct
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export MOZ_ENABLE_WAYLAND=1
export SDL_VIDEODRIVER=wayland
'';
};
};
}

View file

@ -1,7 +1,7 @@
{ lib, config, ... }:
with lib;
{
services.mako = mkIf config.desktop.enableSwayStack {
services.mako = mkIf config.my.desktop.sway.enable {
enable = true;
layer = "overlay";

View file

@ -1,7 +1,7 @@
{ lib, config, ... }:
with lib;
{
programs.swaylock = mkIf config.desktop.enableSwayStack {
programs.swaylock = mkIf config.my.desktop.sway.enable {
enable = true;
settings = {

View file

@ -1,9 +1,8 @@
{ config, lib, ... }:
with lib;
{
programs.waybar = mkIf config.desktop.enableSwayStack {
programs.waybar = mkIf config.my.desktop.sway.enable {
enable = true;
#systemd.enable = false;
settings = [
{

View file

@ -6,7 +6,7 @@
}:
with lib;
{
programs.wofi = mkIf config.desktop.enableSwayStack {
programs.wofi = mkIf config.my.desktop.sway.enable {
enable = true;
settings = {

View file

@ -8,7 +8,7 @@ with lib;
{
imports = [ ./embedded.nix ];
options.development.enableGit = mkOption {
options.my.development.git.enable = mkOption {
type = types.bool;
default = true;
example = false;
@ -17,12 +17,12 @@ with lib;
'';
};
config.programs.git = mkIf config.development.enableGit {
config.programs.git = mkIf config.my.development.git.enable {
enable = true;
package = pkgs.gitAndTools.gitFull;
userName = "Victor Mignot";
userEmail = "dala@dalaran.fr";
signing = mkIf config.enableGPGKeyring {
signing = mkIf config.my.pgp.enable {
key = "BEAFED3D";
signByDefault = true;
};

View file

@ -6,7 +6,7 @@
}:
with lib;
{
options.development.embedded.enableTools = mkOption {
options.my.development.embedded-tools.enable = mkOption {
type = types.bool;
default = false;
example = true;
@ -15,7 +15,7 @@ with lib;
'';
};
options.development.embedded.toolsList = mkOption {
options.my.development.embedded-tools.packages = mkOption {
type = types.listOf types.package;
default = with pkgs; [
qemu
@ -23,5 +23,5 @@ with lib;
];
};
config.home.packages = lib.mkIf config.development.embedded.enableTools config.development.embedded.toolsList;
config.home.packages = lib.mkIf config.my.development.embedded-tools.enable config.my.development.embedded-tools.packages;
}

View file

@ -6,12 +6,19 @@
...
}:
with lib;
let
swayLaunchScript =
if config.my.desktop.sway.enable then
''
if [ -z $DISPLAY ] && [ "$(tty)" = /dev/tty1 ]
exec sway
end
''
else
"";
in
{
options.enableFishShell = mkOption { type = types.bool; };
config.programs.fish = mkIf config.enableFishShell {
enable = true;
config.programs.fish = mkIf config.programs.fish.enable {
plugins = [
{
name = "bobthefish";
@ -27,9 +34,7 @@ with lib;
shellInit = ''
set -g theme_color_scheme nord
if [ -z $DISPLAY ] && [ "$(tty)" = /dev/tty1 ]
exec sway
end
${swayLauncScript}
'';
};
}

View file

@ -6,7 +6,7 @@
}:
with lib;
{
options.enableGPGKeyring = mkOption {
options.my.pgp.enable = mkOption {
type = types.bool;
default = true;
example = false;
@ -15,7 +15,7 @@ with lib;
'';
};
config = mkIf config.enableGPGKeyring {
config = mkIf config.my.pgp.enable {
programs.gpg.enable = true;
services.gpg-agent = {

View file

@ -37,10 +37,10 @@ let
showSignature = "append";
};
hasNoAddress = config.communication.mailAccounts == null;
hasNoAddress = config.my.communications.mail.accounts == null;
in
{
options.communication.mailAccounts = mkOption {
options.my.communications.mail.accounts = mkOption {
type = types.nullOr (types.attrsOf mailAccountModule);
default = null;
};
@ -75,7 +75,7 @@ in
name = "${name}/${mb}";
}) defaultExtraMailboxes;
};
}) config.communication.mailAccounts;
}) config.my.communications.mail.accounts;
services.mbsync.enable = true;
programs.mbsync.enable = true;

View file

@ -1,51 +0,0 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
tmuxExtraConfig = ''
set -ag terminal-overrides ",xterm-256color:RGB"
'';
in
{
options.enableTermux = mkOption {
type = types.bool;
default = true;
example = false;
description = ''
Enable termux and the associated config.
'';
};
config.programs.tmux = mkIf config.enableTermux {
enable = true;
# Make windows count start to 1
baseIndex = 1;
# Use 24h clock
clock24 = true;
shell = if config.enableFishShell then "${pkgs.fish}/bin/fish" else "${pkgs.bash}/bin/bash";
keyMode = "vi";
tmuxp.enable = true;
terminal = "tmux-256color";
plugins = with pkgs.tmuxPlugins; [
{
plugin = nord;
extraConfig = ''
set -g @plugin "arcticicestudio/nord-tmux"
'';
}
];
extraConfig = tmuxExtraConfig;
};
}