Compare commits

..

No commits in common. "2a0466c00c84871da01e9efd2f28e108b5c7a882" and "a29770fd01b506950ba14255a392674b9b44ceb8" have entirely different histories.

141 changed files with 1137 additions and 1380 deletions

View File

@ -3,22 +3,20 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
devenv = {
url = "github:cachix/devenv";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-index-database = { nix-index-database = {
url = "github:nix-community/nix-index-database"; url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
devenv = {
url = "github:cachix/devenv";
inputs.nixpkgs.follows = "nixpkgs";
};
pumo-system-info = { pumo-system-info = {
url = "git+https://labs.phundrak.com/phundrak/pumo-system-info"; url = "git+https://labs.phundrak.com/phundrak/pumo-system-info";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -88,9 +86,10 @@
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs outputs; inherit inputs outputs;
home-conf = "minimal";
}; };
modules = [ modules = [
./users/phundrak/host/alys.nix ./users/phundrak/alys.nix
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
]; ];
}; };
@ -98,9 +97,10 @@
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs outputs; inherit inputs outputs;
home-conf = "fullHome";
}; };
modules = [ modules = [
./users/phundrak/host/marpa.nix ./users/phundrak/marpa.nix
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
]; ];
}; };
@ -108,9 +108,10 @@
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs outputs; inherit inputs outputs;
home-conf = "fullHome";
}; };
modules = [ modules = [
./users/phundrak/host/gampo.nix ./users/phundrak/gampo.nix
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
]; ];
}; };
@ -118,9 +119,10 @@
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs outputs; inherit inputs outputs;
home-conf = "minimal";
}; };
modules = [ modules = [
./users/phundrak/host/tilo.nix ./users/phundrak/tilo.nix
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
]; ];
}; };

View File

@ -1,41 +1,64 @@
{inputs, ...}: { {
pkgs,
inputs,
...
}: {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./host.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
../../system ../../modules/locale.nix
../../modules/system.nix
../../modules/ssh.nix
../../modules/endlessh.nix
../../programs/nano.nix
]; ];
zramSwap.enable = true;
# networking.domain = "phundrak.com";
system = { system = {
amdgpu.enable = false;
boot = { boot = {
kernel.hardened = true; kernel = {
hardened = true;
cpuVendor = "amd";
};
systemd-boot = false; systemd-boot = false;
zram = { zfs.enable = false;
enable = true;
memoryMax = 512;
}; };
};
dev.docker.enable = true;
networking = { networking = {
hostname = "alys"; hostname = "alys";
domain = "phundrak.com"; domain = "phundrak.com";
id = "41157110"; id = "41157110";
firewall.openPorts = [
22
];
}; };
packages.nix = { sound.enable = false;
gc.automatic = true; users = {
trusted-users = ["root" "phundrak"]; root.disablePassword = true;
phundrak = true;
}; };
services = { };
endlessh.enable = true;
modules = {
ssh = { ssh = {
enable = true; enable = true;
allowedUsers = ["phundrak"]; allowedUsers = ["phundrak"];
passwordAuthentication = false; passwordAuthentication = false;
}; };
endlessh.enable = false;
}; };
users = {
root.disablePassword = true; nixpkgs.config.allowUnfree = true;
phundrak.enable = true;
}; environment.systemPackages = [pkgs.openssl];
};
# networking.hostName = "alys";
# users.users.root.openssh.authorizedKeys.keys = [
# "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+b7BE/gHrHVkqNVfHtp2r4OCUDdohst8hb3Bz5tYtx3gvXJQCB1rFc2hgQJf8FsVyQbidS64lnhU1rUIEbFhv7itT5FGGUnfJEYs64W30wKsnPSb5WXdFXzrNi8za48i2oNl9JA9Fj9k6isyvkTup89hB+ELbXIcfz3bM93WaAt2dIgKijXaAMAAA+tHhgWvlrHlvGlU9/KxY3ZOQSoEboPXd7TDyOf1672eAibYyb5h1HIewYZ+xv1X4dxx/c9Arh4K0s8scuB7XTQQkEbRUEYKD2YXKN83Z09jfMlMYuBAKKO8zU4CM2KTbL7kEVgNc/ArY+uCAakmC5+eS7LxMuOt86+Bi4gXTJ6o6dbfUbCGiq751ni8pg44YSfwYiI05vvZ08eIyNkowumD+X4GRW4tu0I3qK8TI7exeEeoQIwlSfLXlYHEdNB8Q3feLyhHMRkxXgUskbXwWIBexLzJyY40tyqQplZWbYGrUEmjxZ7FWmaV+o8ZjnU2GfJ8JoWyCnEYfRc6Z2ILdXNDRzZ9qYOwefMHtuaYaYYximL+zdVVrm4EZuOetmaJ6zblk4ebU3GZjYykB8DmCDFDZO9koKwzPazLKQl0OWzmQqgxVNg7Mg1NZbuRQgVAhKPelnqejaXbf2/IHAYBn5LDR1Jew5+srlstM9XuYG2whEOx84w== Lucien Cartier-Tilet <lucien@phundrak.com>"
# "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILw9oiK8tZ5Vpz82RaRLpITU8qeJrT2hjvudGEDQu2QW lucien@phundrak.com"
# ];
system.stateVersion = "23.11"; system.stateVersion = "23.11";
} }

3
hosts/alys/host.nix Normal file
View File

@ -0,0 +1,3 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [neofetch vim emacs];
}

View File

@ -7,72 +7,55 @@
imports = [ imports = [
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
./hardware-configuration.nix ./hardware-configuration.nix
# ./services ./services
../../system ../../modules/opentablet.nix
../../modules/sops.nix
../../modules/system.nix
../../programs/flatpak.nix
../../programs/hyprland.nix
../../programs/steam.nix
]; ];
system = {
boot = {
plymouth.enable = true;
kernel = {
cpuVendor = "intel";
package = pkgs.linuxPackages;
modules = ["i915"];
};
systemd-boot = true;
};
desktop = {
hyprland.enable = true;
xserver = {
enable = true;
de = "gnome";
};
};
dev.docker = {
enable = true;
podman.enable = true;
autoprune.enable = true;
};
hardware = {
bluetooth.enable = true;
corne.allowHidAccess = true;
ibmTrackpoint.disable = true;
opentablet.enable = true;
sound.enable = true;
};
misc.keymap = "fr-bepo";
networking = {
hostname = "gampo";
id = "0630b33f";
hostFiles = [config.sops.secrets.extraHosts.path];
};
packages = {
appimage.enable = true;
flatpak.enable = true;
nix = {
nix-ld.enable = true;
trusted-users = ["root" "phundrak"];
};
};
programs.steam.enable = true;
services = {
fwupd.enable = true;
ssh.enable = true;
};
users = {
root.disablePassword = true;
phundrak.enable = true;
};
};
sops.secrets.extraHosts = { sops.secrets.extraHosts = {
inherit (config.users.users.root) group; inherit (config.users.users.root) group;
owner = config.users.users.phundrak.name; owner = config.users.users.phundrak.name;
mode = "0440"; mode = "0440";
}; };
boot.initrd.kernelModules = ["i915"];
system = {
boot.plymouth.enable = true;
docker = {
enable = true;
autoprune.enable = true;
podman.enable = true;
};
networking = {
hostname = "gampo";
id = "0630b33f";
hostFiles = [config.sops.secrets.extraHosts.path];
};
sound.enable = true;
};
modules = {
appimage.enable = true;
hyprland.enable = true;
};
security.rtkit.enable = true; security.rtkit.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
curl
openssl
wget
];
nix.settings.trusted-users = ["root" "phundrak"];
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database # settings for stateful data, like file locations and database
# versions on your system were taken. Its perfectly fine and # versions on your system were taken. Its perfectly fine and

