commit 19ba4a6a09bcb6adedf8f2d2de51f5281713aeca Author: Dmitri Date: Sat Oct 4 13:32:17 2025 +0200 first commit diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..e89f81b --- /dev/null +++ b/configuration.nix @@ -0,0 +1,176 @@ +{ pkgs, input, ... }: + +{ + imports = [ ./hardware-configuration.nix ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Use latest kernel. + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking.hostName = "laptop"; + + # Enable networking + networking.networkmanager.enable = true; + hardware.bluetooth.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Rome"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "it_IT.UTF-8"; + LC_IDENTIFICATION = "it_IT.UTF-8"; + LC_MEASUREMENT = "it_IT.UTF-8"; + LC_MONETARY = "it_IT.UTF-8"; + LC_NAME = "it_IT.UTF-8"; + LC_NUMERIC = "it_IT.UTF-8"; + LC_PAPER = "it_IT.UTF-8"; + LC_TELEPHONE = "it_IT.UTF-8"; + LC_TIME = "it_IT.UTF-8"; + }; + + # Enable the GNOME Desktop Environment. + services = { + blueman.enable = true; + power-profiles-daemon.enable = true; + fprintd.enable = true; + printing.enable = true; + displayManager.ly = { enable = true; }; + pulseaudio.enable = false; + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + gnome.gnome-keyring.enable = true; + }; + + security.rtkit.enable = true; + xdg.portal = { + enable = true; + wlr.enable = true; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.user = { + isNormalUser = true; + description = "user"; + extraGroups = [ "networkmanager" "wheel" "docker" ]; + packages = with pkgs; [ + firefox + nextcloud-client + keepassxc + signal-desktop + luarocks + python3 + unzip + wget + go + nodejs + tree-sitter + gcc + ripgrep + fd + cargo + texliveFull + jdk21 + eza + zoxide + fzf + docker-compose + btop + freecad + orca-slicer + ]; + }; + + users.extraUsers.user = { shell = pkgs.zsh; }; + + fonts.packages = with pkgs; [ nerd-fonts.iosevka ]; + + programs = { + zsh.enable = true; + xwayland.enable = true; + gnupg = { agent.enable = true; }; + sway = { + enable = true; + wrapperFeatures.gtk = true; + extraPackages = with pkgs; [ + xss-lock + networkmanagerapplet + pavucontrol + brightnessctl + foot + ghostty + grim + pulseaudio + swayidle + swaylock + waybar + wofi + zathura + easyeffects + yt-dlp + mpv + tmux + mako + bibata-cursors + wl-clipboard + adw-gtk3 + xfce.thunar + wluma + blueman + wlsunset + playerctl + sway-contrib.grimshot + wf-recorder + adwaita-icon-theme + kdePackages.polkit-kde-agent-1 + ]; + }; + }; + virtualisation.docker.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # List packages installed in system profile. To search, run: + environment.systemPackages = with pkgs; [ git neovim ]; + + environment = { + variables = { + JAVA_HOME = "${pkgs.jdk21}/lib/openjdk"; + GTK_THEME = "Adwaita:dark"; + XCURSOR_THEME = "Bibata-Modern-Clasic"; + }; + }; + + system = { + stateVersion = "25.05"; + autoUpgrade = { + enable = true; + dates = "20:00"; + randomizedDelaySec = "45min"; + }; + }; + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + + # home-manager = { + # extraSpecialArgs = { inherit input; }; + # users = { "user" = import ./home.nix; }; + # }; + # home-manager.users.user = import ./home.nix; + +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..49f8c92 --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1758463745, + "narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1759439645, + "narHash": "sha256-oiAyQaRilPk525Z5aTtTNWNzSrcdJ7IXM0/PL3CGlbI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "879bd460b3d3e8571354ce172128fbcbac1ed633", + "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..68c5224 --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +{ + 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, ... }: { + nixosConfigurations.laptop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + # Enable HM as a NixOS module + home-manager.nixosModules.home-manager + + # Your system config + ./configuration.nix + + # HM settings and user wiring + ({ ... }: { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + + # Use your existing home.nix for user "user" + home-manager.users.user = import ./home.nix; + }) + ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..8a241d9 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/32a26736-8c6c-4352-b438-1b19fcae139e"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-598c0861-a3f4-44dc-a716-0f2a21cf3f41".device = + "/dev/disk/by-uuid/598c0861-a3f4-44dc-a716-0f2a21cf3f41"; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/E4B5-0BD3"; + 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.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..3e5df13 --- /dev/null +++ b/home.nix @@ -0,0 +1,57 @@ +{ config, pkgs, ... }: + +{ + home.username = "user"; + home.homeDirectory = "/home/user"; + + # 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.05"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ librewolf ]; + + # 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/user/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +}