config system

This commit is contained in:
Rachel Lambda Samuelsson 2024-10-17 15:10:59 +02:00
parent 1141408b14
commit d1cd6216d5
9 changed files with 161 additions and 135 deletions

View File

@ -36,13 +36,13 @@
nix.registry.unstable.flake = nixpkgs-unstable; nix.registry.unstable.flake = nixpkgs-unstable;
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
}; };
rachel-home-module = home-module =
system: { system: config: {
home-manager = { home-manager = {
sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
users.rachel = import ./home-manager/all.nix { users.${config.user} = import ./home-manager/all.nix {
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
@ -68,43 +68,50 @@
protonmail-desktop = self.packages.${system}.protonmail-desktop; protonmail-desktop = self.packages.${system}.protonmail-desktop;
eyezoom = self.packages.${system}.eyezoom; eyezoom = self.packages.${system}.eyezoom;
}; };
inherit config;
}; };
}; };
}; };
base-modules = [ user-system = import ./nixos/shared/user-system.nix;
graphical = import ./nixos/shared/graphical.nix;
graphical-with-conf = base: system: config: [
nix-config-module nix-config-module
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
base
(user-system system config)
(graphical system config)
(home-module system config)
]; ];
in { in {
nixosConfigurations.lambda = nixpkgs.lib.nixosSystem rec { nixosConfigurations.lambda = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux"; system = "x86_64-linux";
modules = base-modules ++ [ modules = graphical-with-conf ./nixos/lambda/configuration.nix system {
./nixos/lambda/configuration.nix user = "rachel";
./nixos/shared/user-system.nix steam = true;
./nixos/shared/graphical.nix mcsr = false;
(rachel-home-module system) i3-plasma = true;
]; };
}; };
nixosConfigurations.transient = nixpkgs.lib.nixosSystem rec { nixosConfigurations.transient = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux"; system = "x86_64-linux";
modules = base-modules ++ [ modules = graphical-with-conf ./nixos/transient/configuration.nix system {
./nixos/transient/configuration.nix user = "rachel";
./nixos/shared/user-system.nix steam = true;
./nixos/shared/graphical.nix mcsr = false;
(rachel-home-module system) i3-plasma = true;
]; };
}; };
nixosConfigurations.computational = nixpkgs.lib.nixosSystem rec { nixosConfigurations.computational = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux"; system = "x86_64-linux";
modules = base-modules ++ [ modules = graphical-with-conf ./nixos/computational/configuration.nix system {
./nixos/computational/configuration.nix user = "rachel";
./nixos/shared/user-system.nix steam = true;
./nixos/shared/graphical.nix mcsr = true;
(rachel-home-module system) i3-plasma = false;
]; };
}; };
keyboardLayouts.fox = ./resources/fox.xkb; keyboardLayouts.fox = ./resources/fox.xkb;

View File

@ -1,26 +1,27 @@
{ pkgs, unstable, extra, ... }: { pkgs, unstable, extra, config, ... }:
let common = rec { let common = rec {
username = "rachel"; username = config.user;
homeDir = "/home/${username}"; homeDir = "/home/${username}";
}; };
in { in {
imports = builtins.map (x: import x { inherit pkgs unstable extra common; }) [ imports = builtins.map (x: import x { inherit pkgs unstable extra common config; }) ([
./applications.nix ./applications.nix
./fetch.nix ./fetch.nix
./files.nix
./git.nix ./git.nix
./gpg.nix ./gpg.nix
./hm-settings.nix ./hm-settings.nix
./i3.nix
./launcher.nix ./launcher.nix
./media.nix ./media.nix
./neovim.nix ./neovim.nix
./picom.nix
./plasma.nix ./plasma.nix
./shell.nix ./shell.nix
./ssh.nix ./ssh.nix
./terminal.nix ./terminal.nix
./tmux.nix ./tmux.nix
./xdg-dirs.nix ./xdg-dirs.nix
]; ./xinitrc.nix
] ++ (if config.i3-plasma then [
./i3.nix
./picom.nix
] else []));
} }