View File

@ -1,7 +1,7 @@
{ {
# imports = [ imports = [
# ./gnome.nix ./gnome.nix
# ]; ];
services = { services = {
# Enable CUPS to print documents. # Enable CUPS to print documents.

View File

@ -1,48 +1,42 @@
{ {
config, config,
pkgs,
inputs, inputs,
... ...
}: { }: {
imports = [ imports = [
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
./system/hardware-configuration.nix ./system/hardware-configuration.nix
../../system ./services
../../modules/opentablet.nix
../../modules/sops.nix
../../modules/system.nix
../../programs/flatpak.nix
../../programs/hyprland.nix
../../programs/steam.nix
]; ];
sops.secrets.extraHosts = {
inherit (config.users.users.root) group;
owner = config.users.users.phundrak.name;
mode = "0440";
};
security.polkit.enable = true;
fileSystems."/games" = {
device = "/dev/disk/by-uuid/77d32db8-2e85-4593-b6b8-55d4f9d14e1a";
fsType = "ext4";
};
system = { system = {
boot = { amdgpu.enable = true;
extraModprobeConfig = '' boot.plymouth.enable = true;
options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1 docker = {
'';
plymouth.enable = true;
kernel.cpuVendor = "amd";
systemd-boot = true;
};
desktop = {
hyprland.enable = true;
niri.enable = true;
xserver = {
enable = true;
de = "gnome";
};
};
dev.docker = {
enable = true; enable = true;
podman.enable = true; podman.enable = true;
autoprune.enable = true; autoprune.enable = true;
}; };
hardware = {
amdgpu.enable = true;
bluetooth.enable = true;
corne.allowHidAccess = true;
opentablet.enable = true;
sound = {
enable = true;
jack = true;
scarlett.enable = true;
};
};
misc.keymap = "fr-bepo";
networking = { networking = {
hostname = "marpa"; hostname = "marpa";
id = "7EA4A111"; id = "7EA4A111";
@ -55,45 +49,34 @@
} }
]; ];
}; };
packages = { sound = {
appimage.enable = true;
flatpak.enable = true;
nix = {
nix-ld.enable = true;
trusted-users = ["root" "phundrak"];
};
};
programs.steam.enable = true;
services = {
fwupd.enable = true;
printing.enable = true;
ssh.enable = true;
sunshine = {
enable = true; enable = true;
autostart = true; jack = true;
};
};
users = {
root.disablePassword = true;
phundrak.enable = true;
}; };
}; };
sops.secrets.extraHosts = { modules = {
inherit (config.users.users.root) group; appimage.enable = true;
owner = config.users.users.phundrak.name; hyprland.enable = true;
mode = "0440";
}; };
security = { security.rtkit.enable = true;
polkit.enable = true;
rtkit.enable = true;
};
fileSystems."/games" = { nix.settings.trusted-users = ["root" "phundrak"];
device = "/dev/disk/by-uuid/77d32db8-2e85-4593-b6b8-55d4f9d14e1a";
fsType = "ext4"; environment.systemPackages = with pkgs; [
}; clinfo # AMD
curl
openssl
wget
alsa-scarlett-gui
];
boot.extraModprobeConfig = ''
options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1
'';
programs.nix-ld.enable = true;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions

View File

@ -1,24 +1,25 @@
{ {
# imports = [ imports = [
# ./logind.nix ./logind.nix
# ../../../system ../../../modules/ssh.nix
# ]; ../../../modules/sunshine.nix
# imports = [ ../../../modules/xserver.nix
# ./logind.nix ];
# ../../../modules/ssh.nix
# ../../../modules/sunshine.nix
# ];
# modules = { modules = {
# sunshine = { sunshine = {
# enable = true; enable = true;
# autostart = true; autostart = true;
# }; };
# }; xserver = {
# services = { amdgpu.enable = true;
# blueman.enable = true; de = "gnome";
# fwupd.enable = true; };
# printing.enable = true; };
# openssh.enable = true; services = {
# }; blueman.enable = true;
fwupd.enable = true;
printing.enable = true;
openssh.enable = true;
};
} }

View File

@ -1,15 +1,24 @@
# Edit this configuration file to define what should be installed on your # Edit this configuration file to define what should be installed on your
# system. Help is available in the configuration.nix(5) man page and in # system. Help is available in the configuration.nix(5) man page and in
# the NixOS manual (accessible by running nixos-help). # the NixOS manual (accessible by running nixos-help).
{inputs, ...}: { {
pkgs,
inputs,
...
}: {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
../../system ../../modules/locale.nix
../../modules/system.nix
../../modules/ssh.nix
../../modules/endlessh.nix
../../programs/nano.nix
./services ./services
]; ];
system = { system = {
amdgpu.enable = false;
boot = { boot = {
kernel = { kernel = {
hardened = true; hardened = true;
@ -20,15 +29,16 @@
pools = ["tank"]; pools = ["tank"];
}; };
}; };
dev.docker.enable = true; docker.enable = true;
misc.keymap = "fr-bepo";
networking = { networking = {
hostname = "tilo"; hostname = "tilo";
id = "7110b33f"; id = "7110b33f";
firewall = { firewall = {
openPorts = [ openPorts = [
22 # SSH
80 # HTTP 80 # HTTP
443 # HTTPS 443 # HTTPS
2222 # endlessh
25565 # Minecraft 25565 # Minecraft
]; ];
extraCommands = '' extraCommands = ''
@ -37,23 +47,27 @@
''; '';
}; };
}; };
packages.nix = { nix.gc.automatic = true;
gc.automatic = true; sound.enable = false;
trusted-users = ["root" "phundrak"]; users = {
root.disablePassword = true;
phundrak = true;
}; };
services = { console.keyMap = "fr-bepo";
endlessh.enable = true; };
modules = {
ssh = { ssh = {
enable = true; enable = true;
allowedUsers = ["phundrak"]; allowedUsers = ["phundrak"];
passwordAuthentication = false; passwordAuthentication = false;
}; };
endlessh.enable = true;
}; };
users = {
root.disablePassword = true; nixpkgs.config.allowUnfree = true;
phundrak.enable = true;
}; environment.systemPackages = [pkgs.openssl];
};
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions

View File

@ -5,18 +5,13 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.hardware.amdgpu; cfg = config.modules.amdgpu;
in { in {
options.system.hardware.amdgpu.enable = mkEnableOption "Enables an AMD GPU configuration"; options.modules.amdgpu.enable = mkEnableOption "Enables an AMD GPU configuration";
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}"
]; ];
hardware.graphics.extraPackages = with pkgs; [rocmPackages.clr.icd]; hardware.graphics.extraPackages = with pkgs; [rocmPackages.clr.icd];
environment.systemPackages = with pkgs; [
clinfo
amdgpu_top
nvtopPackages.amd
];
}; };
} }

