refactor: [WIP] add hm and server profiles

This commit is contained in:
Leon Schwarzäugl 2025-04-03 00:20:26 +02:00
parent bd95ef4c9b
commit 9034735f84
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
38 changed files with 2559 additions and 2178 deletions

View file

@ -807,6 +807,7 @@ My work machine. Built for more security, this is the gold standard of my config
isBtrfs = true; isBtrfs = true;
isLinux = true; isLinux = true;
sharescreen = "eDP-2"; sharescreen = "eDP-2";
profiles.personal = true;
}; };
in in
{ {
@ -829,6 +830,7 @@ My work machine. Built for more security, this is the gold standard of my config
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ {
home-manager.users."${primaryUser}".imports = [ home-manager.users."${primaryUser}".imports = [
"${self}/profiles/home"
"${modulesPath}/home/optional/gaming.nix" "${modulesPath}/home/optional/gaming.nix"
"${modulesPath}/home/optional/work.nix" "${modulesPath}/home/optional/work.nix"
]; ];
@ -892,7 +894,6 @@ My work machine. Built for more security, this is the gold standard of my config
swarselsystems = lib.recursiveUpdate swarselsystems = lib.recursiveUpdate
{ {
profiles.personal = true;
wallpaper = self + /wallpaper/lenovowp.png; wallpaper = self + /wallpaper/lenovowp.png;
hasBluetooth = true; hasBluetooth = true;
hasFingerprint = true; hasFingerprint = true;
@ -902,7 +903,9 @@ My work machine. Built for more security, this is the gold standard of my config
} }
sharedOptions; sharedOptions;
home-manager.users."${primaryUser}".swarselsystems = lib.recursiveUpdate home-manager.users."${primaryUser}" = {
home.stateVersion = lib.mkForce "23.05";
swarselsystems = lib.recursiveUpdate
{ {
isLaptop = true; isLaptop = true;
isNixos = true; isNixos = true;
@ -1030,6 +1033,7 @@ My work machine. Built for more security, this is the gold standard of my config
}; };
} }
sharedOptions; sharedOptions;
};
} }
@ -3805,10 +3809,11 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
#+begin_src nix :tangle profiles/nixos/default.nix #+begin_src nix :tangle profiles/nixos/default.nix
{ lib, ... }: { lib, ... }:
let let
moduleNames = lib.swarselsystems.readNix "profiles/nixos"; profileNames = lib.swarselsystems.readNix "profiles/nixos";
in in
lib.swarselsystems.mkProfiles moduleNames "nixos" {
imports = lib.swarselsystems.mkImports profileNames "profiles/nixos";
}
#+end_src #+end_src
***** Personal ***** Personal
@ -3816,9 +3821,9 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
#+begin_src nix :tangle profiles/nixos/personal/default.nix :mkdirp yes #+begin_src nix :tangle profiles/nixos/personal/default.nix :mkdirp yes
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.profiles.personalz = lib.mkEnableOption "is this a personal host"; options.swarselsystems.profiles.personal = lib.mkEnableOption "is this a personal host";
config = lib.mkIf config.swarselsystems.profiles.personalz { config = lib.mkIf config.swarselsystems.profiles.personal {
config.swarselsystems.modules = { swarselsystems.modules = {
packages = lib.mkDefault true; packages = lib.mkDefault true;
general = lib.mkDefault true; general = lib.mkDefault true;
home-manager = lib.mkDefault true; home-manager = lib.mkDefault true;
@ -3868,6 +3873,78 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
#+end_src #+end_src
***** Local Server
#+begin_src nix :tangle profiles/nixos/localserver/default.nix :mkdirp yes
{ lib, config, ... }:
{
options.swarselsystems.profiles.server.local = lib.mkEnableOption "is this a local server";
config = lib.mkIf config.swarselsystems.profiles.server.local {
swarselsystems = {
# common modules
modules = {
nix-ld = lib.mkDefault true;
home-manager = lib.mkDefault true;
home-managerExtra = lib.mkDefault true;
xserver = lib.mkDefault true;
gc = lib.mkDefault true;
storeOptimize = lib.mkDefault true;
time = lib.mkDefault true;
users = lib.mkDefault true;
};
# server modules
# server = {
# kavita = lib.mkDefault true;
# jellyfin = lib.mkDefault true;
# navidrome = lib.mkDefault true;
# spotifyd = lib.mkDefault true;
# mpd = lib.mkDefault true;
# matrix = lib.mkDefault true;
# nextcloud = lib.mkDefault true;
# immich = lib.mkDefault true;
# paperless = lib.mkDefault true;
# transmission = lib.mkDefault true;
# syncthing = lib.mkDefault true;
# monitoring = lib.mkDefault true;
# emacs = lib.mkDefault true;
# freshrss = lib.mkDefault true;
# };
};
};
}
#+end_src
***** OCI Sync Server
#+begin_src nix :tangle profiles/nixos/syncserver/default.nix :mkdirp yes
{ lib, config, ... }:
{
options.swarselsystems.profiles.server.sync = lib.mkEnableOption "is this a oci sync server";
config = lib.mkIf config.swarselsystems.profiles.server.sync {
swarselsystems = {
# common modules
modules = {
nix-ld = lib.mkDefault true;
home-manager = lib.mkDefault true;
home-managerExtra = lib.mkDefault true;
xserver = lib.mkDefault true;
gc = lib.mkDefault true;
storeOptimize = lib.mkDefault true;
time = lib.mkDefault true;
users = lib.mkDefault true;
};
# server modules
# server = {
# forgejo = lib.mkDefault true;
# ankisync = lib.mkDefault true;
# };
};
};
}
#+end_src
**** home-manager **** home-manager
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:ced5841f-c088-4d88-b3a1-7d62aad8837b :CUSTOM_ID: h:ced5841f-c088-4d88-b3a1-7d62aad8837b
@ -3878,9 +3955,53 @@ This holds modules that are to be used on most hosts. These are also the most im
#+BEGIN_src nix :tangle profiles/home/default.nix #+BEGIN_src nix :tangle profiles/home/default.nix
{ lib, ... }: { lib, ... }:
let let
moduleNames = lib.swarselsystems.readNix "profiles/home"; profileNames = lib.swarselsystems.readNix "profiles/home";
in in
lib.swarselsystems.mkProfiles moduleNames "home" {
imports = lib.swarselsystems.mkImports profileNames "profiles/home";
}
#+end_src
***** Personal
#+begin_src nix :tangle profiles/home/personal/default.nix :mkdirp yes
{ lib, config, ... }:
{
options.swarselsystems.profiles.personal = lib.mkEnableOption "is this a personal host";
config = lib.mkIf config.swarselsystems.profiles.personal {
swarselsystems.modules = {
packages = lib.mkDefault true;
ownpackages = lib.mkDefault true;
general = lib.mkDefault true;
nixgl = lib.mkDefault true;
sops = lib.mkDefault true;
yubikey = lib.mkDefault true;
ssh = lib.mkDefault true;
stylix = lib.mkDefault true;
desktop = lib.mkDefault true;
symlink = lib.mkDefault true;
env = lib.mkDefault true;
programs = lib.mkDefault true;
nix-index = lib.mkDefault true;
direnv = lib.mkDefault true;
eza = lib.mkDefault true;
git = lib.mkDefault true;
fuzzel = lib.mkDefault true;
starship = lib.mkDefault true;
kitty = lib.mkDefault true;
zsh = lib.mkDefault true;
zellij = lib.mkDefault true;
tmux = lib.mkDefault true;
mail = lib.mkDefault true;
emacs = lib.mkDefault true;
waybar = lib.mkDefault true;
firefox = lib.mkDefault true;
gnome-keyring = lib.mkDefault true;
};
};
}
#+end_src #+end_src
*** Library functions *** Library functions
@ -8014,7 +8135,7 @@ Options that I need specifically at work. There are more options at [[#h:f0b2ea9
udev.extraRules = '' udev.extraRules = ''
# share screen when dongle detected # share screen when dongle detected
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", TAG+="systemd", ENV{SYSTEMD_WANTS}="swarsel-screenshare.service" SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="343c", ATTRS{idProduct}=="0000", TAG+="systemd", ENV{SYSTEMD_WANTS}="swarsel-screenshare.service"
# lock screen when yubikey removed # lock screen when yubikey removed
ACTION=="remove", ENV{PRODUCT}=="3/1050/407/110", RUN+="${pkgs.systemd}/bin/systemctl suspend" ACTION=="remove", ENV{PRODUCT}=="3/1050/407/110", RUN+="${pkgs.systemd}/bin/systemctl suspend"
@ -8426,6 +8547,8 @@ Again, we adapt =nix= to our needs, enable the home-manager command for non-NixO
inherit (config.swarselsystems) mainUser; inherit (config.swarselsystems) mainUser;
in in
{ {
options.swarselsystems.modules.general = lib.mkEnableOption "general nix settings";
config = lib.mkIf config.swarselsystems.modules.general {
nix = lib.mkIf (!config.swarselsystems.isNixos) { nix = lib.mkIf (!config.swarselsystems.isNixos) {
settings = { settings = {
experimental-features = [ experimental-features = [
@ -8463,6 +8586,7 @@ Again, we adapt =nix= to our needs, enable the home-manager command for non-NixO
FLAKE = "/home/${mainUser}/.dotfiles"; FLAKE = "/home/${mainUser}/.dotfiles";
}; };
}; };
};
} }
#+end_src #+end_src
@ -8481,16 +8605,17 @@ It can be set to either:
- a PCI id in the form =vendor_id:device_id= - a PCI id in the form =vendor_id:device_id=
#+begin_src nix :tangle modules/home/common/nixgl.nix #+begin_src nix :tangle modules/home/common/nixgl.nix
{ lib, config, nixgl, ... }: { lib, config, nixgl, ... }:
{ {
options.swarselsystems = { options.swarselsystems = {
modules.nixgl = lib.mkEnableOption "nixgl settings";
isSecondaryGpu = lib.mkEnableOption "device has a secondary GPU"; isSecondaryGpu = lib.mkEnableOption "device has a secondary GPU";
SecondaryGpuCard = lib.mkOption { SecondaryGpuCard = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
}; };
config = { config = lib.mkIf config.swarselsystems.modules.nixgl {
nixGL = lib.mkIf (!config.swarselsystems.isNixos) { nixGL = lib.mkIf (!config.swarselsystems.isNixos) {
inherit (nixgl) packages; inherit (nixgl) packages;
defaultWrapper = lib.mkDefault "mesa"; defaultWrapper = lib.mkDefault "mesa";
@ -8506,7 +8631,7 @@ It can be set to either:
]; ];
}; };
}; };
} }
#+end_src #+end_src
**** Installed packages **** Installed packages
@ -8528,9 +8653,11 @@ Programming languages and default lsp's are defined here: [[#h:0e7e8bea-ec58-499
This holds packages that I can use as provided, or with small modifications (as in the =texlive= package that needs special configuration). This holds packages that I can use as provided, or with small modifications (as in the =texlive= package that needs special configuration).
#+begin_src nix :tangle modules/home/common/packages.nix #+begin_src nix :tangle modules/home/common/packages.nix
{ pkgs, ... }: { lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.packages = lib.mkEnableOption "packages settings";
config = lib.mkIf config.swarselsystems.modules.packages {
home.packages = with pkgs; [ home.packages = with pkgs; [
# audio stuff # audio stuff
@ -8706,7 +8833,8 @@ This holds packages that I can use as provided, or with small modifications (as
noto-fonts noto-fonts
noto-fonts-cjk-sans noto-fonts-cjk-sans
]; ];
} };
}
#+end_src #+end_src
***** Self-defined ***** Self-defined
@ -8717,9 +8845,11 @@ This holds packages that I can use as provided, or with small modifications (as
This is just a separate container for derivations defined in [[#h:64a5cc16-6b16-4802-b421-c67ccef853e1][Packages]]. This is a good idea so that I do not lose track of package names I have defined myself, as this was once a problem in the past already. This is just a separate container for derivations defined in [[#h:64a5cc16-6b16-4802-b421-c67ccef853e1][Packages]]. This is a good idea so that I do not lose track of package names I have defined myself, as this was once a problem in the past already.
#+begin_src nix :tangle modules/home/common/custom-packages.nix #+begin_src nix :tangle modules/home/common/custom-packages.nix
{ config, pkgs, ... }: { lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.ownpackages = lib.mkEnableOption "own packages settings";
config = lib.mkIf config.swarselsystems.modules.ownpackages {
home.packages = with pkgs; lib.mkIf (!config.swarselsystems.isPublic) [ home.packages = with pkgs; lib.mkIf (!config.swarselsystems.isPublic) [
pass-fuzzel pass-fuzzel
cura5 cura5
@ -8746,6 +8876,7 @@ This is just a separate container for derivations defined in [[#h:64a5cc16-6b16-
rustdesk-vbc rustdesk-vbc
]; ];
};
} }
#+end_src #+end_src
@ -8769,6 +8900,8 @@ I use sops-nix to handle secrets that I want to have available on my machines at
inherit (config.swarselsystems) homeDir xdgDir; inherit (config.swarselsystems) homeDir xdgDir;
in in
{ {
options.swarselsystems.modules.sops = lib.mkEnableOption "sops settings";
config = lib.mkIf config.swarselsystems.modules.sops {
sops = lib.mkIf (!config.swarselsystems.isPublic) { sops = lib.mkIf (!config.swarselsystems.isPublic) {
age.sshKeyPaths = [ "${homeDir}/.ssh/sops" "${homeDir}/.ssh/ssh_host_ed25519_key" ]; age.sshKeyPaths = [ "${homeDir}/.ssh/sops" "${homeDir}/.ssh/ssh_host_ed25519_key" ];
defaultSopsFile = lib.swarselsystems.mkIfElseList config.swarselsystems.isBtrfs "/persist/.dotfiles/secrets/general/secrets.yaml" "${homeDir}/.dotfiles/secrets/general/secrets.yaml"; defaultSopsFile = lib.swarselsystems.mkIfElseList config.swarselsystems.isBtrfs "/persist/.dotfiles/secrets/general/secrets.yaml" "${homeDir}/.dotfiles/secrets/general/secrets.yaml";
@ -8783,6 +8916,7 @@ I use sops-nix to handle secrets that I want to have available on my machines at
u2f_keys = { path = "${homeDir}/.config/Yubico/u2f_keys"; }; u2f_keys = { path = "${homeDir}/.config/Yubico/u2f_keys"; };
}; };
}; };
};
} }
#+end_src #+end_src
@ -8792,19 +8926,22 @@ I use sops-nix to handle secrets that I want to have available on my machines at
:END: :END:
#+begin_src nix :tangle modules/home/common/yubikey.nix #+begin_src nix :tangle modules/home/common/yubikey.nix
{ lib, nix-secrets, ... }: { lib, config, nix-secrets, ... }:
let let
secretsDirectory = builtins.toString nix-secrets; secretsDirectory = builtins.toString nix-secrets;
yubikey1 = lib.swarselsystems.getSecret "${secretsDirectory}/yubikey/yubikey1"; yubikey1 = lib.swarselsystems.getSecret "${secretsDirectory}/yubikey/yubikey1";
yubikey2 = lib.swarselsystems.getSecret "${secretsDirectory}/yubikey/yubikey2"; yubikey2 = lib.swarselsystems.getSecret "${secretsDirectory}/yubikey/yubikey2";
in in
{ {
options.swarselsystems.modules.yubikey = lib.mkEnableOption "yubikey settings";
config = lib.mkIf config.swarselsystems.modules.yubikey {
pam.yubico.authorizedYubiKeys = { pam.yubico.authorizedYubiKeys = {
ids = [ ids = [
"${yubikey1}" "${yubikey1}"
"${yubikey2}" "${yubikey2}"
]; ];
}; };
};
} }
#+end_src #+end_src
@ -8816,8 +8953,10 @@ I use sops-nix to handle secrets that I want to have available on my machines at
It is very convenient to have SSH aliases in place for machines that I use. This is mainly used for some server machines and some university clusters. We also enable agent forwarding to have our Yubikey SSH key accessible on the remote host. It is very convenient to have SSH aliases in place for machines that I use. This is mainly used for some server machines and some university clusters. We also enable agent forwarding to have our Yubikey SSH key accessible on the remote host.
#+begin_src nix :tangle modules/home/common/ssh.nix #+begin_src nix :tangle modules/home/common/ssh.nix
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.ssh = lib.mkEnableOption "ssh settings";
config = lib.mkIf config.swarselsystems.modules.ssh {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
forwardAgent = true; forwardAgent = true;
@ -8852,6 +8991,7 @@ It is very convenient to have SSH aliases in place for machines that I use. This
}; };
}; };
}; };
};
} }
#+end_src #+end_src
@ -8869,12 +9009,15 @@ This section has been notably empty ever since switching to stylix. Only Emacs i
#+begin_src nix :noweb yes :tangle modules/home/common/stylix.nix #+begin_src nix :noweb yes :tangle modules/home/common/stylix.nix
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.modules.stylix = lib.mkEnableOption "stylix settings";
config = lib.mkIf config.swarselsystems.modules.stylix {
stylix = lib.mkIf (!config.swarselsystems.isNixos) (lib.recursiveUpdate stylix = lib.mkIf (!config.swarselsystems.isNixos) (lib.recursiveUpdate
{ {
image = config.swarselsystems.wallpaper; image = config.swarselsystems.wallpaper;
targets = config.swarselsystems.stylixHomeTargets; targets = config.swarselsystems.stylixHomeTargets;
} }
config.swarselsystems.stylix); config.swarselsystems.stylix);
};
} }
#+end_src #+end_src
@ -8888,9 +9031,10 @@ Some programs lack a dmenu launcher - I define them myself here.
TODO: Non-NixOS machines (=sp3) should not use these by default, but instead the programs prefixed with "nixGL". I need to figure out how to automate this process, as it is not feasible to write desktop entries for all programs installed on that machine. TODO: Non-NixOS machines (=sp3) should not use these by default, but instead the programs prefixed with "nixGL". I need to figure out how to automate this process, as it is not feasible to write desktop entries for all programs installed on that machine.
#+begin_src nix :tangle modules/home/common/desktop.nix #+begin_src nix :tangle modules/home/common/desktop.nix
{ lib, config, ... }:
_:
{ {
options.swarselsystems.modules.desktop = lib.mkEnableOption "desktop settings";
config = lib.mkIf config.swarselsystems.modules.desktop {
xdg.desktopEntries = { xdg.desktopEntries = {
cura = { cura = {
@ -8980,6 +9124,7 @@ TODO: Non-NixOS machines (=sp3) should not use these by default, but instead the
}; };
}; };
}; };
};
} }
#+end_src #+end_src
@ -8996,8 +9141,10 @@ Also, we link some files to the users XDG configuration home:
Also in firefox `about:config > toolkit.legacyUserProfileCustomizations.stylesheets` to true. Also in firefox `about:config > toolkit.legacyUserProfileCustomizations.stylesheets` to true.
#+begin_src nix :tangle modules/home/common/symlink.nix #+begin_src nix :tangle modules/home/common/symlink.nix
{ self, lib, ... }: { self, lib, config, ... }:
{ {
options.swarselsystems.modules.symlink = lib.mkEnableOption "symlink settings";
config = lib.mkIf config.swarselsystems.modules.symlink {
home.file = { home.file = {
"init.el" = lib.mkDefault { "init.el" = lib.mkDefault {
source = self + /programs/emacs/init.el; source = self + /programs/emacs/init.el;
@ -9024,6 +9171,7 @@ Also in firefox `about:config > toolkit.legacyUserProfileCustomizations.styleshe
"tridactyl/themes/swarsel.css".source = self + /programs/firefox/tridactyl/themes/swarsel.css; "tridactyl/themes/swarsel.css".source = self + /programs/firefox/tridactyl/themes/swarsel.css;
"swayidle/config".source = self + /programs/swayidle/config; "swayidle/config".source = self + /programs/swayidle/config;
}; };
};
} }
#+end_src #+end_src
@ -9046,6 +9194,8 @@ Sets environment variables. Here I am only setting the EDITOR variable, most var
allMailAddresses = lib.swarselsystems.getSecret "${secretsDirectory}/mail/list"; allMailAddresses = lib.swarselsystems.getSecret "${secretsDirectory}/mail/list";
in in
{ {
options.swarselsystems.modules.env = lib.mkEnableOption "env settings";
config = lib.mkIf config.swarselsystems.modules.env {
home.sessionVariables = { home.sessionVariables = {
EDITOR = "e -w"; EDITOR = "e -w";
DISPLAY = ":0"; DISPLAY = ":0";
@ -9060,6 +9210,7 @@ Sets environment variables. Here I am only setting the EDITOR variable, most var
SWARSEL_FULLNAME = fullName; SWARSEL_FULLNAME = fullName;
SWARSEL_MAIL_ALL = allMailAddresses; SWARSEL_MAIL_ALL = allMailAddresses;
}; };
};
} }
#+end_src #+end_src
@ -9071,8 +9222,10 @@ Sets environment variables. Here I am only setting the EDITOR variable, most var
This section is for programs that require no further configuration. zsh Integration is enabled by default for these. This section is for programs that require no further configuration. zsh Integration is enabled by default for these.
#+begin_src nix :tangle modules/home/common/programs.nix #+begin_src nix :tangle modules/home/common/programs.nix
{ pkgs, ... }: { lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.programs = lib.mkEnableOption "programs settings";
config = lib.mkIf config.swarselsystems.modules.programs {
programs = { programs = {
bottom.enable = true; bottom.enable = true;
imv.enable = true; imv.enable = true;
@ -9092,6 +9245,7 @@ This section is for programs that require no further configuration. zsh Integrat
fzf.enable = true; fzf.enable = true;
zoxide.enable = true; zoxide.enable = true;
}; };
};
} }
#+end_src #+end_src
@ -9103,8 +9257,10 @@ This section is for programs that require no further configuration. zsh Integrat
nix-index provides a way to find out which packages are provided by which derivations. By default it also comes with a replacement for =command-not-found.sh=, however, the implementation is based on a channel based setup. I like consistency, so I replace the command with one that provides a flakes-based output. nix-index provides a way to find out which packages are provided by which derivations. By default it also comes with a replacement for =command-not-found.sh=, however, the implementation is based on a channel based setup. I like consistency, so I replace the command with one that provides a flakes-based output.
#+begin_src nix :tangle modules/home/common/nix-index.nix #+begin_src nix :tangle modules/home/common/nix-index.nix
{ self, pkgs, ... }: { self, lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.nix-index = lib.mkEnableOption "nix-index settings";
config = lib.mkIf config.swarselsystems.modules.nix-index {
programs.nix-index = programs.nix-index =
let let
commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } '' commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } ''
@ -9123,6 +9279,7 @@ nix-index provides a way to find out which packages are provided by which deriva
paths = [ commandNotFound ]; paths = [ commandNotFound ];
}; };
}; };
};
} }
#+end_src #+end_src
@ -9134,8 +9291,10 @@ nix-index provides a way to find out which packages are provided by which deriva
Enables password store with the =pass-otp= extension which allows me to store and generate one-time-passwords. Enables password store with the =pass-otp= extension which allows me to store and generate one-time-passwords.
#+begin_src nix :tangle modules/home/common/password-store.nix #+begin_src nix :tangle modules/home/common/password-store.nix
{ pkgs, ... }: { lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.passwordstore = lib.mkEnableOption "passwordstore settings";
config = lib.mkIf config.swarselsystems.modules.passwordstore {
programs.password-store = { programs.password-store = {
enable = true; enable = true;
settings = { settings = {
@ -9143,6 +9302,7 @@ Enables password store with the =pass-otp= extension which allows me to store an
}; };
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]); package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
}; };
};
} }
#+end_src #+end_src
@ -9154,13 +9314,16 @@ Enables password store with the =pass-otp= extension which allows me to store an
Enables direnv, which I use for nearly all of my nix dev flakes. Enables direnv, which I use for nearly all of my nix dev flakes.
#+begin_src nix :tangle modules/home/common/direnv.nix #+begin_src nix :tangle modules/home/common/direnv.nix
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.direnv = lib.mkEnableOption "direnv settings";
config = lib.mkIf config.swarselsystems.modules.direnv {
programs.direnv = { programs.direnv = {
enable = true; enable = true;
silent = true; silent = true;
nix-direnv.enable = true; nix-direnv.enable = true;
}; };
};
} }
#+end_src #+end_src
@ -9172,8 +9335,10 @@ Enables direnv, which I use for nearly all of my nix dev flakes.
Eza provides me with a better =ls= command and some other useful aliases. Eza provides me with a better =ls= command and some other useful aliases.
#+begin_src nix :tangle modules/home/common/eza.nix #+begin_src nix :tangle modules/home/common/eza.nix
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.eza = lib.mkEnableOption "eza settings";
config = lib.mkIf config.swarselsystems.modules.eza {
programs.eza = { programs.eza = {
enable = true; enable = true;
icons = "auto"; icons = "auto";
@ -9183,6 +9348,7 @@ Eza provides me with a better =ls= command and some other useful aliases.
"--group-directories-first" "--group-directories-first"
]; ];
}; };
};
} }
#+end_src #+end_src
@ -9194,13 +9360,15 @@ Eza provides me with a better =ls= command and some other useful aliases.
Here I set up my git config, automatic signing of commits, useful aliases for my ost used commands (for when I am not using [[#h:d2c7323d-f8c6-4f23-b70a-930e3e4ecce5][Magit]]) as well as a git template defined in [[#h:5ef03803-e150-41bc-b603-e80d60d96efc][Linking dotfiles]]. Here I set up my git config, automatic signing of commits, useful aliases for my ost used commands (for when I am not using [[#h:d2c7323d-f8c6-4f23-b70a-930e3e4ecce5][Magit]]) as well as a git template defined in [[#h:5ef03803-e150-41bc-b603-e80d60d96efc][Linking dotfiles]].
#+begin_src nix :tangle modules/home/common/git.nix #+begin_src nix :tangle modules/home/common/git.nix
{ lib, nix-secrets, ... }: { lib, config, nix-secrets, ... }:
let let
secretsDirectory = builtins.toString nix-secrets; secretsDirectory = builtins.toString nix-secrets;
leonMail = lib.swarselsystems.getSecret "${secretsDirectory}/mail/leon"; leonMail = lib.swarselsystems.getSecret "${secretsDirectory}/mail/leon";
fullName = lib.swarselsystems.getSecret "${secretsDirectory}/info/fullname"; fullName = lib.swarselsystems.getSecret "${secretsDirectory}/info/fullname";
in in
{ {
options.swarselsystems.modules.git = lib.mkEnableOption "git settings";
config = lib.mkIf config.swarselsystems.modules.git {
programs.git = { programs.git = {
enable = true; enable = true;
aliases = { aliases = {
@ -9237,6 +9405,7 @@ Here I set up my git config, automatic signing of commits, useful aliases for my
} }
]; ];
}; };
};
} }
#+end_src #+end_src
@ -9248,8 +9417,10 @@ Here I set up my git config, automatic signing of commits, useful aliases for my
Here I only need to set basic layout options - the rest is being managed by stylix. Here I only need to set basic layout options - the rest is being managed by stylix.
#+begin_src nix :tangle modules/home/common/fuzzel.nix #+begin_src nix :tangle modules/home/common/fuzzel.nix
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.fuzzel = lib.mkEnableOption "fuzzel settings";
config = lib.mkIf config.swarselsystems.modules.fuzzel {
programs.fuzzel = { programs.fuzzel = {
enable = true; enable = true;
settings = { settings = {
@ -9261,6 +9432,7 @@ Here I only need to set basic layout options - the rest is being managed by styl
border.radius = "0"; border.radius = "0";
}; };
}; };
};
} }
#+end_src #+end_src
@ -9272,8 +9444,10 @@ Here I only need to set basic layout options - the rest is being managed by styl
Starship makes my =zsh= look cooler! I have symbols for most programming languages and toolchains, also I build my own powerline. Starship makes my =zsh= look cooler! I have symbols for most programming languages and toolchains, also I build my own powerline.
#+begin_src nix :tangle modules/home/common/starship.nix #+begin_src nix :tangle modules/home/common/starship.nix
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.starship = lib.mkEnableOption "starship settings";
config = lib.mkIf config.swarselsystems.modules.starship {
programs.starship = { programs.starship = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
@ -9392,6 +9566,7 @@ Starship makes my =zsh= look cooler! I have symbols for most programming languag
scala.symbol = " "; scala.symbol = " ";
}; };
}; };
};
} }
#+end_src #+end_src
@ -9405,8 +9580,10 @@ Kitty is the terminal emulator of choice for me, it is nice to configure using n
The theme is handled by stylix. The theme is handled by stylix.
#+begin_src nix :tangle modules/home/common/kitty.nix #+begin_src nix :tangle modules/home/common/kitty.nix
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.kitty = lib.mkEnableOption "kitty settings";
config = lib.mkIf config.swarselsystems.modules.kitty {
programs.kitty = { programs.kitty = {
enable = true; enable = true;
keybindings = { }; keybindings = { };
@ -9416,6 +9593,7 @@ The theme is handled by stylix.
notify_on_cmd_finish = "always 20"; notify_on_cmd_finish = "always 20";
}; };
}; };
};
} }
#+end_src #+end_src
@ -9435,12 +9613,13 @@ Here we set some aliases (some of them should be shellApplications instead) as w
in in
{ {
options.swarselsystems = { options.swarselsystems = {
modules.zsh = lib.mkEnableOption "zsh settings";
shellAliases = lib.mkOption { shellAliases = lib.mkOption {
type = lib.types.attrsOf lib.types.str; type = lib.types.attrsOf lib.types.str;
default = { }; default = { };
}; };
}; };
config = { config = lib.mkIf config.swarselsystems.modules.zsh {
programs.zsh = { programs.zsh = {
enable = true; enable = true;
shellAliases = lib.recursiveUpdate shellAliases = lib.recursiveUpdate
@ -9548,9 +9727,10 @@ Here we set some aliases (some of them should be shellApplications instead) as w
:CUSTOM_ID: h:00de4901-631c-4b4c-86ce-d9d6e62ed8c7 :CUSTOM_ID: h:00de4901-631c-4b4c-86ce-d9d6e62ed8c7
:END: :END:
#+begin_src nix :tangle modules/home/common/zellij.nix #+begin_src nix :tangle modules/home/common/zellij.nix
{ self, config, pkgs, ... }: { self, lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.zellij = lib.mkEnableOption "zellij settings";
config = lib.mkIf config.swarselsystems.modules.zellij {
programs.zellij = { programs.zellij = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
@ -9564,6 +9744,7 @@ Here we set some aliases (some of them should be shellApplications instead) as w
"zellij/config.kdl".text = import "${self}/programs/zellij/config.kdl.nix" { inherit config; }; "zellij/config.kdl".text = import "${self}/programs/zellij/config.kdl.nix" { inherit config; };
"zellij/layouts/default.kdl".text = import "${self}/programs/zellij/layouts/default.kdl.nix" { inherit config pkgs; }; "zellij/layouts/default.kdl".text = import "${self}/programs/zellij/layouts/default.kdl.nix" { inherit config pkgs; };
}; };
};
} }
#+end_src #+end_src
@ -9572,8 +9753,7 @@ Here we set some aliases (some of them should be shellApplications instead) as w
:CUSTOM_ID: h:45de9430-f925-4df6-9db6-bffb5b8f1604 :CUSTOM_ID: h:45de9430-f925-4df6-9db6-bffb5b8f1604
:END: :END:
#+begin_src nix :tangle modules/home/common/tmux.nix #+begin_src nix :tangle modules/home/common/tmux.nix
{ lib, config, pkgs, ... }:
{ pkgs, ... }:
let let
tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin
{ {
@ -9588,7 +9768,8 @@ Here we set some aliases (some of them should be shellApplications instead) as w
}; };
in in
{ {
options.swarselsystems.modules.tmux = lib.mkEnableOption "tmux settings";
config = lib.mkIf config.swarselsystems.modules.tmux {
home.packages = with pkgs; [ home.packages = with pkgs; [
lsof lsof
sesh sesh
@ -9669,6 +9850,7 @@ Here we set some aliases (some of them should be shellApplications instead) as w
''; '';
}; };
};
} }
@ -9691,6 +9873,8 @@ Normally I use 4 mail accounts - here I set them all up. Three of them are Googl
fullName = lib.swarselsystems.getSecret "${secretsDirectory}/info/fullname"; fullName = lib.swarselsystems.getSecret "${secretsDirectory}/info/fullname";
in in
{ {
options.swarselsystems.modules.mail = lib.mkEnableOption "mail settings";
config = lib.mkIf config.swarselsystems.modules.mail {
programs = { programs = {
mbsync = { mbsync = {
enable = true; enable = true;
@ -9825,6 +10009,7 @@ Normally I use 4 mail accounts - here I set them all up. Three of them are Googl
}; };
}; };
}; };
};
} }
#+end_src #+end_src
@ -9843,7 +10028,8 @@ Lastly, I am defining some more packages here that the parser has problems findi
inherit (config.swarselsystems) homeDir isPublic; inherit (config.swarselsystems) homeDir isPublic;
in in
{ {
options.swarselsystems.modules.emacs = lib.mkEnableOption "emacs settings";
config = lib.mkIf config.swarselsystems.modules.emacs {
# needed for elfeed # needed for elfeed
sops.secrets.fever = lib.mkIf (!isPublic) { path = "${homeDir}/.emacs.d/.fever"; }; sops.secrets.fever = lib.mkIf (!isPublic) { path = "${homeDir}/.emacs.d/.fever"; };
@ -9914,6 +10100,7 @@ Lastly, I am defining some more packages here that the parser has problems findi
socketActivation.enable = false; socketActivation.enable = false;
startWithUserSession = "graphical"; startWithUserSession = "graphical";
}; };
};
} }
#+end_src #+end_src
@ -9957,6 +10144,7 @@ The rest of the related configuration is found here:
in in
{ {
options.swarselsystems = { options.swarselsystems = {
modules.waybar = lib.mkEnableOption "waybar settings";
cpuCount = lib.mkOption { cpuCount = lib.mkOption {
type = lib.types.int; type = lib.types.int;
default = 8; default = 8;
@ -9985,7 +10173,7 @@ The rest of the related configuration is found here:
internal = true; internal = true;
}; };
}; };
config = { config = lib.mkIf config.swarselsystems.modules.waybar {
swarselsystems = { swarselsystems = {
waybarModules = lib.mkIf config.swarselsystems.isLaptop (modulesLeft ++ [ waybarModules = lib.mkIf config.swarselsystems.isLaptop (modulesLeft ++ [
"battery" "battery"
@ -10260,6 +10448,8 @@ I used to build the firefox addon =bypass-paywalls-clean= myself here, but the m
#+begin_src nix :tangle modules/home/common/firefox.nix #+begin_src nix :tangle modules/home/common/firefox.nix
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
options.swarselsystems.modules.firefox = lib.mkEnableOption "firefox settings";
config = lib.mkIf config.swarselsystems.modules.firefox {
programs.firefox = { programs.firefox = {
enable = true; enable = true;
package = pkgs.firefox; # uses overrides package = pkgs.firefox; # uses overrides
@ -10404,6 +10594,7 @@ I used to build the firefox addon =bypass-paywalls-clean= myself here, but the m
config.swarselsystems.firefox; config.swarselsystems.firefox;
}; };
}; };
};
} }
#+end_src #+end_src
@ -10424,9 +10615,12 @@ Used for storing sessions in e.g. Nextcloud
#+begin_src nix :tangle modules/home/common/gnome-keyring.nix #+begin_src nix :tangle modules/home/common/gnome-keyring.nix
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.modules.gnome-keyring = lib.mkEnableOption "gnome keyring settings";
config = lib.mkIf config.swarselsystems.modules.gnome-keyring {
services.gnome-keyring = lib.mkIf (!config.swarselsystems.isNixos) { services.gnome-keyring = lib.mkIf (!config.swarselsystems.isNixos) {
enable = true; enable = true;
}; };
};
} }
#+end_src #+end_src

View file

@ -6,6 +6,7 @@ let
isBtrfs = true; isBtrfs = true;
isLinux = true; isLinux = true;
sharescreen = "eDP-2"; sharescreen = "eDP-2";
profiles.personal = true;
}; };
in in
{ {
@ -28,6 +29,7 @@ in
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ {
home-manager.users."${primaryUser}".imports = [ home-manager.users."${primaryUser}".imports = [
"${self}/profiles/home"
"${modulesPath}/home/optional/gaming.nix" "${modulesPath}/home/optional/gaming.nix"
"${modulesPath}/home/optional/work.nix" "${modulesPath}/home/optional/work.nix"
]; ];
@ -91,7 +93,6 @@ in
swarselsystems = lib.recursiveUpdate swarselsystems = lib.recursiveUpdate
{ {
profiles.personal = true;
wallpaper = self + /wallpaper/lenovowp.png; wallpaper = self + /wallpaper/lenovowp.png;
hasBluetooth = true; hasBluetooth = true;
hasFingerprint = true; hasFingerprint = true;
@ -101,7 +102,9 @@ in
} }
sharedOptions; sharedOptions;
home-manager.users."${primaryUser}".swarselsystems = lib.recursiveUpdate home-manager.users."${primaryUser}" = {
home.stateVersion = lib.mkForce "23.05";
swarselsystems = lib.recursiveUpdate
{ {
isLaptop = true; isLaptop = true;
isNixos = true; isNixos = true;
@ -229,4 +232,5 @@ in
}; };
} }
sharedOptions; sharedOptions;
};
} }

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }: { lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.ownpackages = lib.mkEnableOption "own packages settings";
config = lib.mkIf config.swarselsystems.modules.ownpackages {
home.packages = with pkgs; lib.mkIf (!config.swarselsystems.isPublic) [ home.packages = with pkgs; lib.mkIf (!config.swarselsystems.isPublic) [
pass-fuzzel pass-fuzzel
cura5 cura5
@ -27,4 +29,5 @@
rustdesk-vbc rustdesk-vbc
]; ];
};
} }

View file

@ -1,5 +1,7 @@
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.desktop = lib.mkEnableOption "desktop settings";
config = lib.mkIf config.swarselsystems.modules.desktop {
xdg.desktopEntries = { xdg.desktopEntries = {
cura = { cura = {
@ -89,4 +91,5 @@ _:
}; };
}; };
}; };
};
} }

View file

@ -1,8 +1,11 @@
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.direnv = lib.mkEnableOption "direnv settings";
config = lib.mkIf config.swarselsystems.modules.direnv {
programs.direnv = { programs.direnv = {
enable = true; enable = true;
silent = true; silent = true;
nix-direnv.enable = true; nix-direnv.enable = true;
}; };
};
} }

View file

@ -3,7 +3,8 @@ let
inherit (config.swarselsystems) homeDir isPublic; inherit (config.swarselsystems) homeDir isPublic;
in in
{ {
options.swarselsystems.modules.emacs = lib.mkEnableOption "emacs settings";
config = lib.mkIf config.swarselsystems.modules.emacs {
# needed for elfeed # needed for elfeed
sops.secrets.fever = lib.mkIf (!isPublic) { path = "${homeDir}/.emacs.d/.fever"; }; sops.secrets.fever = lib.mkIf (!isPublic) { path = "${homeDir}/.emacs.d/.fever"; };
@ -74,4 +75,5 @@ in
socketActivation.enable = false; socketActivation.enable = false;
startWithUserSession = "graphical"; startWithUserSession = "graphical";
}; };
};
} }

View file

@ -9,6 +9,8 @@ let
allMailAddresses = lib.swarselsystems.getSecret "${secretsDirectory}/mail/list"; allMailAddresses = lib.swarselsystems.getSecret "${secretsDirectory}/mail/list";
in in
{ {
options.swarselsystems.modules.env = lib.mkEnableOption "env settings";
config = lib.mkIf config.swarselsystems.modules.env {
home.sessionVariables = { home.sessionVariables = {
EDITOR = "e -w"; EDITOR = "e -w";
DISPLAY = ":0"; DISPLAY = ":0";
@ -23,4 +25,5 @@ in
SWARSEL_FULLNAME = fullName; SWARSEL_FULLNAME = fullName;
SWARSEL_MAIL_ALL = allMailAddresses; SWARSEL_MAIL_ALL = allMailAddresses;
}; };
};
} }

View file

@ -1,5 +1,7 @@
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.eza = lib.mkEnableOption "eza settings";
config = lib.mkIf config.swarselsystems.modules.eza {
programs.eza = { programs.eza = {
enable = true; enable = true;
icons = "auto"; icons = "auto";
@ -9,4 +11,5 @@ _:
"--group-directories-first" "--group-directories-first"
]; ];
}; };
};
} }

View file

@ -1,5 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
options.swarselsystems.modules.firefox = lib.mkEnableOption "firefox settings";
config = lib.mkIf config.swarselsystems.modules.firefox {
programs.firefox = { programs.firefox = {
enable = true; enable = true;
package = pkgs.firefox; # uses overrides package = pkgs.firefox; # uses overrides
@ -144,4 +146,5 @@
config.swarselsystems.firefox; config.swarselsystems.firefox;
}; };
}; };
};
} }

View file

@ -1,5 +1,7 @@
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.fuzzel = lib.mkEnableOption "fuzzel settings";
config = lib.mkIf config.swarselsystems.modules.fuzzel {
programs.fuzzel = { programs.fuzzel = {
enable = true; enable = true;
settings = { settings = {
@ -11,4 +13,5 @@ _:
border.radius = "0"; border.radius = "0";
}; };
}; };
};
} }

View file

@ -1,10 +1,12 @@
{ lib, nix-secrets, ... }: { lib, config, nix-secrets, ... }:
let let
secretsDirectory = builtins.toString nix-secrets; secretsDirectory = builtins.toString nix-secrets;
leonMail = lib.swarselsystems.getSecret "${secretsDirectory}/mail/leon"; leonMail = lib.swarselsystems.getSecret "${secretsDirectory}/mail/leon";
fullName = lib.swarselsystems.getSecret "${secretsDirectory}/info/fullname"; fullName = lib.swarselsystems.getSecret "${secretsDirectory}/info/fullname";
in in
{ {
options.swarselsystems.modules.git = lib.mkEnableOption "git settings";
config = lib.mkIf config.swarselsystems.modules.git {
programs.git = { programs.git = {
enable = true; enable = true;
aliases = { aliases = {
@ -41,4 +43,5 @@ in
} }
]; ];
}; };
};
} }

View file

@ -1,6 +1,9 @@
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.modules.gnome-keyring = lib.mkEnableOption "gnome keyring settings";
config = lib.mkIf config.swarselsystems.modules.gnome-keyring {
services.gnome-keyring = lib.mkIf (!config.swarselsystems.isNixos) { services.gnome-keyring = lib.mkIf (!config.swarselsystems.isNixos) {
enable = true; enable = true;
}; };
};
} }

View file

@ -1,5 +1,7 @@
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.kitty = lib.mkEnableOption "kitty settings";
config = lib.mkIf config.swarselsystems.modules.kitty {
programs.kitty = { programs.kitty = {
enable = true; enable = true;
keybindings = { }; keybindings = { };
@ -9,4 +11,5 @@ _:
notify_on_cmd_finish = "always 20"; notify_on_cmd_finish = "always 20";
}; };
}; };
};
} }

View file

@ -8,6 +8,8 @@ let
fullName = lib.swarselsystems.getSecret "${secretsDirectory}/info/fullname"; fullName = lib.swarselsystems.getSecret "${secretsDirectory}/info/fullname";
in in
{ {
options.swarselsystems.modules.mail = lib.mkEnableOption "mail settings";
config = lib.mkIf config.swarselsystems.modules.mail {
programs = { programs = {
mbsync = { mbsync = {
enable = true; enable = true;
@ -142,4 +144,5 @@ in
}; };
}; };
}; };
};
} }

View file

@ -1,5 +1,7 @@
{ self, pkgs, ... }: { self, lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.nix-index = lib.mkEnableOption "nix-index settings";
config = lib.mkIf config.swarselsystems.modules.nix-index {
programs.nix-index = programs.nix-index =
let let
commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } '' commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } ''
@ -18,4 +20,5 @@
paths = [ commandNotFound ]; paths = [ commandNotFound ];
}; };
}; };
};
} }

View file

@ -1,13 +1,14 @@
{ lib, config, nixgl, ... }: { lib, config, nixgl, ... }:
{ {
options.swarselsystems = { options.swarselsystems = {
modules.nixgl = lib.mkEnableOption "nixgl settings";
isSecondaryGpu = lib.mkEnableOption "device has a secondary GPU"; isSecondaryGpu = lib.mkEnableOption "device has a secondary GPU";
SecondaryGpuCard = lib.mkOption { SecondaryGpuCard = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
}; };
config = { config = lib.mkIf config.swarselsystems.modules.nixgl {
nixGL = lib.mkIf (!config.swarselsystems.isNixos) { nixGL = lib.mkIf (!config.swarselsystems.isNixos) {
inherit (nixgl) packages; inherit (nixgl) packages;
defaultWrapper = lib.mkDefault "mesa"; defaultWrapper = lib.mkDefault "mesa";

View file

@ -1,6 +1,8 @@
{ pkgs, ... }: { lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.packages = lib.mkEnableOption "packages settings";
config = lib.mkIf config.swarselsystems.modules.packages {
home.packages = with pkgs; [ home.packages = with pkgs; [
# audio stuff # audio stuff
@ -176,4 +178,5 @@
noto-fonts noto-fonts
noto-fonts-cjk-sans noto-fonts-cjk-sans
]; ];
};
} }

View file

@ -1,5 +1,7 @@
{ pkgs, ... }: { lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.passwordstore = lib.mkEnableOption "passwordstore settings";
config = lib.mkIf config.swarselsystems.modules.passwordstore {
programs.password-store = { programs.password-store = {
enable = true; enable = true;
settings = { settings = {
@ -7,4 +9,5 @@
}; };
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]); package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
}; };
};
} }

View file

@ -1,5 +1,7 @@
{ pkgs, ... }: { lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.programs = lib.mkEnableOption "programs settings";
config = lib.mkIf config.swarselsystems.modules.programs {
programs = { programs = {
bottom.enable = true; bottom.enable = true;
imv.enable = true; imv.enable = true;
@ -19,4 +21,5 @@
fzf.enable = true; fzf.enable = true;
zoxide.enable = true; zoxide.enable = true;
}; };
};
} }

View file

@ -3,6 +3,8 @@ let
inherit (config.swarselsystems) mainUser; inherit (config.swarselsystems) mainUser;
in in
{ {
options.swarselsystems.modules.general = lib.mkEnableOption "general nix settings";
config = lib.mkIf config.swarselsystems.modules.general {
nix = lib.mkIf (!config.swarselsystems.isNixos) { nix = lib.mkIf (!config.swarselsystems.isNixos) {
settings = { settings = {
experimental-features = [ experimental-features = [
@ -40,5 +42,6 @@ in
FLAKE = "/home/${mainUser}/.dotfiles"; FLAKE = "/home/${mainUser}/.dotfiles";
}; };
}; };
};
} }

View file

@ -3,6 +3,8 @@ let
inherit (config.swarselsystems) homeDir xdgDir; inherit (config.swarselsystems) homeDir xdgDir;
in in
{ {
options.swarselsystems.modules.sops = lib.mkEnableOption "sops settings";
config = lib.mkIf config.swarselsystems.modules.sops {
sops = lib.mkIf (!config.swarselsystems.isPublic) { sops = lib.mkIf (!config.swarselsystems.isPublic) {
age.sshKeyPaths = [ "${homeDir}/.ssh/sops" "${homeDir}/.ssh/ssh_host_ed25519_key" ]; age.sshKeyPaths = [ "${homeDir}/.ssh/sops" "${homeDir}/.ssh/ssh_host_ed25519_key" ];
defaultSopsFile = lib.swarselsystems.mkIfElseList config.swarselsystems.isBtrfs "/persist/.dotfiles/secrets/general/secrets.yaml" "${homeDir}/.dotfiles/secrets/general/secrets.yaml"; defaultSopsFile = lib.swarselsystems.mkIfElseList config.swarselsystems.isBtrfs "/persist/.dotfiles/secrets/general/secrets.yaml" "${homeDir}/.dotfiles/secrets/general/secrets.yaml";
@ -17,4 +19,5 @@ in
u2f_keys = { path = "${homeDir}/.config/Yubico/u2f_keys"; }; u2f_keys = { path = "${homeDir}/.config/Yubico/u2f_keys"; };
}; };
}; };
};
} }

View file

@ -1,5 +1,7 @@
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.ssh = lib.mkEnableOption "ssh settings";
config = lib.mkIf config.swarselsystems.modules.ssh {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
forwardAgent = true; forwardAgent = true;
@ -34,4 +36,5 @@ _:
}; };
}; };
}; };
};
} }

View file

@ -1,5 +1,7 @@
_: { lib, config, ... }:
{ {
options.swarselsystems.modules.starship = lib.mkEnableOption "starship settings";
config = lib.mkIf config.swarselsystems.modules.starship {
programs.starship = { programs.starship = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
@ -118,4 +120,5 @@ _:
scala.symbol = " "; scala.symbol = " ";
}; };
}; };
};
} }

View file

@ -1,9 +1,12 @@
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.modules.stylix = lib.mkEnableOption "stylix settings";
config = lib.mkIf config.swarselsystems.modules.stylix {
stylix = lib.mkIf (!config.swarselsystems.isNixos) (lib.recursiveUpdate stylix = lib.mkIf (!config.swarselsystems.isNixos) (lib.recursiveUpdate
{ {
image = config.swarselsystems.wallpaper; image = config.swarselsystems.wallpaper;
targets = config.swarselsystems.stylixHomeTargets; targets = config.swarselsystems.stylixHomeTargets;
} }
config.swarselsystems.stylix); config.swarselsystems.stylix);
};
} }

View file

@ -180,13 +180,18 @@
"${modifier}+Print" = "exec screenshare"; "${modifier}+Print" = "exec screenshare";
# exec swaymsg move workspace to "$(swaymsg -t get_outputs | jq '[.[] | select(.active == true)] | .[(map(.focused) | index(true) + 1) % length].name')" # exec swaymsg move workspace to "$(swaymsg -t get_outputs | jq '[.[] | select(.active == true)] | .[(map(.focused) | index(true) + 1) % length].name')"
# "XF86AudioRaiseVolume" = "exec pa 5%"; # "XF86AudioRaiseVolume" = "exec pa 5%";
"XF86AudioRaiseVolume" = "exec pamixer -i 5"; # "XF86AudioRaiseVolume" = "exec pamixer -i 5";
"XF86AudioRaiseVolume" = "exec swayosd-client --output-volume raise";
# "XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%"; # "XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioLowerVolume" = "exec pamixer -d 5"; # "XF86AudioLowerVolume" = "exec pamixer -d 5";
"XF86AudioLowerVolume" = "exec swayosd-client --output-volume lower";
# "XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle"; # "XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMute" = "exec pamixer -t"; # "XF86AudioMute" = "exec pamixer -t";
"XF86MonBrightnessUp" = "exec brightnessctl set +5%"; "XF86AudioMute" = "exec swayosd-client --output-volume mute-toggle";
"XF86MonBrightnessDown" = "exec brightnessctl set 5%-"; # "XF86MonBrightnessUp" = "exec brightnessctl set +5%";
"XF86MonBrightnessUp" = "exec swayosd-client --brightness raise";
# "XF86MonBrightnessDown" = "exec brightnessctl set 5%-";
"XF86MonBrightnessDown" = "exec swayosd-client --brightness lower";
"XF86Display" = "exec wl-mirror eDP-1"; "XF86Display" = "exec wl-mirror eDP-1";
} }
config.swarselsystems.keybindings; config.swarselsystems.keybindings;
@ -388,6 +393,7 @@
exec kanshi exec kanshi
exec_always kill -1 $(pidof kanshi) exec_always kill -1 $(pidof kanshi)
exec swayosd-server
bindswitch --locked lid:on exec kanshictl switch lidclosed bindswitch --locked lid:on exec kanshictl switch lidclosed
bindswitch --locked lid:off exec kanshictl switch lidopen bindswitch --locked lid:off exec kanshictl switch lidopen

View file

@ -1,5 +1,7 @@
{ self, lib, ... }: { self, lib, config, ... }:
{ {
options.swarselsystems.modules.symlink = lib.mkEnableOption "symlink settings";
config = lib.mkIf config.swarselsystems.modules.symlink {
home.file = { home.file = {
"init.el" = lib.mkDefault { "init.el" = lib.mkDefault {
source = self + /programs/emacs/init.el; source = self + /programs/emacs/init.el;
@ -26,4 +28,5 @@
"tridactyl/themes/swarsel.css".source = self + /programs/firefox/tridactyl/themes/swarsel.css; "tridactyl/themes/swarsel.css".source = self + /programs/firefox/tridactyl/themes/swarsel.css;
"swayidle/config".source = self + /programs/swayidle/config; "swayidle/config".source = self + /programs/swayidle/config;
}; };
};
} }

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { lib, config, pkgs, ... }:
let let
tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin
{ {
@ -13,7 +13,8 @@ let
}; };
in in
{ {
options.swarselsystems.modules.tmux = lib.mkEnableOption "tmux settings";
config = lib.mkIf config.swarselsystems.modules.tmux {
home.packages = with pkgs; [ home.packages = with pkgs; [
lsof lsof
sesh sesh
@ -94,4 +95,5 @@ in
''; '';
}; };
};
} }

View file

@ -22,6 +22,7 @@ let
in in
{ {
options.swarselsystems = { options.swarselsystems = {
modules.waybar = lib.mkEnableOption "waybar settings";
cpuCount = lib.mkOption { cpuCount = lib.mkOption {
type = lib.types.int; type = lib.types.int;
default = 8; default = 8;
@ -50,7 +51,7 @@ in
internal = true; internal = true;
}; };
}; };
config = { config = lib.mkIf config.swarselsystems.modules.waybar {
swarselsystems = { swarselsystems = {
waybarModules = lib.mkIf config.swarselsystems.isLaptop (modulesLeft ++ [ waybarModules = lib.mkIf config.swarselsystems.isLaptop (modulesLeft ++ [
"battery" "battery"

View file

@ -1,14 +1,17 @@
{ lib, nix-secrets, ... }: { lib, config, nix-secrets, ... }:
let let
secretsDirectory = builtins.toString nix-secrets; secretsDirectory = builtins.toString nix-secrets;
yubikey1 = lib.swarselsystems.getSecret "${secretsDirectory}/yubikey/yubikey1"; yubikey1 = lib.swarselsystems.getSecret "${secretsDirectory}/yubikey/yubikey1";
yubikey2 = lib.swarselsystems.getSecret "${secretsDirectory}/yubikey/yubikey2"; yubikey2 = lib.swarselsystems.getSecret "${secretsDirectory}/yubikey/yubikey2";
in in
{ {
options.swarselsystems.modules.yubikey = lib.mkEnableOption "yubikey settings";
config = lib.mkIf config.swarselsystems.modules.yubikey {
pam.yubico.authorizedYubiKeys = { pam.yubico.authorizedYubiKeys = {
ids = [ ids = [
"${yubikey1}" "${yubikey1}"
"${yubikey2}" "${yubikey2}"
]; ];
}; };
};
} }

View file

@ -1,6 +1,7 @@
{ self, config, pkgs, ... }: { self, lib, config, pkgs, ... }:
{ {
options.swarselsystems.modules.zellij = lib.mkEnableOption "zellij settings";
config = lib.mkIf config.swarselsystems.modules.zellij {
programs.zellij = { programs.zellij = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
@ -14,5 +15,6 @@
"zellij/config.kdl".text = import "${self}/programs/zellij/config.kdl.nix" { inherit config; }; "zellij/config.kdl".text = import "${self}/programs/zellij/config.kdl.nix" { inherit config; };
"zellij/layouts/default.kdl".text = import "${self}/programs/zellij/layouts/default.kdl.nix" { inherit config pkgs; }; "zellij/layouts/default.kdl".text = import "${self}/programs/zellij/layouts/default.kdl.nix" { inherit config pkgs; };
}; };
};
} }

View file

@ -4,12 +4,13 @@ let
in in
{ {
options.swarselsystems = { options.swarselsystems = {
modules.zsh = lib.mkEnableOption "zsh settings";
shellAliases = lib.mkOption { shellAliases = lib.mkOption {
type = lib.types.attrsOf lib.types.str; type = lib.types.attrsOf lib.types.str;
default = { }; default = { };
}; };
}; };
config = { config = lib.mkIf config.swarselsystems.modules.zsh {
programs.zsh = { programs.zsh = {
enable = true; enable = true;
shellAliases = lib.recursiveUpdate shellAliases = lib.recursiveUpdate

View file

@ -143,7 +143,7 @@ in
udev.extraRules = '' udev.extraRules = ''
# share screen when dongle detected # share screen when dongle detected
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", TAG+="systemd", ENV{SYSTEMD_WANTS}="swarsel-screenshare.service" SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="343c", ATTRS{idProduct}=="0000", TAG+="systemd", ENV{SYSTEMD_WANTS}="swarsel-screenshare.service"
# lock screen when yubikey removed # lock screen when yubikey removed
ACTION=="remove", ENV{PRODUCT}=="3/1050/407/110", RUN+="${pkgs.systemd}/bin/systemctl suspend" ACTION=="remove", ENV{PRODUCT}=="3/1050/407/110", RUN+="${pkgs.systemd}/bin/systemctl suspend"

View file

@ -1,5 +1,7 @@
{ lib, ... }: { lib, ... }:
let let
moduleNames = lib.swarselsystems.readNix "profiles/home"; profileNames = lib.swarselsystems.readNix "profiles/home";
in in
lib.swarselsystems.mkProfiles moduleNames "home" {
imports = lib.swarselsystems.mkImports profileNames "profiles/home";
}

View file

@ -0,0 +1,36 @@
{ lib, config, ... }:
{
options.swarselsystems.profiles.personal = lib.mkEnableOption "is this a personal host";
config = lib.mkIf config.swarselsystems.profiles.personal {
swarselsystems.modules = {
packages = lib.mkDefault true;
ownpackages = lib.mkDefault true;
general = lib.mkDefault true;
nixgl = lib.mkDefault true;
sops = lib.mkDefault true;
yubikey = lib.mkDefault true;
ssh = lib.mkDefault true;
stylix = lib.mkDefault true;
desktop = lib.mkDefault true;
symlink = lib.mkDefault true;
env = lib.mkDefault true;
programs = lib.mkDefault true;
nix-index = lib.mkDefault true;
direnv = lib.mkDefault true;
eza = lib.mkDefault true;
git = lib.mkDefault true;
fuzzel = lib.mkDefault true;
starship = lib.mkDefault true;
kitty = lib.mkDefault true;
zsh = lib.mkDefault true;
zellij = lib.mkDefault true;
tmux = lib.mkDefault true;
mail = lib.mkDefault true;
emacs = lib.mkDefault true;
waybar = lib.mkDefault true;
firefox = lib.mkDefault true;
gnome-keyring = lib.mkDefault true;
};
};
}

View file

@ -1,5 +1,7 @@
{ lib, ... }: { lib, ... }:
let let
moduleNames = lib.swarselsystems.readNix "profiles/nixos"; profileNames = lib.swarselsystems.readNix "profiles/nixos";
in in
lib.swarselsystems.mkProfiles moduleNames "nixos" {
imports = lib.swarselsystems.mkImports profileNames "profiles/nixos";
}

View file

@ -0,0 +1,37 @@
{ lib, config, ... }:
{
options.swarselsystems.profiles.server.local = lib.mkEnableOption "is this a local server";
config = lib.mkIf config.swarselsystems.profiles.server.local {
swarselsystems = {
# common modules
modules = {
nix-ld = lib.mkDefault true;
home-manager = lib.mkDefault true;
home-managerExtra = lib.mkDefault true;
xserver = lib.mkDefault true;
gc = lib.mkDefault true;
storeOptimize = lib.mkDefault true;
time = lib.mkDefault true;
users = lib.mkDefault true;
};
# server modules
# server = {
# kavita = lib.mkDefault true;
# jellyfin = lib.mkDefault true;
# navidrome = lib.mkDefault true;
# spotifyd = lib.mkDefault true;
# mpd = lib.mkDefault true;
# matrix = lib.mkDefault true;
# nextcloud = lib.mkDefault true;
# immich = lib.mkDefault true;
# paperless = lib.mkDefault true;
# transmission = lib.mkDefault true;
# syncthing = lib.mkDefault true;
# monitoring = lib.mkDefault true;
# emacs = lib.mkDefault true;
# freshrss = lib.mkDefault true;
# };
};
};
}

View file

@ -1,8 +1,8 @@
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.profiles.personalz = lib.mkEnableOption "is this a personal host"; options.swarselsystems.profiles.personal = lib.mkEnableOption "is this a personal host";
config = lib.mkIf config.swarselsystems.profiles.personalz { config = lib.mkIf config.swarselsystems.profiles.personal {
config.swarselsystems.modules = { swarselsystems.modules = {
packages = lib.mkDefault true; packages = lib.mkDefault true;
general = lib.mkDefault true; general = lib.mkDefault true;
home-manager = lib.mkDefault true; home-manager = lib.mkDefault true;

View file

@ -0,0 +1,25 @@
{ lib, config, ... }:
{
options.swarselsystems.profiles.server.sync = lib.mkEnableOption "is this a oci sync server";
config = lib.mkIf config.swarselsystems.profiles.server.sync {
swarselsystems = {
# common modules
modules = {
nix-ld = lib.mkDefault true;
home-manager = lib.mkDefault true;
home-managerExtra = lib.mkDefault true;
xserver = lib.mkDefault true;
gc = lib.mkDefault true;
storeOptimize = lib.mkDefault true;
time = lib.mkDefault true;
users = lib.mkDefault true;
};
# server modules
# server = {
# forgejo = lib.mkDefault true;
# ankisync = lib.mkDefault true;
# };
};
};
}