diff --git a/boot.nix b/boot.nix new file mode 100644 index 0000000..a100fd3 --- /dev/null +++ b/boot.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/configuration.nix b/configuration.nix index cad868f..e9b0235 100644 --- a/configuration.nix +++ b/configuration.nix @@ -8,26 +8,19 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./boot.nix + ./networking.nix + ./gui.nix + ./users.nix + ./packages.nix + ./services.nix + # TOOD: check if we need this here still, it's imported in users.nix ]; - - # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # networking.hostName = "nixos"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - # Set your time zone. time.timeZone = "America/Chicago"; - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; # console = { @@ -36,171 +29,14 @@ # useXkbConfig = true; # use xkb.options in tty. # }; - # Networking - - networking.hostName = "odin"; - # I like systemd-networkd - systemd.network.enable = true; - systemd.network.networks."50-wlp2s0" = { - matchConfig.name = "wlp2s0"; - networkConfig.DHCP = "yes"; - linkConfig.RequiredForOnline = "no"; - }; - networking.useNetworkd = true; - # TODO: static IP @ 192.168.1.2 - - # Enable the X11 windowing system. - services.xserver.enable = true; - - - - - # Configure keymap in X11 - # services.xserver.xkb.layout = "us"; - # services.xserver.xkb.options = "eurosign:e,caps:escape"; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # Enable sound. - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - pulse.enable = true; - }; - - # Graphics and parallel compute configuration - hardware.opengl.extraPackages = [ - # TODO: figure out why this doesn't work - # Looks like it requires unfree - # rocmPackages.clr.icd - pkgs.amdvlk - pkgs.libva - ]; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.noah = { - isNormalUser = true; - shell = pkgs.fish; - extraGroups = [ "wheel" "video" ]; # Enable ‘sudo’ for the user. - hashedPasswordFile = "/etc/nixos/noah-password"; - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnp/AcaPipgw4+HnqpYioG+DgheOWBYDOnVkXi42PC0R1FMc+bm4wVP8TA9DAWczaWmllqlA8N2/LSleaqp+46r980VgqmeYEem5aHJuR+Cq/Mg2Z2wcp9VT8njH72wIPIUOXAv+dnPnCe4yvoasgvhwZZCDE4BFTIImuTxrEFPg5ayvkr7b/mUg9LbxaVSjK7fk082pqlShizIKAVcgIIa0lCFSMUs1V/eLi5D11moVcxJU/QoEBh+6Qn5BVM0taPFA4Gbi+288LobQ8RcgRBXKpP03Dt+onYuZQ3KzFjd6USi/d4M+pByrWFcpBJfMXuXJLuwsSF7SfxsuqjjlDt Portable" - ]; - }; - # I manage my home with home-manager - # Don't store packages in ~/.nix-profile, use /etc/profiles so we can build-vm - home-manager.useUserPackages = true; - # No more NIX_PATH, use system pkgs - home-manager.useGlobalPkgs = true; - - home-manager.users.noah = import ./noah-home.nix ; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - neovim - pkgs.appimage-run - wget - kitty - w3m - fishPlugins.fzf-fish - fzf - qemu - OVMF - ]; - - # Fonts - fonts.packages = with pkgs; [ - fira-code - fira-code-symbols - noto-fonts - noto-fonts-cjk - noto-fonts-emoji - noto-fonts-extra - (nerdfonts.override { fonts = ["FiraCode"]; }) - ]; - - # Fix dynamically linked libraries for unpackaged binaries - programs.nix-ld = { - enable = true; - libraries = with pkgs; [ - # Add missing dynamic libraries for unpackaged programs HERE - # NOT in environment.systemPackages - zlib - ]; - }; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - - # Fish shell, the best - programs.fish.enable = true; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # TODO: allow some ports - networking.firewall.enable = true; - - services.avahi = { - enable = true; - publish = { - enable = true; - addresses = true; - workstation = true; - }; - }; - # Copy the NixOS configuration file and link it from the resulting system # (/run/current-system/configuration.nix). This is useful in case you # accidentally delete configuration.nix. system.copySystemConfiguration = true; - # This option is for enabling the bolt daemon for managing Thunderbolt/USB4 Devices. - services.hardware.bolt.enable = true; - - # Polkit is a dependency of Sway. It's responsible for handling security policies - security.polkit.enable = true; - - # Enable the sway window manager - programs.sway = { - enable = true; - wrapperFeatures.gtk = true; - }; - # Use greetd as the displaymanager - #services.xserver.displayManager.greetd.enable = true; - services.xserver.displayManager.lightdm.enable = false; - xdg.portal = { - enable = true; - wlr.enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - }; - # Automatic doc cache generation documentation.man.generateCaches = true; - # Declarative only optoins. - # I don't want to allow ad-hoc modifying users on the system. - # Users must be declared either as part of a package or in this file. - users.mutableUsers = false; - - # Automatic system upgrades system.autoUpgrade = { enable = true; @@ -208,19 +44,6 @@ randomizedDelaySec = "45min"; }; - # Unfree packages need to be whitelisted here - - nixpkgs.config.allowUnfreePredicate = pkg: - builtins.elem (lib.getName pkg) [ - "discord" - "spotify" - "obsidian" - "tailscale" - "rust-rover" - ]; - # Logseq uses an ancient version of Electron, so we enable that - nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ]; - # This option defines the first version of NixOS you have installed on this particular machine, # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. # @@ -240,4 +63,3 @@ system.stateVersion = "23.11"; # Did you read the comment? } - diff --git a/gui.nix b/gui.nix new file mode 100644 index 0000000..3e0b9c0 --- /dev/null +++ b/gui.nix @@ -0,0 +1,61 @@ +{ pkgs, ... }: +{ + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Configure keymap in X11 + # services.xserver.xkb.layout = "us"; + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; + + # Graphics and parallel compute configuration + hardware.opengl.extraPackages = [ + # TODO: figure out why this doesn't work + # Looks like it requires unfree + # rocmPackages.clr.icd + pkgs.amdvlk + pkgs.libva + ]; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Fonts + fonts.packages = with pkgs; [ + fira-code + fira-code-symbols + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + noto-fonts-extra + (nerdfonts.override { fonts = ["FiraCode"]; }) + ]; + + # Polkit is a dependency of Sway. It's responsible for handling security policies + security.polkit.enable = true; + + # Enable the sway window manager + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; + # Use greetd as the displaymanager + #services.xserver.displayManager.greetd.enable = true; + services.xserver.displayManager.lightdm.enable = false; + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; + +} diff --git a/networking.nix b/networking.nix new file mode 100644 index 0000000..7fedc9f --- /dev/null +++ b/networking.nix @@ -0,0 +1,22 @@ +{ ... }: +{ + # networking.hostName = "nixos"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + networking.hostName = "odin"; + # I like systemd-networkd + systemd.network.enable = true; + systemd.network.networks."50-wlp2s0" = { + matchConfig.name = "wlp2s0"; + networkConfig.DHCP = "yes"; + linkConfig.RequiredForOnline = "no"; + }; + networking.useNetworkd = true; + # TODO: static IP @ 192.168.1.2 + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + +} diff --git a/packages.nix b/packages.nix new file mode 100644 index 0000000..2e57b82 --- /dev/null +++ b/packages.nix @@ -0,0 +1,29 @@ +{ pkgs, lib, ... }: +{ + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim + appimage-run + wget + kitty + w3m + fishPlugins.fzf-fish + fzf + qemu + OVMF + ]; + + # Unfree packages need to be whitelisted here + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "discord" + "spotify" + "obsidian" + "tailscale" + "jetbrains-toolbox" + ]; + # Logseq uses an ancient version of Electron, so we enable that + nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ]; + +} diff --git a/services.nix b/services.nix new file mode 100644 index 0000000..1a62c0d --- /dev/null +++ b/services.nix @@ -0,0 +1,50 @@ +{ pkgs, ... }: +{ + + # Fix dynamically linked libraries for unpackaged binaries + programs.nix-ld = { + enable = true; + libraries = with pkgs; [ + # Add missing dynamic libraries for unpackaged programs HERE + # NOT in environment.systemPackages + zlib + ]; + }; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # Fish shell, the best + programs.fish.enable = true; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # TODO: allow some ports + networking.firewall.enable = true; + + services.avahi = { + enable = true; + publish = { + enable = true; + addresses = true; + workstation = true; + }; + }; + + # This option is for enabling the bolt daemon for managing Thunderbolt/USB4 Devices. + services.hardware.bolt.enable = true; + + +} diff --git a/users.nix b/users.nix new file mode 100644 index 0000000..eba0407 --- /dev/null +++ b/users.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: +{ + + imports = + [ + + ]; + + # Declarative only optoins. + # I don't want to allow ad-hoc modifying users on the system. + # Users must be declared either as part of a package or in this file. + users.mutableUsers = false; + + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.noah = { + isNormalUser = true; + shell = pkgs.fish; + extraGroups = [ "wheel" "video" ]; # Enable ‘sudo’ for the user. + hashedPasswordFile = "/etc/nixos/noah-password"; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnp/AcaPipgw4+HnqpYioG+DgheOWBYDOnVkXi42PC0R1FMc+bm4wVP8TA9DAWczaWmllqlA8N2/LSleaqp+46r980VgqmeYEem5aHJuR+Cq/Mg2Z2wcp9VT8njH72wIPIUOXAv+dnPnCe4yvoasgvhwZZCDE4BFTIImuTxrEFPg5ayvkr7b/mUg9LbxaVSjK7fk082pqlShizIKAVcgIIa0lCFSMUs1V/eLi5D11moVcxJU/QoEBh+6Qn5BVM0taPFA4Gbi+288LobQ8RcgRBXKpP03Dt+onYuZQ3KzFjd6USi/d4M+pByrWFcpBJfMXuXJLuwsSF7SfxsuqjjlDt Portable" + ]; + }; + # I manage my home with home-manager + # Don't store packages in ~/.nix-profile, use /etc/profiles so we can build-vm + home-manager.useUserPackages = true; + # No more NIX_PATH, use system pkgs + home-manager.useGlobalPkgs = true; + + home-manager.users.noah = import ./noah-home.nix ; +}