From eec532daed068a33400e935f9d2ee7e1dc012b09 Mon Sep 17 00:00:00 2001 From: "thomas g. lopes" Date: Sun, 8 Mar 2026 18:21:37 +0000 Subject: [PATCH] wip: flake parts setup --- configuration.nix.backup | 150 +++++++++++++++++++++++++++++++++++++ flake.lock | 109 +++++++++++++++++++++++++++ flake.nix | 25 +++++++ hardware-configuration.nix | 31 ++++++++ modules/desktop-ui.nix | 22 ++++++ modules/nixos.nix | 120 +++++++++++++++++++++++++++++ 6 files changed, 457 insertions(+) create mode 100644 configuration.nix.backup create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware-configuration.nix create mode 100644 modules/desktop-ui.nix create mode 100644 modules/nixos.nix diff --git a/configuration.nix.backup b/configuration.nix.backup new file mode 100644 index 0000000..03d8c43 --- /dev/null +++ b/configuration.nix.backup @@ -0,0 +1,150 @@ +# 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 + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Use latest kernel. + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking.hostName = "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/Lisbon"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_GB.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "pt_PT.UTF-8"; + LC_IDENTIFICATION = "pt_PT.UTF-8"; + LC_MEASUREMENT = "pt_PT.UTF-8"; + LC_MONETARY = "pt_PT.UTF-8"; + LC_NAME = "pt_PT.UTF-8"; + LC_NUMERIC = "pt_PT.UTF-8"; + LC_PAPER = "pt_PT.UTF-8"; + LC_TELEPHONE = "pt_PT.UTF-8"; + LC_TIME = "pt_PT.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 = ""; + }; + + # 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.thomasgl = { + isNormalUser = true; + description = "Thomas Gouveia Lopes"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + neovim + nodejs_24 + pnpm + fd + ripgrep + fish + go + nerdfetch + git + alacritty + zellij + fzf + autojump + # thunderbird + ]; + + }; +fonts.packages = with pkgs; [ +nerd-fonts.iosevka-term-slab +]; + + # 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; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + ]; + + # 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/flake.lock b/flake.lock new file mode 100644 index 0000000..785807f --- /dev/null +++ b/flake.lock @@ -0,0 +1,109 @@ +{ + "nodes": { + "dms": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "quickshell": "quickshell" + }, + "locked": { + "lastModified": 1772034342, + "narHash": "sha256-InX8kRyrpVL+MP/gW1qhH9tGtDx2z2gmJ9NfmvUJ35I=", + "owner": "AvengeMedia", + "repo": "DankMaterialShell", + "rev": "47b12d09fc8526f9c231de60848a41b5990b4a37", + "type": "github" + }, + "original": { + "owner": "AvengeMedia", + "ref": "stable", + "repo": "DankMaterialShell", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772408722, + "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "import-tree": { + "locked": { + "lastModified": 1772344373, + "narHash": "sha256-OQQ1MhB9t1J71b2wxRRTdH/Qd8UGG0p+dGspfCf5U1c=", + "owner": "vic", + "repo": "import-tree", + "rev": "10fda59eee7d7970ec443b925f32a1bc7526648c", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1772773019, + "narHash": "sha256-E1bxHxNKfDoQUuvriG71+f+s/NT0qWkImXsYZNFFfCs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "aca4d95fce4914b3892661bcb80b8087293536c6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "quickshell": { + "inputs": { + "nixpkgs": [ + "dms", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1766725085, + "narHash": "sha256-O2aMFdDUYJazFrlwL7aSIHbUSEm3ADVZjmf41uBJfHs=", + "ref": "refs/heads/master", + "rev": "41828c4180fb921df7992a5405f5ff05d2ac2fff", + "revCount": 715, + "type": "git", + "url": "https://git.outfoxxed.me/quickshell/quickshell" + }, + "original": { + "rev": "41828c4180fb921df7992a5405f5ff05d2ac2fff", + "type": "git", + "url": "https://git.outfoxxed.me/quickshell/quickshell" + } + }, + "root": { + "inputs": { + "dms": "dms", + "flake-parts": "flake-parts", + "import-tree": "import-tree", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3bd9095 --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; + import-tree.url = "github:vic/import-tree"; + + dms = { + url = "github:AvengeMedia/DankMaterialShell/stable"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs@{ flake-parts, nixpkgs, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-linux" ]; + imports = [ + ./modules/nixos.nix + ./modules/desktop-ui.nix + ]; + } // { + # re-export inputs for modules to access + inherit inputs; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..3a0d310 --- /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 + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/6087d546-9110-4bc2-9da0-271c5d1a4405"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/94B4-7348"; + 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/modules/desktop-ui.nix b/modules/desktop-ui.nix new file mode 100644 index 0000000..5b81114 --- /dev/null +++ b/modules/desktop-ui.nix @@ -0,0 +1,22 @@ +{ inputs, ... }: { + +flake.nixosModules.desktop-ui = { pkgs, ... }: { + # Desktop environment + services.xserver.enable = true; + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + # DankMaterialShell + programs.dank-material-shell = { + enable = true; + enableSystemMonitoring = true; + enableDynamicTheming = true; + }; + + programs.niri.enable = true; + services.gnome.gnome-keyring.enable = true; # secret service +};} diff --git a/modules/nixos.nix b/modules/nixos.nix new file mode 100644 index 0000000..5161e65 --- /dev/null +++ b/modules/nixos.nix @@ -0,0 +1,120 @@ +{ inputs, self, ... }: { + +flake.nixosConfigurations.nixos = inputs.nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + inputs.dms.nixosModules.dank-material-shell + self.nixosModules.nixos + self.nixosModules.desktop-ui + ]; +}; + +flake.nixosModules.nixos = {pkgs, ...}: { + imports = [ + ../hardware-configuration.nix + ]; + + # Bootloader + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Use latest kernel + boot.kernelPackages = pkgs.linuxPackages_latest; + + # Hostname + networking.hostName = "nixos"; + + # Networking + networking.networkmanager.enable = true; + + # Time zone + time.timeZone = "Europe/Lisbon"; + + # Locale + i18n.defaultLocale = "en_GB.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "pt_PT.UTF-8"; + LC_IDENTIFICATION = "pt_PT.UTF-8"; + LC_MEASUREMENT = "pt_PT.UTF-8"; + LC_MONETARY = "pt_PT.UTF-8"; + LC_NAME = "pt_PT.UTF-8"; + LC_NUMERIC = "pt_PT.UTF-8"; + LC_PAPER = "pt_PT.UTF-8"; + LC_TELEPHONE = "pt_PT.UTF-8"; + LC_TIME = "pt_PT.UTF-8"; + }; + + # Desktop environment + services.xserver.enable = true; + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + # Printing + services.printing.enable = true; + + # Audio + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # User account + users.users.thomasgl = { + isNormalUser = true; + description = "Thomas Gouveia Lopes"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + neovim + nodejs_24 + pnpm + fd + ripgrep + fish + go + nerdfetch + git + alacritty + zellij + fzf + autojump + ]; + }; + + # Fonts + fonts.packages = with pkgs; [ + nerd-fonts.iosevka-term-slab + ]; + + # Programs + programs.firefox.enable = true; + + # Allow unfree + nixpkgs.config.allowUnfree = true; + + # Enable flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # DankMaterialShell + programs.dank-material-shell = { + enable = true; + enableSystemMonitoring = true; + enableDynamicTheming = true; + }; + + # System packages + environment.systemPackages = with pkgs; [ + # Add system-wide packages here + ]; + + # State version + system.stateVersion = "25.11"; +}; +}