commit 38092498aa0c2afe3b153eb3dc435ba96a0ed755 Author: Tomas Rivera <137088692+Totorile1@users.noreply.github.com> Date: Wed Feb 25 10:40:52 2026 +0100 Initial NixOS configuration diff --git a/flake.lock b/flake.lock new file mode 100755 index 0000000..30786fe --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1771744638, + "narHash": "sha256-EDLi+YAsEEAmMeZe1v6GccuGRbCkpSZp/+A6g+pivR8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "cb6c151f5c9db4df0b69d06894dc8484de1f16a0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1771903837, + "narHash": "sha256-sdaqdnsQCv3iifzxwB22tUwN/fSHoN7j2myFW5EIkGk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e764fc9a405871f1f6ca3d1394fb422e0a0c3951", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.11", + "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..ef545a8 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +# ~/nixos/flake.nix +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + + home-manager = { + url = "github:nix-community/home-manager/release-25.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, ... }@inputs: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in + { + nixosConfigurations = { + laptop = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/laptop/configuration.nix + ]; + }; + }; + }; +} diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix new file mode 100755 index 0000000..cec3905 --- /dev/null +++ b/hosts/laptop/configuration.nix @@ -0,0 +1,154 @@ +# 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, libs, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + #networking.Name = "nixos"; # 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; + + # Set your time zone. + time.timeZone = "Europe/Zurich"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # zsh dont want to work if it is not initialzed here. + programs.zsh.enable = true; + +# Enable the GNOME Desktop Environment. + services.displayManager.gdm.enable = true; + services.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "ch"; + variant = "fr"; + }; + + # Configure console keymap + console.keyMap = "fr_CH"; + + # 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; + }; + + # 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.tomasr = { + isNormalUser = true; + description = "Tomas Rivera"; + extraGroups = [ "networkmanager" "wheel" ]; #wheel allow to use sudo + shell = pkgs.zsh; + }; + + #adds nixos experimental features: + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + + # Garbage collector of generations + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; # every week delete generations older than a month + }; + + # Install firefox. + programs.firefox.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + #home manager config from https://www.youtube.com/watch?v=a67Sv4Mbxmc / https://github.com/vimjoyer/flake-starter-config + home-manager = { + # also pass inputs to home-manager modules + extraSpecialArgs = {inherit inputs;}; + users = { + "tomasr" = import ./home.nix; + }; +}; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + warpinator # used to send files via Lan between Linux systems + #zoxide # better cd moved into home-manager + fastfetch + #git #enabled in home-manager + tree # shows dir in tree + zsh # better bash + ]; + +# fonts +fonts.packages = with pkgs; [ +nerd-fonts._0xproto +]; + + # 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; + + # 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.11"; # Did you read the comment? + +} diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix new file mode 100755 index 0000000..2bc11c6 --- /dev/null +++ b/hosts/laptop/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 + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/6aa664c2-8b23-4e20-b6e9-1806bf0f8df2"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/A59A-7AFA"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix new file mode 100755 index 0000000..b318463 --- /dev/null +++ b/hosts/laptop/home.nix @@ -0,0 +1,112 @@ +{ config, pkgs, ... }: + +{ +# every import imports a specific module for an app. This module contains the enabling of this app and its settings. +# So if you want to add an home-manager app create a module which enables it and configures it and import it. +imports = [ +../../modules/home-manager/kitty.nix # terminal # use absolute path with --impure flag or go back to /etc/nixos and use relative +../../modules/home-manager/zoxide.nix # better cd +../../modules/home-manager/zsh.nix # better bash +../../modules/home-manager/git.nix +../../modules/home-manager/ssh.nix +]; + + +# Home Manager needs a bit of information about you and the paths it should +# manage. +home.username = "tomasr"; +home.homeDirectory = "/home/tomasr"; + +# 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 should not change this value, even if you update Home Manager. If you do +# want to update the value, then make sure to first check the Home Manager +# release notes. +home.stateVersion = "25.11"; # Please read the comment before changing. + +# The home.packages option allows you to install Nix packages into your +# environment. +home.packages = [ +# # Adds the 'hello' command to your environment. It prints a friendly +# # "Hello, world!" when run. +# pkgs.hello + +# # It is sometimes useful to fine-tune packages, for example, by applying +# # overrides. You can do that directly here, just don't forget the +# # parentheses. Maybe you want to install Nerd Fonts with a limited number of +# # fonts? +# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + +# # You can also create simple shell scripts directly inside your +# # configuration. For example, this adds a command 'my-hello' to your +# # environment: +# (pkgs.writeShellScriptBin "my-hello" '' +# echo "Hello, ${config.home.username}!" +# '') +]; + +#ssh config + +programs.ssh.enable = true; +services.ssh-agent.enable = true; + +home.file.".ssh/config".text = '' +Host * + AddKeysToAgent yes + IdentityFile ~/.ssh/id_ed25519 +''; + + + +# Home Manager is pretty good at managing dotfiles. The primary way to manage +# plain files is through 'home.file'. +home.file = { +# # Building this configuration will create a copy of 'dotfiles/screenrc' in +# # the Nix store. Activating the configuration will then make '~/.screenrc' a +# # symlink to the Nix store copy. +# ".screenrc".source = dotfiles/screenrc; + +# # You can also set the file content immediately. +# ".gradle/gradle.properties".text = '' +# org.gradle.console=verbose +# org.gradle.daemon.idletimeout=3600000 +# ''; +}; + + +# Home Manager can also manage your environment variables through +# 'home.sessionVariables'. These will be explicitly sourced when using a +# shell provided by Home Manager. If you don't want to manage your shell +# through Home Manager then you have to manually source 'hm-session-vars.sh' +# located at either +# +# ~/.nix-profile/etc/profile.d/hm-session-vars.sh +# +# or +# +# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh +# +# or +# +# /etc/profiles/per-user/tomasr/etc/profile.d/hm-session-vars.sh +# +home.sessionVariables = { + EDITOR = "neovim"; + # Git update function + # Prompts for commit message; defaults if empty + GIT_UPDATE = '' + echo 'Enter commit message: ' +read msg +if [ -z "$msg" ]; then + msg="Update NixOS configuration" +fi +git add . && git commit -m "$msg" && git push origin main + ''; + }; + + +# Let Home Manager install and manage itself. +programs.home-manager.enable = true; +} diff --git a/modules/home-manager/git.nix b/modules/home-manager/git.nix new file mode 100644 index 0000000..5c58a94 --- /dev/null +++ b/modules/home-manager/git.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: + +{ + programs.git = { + enable = true; + # no declarative parameters for git as it would show in a public git repo more info than I would like. Just use the following commands + # git config --global user.name "YourName" + # git config --global user.email "YourEmail" + # git config --global init.defaultBranch main + +#cd ~/nixos\ +#git add . +#git commit -m "Update NixOS configuration" +#git push origin master + +}; +} diff --git a/modules/home-manager/kitty.nix b/modules/home-manager/kitty.nix new file mode 100644 index 0000000..5324f64 --- /dev/null +++ b/modules/home-manager/kitty.nix @@ -0,0 +1,58 @@ +{ config, pkgs, ... }: + +{ + programs.kitty = { + enable = true; + #font.name = nerd-fonts._0xproto; + #font.size = "10"; + extraConfig = '' +bold_font auto +italic_font auto +bold_italic_font auto +window_padding_width 25 +foreground #FFFFFF +background #1B1D1C +selection_foreground #1B1D1C +selection_background #FFFFFF +cursor #C3AC76 +cursor_text_color #0F1010 + +active_tab_foreground #1B1D1C +active_tab_background #6B5540 +inactive_tab_foreground #6B5540 +inactive_tab_background #1B1D1C + +# black +color0 #29523D +color8 #578F73 + +# red +color1 #FFF0CC +color9 #F0DBAA + +# green +color2 #FFEECC +color10 #F0D9AA + +# yellow +color3 #FFE5CC +color11 #F0CCAA + +# blue +color4 #9AE6C0 +color12 #9AE6C0 + +# magenta +color5 #E6CC9A +color13 #E6CC9A + +# cyan +color6 #E6BF9A +color14 #E6BF9A + +# white +color7 #FFF0CC +color15 #F0DBAA +''; +}; +} diff --git a/modules/home-manager/ssh.nix b/modules/home-manager/ssh.nix new file mode 100644 index 0000000..e62d8f7 --- /dev/null +++ b/modules/home-manager/ssh.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + + programs.ssh = { + enable = true; + #agentKeys = [ + # "/home/tomasr/.ssh/id_ed25519" + #]; + }; + services.ssh-agent.enable = true; + +} diff --git a/modules/home-manager/zoxide.nix b/modules/home-manager/zoxide.nix new file mode 100644 index 0000000..cb6a272 --- /dev/null +++ b/modules/home-manager/zoxide.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + programs.zoxide = { + enable = true; + enableZshIntegration = true; + }; +} diff --git a/modules/home-manager/zsh.nix b/modules/home-manager/zsh.nix new file mode 100644 index 0000000..936cc9e --- /dev/null +++ b/modules/home-manager/zsh.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + programs.zsh = { + enable = true; + autosuggestion.enable = true; + initContent = "fastfetch\n"; + }; +} diff --git a/todo b/todo new file mode 100644 index 0000000..673477f --- /dev/null +++ b/todo @@ -0,0 +1,26 @@ +use hyprland +transfer everything +list to things to transfere: + + +finish to link github +make a zsh script that nixos-rebuild switch +and uploads it to github +git add . +git add -A +git commit -m "Describe the change" +git push + + +write README.md + +only things which is not declarative is git. Dont want my email in a repo. +guide on how to connect to git in ./modules/home-manager/git.nix + + + +write an install script + +which setups config. + +and setups github and ssh