diff --git a/flake.nix b/flake.nix index 9c4ed97..0b411bf 100644 --- a/flake.nix +++ b/flake.nix @@ -14,16 +14,16 @@ }; # ... - # Optional - updates underlying without waiting for nix-citizen to update }; outputs = - { self - , nixpkgs - , home-manager - , ... + { + self, + nixpkgs, + home-manager, + ... }@inputs: let system = "x86_64-linux"; @@ -32,7 +32,6 @@ { nixosConfigurations = { - zedd = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self user; }; diff --git a/hosts/zedd/configuration.nix b/hosts/zedd/configuration.nix index 5c78037..ee14b12 100644 --- a/hosts/zedd/configuration.nix +++ b/hosts/zedd/configuration.nix @@ -1,4 +1,9 @@ -{ config, pkgs,lib, ... }: +{ + config, + pkgs, + lib, + ... +}: { # Enable OpenGL # Load nvidia driver for Xorg and Wayland @@ -23,12 +28,10 @@ "vm.max_map_count" = 2147483642; "fs.file-max" = 524288; }; - networking.extraHosts = - '' - 127.0.0.1 zedd zedd.local + networking.extraHosts = '' + 127.0.0.1 zedd zedd.local ''; - networking.hostName = "zedd"; # Define your hostname. time.timeZone = "Europe/Oslo"; i18n.defaultLocale = "en_US.UTF-8"; @@ -46,27 +49,32 @@ device = "/dev/data/data"; fsType = "ext4"; }; - xdg.portal = - { - enable = true; - xdgOpenUsePortal = true; - config = { - common = { - default = [ - "*" - ]; - }; + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + config = { + common = { + default = [ + "*" + ]; }; - extraPortals = (with pkgs; [ + }; + extraPortals = ( + with pkgs; + [ # unstable.xdg-desktop-portal-hyprland xdg-desktop-portal-gtk - ]); + ] + ); - }; + }; # Allow unfree packages nixpkgs.config.allowUnfree = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; virtualisation.docker.enable = true; virtualisation.docker.liveRestore = false; system.stateVersion = "23.11"; # Did you read the comment? diff --git a/hosts/zedd/default.nix b/hosts/zedd/default.nix index a0f343f..48b4167 100644 --- a/hosts/zedd/default.nix +++ b/hosts/zedd/default.nix @@ -1,4 +1,10 @@ -{ inputs, self, pks, ... }: { +{ + inputs, + self, + pks, + ... +}: +{ imports = [ ./configuration.nix ./hardware-configuration.nix diff --git a/hosts/zedd/hardware-configuration.nix b/hosts/zedd/hardware-configuration.nix index 86b2bb8..d99321b 100644 --- a/hosts/zedd/hardware-configuration.nix +++ b/hosts/zedd/hardware-configuration.nix @@ -1,31 +1,41 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "vmd" + "xhci_pci" + "ahci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { - device = "/dev/disk/by-uuid/d05743bb-9448-483b-8002-caa0da402820"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/4B24-7005"; - fsType = "vfat"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/d05743bb-9448-483b-8002-caa0da402820"; + fsType = "ext4"; + }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/4B24-7005"; + fsType = "vfat"; + }; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/system/default.nix b/system/default.nix index 2573605..ed99849 100644 --- a/system/default.nix +++ b/system/default.nix @@ -1 +1,10 @@ -{ imports = [ ./users.nix ./services ./hardware.nix ./fonts.nix ./security.nix ./programs.nix ]; } +{ + imports = [ + ./users.nix + ./services + ./hardware.nix + ./fonts.nix + ./security.nix + ./programs.nix + ]; +} diff --git a/system/fonts.nix b/system/fonts.nix index 5045e95..e1658c5 100644 --- a/system/fonts.nix +++ b/system/fonts.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ environment.systemPackages = with pkgs; [ twemoji-color-font ]; fonts.packages = with pkgs; [ fira-code diff --git a/system/hardware.nix b/system/hardware.nix index 4c30b36..903fabd 100644 --- a/system/hardware.nix +++ b/system/hardware.nix @@ -1,36 +1,33 @@ { config, pkgs, ... }: { - environment.sessionVariables = { LIBVA_DRIVER_NAME = "nvidia"; }; + environment.sessionVariables = { + LIBVA_DRIVER_NAME = "nvidia"; + }; - nixpkgs.config.packageOverrides = pkgs: { + nixpkgs.config.packageOverrides = pkgs: { intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; }; }; hardware = { enableRedistributableFirmware = true; cpu.intel.updateMicrocode = true; - pulseaudio = { - enable =true; - support32Bit = true; - }; - graphics = - { - enable = true; - enable32Bit = true; - extraPackages = with pkgs; [ - vaapiVdpau - mangohud - nvidia-vaapi-driver - intel-media-driver - intel-vaapi-driver - libvdpau-va-gl - ]; - extraPackages32 = with pkgs.pkgsi686Linux; [ - mangohud - intel-media-driver - intel-vaapi-driver - ]; + graphics = { + enable = true; + enable32Bit = true; + extraPackages = with pkgs; [ + vaapiVdpau + mangohud + nvidia-vaapi-driver + intel-media-driver + intel-vaapi-driver + libvdpau-va-gl + ]; + extraPackages32 = with pkgs.pkgsi686Linux; [ + mangohud + intel-media-driver + intel-vaapi-driver + ]; - }; + }; nvidia = { modesetting.enable = true; powerManagement.enable = false; diff --git a/system/nix-alien.nix b/system/nix-alien.nix index e744320..8df71ae 100644 --- a/system/nix-alien.nix +++ b/system/nix-alien.nix @@ -1,10 +1,8 @@ { ... }: let - nix-alien-pkgs = import - ( - builtins.fetchTarball "https://github.com/thiagokokada/nix-alien/tarball/master" - ) - { }; + nix-alien-pkgs = + import (builtins.fetchTarball "https://github.com/thiagokokada/nix-alien/tarball/master") + { }; in { environment.systemPackages = with nix-alien-pkgs; [ diff --git a/system/programs.nix b/system/programs.nix index 87d8e28..d4cb1de 100644 --- a/system/programs.nix +++ b/system/programs.nix @@ -1,4 +1,10 @@ -{ config, pkgs, inputs, ... }: { +{ + config, + pkgs, + inputs, + ... +}: +{ services.flatpak.enable = true; programs.nix-ld.enable = true; programs.nix-ld.libraries = [ @@ -7,20 +13,19 @@ ]; programs.steam = { enable = true; - extraPackages = [ - pkgs.mangohud - ]; + extraPackages = [ + pkgs.mangohud + ]; package = pkgs.steam.override { extraLibraries = pkgs: [ pkgs.mangohud ]; extraEnv = { - MANGOHUD=true; + MANGOHUD = true; }; }; - }; programs.thunar.enable = true; programs.gnupg.agent = { diff --git a/system/security.nix b/system/security.nix index 8f4af2c..df615b3 100644 --- a/system/security.nix +++ b/system/security.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ # Enable sudo security.sudo = { enable = true; diff --git a/system/services/audio.nix b/system/services/audio.nix index 6be98c1..df0b5d8 100644 --- a/system/services/audio.nix +++ b/system/services/audio.nix @@ -1,12 +1,12 @@ - -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ security.rtkit.enable = true; -services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; -}; -} \ No newline at end of file + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + }; +} diff --git a/system/services/default.nix b/system/services/default.nix index 0378f0a..91388f7 100644 --- a/system/services/default.nix +++ b/system/services/default.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ services.fwupd.enable = true; programs.dconf.enable = true; @@ -15,10 +16,9 @@ enable = true; settings.PasswordAuthentication = true; }; - imports = - [ ./networking.nix - ./audio.nix - ./xserver.nix - ./vscode.nix + imports = [ + ./networking.nix + ./audio.nix + ./xserver.nix ]; -} +} diff --git a/system/services/networking.nix b/system/services/networking.nix index 9d43949..5b872ff 100644 --- a/system/services/networking.nix +++ b/system/services/networking.nix @@ -1,19 +1,19 @@ - -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ networking = { - wireless = { - enable = false; - networks = { - # "bennynet" = { - # pskRaw = "85e8f17e02f4b4df5ddc9b95d1a4256b3c2608fcc8dfa1860b693d06c2a0bf1f"; - # }; + wireless = { + enable = false; + networks = { + # "bennynet" = { + # pskRaw = "85e8f17e02f4b4df5ddc9b95d1a4256b3c2608fcc8dfa1860b693d06c2a0bf1f"; + # }; + }; + }; + firewall = { + enable = true; + allowedTCPPorts = [ 22 ]; + extraCommands = "iptables -A INPUT -s 192.168.0.0/16 -j ACCEPT"; + }; }; - firewall = { - enable = true; - allowedTCPPorts = [ 22 ]; - extraCommands = "iptables -A INPUT -s 192.168.0.0/16 -j ACCEPT"; - - }; - }; -} \ No newline at end of file +} diff --git a/system/services/xserver.nix b/system/services/xserver.nix index c00c2d2..94025a3 100644 --- a/system/services/xserver.nix +++ b/system/services/xserver.nix @@ -1,13 +1,12 @@ - -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ services = { - displayManager = - { - defaultSession = "none+i3"; - autoLogin.enable = true; - autoLogin.user = "mbeno"; + displayManager = { + defaultSession = "none+i3"; + autoLogin.enable = true; + autoLogin.user = "mbeno"; - }; + }; logind.extraConfig = "IdleAction=ignore"; xserver = { exportConfiguration = true; @@ -44,18 +43,17 @@ "; } ]; - screenSection = - '' - Option "metamodes" "DP-2: 2560x1440_144 +0+0, DP-0: 1920x1080_144 +2560+0" - ''; + screenSection = '' + Option "metamodes" "DP-2: 2560x1440_144 +0+0, DP-0: 1920x1080_144 +2560+0" + ''; windowManager.i3 = { enable = true; extraPackages = with pkgs; [ - dmenu #application launcher most people use + dmenu # application launcher most people use i3status # gives you the default i3 status bar i3lock # i3lock #default i3 screen locker - i3blocks #if you are planning on using i3blocks over i3status + i3blocks # if you are planning on using i3blocks over i3status polybar rofi nitrogen @@ -63,4 +61,4 @@ }; }; }; -} \ No newline at end of file +} diff --git a/system/users.nix b/system/users.nix index 33fe285..f91aa0d 100644 --- a/system/users.nix +++ b/system/users.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ programs.zsh.enable = true; environment.shells = with pkgs; [ zsh ]; @@ -6,7 +7,12 @@ shell = pkgs.zsh; isNormalUser = true; description = "Martin"; - extraGroups = [ "networkmanager" "wheel" "docker" "audio" ]; + extraGroups = [ + "networkmanager" + "wheel" + "docker" + "audio" + ]; packages = with pkgs; [ alacritty mumble diff --git a/user/default.nix b/user/default.nix index cc72c8e..83a8654 100644 --- a/user/default.nix +++ b/user/default.nix @@ -1,50 +1,58 @@ -{ pkgs, inputs, user, ... }: { +{ + pkgs, + inputs, + user, + ... +}: +{ imports = [ inputs.home-manager.nixosModules.home-manager ]; home-manager = { useUserPackages = true; useGlobalPkgs = true; extraSpecialArgs = { inherit pkgs inputs user; }; - users.${user} = { pkgs, ... }: { - imports = [ - ./programs/neovim - # ./programs/firefox - ./programs/tmux - ./programs/dunst - ./programs/rofi - ./programs/obs-studio - ./programs/vscode - # ./programs/games - ./scripts - ./zsh - ./ssh - ./services/ssh-office.nix - ./packages - ]; - tmux.enable = true; - # firefox.enable = true; - xdg.enable = true; - services.picom = { - enable = true; - settings = { - unredir-if-possible = false; - backend = "xrender"; # try "glx" if xrender doesn't help - vsync = true; + users.${user} = + { pkgs, ... }: + { + imports = [ + ./programs/neovim + # ./programs/firefox + ./programs/tmux + ./programs/dunst + ./programs/rofi + ./programs/obs-studio + ./programs/vscode + # ./programs/games + ./scripts + ./zsh + ./ssh + ./services/ssh-office.nix + ./packages + ]; + tmux.enable = true; + # firefox.enable = true; + xdg.enable = true; + services.picom = { + enable = true; + settings = { + unredir-if-possible = false; + backend = "xrender"; # try "glx" if xrender doesn't help + vsync = true; + }; }; - }; - services.gnome-keyring.enable = true; - home = { - username = "${user}"; - homeDirectory = "/home/${user}"; - stateVersion = "23.11"; - }; - programs.home-manager.enable = true; - programs.direnv = { - enable = true; - enableZshIntegration = true; - nix-direnv.enable = true; - }; - programs.firefox.enable = true; + services.gnome-keyring.enable = true; + home = { + username = "${user}"; + homeDirectory = "/home/${user}"; + stateVersion = "23.11"; + }; + programs.home-manager.enable = true; + programs.direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; + }; + programs.firefox.enable = true; - }; + }; }; } diff --git a/user/packages/default.nix b/user/packages/default.nix index bd29a83..0cf6cb5 100644 --- a/user/packages/default.nix +++ b/user/packages/default.nix @@ -1,4 +1,5 @@ -{ pkgs, inputs, ... }: { +{ pkgs, inputs, ... }: +{ home.packages = with pkgs; [ # Generic tools age @@ -76,6 +77,7 @@ nodejs nodePackages.pnpm typescript + nixfmt-rfc-style # Py stuff (python312.withPackages ( @@ -98,6 +100,5 @@ gcc gnumake - ]; } diff --git a/user/programs/dunst/default.nix b/user/programs/dunst/default.nix index b90b005..ea6c7f6 100644 --- a/user/programs/dunst/default.nix +++ b/user/programs/dunst/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { services.dunst = { @@ -36,7 +41,7 @@ corner_radius = 10; # follow = "mouse"; font = "Source Sans Pro 10"; - format = "%s\\n%b"; #format = "%s %p\n%b" + format = "%s\\n%b"; # format = "%s %p\n%b" frame_color = "#232323"; frame_width = 1; offset = "15x15"; @@ -57,7 +62,9 @@ browser = "/usr/bin/env firefox -new-tab"; }; - fullscreen_delay_everything = { fullscreen = "delay"; }; + fullscreen_delay_everything = { + fullscreen = "delay"; + }; urgency_critical = { background = "#d64e4e"; diff --git a/user/programs/games/default.nix b/user/programs/games/default.nix index 41932a3..cc28a9a 100644 --- a/user/programs/games/default.nix +++ b/user/programs/games/default.nix @@ -1,6 +1,8 @@ -{ pkgs -, inputs -, ... +{ + pkgs, + inputs, + ... }: # games -{ } +{ +} diff --git a/user/programs/neovim/default.nix b/user/programs/neovim/default.nix index f5fb6e7..73a794f 100644 --- a/user/programs/neovim/default.nix +++ b/user/programs/neovim/default.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ programs = { neovim = { enable = true; diff --git a/user/programs/rofi/default.nix b/user/programs/rofi/default.nix index b4fecd4..2da8113 100644 --- a/user/programs/rofi/default.nix +++ b/user/programs/rofi/default.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ xdg.configFile."rofi/config.rasi".text = '' /*Dracula theme based on the Purple official rofi theme*/ @@ -138,4 +139,3 @@ @theme "${pkgs.rofi-unwrapped}/share/rofi/themes/android_notification.rasi" ''; } - diff --git a/user/programs/tmux/default.nix b/user/programs/tmux/default.nix index fdb2647..060d536 100644 --- a/user/programs/tmux/default.nix +++ b/user/programs/tmux/default.nix @@ -1,7 +1,14 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: with lib; -let cfg = config.tmux.enable; -in { +let + cfg = config.tmux.enable; +in +{ options.tmux.enable = mkEnableOption "tmux"; config = mkIf cfg { programs.tmux = { diff --git a/user/programs/vscode/default.nix b/user/programs/vscode/default.nix index 236c2e5..de54ff0 100644 --- a/user/programs/vscode/default.nix +++ b/user/programs/vscode/default.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ programs.vscode = { enable = true; enableUpdateCheck = true; @@ -15,8 +16,9 @@ github.copilot-chat arrterian.nix-env-selector ms-python.python - + ]; + userSettings = { "window.titleBarStyle" = "custom"; "editor.formatOnSave" = true; diff --git a/user/scripts/default.nix b/user/scripts/default.nix index f8026cf..5065be2 100644 --- a/user/scripts/default.nix +++ b/user/scripts/default.nix @@ -1,4 +1,5 @@ -{ pkgs, config, ... }: { +{ pkgs, config, ... }: +{ home.file.".local/bin/rofi-launcher" = { source = ./rofi-launcher.sh; executable = true; diff --git a/user/services/ssh-office.nix b/user/services/ssh-office.nix index 6573734..9a92b5c 100644 --- a/user/services/ssh-office.nix +++ b/user/services/ssh-office.nix @@ -1,26 +1,28 @@ { pkgs, config, ... }: let - sshotp = pkgs.writeScriptBin "sshotp" - '' - #!/usr/bin/env expect - set stty_init -echo - set timeout 300 - set totp [lindex $argv 0]; - puts "Our TOTP $totp" - spawn ssh -D 20000 dresden.uio.no - expect { - -re {.*(Verification_Code):} { - send -- "$totp\r" - exp_continue - } - -re {.*dresden.*} { - wait - } - } - ''; + sshotp = pkgs.writeScriptBin "sshotp" '' + #!/usr/bin/env expect + set stty_init -echo + set timeout 300 + set totp [lindex $argv 0]; + puts "Our TOTP $totp" + spawn ssh -D 20000 dresden.uio.no + expect { + -re {.*(Verification_Code):} { + send -- "$totp\r" + exp_continue + } + -re {.*dresden.*} { + wait + } + } + ''; ssh-dresden = pkgs.writeShellApplication { name = "ssh-dresden"; - runtimeInputs = [ pkgs.rbw pkgs.expect ]; + runtimeInputs = [ + pkgs.rbw + pkgs.expect + ]; text = '' #!/usr/bin/env bash totp=$(rbw get -f "TOTP" rlogin) @@ -41,4 +43,3 @@ in }; }; } - diff --git a/user/sops/default.nix b/user/sops/default.nix index 1a212ff..c0430b0 100644 --- a/user/sops/default.nix +++ b/user/sops/default.nix @@ -1,4 +1,5 @@ -{ user, ... }: { +{ user, ... }: +{ sops = { age.keyFile = "/home/${user}/.config/sops/age/keys.txt"; defaultSopsFile = ../../secrets/${user}/secret.yaml; diff --git a/user/ssh/zedd.nix b/user/ssh/zedd.nix index 031db59..7c145a5 100644 --- a/user/ssh/zedd.nix +++ b/user/ssh/zedd.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ programs.ssh = { enable = true; controlMaster = "auto"; diff --git a/user/zsh/default.nix b/user/zsh/default.nix index a02d58b..6c27922 100644 --- a/user/zsh/default.nix +++ b/user/zsh/default.nix @@ -1,4 +1,10 @@ -{ user, pkgs, config, ... }: { +{ + user, + pkgs, + config, + ... +}: +{ home.packages = with pkgs; [ fd ]; programs.zsh = { enable = true; @@ -53,12 +59,17 @@ zplug = { enable = true; plugins = [ - { name = "plugins/git"; tags = [ "from:oh-my-zsh" ]; } - { name = "modules/prompt"; tags = [ "from:prezto" ]; } + { + name = "plugins/git"; + tags = [ "from:oh-my-zsh" ]; + } + { + name = "modules/prompt"; + tags = [ "from:prezto" ]; + } { name = "zsh-users/zsh-autosuggestions"; } { - name = - "zsh-users/zsh-history-substring-search"; + name = "zsh-users/zsh-history-substring-search"; } ]; };