diff --git a/flake.nix b/flake.nix index 38c9245..4d619c5 100644 --- a/flake.nix +++ b/flake.nix @@ -36,13 +36,13 @@ nix.registry.unstable.flake = nixpkgs-unstable; system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; }; - rachel-home-module = - system: { + home-module = + system: config: { home-manager = { sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; useGlobalPkgs = true; useUserPackages = true; - users.rachel = import ./home-manager/all.nix { + users.${config.user} = import ./home-manager/all.nix { pkgs = import nixpkgs { inherit system; config.allowUnfree = true; @@ -68,43 +68,50 @@ protonmail-desktop = self.packages.${system}.protonmail-desktop; 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 home-manager.nixosModules.home-manager + base + (user-system system config) + (graphical system config) + (home-module system config) ]; in { nixosConfigurations.lambda = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - modules = base-modules ++ [ - ./nixos/lambda/configuration.nix - ./nixos/shared/user-system.nix - ./nixos/shared/graphical.nix - (rachel-home-module system) - ]; + modules = graphical-with-conf ./nixos/lambda/configuration.nix system { + user = "rachel"; + steam = true; + mcsr = false; + i3-plasma = true; + }; }; nixosConfigurations.transient = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - modules = base-modules ++ [ - ./nixos/transient/configuration.nix - ./nixos/shared/user-system.nix - ./nixos/shared/graphical.nix - (rachel-home-module system) - ]; + modules = graphical-with-conf ./nixos/transient/configuration.nix system { + user = "rachel"; + steam = true; + mcsr = false; + i3-plasma = true; + }; }; nixosConfigurations.computational = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - modules = base-modules ++ [ - ./nixos/computational/configuration.nix - ./nixos/shared/user-system.nix - ./nixos/shared/graphical.nix - (rachel-home-module system) - ]; + modules = graphical-with-conf ./nixos/computational/configuration.nix system { + user = "rachel"; + steam = true; + mcsr = true; + i3-plasma = false; + }; }; keyboardLayouts.fox = ./resources/fox.xkb; diff --git a/home-manager/all.nix b/home-manager/all.nix index 19adbbf..f651a8d 100644 --- a/home-manager/all.nix +++ b/home-manager/all.nix @@ -1,26 +1,27 @@ -{ pkgs, unstable, extra, ... }: +{ pkgs, unstable, extra, config, ... }: let common = rec { - username = "rachel"; + username = config.user; homeDir = "/home/${username}"; }; 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 ./fetch.nix - ./files.nix ./git.nix ./gpg.nix ./hm-settings.nix - ./i3.nix ./launcher.nix ./media.nix ./neovim.nix - ./picom.nix ./plasma.nix ./shell.nix ./ssh.nix ./terminal.nix ./tmux.nix ./xdg-dirs.nix - ]; + ./xinitrc.nix + ] ++ (if config.i3-plasma then [ + ./i3.nix + ./picom.nix + ] else [])); } diff --git a/home-manager/applications.nix b/home-manager/applications.nix index ef3d06d..c568923 100644 --- a/home-manager/applications.nix +++ b/home-manager/applications.nix @@ -1,4 +1,4 @@ -{ pkgs, unstable, extra, ... }: +{ pkgs, unstable, extra, config, ... }: { home.packages = (with pkgs; [ unzip @@ -55,7 +55,6 @@ typst ttyper idris2 - prismlauncher graalvm-ce vimv lean4 @@ -68,9 +67,7 @@ fzf bottom virt-manager-qt - i3 wmctrl - xwallpaper ]) ++ [ extra.agda unstable.zoom-us @@ -81,5 +78,12 @@ extra.nixprof extra.protonmail-desktop extra.pash - ]; + ] + ++ (if config.i3-plasma then [ + pkgs.i3 + pkgs.xwallpaper + ] else []) + ++ (if config.mcsr then [ + pkgs.prismlauncher + ] else []); } diff --git a/home-manager/i3.nix b/home-manager/i3.nix index 1f27e4e..700dd7f 100644 --- a/home-manager/i3.nix +++ b/home-manager/i3.nix @@ -1,4 +1,4 @@ -{ extra, ... }: +{ extra, config, ... }: { home.file.".config/i3/config".text = '' # i3 config file (v4) @@ -12,12 +12,16 @@ bindsym Mod4+Return exec --no-startup-id wezterm bindsym Mod4+BackSpace exec --no-startup-id firefox 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+Next exec --no-startup-id ${extra.eyezoom} default bindsym Mod1+Home exec --no-startup-id ${extra.eyezoom} wide bindsym Mod1+End exec --no-startup-id ${extra.eyezoom} thin - + '' else "") + + + '' # class border backgr. text indicator child_border client.focused #d79921 #d79921 #d79921 #d79921 #d79921 client.focused_inactive #d79921 #d79921 #d79921 #d79921 #d79921 diff --git a/home-manager/plasma.nix b/home-manager/plasma.nix index 8849a51..daab66d 100644 --- a/home-manager/plasma.nix +++ b/home-manager/plasma.nix @@ -1,15 +1,58 @@ -{ extra, ... }: +{ extra, config, ... }: { programs.plasma = { enable = 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 = { 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 = { general = { family = "SAX2 Nerd Font"; @@ -25,25 +68,42 @@ panels = [ { - location = "top"; + location = if config.i3-plasma then "top" else "bottom"; floating = true; - height = 36; - widgets = [ - { + height = if config.i3-plasma then 36 else 44; + widgets = let + clock = { digitalClock = { calendar.firstDayOfWeek = "monday"; time.format = "24h"; }; - } - { + }; + spacer = { name = "org.kde.plasma.panelspacer"; config = { General.expanding = true; }; - } - { + }; + nolaunchtasks = { name = "org.kde.plasma.icontasks"; 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 = { shown = [ "org.kde.plasma.battery" @@ -52,7 +112,17 @@ "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; }; - configFile."startkderc" = { + configFile."startkderc" = if config.i3-plasma then { "General"."systemdBoot" = false; # needed to use i3 in place of KWin - }; + } else {}; }; home.packages = [ diff --git a/home-manager/files.nix b/home-manager/xinitrc.nix similarity index 86% rename from home-manager/files.nix rename to home-manager/xinitrc.nix index a50b456..abccbb8 100644 --- a/home-manager/files.nix +++ b/home-manager/xinitrc.nix @@ -1,4 +1,4 @@ -{ extra, ... }: +{ extra, config, ... }: { home.file."bin/xinitrc" = { executable = true; @@ -15,8 +15,14 @@ dbus-update-activation-environment DISPLAY XAUTHORITY fi + '' + + + (if config.i3-plasma then '' xwallpaper --focus ${extra.wall} export KDEWM=i3 + '' else "") + + + '' exec startplasma-x11 ''; }; diff --git a/nixos/shared/graphical.nix b/nixos/shared/graphical.nix index b77c032..061dd15 100644 --- a/nixos/shared/graphical.nix +++ b/nixos/shared/graphical.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +system: config: { pkgs, ... }: { # [DESKTOP / XORG / WAYLAND] services.libinput = { @@ -14,7 +14,7 @@ displayManager.startx.enable = true; }; services.desktopManager.plasma6.enable = true; - programs.slock.enable = true; + programs.slock.enable = config.i3-plasma; # [SOUND] sound.enable = false; @@ -38,10 +38,10 @@ virtualisation.libvirtd.enable = true; programs.gamemode = { - enable = true; + enable = config.steam; settings.general.renice = 20; }; - programs.steam.enable = true; + programs.steam.enable = config.steam; nixpkgs.config.allowUnfree = true; hardware.logitech.wireless.enable = true; diff --git a/nixos/shared/user-system.nix b/nixos/shared/user-system.nix index 0eec210..036fb95 100644 --- a/nixos/shared/user-system.nix +++ b/nixos/shared/user-system.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +system: config: { pkgs, ... }: { # [LOCALE] time.timeZone = "Europe/Stockholm"; @@ -32,19 +32,19 @@ }; # [NFS] - fileSystems."/home/rachel/music" = { + fileSystems."/home/${config.user}/music" = { device = "rachel.cafe:/srv/music"; fsType = "nfs"; options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ]; }; - # fileSystems."/mnt/eta" = - # let secrets = import ../../secrets/eta.nix; - # in { - # device = "//192.168.30.33/users"; - # fsType = "cifs"; - # options = [ "username=${secrets.etaUser}" "password=${secrets.etaPass}" "uid=1000" "gid=1000" "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ]; - # }; + fileSystems."/mnt/eta" = + let secrets = import ../../secrets/eta.nix; + in { + device = "//192.168.30.33/users"; + fsType = "cifs"; + options = [ "username=${secrets.etaUser}" "password=${secrets.etaPass}" "uid=1000" "gid=1000" "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ]; + }; services.xserver = { xkb = { @@ -86,7 +86,7 @@ }]; }; # [USER] - users.users.rachel = { + users.users.${config.user} = { isNormalUser = true; shell = pkgs.zsh; ignoreShellProgramCheck = true; @@ -102,8 +102,8 @@ }; # Done for gamemoderun security.pam.loginLimits = [ - { domain = "rachel"; item = "nice"; "type" = "soft"; value = "-20"; } - { domain = "rachel"; item = "nice"; "type" = "hard"; value = "-20"; } + { domain = "${config.user}"; item = "nice"; "type" = "soft"; value = "-20"; } + { domain = "${config.user}"; item = "nice"; "type" = "hard"; value = "-20"; } ]; # [SERVICES] diff --git a/nixos/transient/lam.nix b/nixos/transient/lam.nix deleted file mode 100644 index 0fe994c..0000000 --- a/nixos/transient/lam.nix +++ /dev/null @@ -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"; -}