feat: add a lot of stuff

This commit is contained in:
Jacob Bachmann 2023-12-11 15:48:55 +01:00
parent 8eb88574fb
commit 6067f0ff0b
Signed by: bchmnn
GPG key ID: 732A612DAD28067D
47 changed files with 578 additions and 136 deletions

View file

@ -15,4 +15,6 @@
nec = "sudo -E nvim -u $HOME/.config/nvim/init.lua --cmd 'cd /etc/nixos'";
ncc = "sudo nixos-rebuild switch --upgrade-all --flake /etc/nixos";
nup = "sudo nix-channel --update && sudo nixos-rebuild switch --upgrade-all --flake /etc/nixos";
nuf = "sudo nix flake update --nix-path /etc/nixos && sudo nixos-rebuild switch --upgrade-all --flake /etc/nixos";
wip = "curl -s 'https://nordvpn.com/wp-admin/admin-ajax.php?action=get_user_info_data' | jq";
}

View file

@ -1,4 +1,4 @@
{ ... }: {
{ config, lib, ... }: lib.mkIf config.bchmnn.audio.enable {
# Enable pipewire - audio
services.pipewire = {
enable = true;

View file

@ -1,4 +1,4 @@
{ ... }: {
{ config, lib, ... }: lib.mkIf config.bchmnn.bluetooth.enable {
hardware.bluetooth = {
enable = true;
powerOnBoot = true;

View file

@ -1,4 +1,50 @@
{
{ lib, ... }: {
# options affecting multiple modules
options.bchmnn = with lib; {
gui = {
enable = mkEnableOption "gui";
flavour = mkOption {
type = types.listOf types.str;
default = [ "sway" ];
example = [ "sway" "i3" ];
description = ''
The flavour (WM) for your system to use
'';
};
};
nvidia = {
enable = mkEnableOption "nvidia";
};
audio = {
enable = mkEnableOption "audio";
};
bluetooth = {
enable = mkEnableOption "bluetooth";
};
vpn = {
enable = mkEnableOption "vpn";
};
devenv = {
enable = mkEnableOption "devenv";
};
virtualisation = {
enable = mkEnableOption "virtualisation";
};
games = {
enable = mkEnableOption "games";
};
};
imports = [
./audio.nix
./bluetooth.nix
@ -6,19 +52,24 @@
./dbus.nix
./fonts.nix
./i18n.nix
./kdeconnect.nix
./keyd.nix
./mozillavpn.nix
./network.nix
./nix.nix
./nvidia.nix
./opengl.nix
./openssh.nix
./power.nix
./packages.nix
./printing.nix
./security.nix
./shell.nix
./steam.nix
./udisks2.nix
./unfree.nix
./virtualisation.nix
./xdg-portal.nix
./xorg.nix
];
}

3
modules/kdeconnect.nix Normal file
View file

@ -0,0 +1,3 @@
{ config, ... }: {
programs.kdeconnect.enable = config.bchmnn.gui.enable;
}

View file

@ -1,27 +1,61 @@
{ ... }: {
{ ... }: let
nav = {
h = "left";
j = "down";
k = "up";
l = "right";
"0" = "home";
"4" = "end";
u = "pageup";
d = "pagedown";
};
alt = {
a = "";
o = "";
u = "";
s = "";
e = "";
};
altShift = {
a = "";
o = "";
u = "";
};
in {
# Enable keyd and remap keys
services.keyd = {
enable = true;
keyboards.default.settings = {
main = {
leftalt = "layer(meta)";
leftmeta = "layer(alt)";
altgr = "layer(control)";
rightalt = "layer(control)";
capslock = "layer(nav)";
keyboards.default = {
ids = [ "*" "-04fe:0020" ];
settings = {
main = {
leftalt = "layer(meta)";
leftmeta = "layer(alt)";
altgr = "layer(control)";
rightalt = "layer(control)";
capslock = "layer(nav)";
};
alt = alt;
"alt+shift" = altShift;
meta = {
capslock = "overload(nav, capslock)";
};
nav = nav;
};
meta = {
capslock = "overload(nav, capslock)";
};
nav = {
h = "left";
j = "down";
k = "up";
l = "right";
"0" = "home";
"4" = "end";
u = "pageup";
d = "pagedown";
};
keyboards.hhkb = {
ids = [ "04fe:0020" ];
settings = {
main = {
rightmeta = "layer(control)";
leftcontrol = "layer(nav)";
};
alt = alt;
"alt+shift" = altShift;
meta = {
leftcontrol = "overload(nav, capslock)";
};
nav = nav;
};
};
};

11
modules/mozillavpn.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, lib, pkgs, ... }: lib.mkIf config.bchmnn.vpn.enable {
environment.systemPackages = with pkgs; [
mozillavpn
];
services.mozillavpn = {
enable = true;
};
}

View file

@ -1,8 +1,8 @@
{ config, ... }: {
{ config, lib, pkgs, ... }: lib.mkIf config.bchmnn.nvidia.enable {
# services.xserver.videoDrivers = [ "nouveau" ];
services.xserver.videoDrivers = [ "nouveau" ];
services.xserver.videoDrivers = [ "nvidia" ];
# services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
# Modesetting is needed for most Wayland compositors

8
modules/openssh.nix Normal file
View file

@ -0,0 +1,8 @@
{ ... }: {
services.openssh = {
enable = true;
openFirewall = true;
};
}

View file

@ -1,10 +1,7 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [
{ lib, pkgs, config, ... }: {
environment.systemPackages = with pkgs; with config.bchmnn; [
pciutils
qt5.qtwayland
qt6.qtwayland
xdg-utils # for opening default programs
glib # gsettings
usbutils
git
mercurial # contains 'hg'
wget
@ -12,8 +9,8 @@
lsd
ripgrep
expect # contains 'unbuffer'
# libs
libnotify
jq # parse json
] ++ lib.optionals (devenv.enable) [
# languages
gcc13
go
@ -22,5 +19,14 @@
gradle_7
python312
nodenv
rustc
cargo
] ++ lib.optionals (gui.enable) [
libnotify
glib # gsettings
xdg-utils # for opening default programs
] ++ lib.optionals (gui.enable && lib.elem "sway" gui.flavour) [
qt5.qtwayland
qt6.qtwayland
];
}

View file

@ -1,11 +1,13 @@
{ ... }: {
{ config, lib, ... }: {
security.polkit.enable = true;
# rtkit is optional but recommended
security.rtkit.enable = true;
} // (lib.mkIf (lib.elem "sway" config.bchmnn.gui.flavour) {
# TODO workaround to get swaylock accepting pw
# https://github.com/NixOS/nixpkgs/issues/158025
security.pam.services.swaylock = {};
security.pam.services.swaylock = { };
}
})

5
modules/steam.nix Normal file
View file

@ -0,0 +1,5 @@
{ config, lib, ... }: lib.mkIf config.bchmnn.games.enable {
programs.steam = {
enable = true;
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{ config, lib, pkgs, ... }: lib.mkIf config.bchmnn.virtualisation.enable {
# virt-manager
virtualisation.libvirtd.enable = true;

View file

@ -1,8 +1,10 @@
{ pkgs, ... }: {
{ lib, config, ... }: lib.mkIf config.bchmnn.gui.enable {
xdg.portal = {
enable = true;
wlr.enable = true;
# gtk portal needed to make gtk apps happy
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# upper has been replaced by following
config.common.default = "*";
};
}

12
modules/xorg.nix Normal file
View file

@ -0,0 +1,12 @@
{ lib, config, ... }: with config.bchmnn; lib.mkIf (gui.enable && lib.elem "i3" gui.flavour) {
environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw
services.xserver = {
enable = true;
displayManager.startx.enable = true;
libinput.enable = true;
};
}