diff --git a/flake.nix b/flake.nix index 406dc17d..e19884ad 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,7 @@ inherit inputs; isServer = true; isLinux = true; + isLaptop = false; isDarwin = false; }; system = "x86_64-linux"; @@ -59,6 +60,7 @@ inherit inputs; isServer = true; isLinux = true; + isLaptop = false; isDarwin = false; }; }; @@ -71,6 +73,7 @@ isServer = false; isDarwin = false; isLinux = true; + isLaptop = false; }; system = "x86_64-linux"; modules = [ @@ -87,6 +90,36 @@ isServer = false; isDarwin = false; isLinux = true; + isLaptop = false; + }; + }; + } + ]; + }; + laptop = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + isServer = false; + isDarwin = false; + isLinux = true; + isLaptop = true; + }; + system = "x86_64-linux"; + modules = [ + ./nixos-modules/common.nix + ./hosts/laptop + home-manager.nixosModules.home-manager + { + home-manager = { + backupFileExtension = "backup"; + useUserPackages = true; + users.mat = import ./home-manager/home.nix; + extraSpecialArgs = { + inherit inputs; + isServer = false; + isDarwin = false; + isLinux = true; + isLaptop = true; }; }; } diff --git a/home-manager/discord.png b/home-manager/discord.png new file mode 100644 index 00000000..092fde21 Binary files /dev/null and b/home-manager/discord.png differ diff --git a/home-manager/home.nix b/home-manager/home.nix index 44888965..e96554ac 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -1,11 +1,5 @@ { inputs, config, pkgs, lib, isDarwin, isLinux, ... }: -let - discordIcon = pkgs.fetchurl { - url = - "https://static-00.iconduck.com/assets.00/apps-discord-icon-2048x2048-hkrl0hxr.png"; - hash = "sha256-e3AT1zekZJEYRm+S9wwMuJb+G2/zSOZSKJztHGKnOiY="; - }; -in { +{ nixpkgs.overlays = [ (final: prev: (import ../packages { @@ -64,7 +58,7 @@ in { xdg = { enable = true; # for discord app icon - dataFile."icons/discord.png".source = discordIcon; + dataFile."icons/discord.png".source = ./discord.png; # link config files, if a dedicated module exists (below) # it will handle its own config configFile = { diff --git a/home-manager/modules/_1password-shell.nix b/home-manager/modules/_1password-shell.nix index 0dc83c52..29eb4520 100644 --- a/home-manager/modules/_1password-shell.nix +++ b/home-manager/modules/_1password-shell.nix @@ -4,7 +4,7 @@ let #!${pkgs.bash}/bin/bash # TODO figure out a way to do this without silently depending on `op` being on $PATH # using `$\{pkgs._1password}/bin/op` results in unable to connect to desktop app - PASSWORD="$(op item get "System Password" --fields password)" + PASSWORD="$(op item get "System Password" --fields password --reveal)" if [[ -z "$PASSWORD" ]]; then echo "Failed to get password from 1Password." read -s -p "Password: " PASSWORD @@ -13,7 +13,7 @@ let echo $PASSWORD ''; in { - home.packages = with pkgs; [ _1password ]; + home.packages = with pkgs; [ _1password-cli ]; imports = [ inputs._1password-shell-plugins.hmModules.default ]; programs = { fish = { diff --git a/home-manager/modules/fish.nix b/home-manager/modules/fish.nix index 84532587..04170648 100644 --- a/home-manager/modules/fish.nix +++ b/home-manager/modules/fish.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, isDarwin, isLinux, isServer, ... }: { +{ pkgs, lib, isDarwin, isLinux, isServer, isLaptop, ... }: { home.sessionVariables = { DOTNET_CLI_TELEMETRY_OPTOUT = "1"; HOMEBREW_NO_ANALYTICS = "1"; @@ -107,7 +107,9 @@ "home-manager switch --flake ~/git/dotfiles/.#mac" else if isServer then "sudo nixos-rebuild switch --flake ~/git/dotfiles/.#server" - else + else if isLaptop then + "sudo nixos-rebuild switch --flake ~/git/dotfiles/.#laptop" + else "sudo nixos-rebuild switch --flake ~/git/dotfiles/.#pc"} ''; }; diff --git a/home-manager/modules/gnome/dconf.nix b/home-manager/modules/gnome/dconf.nix index 2c3e876b..a62d7e9f 100644 --- a/home-manager/modules/gnome/dconf.nix +++ b/home-manager/modules/gnome/dconf.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, lib, isLaptop, ... }: let wallpaperImg = pkgs.fetchurl { url = @@ -39,8 +39,7 @@ in { "signal-desktop.desktop" "firefox.desktop" "vesktop.desktop" - "steam.desktop" - ]; + ] ++ lib.lists.optionals (!isLaptop) [ "steam.desktop" ]; inherit enabled-extensions; }; "org/gnome/desktop/interface" = { diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix new file mode 100644 index 00000000..781764eb --- /dev/null +++ b/hosts/laptop/default.nix @@ -0,0 +1,42 @@ +{ pkgs, ... }: { + networking = { + hostName = "nixos-laptop"; + networkmanager.enable = true; + }; + + imports = [ + ../../nixos-modules/desktop_environment.nix + ../../nixos-modules/_1password.nix + ../../nixos-modules/allowed-unfree.nix + ./hardware-configuration.nix + ]; + + programs = { + fish.enable = true; + + neovim = { + enable = true; + defaultEditor = true; + }; + }; + + environment.variables = { + SUDO_EDITOR = "nvim"; + EDITOR = "nvim"; + }; + + services = { + # Enable the X11 windowing system. + xserver.enable = true; + mullvad-vpn.enable = true; + tailscale.enable = true; + flatpak.enable = true; + }; + + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + }; +} diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix new file mode 100644 index 00000000..5b9f6dc7 --- /dev/null +++ b/hosts/laptop/hardware-configuration.nix @@ -0,0 +1,42 @@ +# 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, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/71f0a300-d3af-4d9c-bcae-4da7b2cb7cdd"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-478962df-c7d5-4e0c-9f30-f5435e27612a".device = "/dev/disk/by-uuid/478962df-c7d5-4e0c-9f30-f5435e27612a"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/EFA5-597E"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + # 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 + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wwp0s20f0u6i12.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/pc/default.nix b/hosts/pc/default.nix index df9c21b0..befd375e 100644 --- a/hosts/pc/default.nix +++ b/hosts/pc/default.nix @@ -60,6 +60,7 @@ services = { # Enable the X11 windowing system. xserver.enable = true; + xserver.videoDrivers = [ "nvidia" ]; mullvad-vpn.enable = true; tailscale.enable = true; flatpak.enable = true; diff --git a/nixos-modules/_1password.nix b/nixos-modules/_1password.nix index 022496ab..895acb76 100644 --- a/nixos-modules/_1password.nix +++ b/nixos-modules/_1password.nix @@ -1,5 +1,5 @@ { - programs._1password = { enable = true; }; + programs._1password-cli = { enable = true; }; programs._1password-gui = { enable = true; polkitPolicyOwners = [ "mat" ]; diff --git a/nixos-modules/desktop_environment.nix b/nixos-modules/desktop_environment.nix index 70d02c92..afa87236 100644 --- a/nixos-modules/desktop_environment.nix +++ b/nixos-modules/desktop_environment.nix @@ -30,7 +30,6 @@ in { displayManager.defaultSession = "gnome-xorg"; xserver = { enable = true; - videoDrivers = [ "nvidia" ]; desktopManager.gnome.enable = true; displayManager = { gdm.enable = true; }; };