This commit is contained in:
twoneis 2024-08-02 23:49:06 +02:00
parent 16fa4956e5
commit a5b5ea7f59
28 changed files with 164 additions and 123 deletions

View file

@ -1,12 +1,11 @@
{ ... }: { { ... }: {
full = true; conf = {
apps.enable = true;
withNiri = true; niri.enable = true;
containers.enable = true;
withContainers = true;
hwmonPath = "/sys/class/hwmon/hwmon1/temp1_input"; hwmonPath = "/sys/class/hwmon/hwmon1/temp1_input";
stateVersion = "24.05"; stateVersion = "24.05";
hmStateVersion = "24.11"; hmStateVersion = "24.11";
};
} }

View file

@ -1,13 +1,12 @@
{ ... }: { { ... }: {
full = true; conf = {
apps.enable = true;
withNiri = true; niri.enable = true;
games.enable = true;
withGames = true; secureboot.enable = true;
withSecureBoot = true;
hwmonPath = "/sys/class/hwmon/hwmon1/temp1_input"; hwmonPath = "/sys/class/hwmon/hwmon1/temp1_input";
stateVersion = "24.05"; stateVersion = "24.05";
hmStateVersion = "24.11"; hmStateVersion = "24.11";
};
} }

View file

@ -1,4 +1,6 @@
{ ... }: { { ... }: {
conf = {
stateVersion = "24.05"; stateVersion = "24.05";
hmStateVersion = "24.11"; hmStateVersion = "24.11";
};
} }

16
disks.nix Normal file
View file

@ -0,0 +1,16 @@
{ lib, ... }: let
inherit (lib) mkOption;
inherit (lib.types) attrsOf str;
in {
options = {
disks = mkOption {
type = attrsOf str;
default = { };
example = {
boot = "4672-C1A9";
crypt = "747ae319-f189-44f5-9737-a42672e2c02d";
root = "04255623-c061-4cf0-89fa-b3d8eb239d59";
};
};
};
}

View file