View File

@ -4,9 +4,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.packages.appimage; cfg = config.modules.appimage;
in { in {
options.system.packages.appimage.enable = mkEnableOption "Enables AppImage support"; options.modules.appimage.enable = mkEnableOption "Enables AppImage support";
config.programs.appimage = mkIf cfg.enable { config.programs.appimage = mkIf cfg.enable {
inherit (cfg) enable; inherit (cfg) enable;
binfmt = true; binfmt = true;

View File

@ -5,16 +5,10 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.boot; cfg = config.modules.boot;
in { in {
options.system.boot = { options.modules.boot = {
extraModprobeConfig = mkOption { amdgpu.enable = mkEnableOption "Enables an AMD GPU configuration";
type = types.lines;
default = "";
example = ''
options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1
'';
};
kernel = { kernel = {
package = mkOption { package = mkOption {
type = types.raw; type = types.raw;
@ -51,7 +45,7 @@ in {
}; };
config.boot = { config.boot = {
initrd.kernelModules = lists.optional config.system.hardware.amdgpu.enable "amdgpu"; initrd.kernelModules = lists.optional cfg.amdgpu.enable "amdgpu";
loader = { loader = {
systemd-boot.enable = cfg.systemd-boot; systemd-boot.enable = cfg.systemd-boot;
efi.canTouchEfiVariables = cfg.systemd-boot; efi.canTouchEfiVariables = cfg.systemd-boot;

View File

@ -4,9 +4,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.dev.docker; cfg = config.modules.docker;
in { in {
options.system.dev.docker = { options.modules.docker = {
enable = mkEnableOption "Enable Docker"; enable = mkEnableOption "Enable Docker";
podman.enable = mkEnableOption "Enable Podman rather than Docker"; podman.enable = mkEnableOption "Enable Podman rather than Docker";
nvidia.enable = mkEnableOption "Activate Nvidia support"; nvidia.enable = mkEnableOption "Activate Nvidia support";

View File

@ -4,9 +4,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.services.endlessh; cfg = config.modules.endlessh;
in { in {
options.system.services.endlessh = { options.modules.endlessh = {
enable = mkEnableOption "Enables endlessh."; enable = mkEnableOption "Enables endlessh.";
port = mkOption { port = mkOption {
type = types.port; type = types.port;

View File

@ -4,9 +4,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.networking; cfg = config.modules.networking;
in { in {
options.system.networking = with types; { options.modules.networking = with types; {
hostname = mkOption { hostname = mkOption {
type = str; type = str;
example = "gampo"; example = "gampo";

View File

@ -4,11 +4,10 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.packages.nix; cfg = config.modules.nix;
in { in {
options.system.packages.nix = { options.modules.nix = {
allowUnfree = mkEnableOption "Enable unfree packages"; disableSandbox = mkEnableOption "Disables Nix sandbox";
disableSandbox = mkEnableOption "Disable Nix sandbox";
gc = { gc = {
automatic = mkOption { automatic = mkOption {
type = types.bool; type = types.bool;
@ -23,27 +22,17 @@ in {
default = "--delete-older-than 30d"; default = "--delete-older-than 30d";
}; };
}; };
nix-ld.enable = mkEnableOption "Enable unpatched binaries support";
trusted-users = mkOption {
type = types.listOf types.str;
example = ["alice" "bob"];
default = [];
};
}; };
config = { config = {
nix = { nix = {
inherit (cfg) gc;
settings = { settings = {
inherit (cfg) trusted-users;
sandbox = cfg.disableSandbox; sandbox = cfg.disableSandbox;
experimental-features = ["nix-command" "flakes"]; experimental-features = ["nix-command" "flakes"];
auto-optimise-store = true; auto-optimise-store = true;
}; };
inherit (cfg) gc;
}; };
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
programs = {
inherit (cfg) nix-ld;
};
}; };
} }

6
modules/opentablet.nix Normal file
View File

@ -0,0 +1,6 @@
{
hardware.opentabletdriver = {
enable = true;
daemon.enable = true;
};
}

View File

@ -5,9 +5,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.boot.plymouth; cfg = config.modules.boot.plymouth;
in { in {
options.system.boot.plymouth.enable = mkEnableOption "Enables Plymouth at system boot"; options.modules.boot.plymouth.enable = mkEnableOption "Enables Plymouth at system boot";
config.boot = mkIf cfg.enable { config.boot = mkIf cfg.enable {
plymouth = { plymouth = {
inherit (cfg) enable; inherit (cfg) enable;

View File

@ -1,6 +1,6 @@
{ {
sops = { sops = {
defaultSopsFile = ../../secrets/secrets.yaml; defaultSopsFile = ../secrets/secrets.yaml;
defaultSopsFormat = "yaml"; defaultSopsFormat = "yaml";
age = { age = {
# automatically import user SSH keys as age keys # automatically import user SSH keys as age keys

View File

@ -5,11 +5,10 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.hardware.sound; cfg = config.modules.sound;
in { in {
options.system.hardware.sound = { options.modules.sound = {
enable = mkEnableOption "Whether to enable sounds with Pipewire"; enable = mkEnableOption "Whether to enable sounds with Pipewire";
scarlett.enable = mkEnableOption "Activate support for Scarlett sound card";
alsa = mkOption { alsa = mkOption {
type = types.bool; type = types.bool;
example = true; example = true;
@ -30,9 +29,7 @@ in {
}; };
}; };
config = { config.services.pipewire = mkIf cfg.enable {
environment.systemPackages = mkIf cfg.scarlett.enable [pkgs.alsa-scarlett-gui];
services.pipewire = mkIf cfg.enable {
enable = true; enable = true;
alsa = mkIf cfg.alsa { alsa = mkIf cfg.alsa {
enable = mkDefault true; enable = mkDefault true;
@ -40,5 +37,4 @@ in {
}; };
jack.enable = mkDefault cfg.jack; jack.enable = mkDefault cfg.jack;
}; };
};
} }

View File

@ -4,9 +4,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.services.ssh; cfg = config.modules.ssh;
in { in {
options.system.services.ssh = { options.modules.ssh = {
enable = mkEnableOption "Enables OpenSSH"; enable = mkEnableOption "Enables OpenSSH";
allowedUsers = mkOption { allowedUsers = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
@ -20,7 +20,7 @@ in {
}; };
}; };
config.services.openssh = mkIf cfg.enable { config.services.openssh = mkIf cfg.enable {
inherit (cfg) enable; enable = true;
settings = { settings = {
AllowUsers = cfg.allowedUsers; AllowUsers = cfg.allowedUsers;
PermitRootLogin = "no"; PermitRootLogin = "no";

View File

@ -4,17 +4,19 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.services.sunshine; cfg = config.modules.sunshine;
in { in {
options.system.services.sunshine = { options.modules.sunshine = {
enable = mkEnableOption "Enables Sunshine"; enable = mkEnableOption "Enables moonlight";
autostart = mkEnableOption "Enables autostart"; autostart = mkEnableOption "Enables autostart";
}; };
config.services.sunshine = mkIf cfg.enable { config.services.sunshine = mkIf cfg.enable {
inherit (cfg) enable; enable = true;
autoStart = cfg.autostart; autoStart = cfg.autostart;
capSysAdmin = true; capSysAdmin = true;
openFirewall = true; openFirewall = true;
settings.sunshine_name = config.system.networking.hostname; settings = {
sunshine_name = "marpa";
};
}; };
} }

183
modules/system.nix Normal file
View File

@ -0,0 +1,183 @@
{
pkgs,
lib,
config,
...
}:
with lib; let
cfg = config.system;
in {
imports = [
./amdgpu.nix
./appimage.nix
./boot.nix
./locale.nix
./networking.nix
./nix.nix
./plymouth.nix
./sound.nix
./users.nix
./dev/docker.nix
];
options.system = with types; {
amdgpu.enable = mkEnableOption "Enables AMD GPU support";
boot = {
kernel = {
package = mkOption {
type = raw;
default = pkgs.linuxPackages_zen;
};
modules = mkOption {
type = listOf str;
default = [];
};
cpuVendor = mkOption {
description = "Intel or AMD?";
type = enum ["intel" "amd"];
default = "amd";
};
v4l2loopback = mkOption {
description = "Enables v4l2loopback";
type = bool;
default = true;
};
hardened = mkEnableOption "Enables hardened Linux kernel";
};
systemd-boot = mkOption {
type = types.bool;
default = true;
description = "Does the system use systemd-boot?";
};
plymouth.enable = mkEnableOption "Enables Plymouth";
zfs = {
enable = mkEnableOption "Enables ZFS";
pools = mkOption {
type = listOf str;
default = [];
};
};
};
docker = {
enable = mkEnableOption "Enable Docker";
podman.enable = mkEnableOption "Enable Podman rather than Docker";
nvidia.enable = mkEnableOption "Activate Nvidia support";
autoprune.enable = mkEnableOption "Enable autoprune";
};
networking = {
hostname = mkOption {
type = str;
example = "gampo";
};
id = mkOption {
type = str;
example = "deadb33f";
};
domain = mkOption {
type = nullOr str;
example = "phundrak.com";
default = null;
};
hostFiles = mkOption {
type = listOf path;
example = [/path/to/hostFile];
default = [];
};
firewall = {
openPorts = mkOption {
type = listOf int;
example = [22 80 443];
default = [];
};
openPortRanges = mkOption {
type = listOf (attrsOf port);
default = [];
example = [
{
from = 8080;
to = 8082;
}
];
description = ''
A range of TCP and UDP ports on which incoming connections are
accepted.
'';
};
extraCommands = mkOption {
type = nullOr lines;
example = "iptables -A INPUTS -p icmp -j ACCEPT";
default = null;
};
};
};
nix = {
disableSandbox = mkOption {
type = bool;
default = false;
};
gc = {
automatic = mkOption {
type = bool;
default = true;
};
dates = mkOption {
type = str;
default = "Monday 01:00 UTC";
};
options = mkOption {
type = str;
default = "--delete-older-than 30d";
};
};
};
sound = {
enable = mkEnableOption "Whether to enable sounds with Pipewire";
alsa = mkOption {
type = bool;
example = true;
default = true;
description = "Whether to enable ALSA support with Pipewire";
};
jack = mkOption {
type = bool;
example = true;
default = false;
description = "Whether to enable JACK support with Pipewire";
};
package = mkOption {
type = package;
example = pkgs.pulseaudio;
default = pkgs.pulseaudioFull;
description = "Which base package to use for PulseAudio";
};
};
users = {
root.disablePassword = mkEnableOption "Disables root password";
phundrak = mkOption {
type = bool;
default = true;
};
};
timezone = mkOption {
type = str;
default = "Europe/Paris";
};
console.keyMap = mkOption {
type = str;
default = "fr";
};
};
config = {
boot.tmp.cleanOnBoot = true;
time.timeZone = cfg.timezone;
console.keyMap = cfg.console.keyMap;
modules = {
boot = {
inherit (cfg) amdgpu;
inherit (cfg.boot) kernel systemd-boot plymouth zfs;
};
inherit (cfg) sound users networking docker amdgpu;
};
};
}

View File

@ -5,11 +5,14 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.users; cfg = config.modules.users;
in { in {
options.system.users = { options.modules.users = {
root.disablePassword = mkEnableOption "Disables root password"; root.disablePassword = mkEnableOption "Disables root password";
phundrak.enable = mkEnableOption "Enables users phundrak"; phundrak = mkOption {
type = types.bool;
default = true;
};
}; };
config = { config = {
@ -18,12 +21,12 @@ in {
hashedPassword = mkIf cfg.root.disablePassword "*"; hashedPassword = mkIf cfg.root.disablePassword "*";
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
phundrak = mkIf cfg.phundrak.enable { phundrak = {
isNormalUser = true; isNormalUser = true;
description = "Lucien Cartier-Tilet"; description = "Lucien Cartier-Tilet";
extraGroups = ["networkmanager" "wheel" "docker" "dialout" "podman"]; extraGroups = ["networkmanager" "wheel" "docker" "dialout" "podman"];
shell = pkgs.zsh; shell = pkgs.zsh;
openssh.authorizedKeys.keyFiles = lib.filesystem.listFilesRecursive ../../keys; openssh.authorizedKeys.keyFiles = lib.filesystem.listFilesRecursive ./keys;
}; };
}; };
programs.zsh.enable = true; programs.zsh.enable = true;

View File

@ -4,10 +4,10 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.desktop.xserver; cfg = config.modules.xserver;
in { in {
options.system.desktop.xserver = { options.modules.xserver = {
enable = mkEnableOption "Enables xserver"; amdgpu.enable = mkEnableOption "Enables AMD GPU support";
de = mkOption { de = mkOption {
type = types.enum ["gnome" "kde"]; type = types.enum ["gnome" "kde"];
default = "gnome"; default = "gnome";
@ -15,7 +15,7 @@ in {
description = "Which DE to enable"; description = "Which DE to enable";
}; };
}; };
config.services = mkIf cfg.enable { config.services = {
displayManager = { displayManager = {
sddm.enable = mkIf (cfg.de == "kde") true; sddm.enable = mkIf (cfg.de == "kde") true;
gdm.enable = mkIf (cfg.de == "gnome") true; gdm.enable = mkIf (cfg.de == "gnome") true;
@ -34,8 +34,8 @@ in {
}; };
xserver = { xserver = {
inherit (cfg) enable; enable = true;
videoDrivers = lists.optional config.system.hardware.amdgpu.enable "amdgpu"; videoDrivers = lists.optional cfg.amdgpu.enable "amdgpu";
xkb = { xkb = {
layout = "fr"; layout = "fr";
variant = "bepo_afnor"; variant = "bepo_afnor";

3
programs/flatpak.nix Normal file
View File

@ -0,0 +1,3 @@
{
services.flatpak.enable = true;
}

View File

@ -4,9 +4,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.system.desktop.hyprland; cfg = config.modules.hyprland;
in { in {
options.system.desktop.hyprland.enable = mkEnableOption "Enables Hyprland"; options.modules.hyprland.enable = mkEnableOption "Enables Hyprland";
config.programs.hyprland = mkIf cfg.enable { config.programs.hyprland = mkIf cfg.enable {
inherit (cfg) enable; inherit (cfg) enable;
withUWSM = true; withUWSM = true;

21
programs/steam.nix Normal file
View File

@ -0,0 +1,21 @@
{pkgs, ...}: {
programs = {
steam = {
enable = true;
protontricks.enable = true;
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
gamescopeSession.enable = true;
extraCompatPackages = [pkgs.proton-ge-bin];
};
gamescope = {
enable = true;
capSysNice = true;
args = [
"--rt"
"--expose-wayland"
];
};
};
hardware.steam-hardware.enable = true;
}

View File

@ -1,7 +0,0 @@
{
imports = [
./boot.nix
./plymouth.nix
./zram.nix
];
}

View File

@ -1,21 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.system.boot.zram;
in {
options.system.boot.zram = {
enable = mkEnableOption "Enable ZRAM";
memoryMax = mkOption {
type = types.int;
example = "512";
description = "Maximum size allocated to ZRAM in MiB";
};
};
config.zramSwap = mkIf cfg.enable {
inherit (cfg) enable;
memoryMax = cfg.memoryMax * 1024 * 1024;
};
}

View File

@ -1,40 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.system.misc;
in {
imports = [
./boot
./desktop
./dev
./hardware
./i18n
./network
./packages
./security
./services
./users
];
options.system.misc = {
timezone = mkOption {
type = types.str;
default = "Europe/Paris";
};
keymap = mkOption {
type = types.str;
default = "fr";
example = "fr-bepo";
description = "Keymap to use in the TTY console";
};
};
config = {
boot.tmp.cleanOnBoot = true;
time.timeZone = cfg.timezone;
console.keyMap = cfg.keymap;
};
}

View File

@ -1,3 +0,0 @@
{
imports = [./hyprland.nix ./niri.nix ./xserver.nix];
}

View File

@ -1,13 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.system.desktop.niri;
in {
options.system.desktop.niri.enable = mkEnableOption "Enables Niri";
config.programs.niri = mkIf cfg.enable {
inherit (cfg) enable;
};
}

View File

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

View File

@ -1,14 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.system.hardware.bluetooth;
in {
options.system.hardware.bluetooth.enable = mkEnableOption "Enable bluetooth";
config = mkIf cfg.enable {
hardware.bluetooth.enable = cfg.enable;
services.blueman.enable = cfg.enable;
};
}

View File

@ -1,15 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.system.hardware.corne;
in {
options.system.hardware.corne.allowHidAccess = mkEnableOption "Enable HID access to the corne keyboard";
config.services.udev = mkIf cfg.allowHidAccess {
extraRules = ''
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
'';
};
}

View File

@ -1,10 +0,0 @@
{
imports = [
./amdgpu.nix
./bluetooth.nix
./corne.nix
./ibm-trackpoint.nix
./opentablet.nix
./sound.nix
];
}

View File

@ -1,15 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.system.hardware.ibmTrackpoint;
in {
options.system.hardware.ibmTrackpoint.disable = mkEnableOption "Disable IBMs trackpoint on ThinkPad";
config.services.udev = mkIf cfg.disable {
extraRules = ''
ATTRS{name}=="*TPPS/2 IBM TrackPoint", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}=""
'';
};
}

View File

@ -1,14 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.system.hardware.opentablet;
in {
options.system.hardware.opentablet.enable = mkEnableOption "Enables OpenTablet drivers";
config.hardware.opentabletdriver = mkIf cfg.enable {
inherit (cfg) enable;
daemon.enable = true;
};
}

View File

@ -1,5 +0,0 @@
{
imports = [
./locale.nix
];
}

View File

@ -1,5 +0,0 @@
{
imports = [
./networking.nix
];
}

View File

@ -1,15 +0,0 @@
{pkgs, ...}: {
imports = [
./appimage.nix
./flatpak.nix
./nano.nix
./nix.nix
./steam.nix
];
environment.systemPackages = with pkgs; [
curl
openssl
wget
];
}

View File

@ -1,22 +0,0 @@
{
pkgs,
lib,
config,
...
}:
with lib; let
cfg = config.system.packages.flatpak;
in {
options.system.packages.flatpak = {
enable = mkEnableOption "Enable Flatpak support";
builder.enable = mkEnableOption "Enable Flatpak builder";
};
config = {
services.flatpak = mkIf cfg.enable {
inherit (cfg) enable;
};
environment.systemPackages = mkIf cfg.builder.enable [
pkgs.flatpak-buildR
];
};
}

View File

@ -1,34 +0,0 @@
{
pkgs,
lib,
config,
...
}:
with lib; let
cfg = config.system.programs.steam;
in {
options.system.programs.steam.enable = mkEnableOption "Enables Steam and Steam hardware";
config = mkIf cfg.enable {
programs = {
steam = {
inherit (cfg) enable;
protontricks.enable = true;
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
gamescopeSession.enable = true;
extraCompatPackages = [pkgs.proton-ge-bin];
};
gamescope = {
enable = true;
capSysNice = true;
args = [
"--rt"
"--expose-wayland"
];
};
};
hardware.steam-hardware = {
inherit (cfg) enable;
};
};
}

View File

@ -1,5 +0,0 @@
{
imports = [
./sops.nix
];
}

View File

@ -1,9 +0,0 @@
{
imports = [
./endlessh.nix
./fwupd.nix
./printing.nix
./ssh.nix
./sunshine.nix
];
}

View File

@ -1,13 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.system.services.fwupd;
in {
options.system.services.fwupd.enable = mkEnableOption "Enable fwupd";
config.services.fwupd = mkIf cfg.enable {
inherit (cfg) enable;
};
}

View File

@ -1,13 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.system.services.printing;
in {
options.system.services.printing.enable = mkEnableOption "Enable printing with CUPS";
config.services.printing = mkIf cfg.enable {
inherit (cfg) enable;
};
}

View File

@ -1,5 +0,0 @@
{
imports = [
./phundrak.nix
];
}

View File

@ -5,9 +5,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.home.cli.bat; cfg = config.modules.bat;
in { in {
options.home.cli.bat.extras = mkEnableOption "Enables extra packages for bat."; options.modules.bat.extras = mkEnableOption "Enables extra packages for bat.";
config.programs.bat = { config.programs.bat = {
enable = true; enable = true;
config = { config = {

View File

@ -1,29 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.cli;
in {
imports = [
./bat.nix
./btop.nix
./direnv.nix
./eza.nix
./mu.nix
./nh.nix
./nix-index.nix
./scripts
./tealdeer.nix
./yt-dlp.nix
];
options.home.cli.fullDesktop = mkEnableOption "Enable all optional modules and options";
config.home.cli = {
bat.extras = mkDefault cfg.fullDesktop;
mu.enable = mkDefault cfg.fullDesktop;
scripts.enable = mkDefault cfg.fullDesktop;
yt-dlp.enable = mkDefault cfg.fullDesktop;
};
}

View File

@ -1,11 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.cli.mu;
in {
options.home.cli.mu.enable = mkEnableOption "Enable mu";
config.programs.mu.enable = cfg.enable;
}

View File

@ -1,10 +0,0 @@
{inputs, ...}: {
imports = [
inputs.nix-index-database.homeModules.nix-index
];
programs = {
nix-index.enable = true;
nix-index-database.comma.enable = true;
};
}

View File

@ -1,15 +0,0 @@
{
pkgs,
lib,
config,
...
}:
with lib; let
cfg = config.home.cli.scripts;
files = filesystem.listFilesRecursive ./.;
scriptFiles = builtins.filter (path: baseNameOf path != "default.nix") files;
scripts = map (file: (import file {inherit pkgs config;})) scriptFiles;
in {
options.home.cli.scripts.enable = mkEnableOption "Add custom scripts to PATH";
config.home.packages = mkIf cfg.enable scripts;
}

View File

@ -1,18 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.home.cli.yt-dlp;
in {
options.home.cli.yt-dlp.enable = mkEnableOption "Enable yt-dlp";
config.programs.yt-dlp = mkIf cfg.enable {
inherit (cfg) enable;
settings = {
embed-thumbnail = true;
embed-subs = true;
sub-langs = "all";
};
};
}

View File

@ -1,29 +1,17 @@
{ {
config,
lib,
...
}:
with lib; let
cfg = config.home;
in {
imports = [ imports = [
./basics.nix ./basics.nix
./cli ./bat.nix
./desktop ./btop.nix
./dev ./direnv.nix
./media ./eza.nix
./services ./gpg.nix
./security ./mopidy.nix
./nh.nix
./nix-index.nix
./shell ./shell
./ssh.nix
./tealdeer.nix
./vcs
]; ];
options.home.fullDesktop = mkEnableOption "Enable most modules";
config.home = {
cli.fullDesktop = mkDefault cfg.fullDesktop;
desktop.fullDesktop = mkDefault cfg.fullDesktop;
dev.fullDesktop = mkDefault cfg.fullDesktop;
media.fullDesktop = mkDefault cfg.fullDesktop;
security.fullDesktop = mkDefault cfg.fullDesktop;
services.fullDesktop = mkDefault cfg.fullDesktop;
};
} }

View File

@ -1,32 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.home.desktop;
in {
imports = [
./emoji.nix
./eww.nix
./hyprland.nix
./kdeconnect.nix
./kitty.nix
./obs.nix
./qt.nix
./swaync.nix
./waybar.nix
./wlsunset.nix
./wofi.nix
];
options.home.desktop.fullDesktop = mkEnableOption "Enable options for graphical environments";
config.home.desktop = {
eww.enable = mkDefault cfg.fullDesktop;
hyprland.enable = mkDefault cfg.fullDesktop;
kdeconnect.enable = mkDefault cfg.fullDesktop;
kitty.enable = mkDefault cfg.fullDesktop;
obs.enable = mkDefault cfg.fullDesktop;
qt.enable = mkDefault cfg.fullDesktop;
};
}

View File

@ -1,14 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.home.desktop.eww;
in {
options.home.desktop.eww.enable = mkEnableOption "Enable eww support";
config.programs.eww = mkIf cfg.enable {
inherit (cfg) enable;
configDir = ./eww-config;
};
}

View File

@ -1,14 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.home.desktop.kdeconnect;
in {
options.home.desktop.kdeconnect.enable = mkEnableOption "Enable KDE Connect";
config.services.kdeconnect = mkIf cfg.enable {
enable = true;
indicator = true;
};
}

View File

@ -1,23 +0,0 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.home.desktop.obs;
in {
options.home.desktop.obs.enable = mkEnableOption "Enables OBS Studio";
config.programs.obs-studio = mkIf cfg.enable {
inherit (cfg) enable;
plugins = with pkgs.obs-studio-plugins; [
input-overlay
obs-backgroundremoval
obs-mute-filter
obs-pipewire-audio-capture
obs-source-clone
obs-source-record
obs-tuna
];
};
}

View File

@ -1,11 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.home.desktop.qt;
in {
options.home.desktop.qt.enable = mkEnableOption "Enable Qt support";
config.qt.enable = cfg.enable;
}

View File

@ -1,20 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.dev;
in {
imports = [
./editors
./ollama.nix
./vcs
];
options.home.dev.fullDesktop = mkEnableOption "Enables everything except AI";
config.home.dev = {
vcs.fullDesktop = mkDefault cfg.fullDesktop;
editors.fullDesktop = mkDefault cfg.fullDesktop;
};
}

View File

@ -1,20 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.dev.editors;
in {
imports = [
./emacs.nix
];
options.home.dev.editors.fullDesktop = mkEnableOption "Enable all editors";
config.home.dev.editors.emacs = {
enable = mkDefault cfg.fullDesktop;
service = mkDefault cfg.fullDesktop;
mu4eMime = mkDefault cfg.fullDesktop;
org-protocol = mkDefault cfg.fullDesktop;
};
}

View File

@ -1,53 +0,0 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.home.dev.vcs;
in {
imports = [./git.nix ./jujutsu.nix];
options.home.dev.vcs = {
fullDesktop = mkEnableOption "Enable all optional values";
name = mkOption {
type = types.str;
default = "Lucien Cartier-Tilet";
};
email = mkOption {
type = types.str;
default = "lucien@phundrak.com";
};
editor = mkOption {
type = types.str;
default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs";
};
publicKey = {
content = mkOption {
type = types.nullOr types.str;
example = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGj+J6N6SO+4P8dOZqfR1oiay2yxhhHnagH52avUqw5h";
default = null;
};
file = mkOption {
type = with types; nullOr path;
default = "/home/phundrak/.ssh/id_ed25519.pub";
};
};
};
config.home.dev.vcs = {
git = {
enable = mkDefault true;
inherit (cfg) name email editor;
publicKeyFile = cfg.publicKey.file;
cliff = mkDefault cfg.fullDesktop;
completeConfig = mkDefault cfg.fullDesktop;
};
jj = {
enable = mkDefault true;
inherit (cfg) name email editor;
signing.sshKey = mkDefault (cfg.publicKey.file or cfg.publicKey.content);
};
};
}

View File

@ -11,9 +11,9 @@ with lib; let
epkgs.pdf-tools epkgs.pdf-tools
] ]
)); ));
cfg = config.home.dev.editors.emacs; cfg = config.modules.emacs;
in { in {
options.home.dev.editors.emacs = { options.modules.emacs = {
enable = mkEnableOption "enables Emacs"; enable = mkEnableOption "enables Emacs";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
@ -25,7 +25,6 @@ in {
}; };
config = { config = {
home.packages = [pkgs.emacs-all-the-icons-fonts];
programs.emacs = mkIf cfg.enable { programs.emacs = mkIf cfg.enable {
enable = true; enable = true;
inherit (cfg) package; inherit (cfg) package;

6
users/modules/eww.nix Normal file
View File

@ -0,0 +1,6 @@
{
programs.eww = {
enable = true;
configDir = ./eww-config;
};
}

12
users/modules/gpg.nix Normal file
View File

@ -0,0 +1,12 @@
{pkgs, ...}: {
programs.gpg = {
enable = true;
mutableKeys = true;
mutableTrust = true;
};
services.gpg-agent = {
enable = true;
enableSshSupport = true;
pinentry.package = pkgs.pinentry-emacs;
};
}

View File

@ -5,9 +5,8 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.home.desktop.hyprland; cfg = config.modules.hyprland;
rofi-emoji = import ../cli/scripts/rofi-emoji.nix {inherit pkgs;}; rofi-emoji = import ../scripts/rofi-emoji.nix {inherit pkgs;};
laptops = ["gampo"];
in { in {
imports = [ imports = [
./swaync.nix ./swaync.nix
@ -15,34 +14,33 @@ in {
./wlsunset.nix ./wlsunset.nix
]; ];
options.home.desktop.hyprland = { options.modules.hyprland = {
enable = mkEnableOption "Enables Hyprland"; enable = mkEnableOption "Enables Hyprland";
swaync = mkEnableOption "Enables swaync";
emacsPkg = mkOption { emacsPkg = mkOption {
type = types.package; type = types.package;
default = config.home.dev.editors.emacs.package or pkgs.emacs; default = pkgs.emacs;
# default = pkgs.emacs;
example = pkgs.emacs;
}; };
host = mkOption { host = mkOption {
type = types.enum ["gampo" "marpa"]; type = types.enum ["tilo" "gampo"];
default = "tilo";
description = '' description = ''
Which host is Hyprland running on. Which host is Hyprland running on.
This helps determine the monitors layout and enable battery support in waybar. This helps determine the monitors layout.
''; '';
}; };
waybar = {
enable = mkEnableOption "Enables waybar.";
battery = mkEnableOption "Enables battery support.";
style = mkOption {
type = types.path;
example = ./style.css;
};
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.desktop = {
swaync.enable = mkDefault true;
waybar = {
enable = mkDefault true;
battery = mkDefault (builtins.elem cfg.host laptops);
};
wlsunset.enable = mkDefault true;
wofi.enable = mkDefault true;
};
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
xwayland.enable = true; xwayland.enable = true;
@ -60,7 +58,7 @@ in {
}; };
monitor = monitor =
{ {
"marpa" = [ "tilo" = [
"DP-1, 3440x1440@144, 1080x550, 1" "DP-1, 3440x1440@144, 1080x550, 1"
"DP-2, 2560x1080@60, 0x0, 1, transform, 1" "DP-2, 2560x1080@60, 0x0, 1, transform, 1"
]; ];
@ -288,5 +286,12 @@ in {
}; };
}; };
}; };
modules = {
swaync.enable = cfg.swaync;
waybar = mkIf cfg.waybar.enable {
inherit (cfg.waybar) enable battery style;
};
wlsunset.enable = true;
};
}; };
} }

View File

@ -0,0 +1,6 @@
{
services.kdeconnect = {
enable = true;
indicator = true;
};
}

View File

@ -1,15 +1,6 @@
{ {pkgs, ...}: {
pkgs, programs.kitty = {
config, enable = true;
lib,
...
}:
with lib; let
cfg = config.home.desktop.kitty;
in {
options.home.desktop.kitty.enable = mkEnableOption "Enable kitty terminal";
config.programs.kitty = mkIf cfg.enable {
inherit (cfg) enable;
themeFile = "Nord"; themeFile = "Nord";
font = { font = {
package = pkgs.cascadia-code; package = pkgs.cascadia-code;

View File

@ -4,14 +4,26 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.home.services.mbsync; cfg = config.modules.mbsync;
in { in {
options.home.services.mbsync = { options.modules.mbsync = {
enable = mkEnableOption "Enables mbsync"; enable = mkEnableOption "Enables mbsync";
passwordFile = mkOption {
type = types.str;
example = "/var/email/password";
};
service.enable = mkOption { service.enable = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
}; };
host = mkOption {
type = types.str;
default = "mail.phundrak.com";
};
user = mkOption {
type = types.str;
default = "lucien@phundrak.com";
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View File

@ -1,22 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.media;
in {
imports = [
./mopidy.nix
./mpd.nix
./mpd-mpris.nix
./mpv.nix
];
options.home.media.fullDesktop = mkEnableOption "Enables everything";
config.home.media = {
mopidy.enable = mkDefault cfg.fullDesktop;
mpd.enable = mkDefault (cfg.fullDesktop or cfg.mpd-mpris.enable);
mpv.enable = mkDefault cfg.fullDesktop;
};
}

View File

@ -1,16 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.media.mpd-mpris;
cfgMpd = config.home.media.mpd;
in {
options.home.media.mpd-mpris.enable = mkOption {
type = types.bool;
default = cfgMpd.enable;
example = false;
};
config.services.mpd-mpris.enable = cfg.enable;
}

View File

@ -1,30 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.home.media.mpd;
in {
options.home.media.mpd.enable = mkEnableOption "Enables MPD";
config.services.mpd = mkIf cfg.enable {
inherit (cfg) enable;
musicDirectory = "${config.home.homeDirectory}/Music";
playlistDirectory = "${config.home.homeDirectory}/Music/playlists";
network.startWhenNeeded = true;
extraConfig = ''
follow_outside_symlinks "yes"
follow_inside_symlinks "yes"
bind_to_address "localhost"
auto_update "yes"
audio_output {
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
'';
};
}

View File

@ -5,9 +5,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.home.media.mopidy; cfg = config.modules.mopidy;
in { in {
options.home.media.mopidy = { options.modules.mopidy = {
enable = mkEnableOption "Enables Mopidy."; enable = mkEnableOption "Enables Mopidy.";
}; };

21
users/modules/mpd.nix Normal file
View File

@ -0,0 +1,21 @@
{
services.mpd = {
enable = true;
musicDirectory = "/home/phundrak/Music";
playlistDirectory = "/home/phundrak/Music/playlists";
extraConfig = ''
follow_outside_symlinks "yes"
follow_inside_symlinks "yes"
bind_to_address "localhost"
auto_update "yes"
audio_output {
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
'';
};
}

View File

@ -1,15 +1,6 @@
{ {pkgs, ...}: {
pkgs, programs.mpv = {
lib, enable = true;
config,
...
}:
with lib; let
cfg = config.home.media.mpv;
in {
options.home.media.mpv.enable = mkEnableOption "Enable MPV";
config.programs.mpv = mkIf cfg.enable {
inherit (cfg) enable;
config = { config = {
force-window = "immediate"; force-window = "immediate";
force-seekable = true; # force streams to be seekable force-seekable = true; # force streams to be seekable
@ -25,7 +16,7 @@ in {
screenshot-format = "png"; screenshot-format = "png";
screenshot-high-bit-depth = true; screenshot-high-bit-depth = true;
screenshot-png-compression = 6; screenshot-png-compression = 6;
screenshot-directory = "${config.home.homeDirectory}/Pictures/Screenshots/mpv"; screenshot-directory = "~/Pictures/Screenshots/mpv";
deband = true; deband = true;
deband-iterations = 2; deband-iterations = 2;

View File

@ -4,9 +4,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.home.cli.nh; cfg = config.modules.nh;
in { in {
options.home.cli.nh.flake = mkOption { options.modules.nh.flake = mkOption {
type = types.path; type = types.path;
default = "/home/phundrak/.dotfiles"; default = "/home/phundrak/.dotfiles";
example = "/etc/nixos"; example = "/etc/nixos";

View File

@ -0,0 +1,8 @@
{inputs, ...}: {
imports = [
inputs.nix-index-database.homeModules.nix-index
];
programs.nix-index.enable = true;
programs.nix-index-database.comma.enable = true;
}

View File

@ -4,9 +4,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.home.dev.ollama; cfg = config.modules.ollama;
in { in {
options.home.dev.ollama = { options.modules.ollama = {
enable = mkEnableOption "Enables Ollama"; enable = mkEnableOption "Enables Ollama";
gpu = mkOption { gpu = mkOption {
type = types.nullOr types.enum ["none" "amd" "nvidia"]; type = types.nullOr types.enum ["none" "amd" "nvidia"];

3
users/modules/qt.nix Normal file
View File

@ -0,0 +1,3 @@
{
qt.enable = true;
}

View File

@ -1,18 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.security;
in {
imports = [
./gpg.nix
./ssh.nix
];
options.home.security.fullDesktop = mkEnableOption "Enable all modules";
config.home.security = {
gpg.enable = mkDefault cfg.fullDesktop;
ssh.enable = mkDefault cfg.fullDesktop;
};
}

View File

@ -1,32 +0,0 @@
{
pkgs,
lib,
config,
...
}:
with lib; let
cfg = config.home.security.gpg;
in {
options.home.security.gpg = {
enable = mkEnableOption "Enable GPG";
pinentry.package = mkOption {
type = types.package;
default =
if config.home.dev.editors.emacs.enable
then pkgs.pinentry-emacs
else pkgs.pinentry-gtk2;
};
};
config = mkIf cfg.enable {
programs.gpg = {
inherit (cfg) enable;
mutableKeys = true;
mutableTrust = true;
};
services.gpg-agent = {
enable = true;
enableSshSupport = true;
pinentry.package = cfg.pinentry.package;
};
};
}

View File

@ -1,11 +0,0 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.home.services.blanket;
in {
options.home.services.blanket.enable = mkEnableOption "Enable blanket";
config.services.blanket.enable = cfg.enable;
}

View File

@ -1,22 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.services;
in {
imports = [
./blanket.nix
./mbsync.nix
./mpris-proxy.nix
./playerctld.nix
];
options.home.services.fullDesktop = mkEnableOption "Enable all modules";
config.home.services = {
blanket.enable = mkDefault cfg.fullDesktop;
mbsync.enable = mkDefault cfg.fullDesktop;
mpris-proxy.enable = mkDefault cfg.fullDesktop;
playerctld.enable = mkDefault cfg.fullDesktop;
};
}

View File

@ -1,11 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.services.mpris-proxy;
in {
options.home.services.mpris-proxy.enable = mkEnableOption "Enable MPRIS forwarding towards bluetooth and MIDI";
config.services.mpris-proxy.enable = cfg.enable;
}

View File

@ -1,11 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.services.playerctld;
in {
options.home.services.playerctld.enable = mkEnableOption "Enable playerctld daemon";
config.services.playerctld.enable = cfg.enable;
}

Some files were not shown because too many files have changed in this diff Show More