View File

@ -1,4 +1,4 @@
{ pkgs, unstable, extra, ... }: { pkgs, unstable, extra, config, ... }:
{ {
home.packages = (with pkgs; [ home.packages = (with pkgs; [
unzip unzip
@ -55,7 +55,6 @@
typst typst
ttyper ttyper
idris2 idris2
prismlauncher
graalvm-ce graalvm-ce
vimv vimv
lean4 lean4
@ -68,9 +67,7 @@
fzf fzf
bottom bottom
virt-manager-qt virt-manager-qt
i3
wmctrl wmctrl
xwallpaper
]) ++ [ ]) ++ [
extra.agda extra.agda
unstable.zoom-us unstable.zoom-us
@ -81,5 +78,12 @@
extra.nixprof extra.nixprof
extra.protonmail-desktop extra.protonmail-desktop
extra.pash extra.pash
]; ]
++ (if config.i3-plasma then [
pkgs.i3
pkgs.xwallpaper
] else [])
++ (if config.mcsr then [
pkgs.prismlauncher
] else []);
} }

View File

@ -1,4 +1,4 @@
{ extra, ... }: { extra, config, ... }:
{ {
home.file.".config/i3/config".text = '' home.file.".config/i3/config".text = ''
# i3 config file (v4) # i3 config file (v4)
@ -12,12 +12,16 @@
bindsym Mod4+Return exec --no-startup-id wezterm bindsym Mod4+Return exec --no-startup-id wezterm
bindsym Mod4+BackSpace exec --no-startup-id firefox bindsym Mod4+BackSpace exec --no-startup-id firefox
bindsym --release Mod4+s exec --no-startup-id slock bindsym --release Mod4+s exec --no-startup-id slock
''
+
(if config.mcsr then ''
bindsym Mod1+Prior exec --no-startup-id ${extra.eyezoom} eye bindsym Mod1+Prior exec --no-startup-id ${extra.eyezoom} eye
bindsym Mod1+Next exec --no-startup-id ${extra.eyezoom} default bindsym Mod1+Next exec --no-startup-id ${extra.eyezoom} default
bindsym Mod1+Home exec --no-startup-id ${extra.eyezoom} wide bindsym Mod1+Home exec --no-startup-id ${extra.eyezoom} wide
bindsym Mod1+End exec --no-startup-id ${extra.eyezoom} thin bindsym Mod1+End exec --no-startup-id ${extra.eyezoom} thin
'' else "")
+
''
# class border backgr. text indicator child_border # class border backgr. text indicator child_border
client.focused #d79921 #d79921 #d79921 #d79921 #d79921 client.focused #d79921 #d79921 #d79921 #d79921 #d79921
client.focused_inactive #d79921 #d79921 #d79921 #d79921 #d79921 client.focused_inactive #d79921 #d79921 #d79921 #d79921 #d79921

View File

@ -1,15 +1,58 @@
{ extra, ... }: { extra, config, ... }:
{ {
programs.plasma = { programs.plasma = {
enable = true; enable = true;
overrideConfig = true; overrideConfig = true;
workspace.lookAndFeel = "org.kde.breezedark.desktop"; workspace = {
lookAndFeel = "org.kde.breezedark.desktop";
} // (if config.i3-plasma then {} else {
wallpaper = "${extra.wall}";
});
kscreenlocker = { kscreenlocker = {
appearance.wallpaper = "${extra.wall}"; appearance.wallpaper = "${extra.wall}";
}; };
hotkeys.commands = if config.i3-plasma then {} else ({
"launch-terminal" = {
name = "Launch terminal";
key = "Meta+Return";
command = "wezterm";
};
"cpypsk" = {
name = "Launch cpypsk";
key = "Meta+p";
command = "${extra.cpypsk}";
};
} // (if config.mcsr then {
"eye" = {
name = "eye zoom";
key = "Alt+PgUp";
command = "${extra.eyezoom} eye";
};
"default" = {
name = "default zoom";
key = "Alt+PgDown";
command = "${extra.eyezoom} default";
};
"thin" = {
name = "thin zoom";
key = "Alt+End";
command = "${extra.eyezoom} tiktok";
};
"wide" = {
name = "wide zoom";
key = "Alt+Home";
command = "${extra.eyezoom} wide";
};
} else {}));
fonts = { fonts = {
general = { general = {
family = "SAX2 Nerd Font"; family = "SAX2 Nerd Font";
@ -25,25 +68,42 @@
panels = [ panels = [
{ {
location = "top"; location = if config.i3-plasma then "top" else "bottom";
floating = true; floating = true;
height = 36; height = if config.i3-plasma then 36 else 44;
widgets = [ widgets = let
{ clock = {
digitalClock = { digitalClock = {
calendar.firstDayOfWeek = "monday"; calendar.firstDayOfWeek = "monday";
time.format = "24h"; time.format = "24h";
}; };
} };
{ spacer = {
name = "org.kde.plasma.panelspacer"; name = "org.kde.plasma.panelspacer";
config = { General.expanding = true; }; config = { General.expanding = true; };
} };
{ nolaunchtasks = {
name = "org.kde.plasma.icontasks"; name = "org.kde.plasma.icontasks";
config = { General.launchers = [ ]; }; config = { General.launchers = [ ]; };
} };
{ launchtasks = {
name = "org.kde.plasma.icontasks";
config = {
General.launchers = [
"applications:thunderbird.desktop"
"applications:org.wezfurlong.wezterm.desktop"
"applications:firefox.desktop"
"applications:discord.desktop"
];
};
};
kickoff = {
name = "org.kde.plasma.kickoff";
config = {
General.icon = "nix-snowflake-white";
};
};
systray = {
systemTray.items = { systemTray.items = {
shown = [ shown = [
"org.kde.plasma.battery" "org.kde.plasma.battery"
@ -52,7 +112,17 @@
"org.kde.plasma.volume" "org.kde.plasma.volume"
]; ];
}; };
} };
in if config.i3-plasma then [
clock
spacer
nolaunchtasks
systray
] else [
kickoff
launchtasks
systray
clock
]; ];
} }
]; ];
@ -62,9 +132,9 @@
"Mouse"."XLbInptPointerAcceleration" = 0; "Mouse"."XLbInptPointerAcceleration" = 0;
}; };
configFile."startkderc" = { configFile."startkderc" = if config.i3-plasma then {
"General"."systemdBoot" = false; # needed to use i3 in place of KWin "General"."systemdBoot" = false; # needed to use i3 in place of KWin
}; } else {};
}; };
home.packages = [ home.packages = [

View File

@ -1,4 +1,4 @@
{ extra, ... }: { extra, config, ... }:
{ {
home.file."bin/xinitrc" = { home.file."bin/xinitrc" = {
executable = true; executable = true;
@ -15,8 +15,14 @@
dbus-update-activation-environment DISPLAY XAUTHORITY dbus-update-activation-environment DISPLAY XAUTHORITY
fi fi
''
+
(if config.i3-plasma then ''
xwallpaper --focus ${extra.wall} xwallpaper --focus ${extra.wall}
export KDEWM=i3 export KDEWM=i3
'' else "")
+
''
exec startplasma-x11 exec startplasma-x11
''; '';
}; };

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: system: config: { pkgs, ... }:
{ {
# [DESKTOP / XORG / WAYLAND] # [DESKTOP / XORG / WAYLAND]
services.libinput = { services.libinput = {
@ -14,7 +14,7 @@
displayManager.startx.enable = true; displayManager.startx.enable = true;
}; };
services.desktopManager.plasma6.enable = true; services.desktopManager.plasma6.enable = true;
programs.slock.enable = true; programs.slock.enable = config.i3-plasma;
# [SOUND] # [SOUND]
sound.enable = false; sound.enable = false;
@ -38,10 +38,10 @@
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = true;
programs.gamemode = { programs.gamemode = {
enable = true; enable = config.steam;
settings.general.renice = 20; settings.general.renice = 20;
}; };
programs.steam.enable = true; programs.steam.enable = config.steam;
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
hardware.logitech.wireless.enable = true; hardware.logitech.wireless.enable = true;

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: system: config: { pkgs, ... }:
{ {
# [LOCALE] # [LOCALE]
time.timeZone = "Europe/Stockholm"; time.timeZone = "Europe/Stockholm";
@ -32,19 +32,19 @@
}; };
# [NFS] # [NFS]
fileSystems."/home/rachel/music" = { fileSystems."/home/${config.user}/music" = {
device = "rachel.cafe:/srv/music"; device = "rachel.cafe:/srv/music";
fsType = "nfs"; fsType = "nfs";
options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ]; options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ];
}; };
# fileSystems."/mnt/eta" = fileSystems."/mnt/eta" =
# let secrets = import ../../secrets/eta.nix; let secrets = import ../../secrets/eta.nix;
# in { in {
# device = "//192.168.30.33/users"; device = "//192.168.30.33/users";
# fsType = "cifs"; fsType = "cifs";
# options = [ "username=${secrets.etaUser}" "password=${secrets.etaPass}" "uid=1000" "gid=1000" "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ]; options = [ "username=${secrets.etaUser}" "password=${secrets.etaPass}" "uid=1000" "gid=1000" "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ];
# }; };
services.xserver = { services.xserver = {
xkb = { xkb = {
@ -86,7 +86,7 @@
}]; }];
}; };
# [USER] # [USER]
users.users.rachel = { users.users.${config.user} = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.zsh; shell = pkgs.zsh;
ignoreShellProgramCheck = true; ignoreShellProgramCheck = true;
@ -102,8 +102,8 @@
}; };
# Done for gamemoderun # Done for gamemoderun
security.pam.loginLimits = [ security.pam.loginLimits = [
{ domain = "rachel"; item = "nice"; "type" = "soft"; value = "-20"; } { domain = "${config.user}"; item = "nice"; "type" = "soft"; value = "-20"; }
{ domain = "rachel"; item = "nice"; "type" = "hard"; value = "-20"; } { domain = "${config.user}"; item = "nice"; "type" = "hard"; value = "-20"; }
]; ];
# [SERVICES] # [SERVICES]

View File

@ -1,66 +0,0 @@
{ config, pkgs, ... }:
{
# [HARDWARE]
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
intel-ocl
intel-compute-runtime
intel-media-driver
vaapiIntel
vaapiVdpau
libvdpau-va-gl
];
};
hardware.bluetooth.enable = true;
services.logind = {
lidSwitch = "hibernate";
lidSwitchDocked = "ignore";
lidSwitchExternalPower = "hibernate";
};
services.udev.extraRules = ''
KERNEL=="0000:00:14.0", SUBSYSTEM=="pci", ATTR{power/wakeup}="disabled"
'';
# [BOOT / DISK ENCRYPTION]
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.grub = {
enable = true;
device = "nodev";
efiSupport = true;
enableCryptodisk = true;
theme = ../../resources/grub-theme;
};
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.initrd = {
availableKernelModules = [ "aesni_intel" "cryptd" ];
secrets = { "/boot/key" = "/boot/key"; };
luks.mitigateDMAAttacks = true;
luks.devices = {
root = {
device = "/dev/disk/by-uuid/91114176-b6cc-4454-89df-e2bf5c1fac0a";
keyFile = "/boot/key";
preLVM = true;
};
};
};
# [NETWORKING]
networking.hostName = "lambda";
networking.networkmanager = {
enable = true;
wifi.powersave = true;
wifi.scanRandMacAddress = true;
wifi.macAddress = "random";
};
system.stateVersion = "24.05";
}