# Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page, on # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). { config, lib, pkgs, hostname, inputs, ... }: let mainUser = "christian"; in { imports = [ inputs.noctalia.nixosModules.default inputs.umbriel.nixosModules.default inputs.noctalia-greeter.nixosModules.default ]; # Binary cache for the noctalia flake input. Umbriel has no cache and # builds from source. nix.settings = { extra-substituters = ["https://noctalia.cachix.org"]; extra-trusted-public-keys = ["noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4="]; trusted-users = [mainUser]; }; # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; # Use latest kernel. boot.kernelPackages = pkgs.linuxPackages_latest; networking.hostName = hostname; # Define your hostname. # Configure network connections interactively with nmcli or nmtui. networking.networkmanager.enable = true; hardware.bluetooth.enable = true; # ZSA keyboards (Moonlander, Voyager, etc.): udev rules for flashing. hardware.keyboard.zsa.enable = true; services.tuned.enable = true; services.upower.enable = true; # Set your time zone. time.timeZone = "America/New_York"; # Windows expects the clock to be in local time. This setting allows Windows # and Linux to work on the same system. time.hardwareClockInLocalTime = true; # Enable dynamic linking. programs.nix-ld.enable = true; # Needed for ghcup programs.nix-ld.libraries = with pkgs; [ gmp ncurses ]; nixpkgs.config.allowUnfree = true; # 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 = { # font = "Lat2-Terminus16"; # keyMap = "us"; # useXkbConfig = true; # use xkb.options in tty. # }; # 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. # services.pulseaudio.enable = true; # OR services.pipewire = { enable = true; pulse.enable = true; }; # Enable touchpad support (enabled default in most desktopManager). # services.libinput.enable = true; # User accounts. users.users.${mainUser} = { isNormalUser = true; extraGroups = ["wheel" "postgres" "plugdev"] ++ lib.optionals (hostname == "whitenoise") ["i2c"]; packages = []; }; # DDC/CI for external monitor brightness control (whitenoise only). boot.kernelModules = lib.optionals (hostname == "whitenoise") ["i2c-dev"]; hardware.i2c.enable = lib.mkIf (hostname == "whitenoise") true; security.sudo.extraRules = [ { users = [mainUser]; commands = [ { command = "ALL"; options = ["NOPASSWD"]; } ]; } ]; programs.firefox.enable = true; # List packages installed in system profile. # You can use https://search.nixos.org/ to find more packages (and options). environment.systemPackages = with pkgs; [ _1password-gui adwaita-icon-theme air alejandra alsa-utils bash brightnessctl clang curl delve direnv duf efibootmgr ffmpeg fzf gcc gh ghostty git git-lfs glow gmp gnumake gnupg go gofumpt golangci-lint golangci-lint-langserver google-chrome gopls go-task gotools gum helix hivemind htop imagemagick imv jq jujutsu keymapp kitty mako mise neovim nil nix-bash-completions nodejs obsidian optipng pkg-config prettier psmisc rio ripgrep rtk shellcheck shfmt signal-desktop slack stylua sqlc svgo swaybg taplo tmux vim wget wl-clipboard thunar thunar-volman tree-sitter tumbler xz yaml-language-server zellij zlib z-lua ] ++ (with pkgs.haskellPackages; [ cabal-fmt fourmolu ]) ++ (with pkgs.elmPackages; [ elm elm-format elm-language-server elm-review elm-test ]) ++ lib.optionals (hostname == "whitenoise") [ ddcutil ]; fonts.packages = with pkgs; [ jetbrains-mono maple-mono.NF-CN noto-fonts ]; programs = { noctalia = { enable = true; package = inputs.noctalia.packages.${pkgs.stdenv.hostPlatform.system}.default; # Start with the graphical session instead of from a compositor autostart; # the session launcher (start-umbriel) imports WAYLAND_DISPLAY into the # user manager so the service can reach the compositor. systemd.enable = true; }; umbriel = { enable = true; }; bash.completion.enable = true; }; services = { displayManager.noctalia-greeter = { enable = true; # Let Noctalia shell push its wallpaper/palette to the greeter # without a Polkit prompt. passwordless-sync-users = [mainUser]; cursorTheme.package = pkgs.adwaita-icon-theme; settings = { session.default = "Umbriel"; user.default = mainUser; cursor = { theme = "Adwaita"; size = 24; }; keyboard.layout = "us"; }; }; tailscale.enable = true; openssh.enable = true; avahi = { enable = true; nssmdns4 = true; openFirewall = true; publish = { enable = true; addresses = true; workstation = true; }; }; postgresql = { enable = true; ensureDatabases = ["christian"]; ensureUsers = [ { name = "christian"; ensureDBOwnership = true; ensureClauses = { superuser = true; }; } ]; authentication = lib.mkOverride 10 '' local all all trust host all all 127.0.0.1/32 trust host all all ::1/128 trust ''; }; }; # Persistent SSH agent (survives session restarts) systemd.user.services.ssh-agent = { description = "SSH key agent"; wantedBy = ["default.target"]; serviceConfig = { Type = "simple"; ExecStart = "${pkgs.openssh}/bin/ssh-agent -D -a %t/ssh-agent.socket"; Restart = "on-failure"; RestartSec = 5; }; }; environment.sessionVariables.SSH_AUTH_SOCK = "\${XDG_RUNTIME_DIR}/ssh-agent.socket"; # 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; # }; # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. # networking.firewall.enable = false; # 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 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. # # Most users should NEVER change this value after the initial install, for any reason, # even if you've upgraded your system to a new NixOS release. # # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how # to actually do that. # # This value being lower than the current NixOS release does NOT mean your system is # out of date, out of support, or vulnerable. # # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, # and migrated your data accordingly. # # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . system.stateVersion = "26.05"; # Did you read the comment? }