commit 943ba9c139599f1cd7cf470d0ae3019dff378faf Author: Alexander Wainwright Date: Fri Jun 20 18:13:06 2025 +1000 Initial commit diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..b0a5ab9 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,185 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "case"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + networking.firewall.allowedTCPPorts = [ 8000 ]; + + # Set your time zone. + time.timeZone = "Australia/Brisbane"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_GB.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_AU.UTF-8"; + LC_IDENTIFICATION = "en_AU.UTF-8"; + LC_MEASUREMENT = "en_AU.UTF-8"; + LC_MONETARY = "en_AU.UTF-8"; + LC_NAME = "en_AU.UTF-8"; + LC_NUMERIC = "en_AU.UTF-8"; + LC_PAPER = "en_AU.UTF-8"; + LC_TELEPHONE = "en_AU.UTF-8"; + LC_TIME = "en_AU.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = "dvorak"; + }; + + # Configure console keymap + console.keyMap = "dvorak"; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + services.pulseaudio.enable = false; + 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; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + services.avahi = { + enable = true; + nssmdns4 = true; # Enables Avahi for name service lookups (e.g., in /etc/nsswitch.conf) + publish = { + enable = true; + addresses = true; # Publish your laptop's IP addresses + workstation = true; # Publish your laptop as a workstation + # You might also want: + # domain = true; # Announce the locally used domain name (usually .local) + # userServices = true; # Publish services advertised by users + }; + # If you're using systemd-resolved alongside Avahi, ensure mDNS is also enabled there: + # services.resolved.enable = true; + # services.resolved.extraConfig = "MulticastDNS=yes"; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + programs.fish.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.alex = { + isNormalUser = true; + description = "Alexander Wainwright"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + # thunderbird + ]; + shell = pkgs.fish; + }; + + # Install firefox. + programs.firefox.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # Enable the Flakes feature and the accompanying new nix command-line tool + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + atuin + avahi + bat + chromium + darktable + duf + dust + entr + # fastfetch + fd + git + neovim + nextcloud-client + python314 + ripgrep + rsync + silver-searcher + tldr + tmux + unzip + uv + wezterm + wget + zip + mullvad-vpn + ]; + + environment.variables.EDITOR = "nvim"; + + # 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; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + services.mullvad-vpn.package = pkgs.mullvad-vpn; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "25.05"; # Did you read the comment? + +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9de8613 --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749154018, + "narHash": "sha256-gjN3j7joRvT3a8Zgcylnd4NFsnXeDBumqiu4HmY1RIg=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "7aae0ee71a17b19708b93b3ed448a1a0952bf111", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1750259320, + "narHash": "sha256-H8J4H2XCIMEJ5g6fZ179QfQvsc2dUqhqfBjC8RAHNRY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9ba04bda9249d5d5e5238303c9755de5a49a79c5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..bc851bc --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + description = "NixOS configuration"; + + inputs = { + # NixOS official package source + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + home-manager = { + url = "github:nix-community/home-manager/release-25.05"; + # The `follows` keyword in inputs is used for inheritance. + # Here, `inputs.nixpkgs` of home-manager is kept consistent with + # the `inputs.nixpkgs` of the current flake, + # to avoid problems caused by different versions of nixpkgs. + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager, ... }@inputs: { + nixosConfigurations.case = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + + specialArgs = { inherit inputs; }; + modules = [ + # Import the previous configuration.nix we used, + # so the old configuration file still takes effect + ./configuration.nix + + # make home-manager as a module of nixos so that home-manager + # configuration will be deployed automatically when executing + # `nixos-rebuild switch` + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + + home-manager.users.alex = import ./home.nix; + + # Optionally, use home-manager.extraSpecialArgs to pass arguments to + # home.nix + } + ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..ec15048 --- /dev/null +++ b/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" "thunderbolt" "nvme" "uas" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/aae2c333-b946-4b26-9e1d-131f9f5867b4"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + boot.initrd.luks.devices."luks-956ea314-17ec-4d83-9374-b53898121c8c".device = "/dev/disk/by-uuid/956ea314-17ec-4d83-9374-b53898121c8c"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6517-A052"; + 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.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..6d289e5 --- /dev/null +++ b/home.nix @@ -0,0 +1,171 @@ +{ config, pkgs, ... }: + +{ + # TODO please change the username & home directory to your own + home.username = "alex"; + home.homeDirectory = "/home/alex"; + + # link the configuration file in current directory to the specified location in home directory + # home.file.".config/i3/wallpaper.jpg".source = ./wallpaper.jpg; + + # link all files in `./scripts` to `~/.config/i3/scripts` + # home.file.".config/i3/scripts" = { + # source = ./scripts; + # recursive = true; # link recursively + # executable = true; # make all files executable + # }; + + # encode the file content in nix configuration file directly + # home.file.".xxx".text = '' + # xxx + # ''; + + # set cursor size and dpi for 4k monitor + # xresources.properties = { + # "Xcursor.size" = 16; + # "Xft.dpi" = 172; + # }; + + home.shellAliases = { + e = "ls -lh"; + vi = "nvim"; + vim = "nvim"; + }; + + # Packages that should be installed to the user profile. + home.packages = with pkgs; [ + # here is some command line tools I use frequently + # feel free to add your own or remove some of them + + neofetch + # nnn # terminal file manager + + # archives + # zip + # xz + # unzip + # p7zip + + # utils + ripgrep # recursively searches directories for a regex pattern + # jq # A lightweight and flexible command-line JSON processor + # yq-go # yaml processor https://github.com/mikefarah/yq + eza # A modern replacement for ‘ls’ + fzf # A command-line fuzzy finder + + # networking tools + mtr # A network diagnostic tool + # iperf3 + # dnsutils # `dig` + `nslookup` + # ldns # replacement of `dig`, it provide the command `drill` + # aria2 # A lightweight multi-protocol & multi-source command-line download utility + # socat # replacement of openbsd-netcat + # nmap # A utility for network discovery and security auditing + # ipcalc # it is a calculator for the IPv4/v6 addresses + + # misc + # cowsay + file + which + tree + # gnused + # gnutar + # gawk + # zstd + gnupg + + # nix related + # + # it provides the command `nom` works just like `nix` + # with more details log output + nix-output-monitor + + # # productivity + # hugo # static site generator + # glow # markdown previewer in terminal + + btop # replacement of htop/nmon + iotop # io monitoring + iftop # network monitoring + + # system call monitoring + strace # system call monitoring + ltrace # library call monitoring + lsof # list open files + + # system tools + # sysstat + lm_sensors # for `sensors` command + ethtool + pciutils # lspci + usbutils # lsusb + zoxide + ]; + + # basic configuration of git, please change to your own + programs.git = { + enable = true; + userName = "Alexander Wainwright"; + userEmail = "code@figtree.dev"; + }; + + # starship - an customizable prompt for any shell + programs.starship = { + enable = true; + # custom settings + settings = { + add_newline = false; + aws.disabled = true; + gcloud.disabled = true; + line_break.disabled = true; + }; + }; + + programs.fish = { + enable = true; + interactiveShellInit = '' + set PATH ~/.cargo/bin $PATH + set PATH ~/scripts $PATH + set PATH ~/.local/bin $PATH + + set fish_prompt_pwd_dir_length 0 + set fish_greeting + + # eza colours + set -x EZA_COLORS "di=0:oc=0:ur=0:uw=0:ux=0:ue=0:gr=0:gw=0:gx=0:tr=0:tw=0:tx=0:su=0:sf=0" + + # enable atuin if available + if command -q atuin + atuin init fish | source + else + echo "Warning: Atuin is not installed, skipping initialisation." + end + + starship init fish | source + + zoxide init fish | source + ''; + functions.borg-h = '' + borg help $argv | less + ''; + }; + + programs.bash = { + enable = true; + enableCompletion = true; + # TODO add your custom bashrc here + bashrcExtra = '' + export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin" + ''; + }; + + # This value determines the home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new home Manager release introduces backwards + # incompatible changes. + # + # You can update home Manager without changing this value. See + # the home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "25.05"; +}