From f92edecbcb767295f04cfa620fd601efc079b877 Mon Sep 17 00:00:00 2001 From: alyssadev Date: Sun, 24 Aug 2025 23:09:19 +1000 Subject: [PATCH] init --- .gitignore | 3 ++ flake.lock | 49 +++++++++++++++++ flake.nix | 88 ++++++++++++++++++++++++++++++ home.nix | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 296 insertions(+) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 home.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..47771e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.qcow2 +result +*-template diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..00e85bd --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1755928099, + "narHash": "sha256-OILVkfhRCm8u18IZ2DKR8gz8CVZM2ZcJmQBXmjFLIfk=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "4a44fb9f7555da362af9d499817084f4288a957f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1755922037, + "narHash": "sha256-wY1+2JPH0ZZC4BQefoZw/k+3+DowFyfOxv17CN/idKs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b1b3291469652d5a2edb0becc4ef0246fff97a7c", + "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..c3a241c --- /dev/null +++ b/flake.nix @@ -0,0 +1,88 @@ +{ + description = "NixOS configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; + home-manager = { + url = "github:nix-community/home-manager/release-25.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs@{ nixpkgs, home-manager, ... }: { + nixosConfigurations = { + aly-desktop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ({ config, pkgs, ... }: { + system.stateVersion = "25.05"; + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + environment.systemPackages = with pkgs; [ + git + vim + wget + ]; + environment.variables.EDITOR = "vim"; + security.sudo.wheelNeedsPassword = false; + + networking.hostName = "aly-desktop"; + networking.networkmanager.enable = true; + services.pulseaudio.enable = false; + services.pipewire = { + enable = true; + pulse.enable = true; + }; + time.timeZone = "Australia/Brisbane"; + users.users.aly = { + isNormalUser = true; + description = "aly"; + initialPassword = "test"; + extraGroups = [ "networkmanager" "wheel" ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGa9sXpYiDXy6L9dQHcKkK45PBgZHo0PCz/ejmvhDW6Z aly@aurora" + ]; + packages = with pkgs; [ + # firefox + # thunderbird + ]; + }; + + # Enable the OpenSSH daemon. + services.openssh = { + enable = true; + settings = { + X11Forwarding = true; + PermitRootLogin = "no"; # disable root login + PasswordAuthentication = false; # disable password login + }; + openFirewall = true; + }; + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.displayManager.autoLogin.user = "aly"; + services.xserver.desktopManager.gnome.enable = true; + }) + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + + home-manager.users.aly = import ./home.nix; + + # Optionally, use home-manager.extraSpecialArgs to pass arguments to home.nix + } + + ({ pkgs, ... }: { + environment.etc."nixos".source = ./.; + }) + ]; + }; + }; + }; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..3ef77c0 --- /dev/null +++ b/home.nix @@ -0,0 +1,156 @@ +{ config, pkgs, ... }: + +{ + home.username = "aly"; + home.homeDirectory = "/home/aly"; + + # 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; + }; + + # 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 + ]; + + # basic configuration of git, please change to your own + programs.git = { + enable = true; + userName = "alyssadev"; + userEmail = "alyssa.dev.smith@gmail.com"; + }; + + # 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; + }; + }; + + # alacritty - a cross-platform, GPU-accelerated terminal emulator + programs.alacritty = { + enable = true; + # custom settings + settings = { + env.TERM = "xterm-256color"; + font = { + size = 12; + draw_bold_text_with_bright_colors = true; + }; + scrolling.multiplier = 5; + selection.save_to_clipboard = true; + }; + }; + + programs.bash = { + enable = true; + enableCompletion = true; + # TODO add your custom bashrc here + bashrcExtra = '' + export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin" + ''; + + # set some aliases, feel free to add more or remove some + shellAliases = { + k = "kubectl"; + urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'"; + urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'"; + }; + }; + + # 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"; +}