From 0efab4c6bd8ed6c2e3415b3935f5c54a70ca2584 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Thu, 7 Jul 2022 15:33:38 +0200 Subject: [PATCH] feat: add p330 config --- configuration.nix | 3 -- flake.nix | 29 +++++++++++++- home-manager/i3/default.nix | 20 +++++++--- home-manager/kitty.nix | 3 +- home-manager/neovim/themes.lua | 2 +- home-mandlm.nix | 1 + machines/apache/home-mandlm.nix | 5 +++ machines/p330/configuration.nix | 27 +++++++++++++ machines/p330/hardware-configuration.nix | 48 ++++++++++++++++++++++++ machines/p330/home-mandlm.nix | 20 ++++++++++ 10 files changed, 146 insertions(+), 12 deletions(-) create mode 100644 machines/apache/home-mandlm.nix create mode 100644 machines/p330/configuration.nix create mode 100644 machines/p330/hardware-configuration.nix create mode 100644 machines/p330/home-mandlm.nix diff --git a/configuration.nix b/configuration.nix index 6055e84..07e55a5 100644 --- a/configuration.nix +++ b/configuration.nix @@ -36,9 +36,6 @@ services.resolved = { enable = true; - extraConfig = '' - DNS = 192.168.178.249 - ''; dnssec = "false"; }; diff --git a/flake.nix b/flake.nix index 015f5ae..b64d4c0 100644 --- a/flake.nix +++ b/flake.nix @@ -50,7 +50,34 @@ home-manager.useUserPackages = true; home-manager.extraSpecialArgs = { inherit user; }; home-manager.users.${user} = { - imports = [ ./home-${user}.nix ]; + imports = [ + ./home-${user}.nix + ./machines/apache/home-${user}.nix + ]; + }; + } + ]; + }; + + p330 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = inputs; + modules = [ + ./configuration.nix + ./users.nix + ./machines/p330/configuration.nix + ./machines/p330/hardware-configuration.nix + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit user; }; + home-manager.users.${user} = { + imports = [ + ./home-${user}.nix + ./machines/p330/home-${user}.nix + ]; }; } ]; diff --git a/home-manager/i3/default.nix b/home-manager/i3/default.nix index bce23fd..8f7fc45 100644 --- a/home-manager/i3/default.nix +++ b/home-manager/i3/default.nix @@ -1,5 +1,10 @@ { config, lib, pkgs, user, ... }: +let + cfg = config.xsession.windowManager.i3; + font.name = "DejaVu Sans Mono"; + font.size = 12.0; +in { imports = [ ./i3status-rust.nix @@ -19,8 +24,8 @@ terminal = "${pkgs.kitty}/bin/kitty"; fonts = { - names = [ "DejaVu Sans Mono" ]; - size = 12.0; + names = [ font.name ]; + size = font.size; }; window = { @@ -41,13 +46,17 @@ statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml"; fonts = { - names = [ "DejaVu Sans Mono" ]; - size = 12.0; + names = [ font.name ]; + size = font.size; }; }]; defaultWorkspace = "workspace number 1"; + keybindings = lib.mkOptionDefault { + "${cfg.config.modifier}+Shift+o" = "exec xdg-open \"zoommtg://zoom.us/join?action=join&confno=4861587170&pwd=ZVk3aHphcWppY21ONjZOMVh6STN6dz09\""; + }; + startup = [ { command = "i3-msg 'workspace 1; append_layout ~/.config/i3/workspaces/workspace-1.json'"; } { command = "i3-msg 'workspace 2; append_layout ~/.config/i3/workspaces/workspace-2.json'"; } @@ -63,10 +72,11 @@ { command = "telegram-desktop"; notification = false; } { command = "thunderbird"; notification = false; } { command = "whatsapp-for-linux"; notification = false; } + { command = "zoom"; notification = false; } ]; assigns = { - "6" = [{ class = "^zoom$"; }]; + "6" = [{ class = "^\.zoom $"; }]; }; }; }; diff --git a/home-manager/kitty.nix b/home-manager/kitty.nix index 5f829db..49eac2a 100644 --- a/home-manager/kitty.nix +++ b/home-manager/kitty.nix @@ -4,10 +4,9 @@ programs = { kitty = { enable = true; - theme = "Solarized Light"; + theme = "Solarized Dark"; font = { name = "DejaVu Sans Mono"; - size = 12; }; settings = { tab_bar_style = "powerline"; diff --git a/home-manager/neovim/themes.lua b/home-manager/neovim/themes.lua index 96d2d9b..3101cab 100644 --- a/home-manager/neovim/themes.lua +++ b/home-manager/neovim/themes.lua @@ -1,2 +1,2 @@ -vim.opt.background = 'light' +vim.opt.background = 'dark' vim.cmd("colorscheme solarized") diff --git a/home-mandlm.nix b/home-mandlm.nix index a3e07a2..6688fbd 100644 --- a/home-mandlm.nix +++ b/home-mandlm.nix @@ -27,6 +27,7 @@ light element-desktop difftastic + zoom-us ]; stateVersion = "22.05"; diff --git a/machines/apache/home-mandlm.nix b/machines/apache/home-mandlm.nix new file mode 100644 index 0000000..6703119 --- /dev/null +++ b/machines/apache/home-mandlm.nix @@ -0,0 +1,5 @@ +{ config, lib, pkgs, user, ... }: + +{ + programs.kitty.font.size = 12; +} diff --git a/machines/p330/configuration.nix b/machines/p330/configuration.nix new file mode 100644 index 0000000..1f4c85e --- /dev/null +++ b/machines/p330/configuration.nix @@ -0,0 +1,27 @@ +{ config, pkgs, ... }: + +{ + networking.hostName = "p330"; + boot.loader.grub.enableCryptodisk = true; + + services.xserver = { + videoDrivers = [ "intel" ]; + dpi = 144; + xrandrHeads = [ + { + output = "DP2"; + primary = true; + monitorConfig = '' + Option "Position" "0 790" + ''; + } + { + output = "DP3"; + monitorConfig = '' + Option "Position" "3840 0" + Option "Rotate" "right" + ''; + } + ]; + }; +} diff --git a/machines/p330/hardware-configuration.nix b/machines/p330/hardware-configuration.nix new file mode 100644 index 0000000..77d666e --- /dev/null +++ b/machines/p330/hardware-configuration.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + boot.initrd.luks.devices = { + crypted = { + device = "/dev/disk/by-uuid/c24c9fba-fa0b-41a2-87c1-75edc7b3f64d"; + preLVM = true; + }; + }; + + fileSystems."/" = + { + device = "/dev/disk/by-uuid/9c6e1dc3-a442-431d-8cf4-6eaf1e45c296"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-uuid/3B69-8F97"; + fsType = "vfat"; + }; + + fileSystems."/home" = + { + device = "/dev/disk/by-uuid/6a44edab-e602-40e9-85c4-cb8517862992"; + fsType = "ext4"; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/b90199d6-05e8-4994-bf9d-7b07f10d583e"; }]; + + networking.interfaces.eno1.useDHCP = lib.mkDefault true; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; +} diff --git a/machines/p330/home-mandlm.nix b/machines/p330/home-mandlm.nix new file mode 100644 index 0000000..1cce414 --- /dev/null +++ b/machines/p330/home-mandlm.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, user, ... }: + +{ + xsession.windowManager.i3.config = { + workspaceOutputAssign = [ + { workspace = "1"; output = "DP3"; } + { workspace = "2"; output = "DP2"; } + { workspace = "3"; output = "DP3"; } + { workspace = "4"; output = "DP2"; } + { workspace = "5"; output = "DP3"; } + { workspace = "6"; output = "DP2"; } + { workspace = "7"; output = "DP3"; } + { workspace = "8"; output = "DP2"; } + { workspace = "9"; output = "DP3"; } + { workspace = "10"; output = "DP2"; } + ]; + }; + + programs.kitty.font.size = 16; +}