refactor: change structure of nix files

This commit is contained in:
matt1432 2023-06-24 10:59:54 +02:00
parent 5652480f01
commit 534d7db975
7 changed files with 147 additions and 141 deletions

View file

@ -36,4 +36,9 @@
hardware.sensor.iio.enable = true; hardware.sensor.iio.enable = true;
hardware.opengl.enable = true; hardware.opengl.enable = true;
hardware.opengl.driSupport32Bit = true; hardware.opengl.driSupport32Bit = true;
virtualisation = {
waydroid.enable = true;
lxd.enable = true;
};
} }

10
nixos/cfg/main.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, pkgs, ... }:
{
imports = [
./boot.nix
./extra-hardware.nix
./security.nix
./packages.nix
];
}

View file

@ -1,6 +1,83 @@
{config, pkgs, ...}: {config, pkgs, ...}:
{ {
services = {
xserver = {
enable = true;
layout = "ca";
displayManager = {
gdm = {
enable = true;
wayland = true;
};
sessionPackages = [
pkgs.gnome.gnome-session.sessions # gnome session needed to fix bugs
(builtins.getFlake "github:hyprwm/Hyprland").packages.x86_64-linux.default
];
defaultSession = "hyprland";
#autoLogin = { # logs out after a minute
# enable = true;
# user = "matt";
#};
};
libinput.enable = true;
};
dbus.enable = true;
flatpak.enable = true;
tlp.enable = true;
locate = {
enable = true;
interval = "hourly";
prunePaths = [
"/tmp"
"/var/tmp"
"/var/cache"
"/var/lock"
"/var/run"
"/var/spool"
"/nix/var/log/nix"
"/proc"
"/run/user/1000"
];
};
};
xdg.portal.enable = true;
programs = {
tmux = {
enable = true;
keyMode = "vi";
terminal = "screen-256color";
newSession = true;
historyLimit = 30000;
extraConfig = ''
bind-key -n Home send Escape "OH"
bind-key -n End send Escape "OF"
set -g mouse on
set -ga terminal-overrides ',xterm*:smcup@:rmcup@'
bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
'';
};
git = { # TODO: make better config
enable = true;
lfs.enable = true;
};
htop = {
enable = true;
};
fzf = {
fuzzyCompletion = true;
keybindings = true;
};
};
# List packages in root user PATH # List packages in root user PATH
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
wl-clipboard wl-clipboard
@ -28,6 +105,7 @@
serif = [ "MesloLGS Nerd Font" ]; serif = [ "MesloLGS Nerd Font" ];
};*/ };*/
}; };
fonts = with pkgs; [ fonts = with pkgs; [
(nerdfonts.override { fonts = [ "JetBrainsMono" "Go-Mono" "Iosevka" "NerdFontsSymbolsOnly" "SpaceMono" "Ubuntu" ]; }) (nerdfonts.override { fonts = [ "JetBrainsMono" "Go-Mono" "Iosevka" "NerdFontsSymbolsOnly" "SpaceMono" "Ubuntu" ]; })
noto-fonts noto-fonts

View file

@ -1,90 +0,0 @@
{ config, pkgs, ... }:
{
services.xserver = {
enable = true;
layout = "ca";
displayManager = {
gdm = {
enable = true;
wayland = true;
}; # gnome session needed to fix bugs
sessionPackages = [ pkgs.gnome.gnome-session.sessions ];
# See ./cfg/home-manager.nix
#defaultSession = "hyprland";
#autoLogin = { # logs out after a minute
# enable = true;
# user = "matt";
#};
};
libinput.enable = true;
};
xdg.portal.enable = true;
virtualisation = {
waydroid.enable = true;
lxd.enable = true;
};
services = {
dbus.enable = true;
flatpak.enable = true;
tlp.enable = true;
locate = {
enable = true;
interval = "hourly";
prunePaths = [
"/tmp"
"/var/tmp"
"/var/cache"
"/var/lock"
"/var/run"
"/var/spool"
"/nix/var/log/nix"
"/proc"
];
};
};
programs = {
waybar = {
enable = true;
package = pkgs.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
});
};
tmux = {
enable = true;
keyMode = "vi";
terminal = "screen-256color";
newSession = true;
historyLimit = 30000;
extraConfig = ''
bind-key -n Home send Escape "OH"
bind-key -n End send Escape "OF"
set -g mouse on
set -ga terminal-overrides ',xterm*:smcup@:rmcup@'
bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
'';
};
git = { # TODO: make better config
enable = true;
lfs.enable = true;
};
htop = {
enable = true;
};
fzf = {
fuzzyCompletion = true;
keybindings = true;
};
};
}

View file

@ -5,12 +5,8 @@
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./overlays/list.nix ./overlays/list.nix
./cfg/boot.nix ./cfg/main.nix
./cfg/security.nix ./home/main.nix
./cfg/extra-hardware.nix
./cfg/services.nix
./cfg/packages.nix
./cfg/home-manager.nix
]; ];
networking.hostName = "wim"; networking.hostName = "wim";

39
nixos/home/hyprland.nix Normal file
View file

