diff --git a/configuration.nix b/configuration.nix new file mode 100755 index 0000000..fac8fe5 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,165 @@ +# 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, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + programs.nix-ld.enable = true; + + # Bootloader. + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/sda"; + boot.loader.grub.useOSProber = true; + + networking.hostName = "Felix-Desktop"; # Define your hostname. + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + services.xserver = { + enable = true; + xkb = { + layout = "de"; + variant = ""; + }; + }; + + # Enable the KDE Plasma Desktop Environment. + services.displayManager.sddm.enable = true; + services.desktopManager.plasma6.enable = true; + + + services.xrdp = { + defaultWindowManager = "startplasma-x11"; + enable = true; + openFirewall = true; + }; + + # Configure console keymap + console.keyMap = "de"; + + # 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; + }; + + programs.zsh.enable = true; + users.users.felix = { + isNormalUser = true; + description = "Felix"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs.kdePackages; [ + kate + kcalc + partitionmanager + kmail + ]; + shell = pkgs.zsh; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIkbAVXWPpN7jAJrf/1h8QHNW3LMQ0LaMTl8gnVzufPV fheitmann@fheitmann-flip" + ]; + }; + + + # Install firefox. + programs.firefox.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + rustdesk-flutter + wget + ncdu + eza + zsh + jq + iperf3 + dnsutils + file + which + tree + gawk + zstd + gnupg + btop + iotop + iftop + lm_sensors + ethtool + pciutils + usbutils + neofetch + zip + xz + unzip + ]; + + # 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; + settings.PasswordAuthentication = false; + settings.KbdInteractiveAuthentication = false; + }; + + # 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..417de1c --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1751810233, + "narHash": "sha256-kllkNbIqQi3VplgTMeGzuh1t8Gk8TauvkTRt93Km+tQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "9b0873b46c9f9e4b7aa01eb634952c206af53068", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1751582995, + "narHash": "sha256-u7ubvtxdTnFPpV27AHpgoKn7qHuE7sgWgza/1oj5nzA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7a732ed41ca0dd64b4b71b563ab9805a80a7d693", + "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 100755 index 0000000..c0004d4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + description = "Felix' first NixOS System Flake"; + + 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 = { self, nixpkgs, home-manager, ... }@inputs: { + nixosConfigurations = { + Felix-Desktop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.felix = import ./home.nix; + } + ]; + }; + }; + }; +} \ No newline at end of file diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..37c1f08 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,31 @@ +# 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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/1c22fc0b-9b19-4509-a695-2be590eb71f8"; + fsType = "ext4"; + }; + + 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.ens18.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/home.nix b/home.nix new file mode 100755 index 0000000..e127dae --- /dev/null +++ b/home.nix @@ -0,0 +1,74 @@ +{ config, lib, pkgs, ... }: + +{ + home.username = "felix"; + home.homeDirectory = "/home/felix"; + + # encode the file content in nix configuration file directly + # home.file.".xxx".text = '' + # xxx + # ''; + + home.packages = with pkgs; [ + # nix related + nix-output-monitor + ]; + + # basic configuration of git, please change to your own + programs.git = { + enable = true; + userName = "Ryan Yin"; + userEmail = "xiaoyin_c@qq.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; + }; + }; + + programs.alacritty = { + enable = true; + settings = { + env.TERM = "xterm-256color"; + font = { + size = 12; + draw_bold_text_with_bright_colors = true; + }; + scrolling.multiplier = 5; + selection.save_to_clipboard = true; + }; + }; + + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + shellAliases = { + ls = "exa -lh"; + ll = "ls -a"; + update = "sudo nixos-rebuild switch"; + }; + initContent = lib.mkOrder 1500 '' + # source "~/.config/ssh-find-agend.sh" + emulate ksh -c "source ~/.config/ssh-find-agent.sh" + ssh-add -l >&/dev/null || ssh-find-agent -a || eval $(ssh-agent) > /dev/null + ''; + + history.size = 10000; + oh-my-zsh = { + enable = true; + plugins = [ "git" ]; + theme = "robbyrussell"; + }; + }; + + home.stateVersion = "25.05"; +} \ No newline at end of file