@ -1,7 +1,7 @@
{ lib, ... }: let { lib, ... }: let
inherit (lib) mkOption; inherit (lib) mkOption;
inherit (lib.types) attrsOf str; inherit (lib.types) attrsOf str;
in { in{
options = { options = {
keys = mkOption { keys = mkOption {
type = attrsOf str; type = attrsOf str;

View file

@ -1,4 +1,7 @@
{ lib, config, pkgs, ... }: { { lib, config, pkgs, ... }: let
inherit (lib) mkIf;
inherit (config) conf;
in {
imports = [ imports = [
./media.nix ./media.nix
./notes.nix ./notes.nix
@ -6,7 +9,7 @@
./themes.nix ./themes.nix
]; ];
config = lib.mkIf config.full { config = mkIf conf.apps.enable {
# Audio # Audio
security.rtkit.enable = true; security.rtkit.enable = true;
@ -30,7 +33,7 @@
}; };
}; };
home-manager.users.${config.username}.home.packages = [ pkgs.overskride ]; home-manager.users.${conf.username}.home.packages = [ pkgs.overskride ];
services.blueman.enable = true; services.blueman.enable = true;
}; };

View file

@ -1,6 +1,9 @@
{ inputs, lib, config, pkgs, ... }: lib.mkIf config.full { { inputs, lib, config, pkgs, ... }: let
inherit (lib) mkIf;
inherit (config) conf;
in mkIf conf.apps.enable {
nixpkgs.overlays = [ inputs.nur.overlay ]; nixpkgs.overlays = [ inputs.nur.overlay ];
home-manager.users.${config.username} = { home-manager.users.${conf.username} = {
programs.firefox = { programs.firefox = {
enable = true; enable = true;
profiles = { profiles = {

17
modules/apps/media.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, lib, pkgs, ... }: let
inherit (lib) mkIf;
inherit (config) conf;
in mkIf conf.apps.enable {
home-manager.users.${conf.username} = {
home.packages = with pkgs; [
loupe
spotify
amberol
];
programs.mpv = {
enable = true;
};
};
}

View file

@ -1,5 +1,8 @@
{ lib, config, ... }: lib.mkIf config.full { { lib, config, ... }: let
home-manager.users.${config.username} = { inherit (lib) mkIf;
inherit (config) conf;
in mkIf conf.apps.enable {
home-manager.users.${conf.username} = {
home.packages = [ home.packages = [
]; ];

View file

@ -1,15 +1,18 @@
{ lib, config, pkgs, ... }: { { lib, config, pkgs, ... }: let
inherit (lib) mkIf;
inherit (config) conf;
in {
imports = [ imports = [
./firefox.nix ./firefox.nix
]; ];
config = lib.mkIf config.full { config = mkIf conf.apps.enable {
services = { services = {
# Needed for some features in nautilus such as auto-mounting and trash # Needed for some features in nautilus such as auto-mounting and trash
gvfs.enable = true; gvfs.enable = true;
}; };
home-manager.users.${config.username} = { home-manager.users.${conf.username} = {
home.packages = with pkgs; [ home.packages = with pkgs; [
signal-desktop signal-desktop
vesktop vesktop

View file

@ -1,5 +1,8 @@
{ lib, config, pkgs, ... }: lib.mkIf config.full { { lib, config, pkgs, ... }: let
home-manager.users.${config.username} = { inherit (lib) mkIf;
inherit (config) conf;
in mkIf conf.apps.enable {
home-manager.users.${conf.username} = {
home.packages = with pkgs; [ home.packages = with pkgs; [
adwaita-icon-theme adwaita-icon-theme
adwaita-qt adwaita-qt

View file

@ -1,4 +1,7 @@
{ lib, config, pkgs, ... }: lib.mkIf config.withContainers { { lib, config, pkgs, ... }: let
inherit (lib) mkIf;
inherit (config) conf;
in mkIf conf.containers.enable {
virtualisation.podman = { virtualisation.podman = {
enable = true; enable = true;
dockerCompat = true; dockerCompat = true;

View file

@ -1,5 +1,8 @@
{ lib, config, ... }: { { config, ... }: let
inherit (config) conf;
in {
imports = [ imports = [
./apps
./containers ./containers
./fonts ./fonts
./games ./games
@ -10,7 +13,6 @@
./niri ./niri
./nix ./nix
./secureboot ./secureboot
./user
./utils ./utils
./vm ./vm
]; ];
@ -29,11 +31,11 @@
}; };
}; };
users.users.${config.username}= { users.users.${conf.username}= {
isNormalUser = true; isNormalUser = true;
description = config.username; description = conf.username;
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];
}; };
system.stateVersion = config.stateVersion; system.stateVersion = conf.stateVersion;
} }

View file

@ -1,5 +1,6 @@
{ lib, config, pkgs, ... }: let { lib, config, pkgs, ... }: let
inherit (lib) mkIf mkMerge; inherit (lib) mkIf mkMerge;
inherit (config) conf;
holo-script = pkgs.writeShellApplication { holo-script = pkgs.writeShellApplication {
name = "holo-script"; name = "holo-script";
runtimeInputs = [ pkgs.steam pkgs.gamescope ]; runtimeInputs = [ pkgs.steam pkgs.gamescope ];
@ -12,9 +13,9 @@
desktopName = "Holo"; desktopName = "Holo";
exec = "${holo-script}/bin/holo-script"; exec = "${holo-script}/bin/holo-script";
}; };
in mkIf config.withGames (mkMerge [ in mkIf conf.games.enable (mkMerge [
(mkIf config.withImpermanence { (mkIf conf.impermanence.enable {
environment.persistence."/persist".users.${config.username}= { environment.persistence."/persist".users.${conf.username}= {
directories = [ directories = [
"Games" "Games"
".steam" ".steam"
@ -26,7 +27,7 @@ in mkIf config.withGames (mkMerge [
programs.gamescope.enable = true; programs.gamescope.enable = true;
programs.gamemode.enable = true; programs.gamemode.enable = true;
home-manager.users.${config.username} = { home-manager.users.${conf.username} = {
home.packages = [ home.packages = [
pkgs.prismlauncher pkgs.prismlauncher
holo holo

View file

@ -1,14 +1,16 @@
{ config, ... }: { { config, ... }: let
inherit (config) conf;
in{
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
users.${config.username} = { users.${conf.username} = {
home = { home = {
username = "twoneis"; username = "twoneis";
homeDirectory = "/home/${config.username}"; homeDirectory = "/home/${conf.username}";
stateVersion = config.hmStateVersion; stateVersion = conf.hmStateVersion;
}; };
programs.home-manager.enable = true; programs.home-manager.enable = true;

View file

@ -1,4 +1,7 @@
{ lib, config, ... }: lib.mkIf config.withImpermanence { { lib, config, ... }: let
inherit (lib) mkIf;
inherit (config) conf;
in mkIf conf.impermanence.enable {
environment.persistence."/persist" = { environment.persistence."/persist" = {
enable = true; enable = true;
directories = [ directories = [
@ -14,7 +17,7 @@
"/etc/shadow" "/etc/shadow"
]; ];
users.${config.username}= { users.${conf.username}= {
directories = [ directories = [
"Documents" "Documents"
"Pictures" "Pictures"

View file

@ -1,5 +1,7 @@
{ config, pkgs, ... }: { { config, pkgs, ... }: let
home-manager.users.${config.username}.home.packages = [ pkgs.networkmanagerapplet ]; inherit (config) conf;
in{
home-manager.users.${conf.username}.home.packages = [ pkgs.networkmanagerapplet ];
networking = { networking = {
networkmanager = { networkmanager = {
enable = true; enable = true;

View file

@ -1,13 +1,13 @@
{ inputs, lib, config, pkgs, ... }: let { inputs, lib, config, pkgs, ... }: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (config) withNiri username; inherit (config) conf;
in { in {
imports = [ imports = [
./xwl-satellite.service.nix ./xwl-satellite.service.nix
]; ];
config = mkIf withNiri { config = mkIf conf.niri.enable {
nixpkgs.overlays = mkIf config.withNiri [ nixpkgs.overlays = [
inputs.niri.overlays.niri inputs.niri.overlays.niri
]; ];
@ -26,7 +26,7 @@ in {
lidSwitch = "suspend"; lidSwitch = "suspend";
}; };
home-manager.users.${username} = { home-manager.users.${conf.username} = {
home.packages = with pkgs; [ home.packages = with pkgs; [
brightnessctl brightnessctl
swaybg swaybg

View file

@ -1,7 +1,7 @@
{ lib, config, pkgs, ... }: let { lib, config, pkgs, ... }: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (config) withNiri; inherit (config) conf;
in mkIf withNiri { in mkIf conf.niri.enable {
environment.systemPackages = with pkgs; [ xwayland-satellite xwayland ]; environment.systemPackages = with pkgs; [ xwayland-satellite xwayland ];
systemd.user.services.xwayland-satellite = { systemd.user.services.xwayland-satellite = {
description = "Xwayland outside your Wayland"; description = "Xwayland outside your Wayland";

View file

@ -1,6 +1,7 @@
{ lib, config, pkgs, ... }: let { lib, config, pkgs, ... }: let
inherit (lib) mkIf mkForce; inherit (lib) mkIf mkForce;
in mkIf config.withSecureBoot { inherit (config) conf;
in mkIf conf.secureboot.enable {
environment.systemPackages = [ pkgs.sbctl ]; environment.systemPackages = [ pkgs.sbctl ];
boot.loader.systemd-boot.enable = mkForce false; boot.loader.systemd-boot.enable = mkForce false;

View file

@ -1,14 +0,0 @@
{ config, lib, pkgs, ... }: lib.mkIf config.full {
home-manager.users.${config.username} = {
home.packages = with pkgs; [
loupe
spotify
amberol
];
programs.mpv = {
enable = true;
};
};
}

View file

@ -1,8 +1,10 @@
{ config, pkgs, ... }: { { config, pkgs, ... }: let
inherit (config) conf;
in {
programs.fish.enable = true; programs.fish.enable = true;
users.defaultUserShell = pkgs.fish; users.defaultUserShell = pkgs.fish;
home-manager.users.${config.username} = { home-manager.users.${conf.username} = {
home.packages = with pkgs; [ home.packages = with pkgs; [
man-pages man-pages
man-pages-posix man-pages-posix

View file

@ -1,5 +1,8 @@
{ lib, config, ... }: lib.mkIf config.withVM { { lib, config, ... }: let
inherit (lib) mkIf;
inherit (config) conf;
in mkIf conf.vm.enable {
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true; programs.virt-manager.enable = true;
users.users.${config.username}.extraGroups = [ "libvirtd" ]; users.users.${conf.username}.extraGroups = [ "libvirtd" ];
} }

View file

@ -1,30 +1,16 @@
{ lib, ... }: { { lib, ... }: let
options = let
inherit (lib) mkOption mkEnableOption; inherit (lib) mkOption mkEnableOption;
inherit (lib.types) nullOr attrsOf str; inherit (lib.types) nullOr str;
in { in {
full = mkEnableOption "Enable complete configuration for end-user machine"; options = {
conf = {
withNiri = mkEnableOption "Enable niri compositor"; apps.enable = mkEnableOption "Enable complete configuration for end-user machine";
niri.enable = mkEnableOption "Enable niri compositor";
withVM = lib.mkEnableOption "Enable VM related configuration"; vm.enable = lib.mkEnableOption "Enable VM related configuration";
withContainers = mkEnableOption "Enable container support"; containers.enable = mkEnableOption "Enable container support";
games.enable = mkEnableOption "Enable games";
withGames = mkEnableOption "Enable games"; impermanence.enable = mkEnableOption "Use impermanence module";
secureboot.enable = mkEnableOption "Enable secure boot utilities (manual key-enrolling required)";
withImpermanence = mkEnableOption "Use impermanence module";
withSecureBoot = mkEnableOption "Enable secure boot utilities (manual key-enrolling required)";
disks = mkOption {
type = attrsOf str;
default = { };
example = {
boot = "4672-C1A9";
crypt = "747ae319-f189-44f5-9737-a42672e2c02d";
root = "04255623-c061-4cf0-89fa-b3d8eb239d59";
};
};
username = mkOption { username = mkOption {
type = str; type = str;
@ -50,4 +36,5 @@
example = "24.11"; example = "24.11";
}; };
}; };
};
} }

View file

@ -1,9 +1,10 @@
{ nixpkgs, lix, home-manager, nixos-hardware, niri, impermanence, lanzaboote, ... }@inputs: let { nixpkgs, lix, home-manager, nixos-hardware, niri, impermanence, lanzaboote, ... }@inputs: let
modules = [ modules = [
./modules ./modules
./options.nix
./colors.nix ./colors.nix
./disks.nix
./keys.nix ./keys.nix
./options.nix
niri.nixosModules.niri niri.nixosModules.niri
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
lix.nixosModules.default lix.nixosModules.default