@ -0,0 +1,39 @@
{ pkgs, ... }: let
flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz";
hyprland = (import flake-compat {
# I use release version for plugin support
src = builtins.fetchTarball "https://github.com/hyprwm/Hyprland/archive/master.tar.gz";
}).defaultNix;
in
{
home.packages = [
(builtins.getFlake "github:hyprwm/Hyprland").packages.x86_64-linux.default
(builtins.getFlake "path:/home/matt/git/hyprland-touch-gestures").packages.x86_64-linux.default
];
home.sessionVariables = {
XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:\$XDG_DATA_DIRS";
};
imports = [
hyprland.homeManagerModules.default
];
wayland.windowManager.hyprland = {
enable = true;
package = (builtins.getFlake "github:hyprwm/Hyprland").packages.x86_64-linux.default; # to be able to get the right ver from hyprctl version
plugins = [
"${(builtins.getFlake "path:/home/matt/git/hyprland-touch-gestures").packages.x86_64-linux.default}/lib/libtouch-gestures.so"
];
extraConfig = ''
exec-once = ${pkgs.plasma5Packages.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1
source = ~/.config/hypr/main.conf
env = XDG_DATA_DIRS, ${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:$XDG_DATA_DIRS
env = SUDO_ASKPASS, ${pkgs.plasma5Packages.ksshaskpass}/bin/${pkgs.plasma5Packages.ksshaskpass.pname}
'';
};
}

View file

@ -1,13 +1,8 @@
{ config, ... }: let { config, pkgs, ... }:
flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz";
hyprland = (import flake-compat {
# I use release version for plugin support
src = builtins.fetchTarball "https://github.com/hyprwm/Hyprland/archive/master.tar.gz";
}).defaultNix;
in
{ {
## Global config to add home-manager module
#############################################################################
imports = imports =
[ [
<home-manager/nixos> <home-manager/nixos>
@ -19,10 +14,17 @@ in
extraGroups = [ "wheel" "input" "adm" "mlocate" "video" ]; extraGroups = [ "wheel" "input" "adm" "mlocate" "video" ];
}; };
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
programs.dconf.enable = true; programs.dconf.enable = true;
#############################################################################
home-manager.users.matt = {
imports = [
./hyprland.nix
];
home-manager.users.matt = { config, pkgs, lib, ... }: {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
package = pkgs.waybar.overrideAttrs (oldAttrs: { package = pkgs.waybar.overrideAttrs (oldAttrs: {
@ -62,8 +64,6 @@ in
]) ++ ]) ++
[ [
(builtins.getFlake "github:hyprwm/Hyprland").packages.x86_64-linux.default
(builtins.getFlake "path:/home/matt/git/hyprland-touch-gestures").packages.x86_64-linux.default
swayosd swayosd
qt5.qtwayland qt5.qtwayland
qt6.qtwayland qt6.qtwayland
@ -80,7 +80,7 @@ in
xdg-utils xdg-utils
pavucontrol # TODO: open on left click pavucontrol # TODO: open on left click
gimp-with-plugins gimp-with-plugins
jdk8_headless jdk19_headless
bluez-tools bluez-tools
spotify spotify
#spotifywm # fails to build #spotifywm # fails to build
@ -121,7 +121,6 @@ in
lxappearance lxappearance
imagemagick imagemagick
usbutils usbutils
catppuccin-plymouth
evtest evtest
squeekboard squeekboard
glib glib
@ -139,6 +138,7 @@ in
done done
) & ) &
SUDO_ASKPASS = "${pkgs.plasma5Packages.ksshaskpass}/bin/${pkgs.plasma5Packages.ksshaskpass.pname}";
exec sudo -k -EA '${gparted}/bin/${gparted.pname}' "$@" exec sudo -k -EA '${gparted}/bin/${gparted.pname}' "$@"
'') '')
]; ];
@ -159,38 +159,6 @@ in
}; };
}; };
home.sessionVariables = {
XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:\$XDG_DATA_DIRS";
SUDO_ASKPASS = "${pkgs.plasma5Packages.ksshaskpass}/bin/${pkgs.plasma5Packages.ksshaskpass.pname}";
};
imports = [
hyprland.homeManagerModules.default
];
wayland.windowManager.hyprland = {
enable = true;
package = (builtins.getFlake "github:hyprwm/Hyprland").packages.x86_64-linux.default; # to be able to get the right ver from hyprctl version
plugins = with pkgs; [
"${(builtins.getFlake "path:/home/matt/git/hyprland-touch-gestures").packages.x86_64-linux.default}/lib/libtouch-gestures.so"
];
extraConfig = ''
exec-once = ${pkgs.plasma5Packages.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1
source = ~/.config/hypr/main.conf
env = XDG_DATA_DIRS, ${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:$XDG_DATA_DIRS
env = SUDO_ASKPASS, ${pkgs.plasma5Packages.ksshaskpass}/bin/${pkgs.plasma5Packages.ksshaskpass.pname}
'';
};
home.stateVersion = "23.05"; home.stateVersion = "23.05";
}; };
services.xserver.displayManager = {
sessionPackages = [
(builtins.getFlake "github:hyprwm/Hyprland").packages.x86_64-linux.default
];
defaultSession = "hyprland";
};
} }