commit 02082e2dd85b2d23b10c535d0fa4ad61ca34d79f Author: Laurent Gueret Date: Sat Jan 24 15:52:13 2026 +0100 Base of Nix Configuration diff --git a/flake.lock b/flake.lock new file mode 100755 index 0000000..cf2a756 --- /dev/null +++ b/flake.lock @@ -0,0 +1,66 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1714043624, + "narHash": "sha256-Xn2r0Jv95TswvPlvamCC46wwNo8ALjRCMBJbGykdhcM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "86853e31dc1b62c6eeed11c667e8cdd0285d4411", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1713995372, + "narHash": "sha256-fFE3M0vCoiSwCX02z8VF58jXFRj9enYUSTqjyHAjrds=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "dd37924974b9202f8226ed5d74a252a9785aedf8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1714076141, + "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100755 index 0000000..4ff9206 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + description = "NixOS files config"; + + inputs = { + # Nixpkgs + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + + # Home manager + home-manager.url = "github:nix-community/home-manager/release-25.11"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { + self, + nixpkgs, + home-manager, + ... + } @ inputs: let + systems = ["x86_64-linux"]; + forAllSystems = nixpkgs.lib.genAttrs systems; + in { + + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + overlays = import ./overlays {inherit inputs;}; + + nixos = import ./modules/nixos; + home = import ./modules/home; + apps = import ./modules/apps; + + nixosConfigurations = { + nixos = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [./nixos/configuration.nix]; + }; + }; + + }; +} diff --git a/home-manager/.DS_Store b/home-manager/.DS_Store new file mode 100644 index 0000000..57043a5 Binary files /dev/null and b/home-manager/.DS_Store differ diff --git a/home-manager/configurations/firefox.nix b/home-manager/configurations/firefox.nix new file mode 100644 index 0000000..4611b62 --- /dev/null +++ b/home-manager/configurations/firefox.nix @@ -0,0 +1,67 @@ +{ ... }: + +{ + programs.firefox = { + + enable = true; + + policies = { + ExtensionSettings = { + "uBlock0@raymondhill.net" = { + default_area = "menupanel"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "force_installed"; + private_browsing = true; + }; + }; + }; + + profiles.alistreaza = { + settings = { + # Disable some telemetry + "app.shield.optoutstudies.enabled" = false; + "browser.discovery.enabled" = false; + "browser.newtabpage.activity-stream.feeds.telemetry" = false; + "browser.newtabpage.activity-stream.telemetry" = false; + "browser.ping-centre.telemetry" = false; + "datareporting.healthreport.service.enabled" = false; + "datareporting.healthreport.uploadEnabled" = false; + "datareporting.policy.dataSubmissionEnabled" = false; + "datareporting.sessions.current.clean" = true; + "devtools.onboarding.telemetry.logged" = false; + "toolkit.telemetry.archive.enabled" = false; + "toolkit.telemetry.bhrPing.enabled" = false; + "toolkit.telemetry.enabled" = false; + "toolkit.telemetry.firstShutdownPing.enabled" = false; + "toolkit.telemetry.hybridContent.enabled" = false; + "toolkit.telemetry.newProfilePing.enabled" = false; + "toolkit.telemetry.prompted" = 2; + "toolkit.telemetry.rejected" = true; + "toolkit.telemetry.reportingpolicy.firstRun" = false; + "toolkit.telemetry.server" = ""; + "toolkit.telemetry.shutdownPingSender.enabled" = false; + "toolkit.telemetry.unified" = false; + "toolkit.telemetry.unifiedIsOptIn" = false; + "toolkit.telemetry.updatePing.enabled" = false; + # New tab page + "browser.newtabpage.activity-stream.feeds.topsites" = false; + "browser.newtabpage.activity-stream.showSponsoredTopSites" = false; + "browser.newtabpage.activity-stream.showSponsoredCheckboxes" = false; + # No bookmartks + "browser.toolbars.bookmarks.visibility" = "never"; + # Vertical tabs + "sidebar.new-sidebar.has-used" = true; + "sidebar.verticalTabs" = true; + "sidebar.revamp" = true; + "sidebar.main.tools" = "history"; + }; + }; + + }; + xdg.mimeApps.defaultApplications = { + "text/html" = [ "firefox.desktop" ]; + "text/xml" = [ "firefox.desktop" ]; + "x-scheme-handler/http" = [ "firefox.desktop" ]; + "x-scheme-handler/https" = [ "firefox.desktop" ]; + }; +} diff --git a/home-manager/configurations/ghostty.nix b/home-manager/configurations/ghostty.nix new file mode 100644 index 0000000..d9a4fe0 --- /dev/null +++ b/home-manager/configurations/ghostty.nix @@ -0,0 +1,14 @@ +{ ... }: +{ + programs.ghostty = { + enable = true; + enableZshIntegration = true; + settings = { + background-opacity = 0.9; + keybind = [ + "performable:ctrl+c=copy_to_clipboard" + "performable:ctrl+v=paste_from_clipboard" + ]; + }; + }; +} diff --git a/home-manager/configurations/gnome.nix b/home-manager/configurations/gnome.nix new file mode 100644 index 0000000..b8ef8c3 --- /dev/null +++ b/home-manager/configurations/gnome.nix @@ -0,0 +1,89 @@ +{ + lib, + pkgs, + ... +}: +with lib.hm.gvariant; +{ + dconf = { + enable = true; + settings = { + + "org/gnome/desktop/input-sources" = { + sources = [ + (mkTuple [ + "xkb" + "fr+mac" + ]) + ]; + }; + + "org/gnome/shell" = { + disable-user-extensions = false; + enabled-extensions = with pkgs.gnomeExtensions; [ + vitals.extensionUuid + paperwm.extensionUuid + app-hider.extensionUuid + dash-to-panel.extensionUuid + ]; + }; + + "org/gnome/desktop/wm/preferences" = { + button-layout = "appmenu:minimize,close"; + }; + + "org/gnome/shell/extensions/app-hider" = { + hidden-apps = [ + "nvim.desktop" + "cups.desktop" + "xterm.desktop" + "nixos-manual.desktop" + ]; + }; + + "org/gnome/desktop/interface" = { + icon-theme = "Papirus"; + accent-color = "teal"; + color-scheme = "prefer-dark"; + }; + + "org/gnome/desktop/background" = { + picture-options = "zoom"; + picture-uri = "file://" + ../wallpapers/mocha.svg; + picture-uri-dark = "file://" + ../wallpapers/mocha.svg; + }; + + "org/gnome/shell/extensions/dash-to-panel" = { + prefs-opened = true; + isolate-monitors = true; + isolate-workspaces = true; + + panel-top-bottom-padding = 8; + + trans-panel-opacity = 0.75; + trans-use-border = true; + trans-use-custom-opacity = true; + + dot-color-dominant = true; + dot-color-override = false; + dot-color-unfocused-different = false; + dot-position = "BOTTOM"; + dot-style-focused = "METRO"; + dot-style-unfocused = "DOTS"; + focus-highlight = true; + focus-highlight-dominant = true; + }; + + "org/gnome/shell/extensions/paperwm" = { + show-window-position-bar = false; + }; + + "org/gnome/shell/extensions/vitals" = { + show-gpu = true; + show-voltage = false; + position-in-panel = 1; + }; + + }; + }; +} diff --git a/home-manager/configurations/zed.nix b/home-manager/configurations/zed.nix new file mode 100644 index 0000000..512ba2f --- /dev/null +++ b/home-manager/configurations/zed.nix @@ -0,0 +1,30 @@ +{ + lib, + pkgs, + config, + ... +}: +with lib; +let + cfg = config.within.zed; +in +{ + options.within.zed = { + enable = mkEnableOption "System zed service"; + }; + config = mkIf cfg.enable { + environment = { + systemPackages = with pkgs; [ + + # Nix languages parser + nil + nixd + + # Zed Editor + zed-editor + + ]; + }; + + }; +} diff --git a/home-manager/home.nix b/home-manager/home.nix new file mode 100755 index 0000000..e3eef17 --- /dev/null +++ b/home-manager/home.nix @@ -0,0 +1,28 @@ +{ + inputs, + ... +}: +{ + imports = [ + ./configurations/gnome.nix + ./configurations/firefox.nix + ./configurations/ghostty.nix + ./configurations/zed.nix + ]; + + nixpkgs = { + overlays = [ + inputs.self.overlays.additions + inputs.self.overlays.modifications + inputs.self.overlays.unstable-packages + ]; + }; + + home = { + username = "alistreaza"; + homeDirectory = "/home/alistreaza"; + }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "25.11"; +} diff --git a/home-manager/wallpapers/dark-gray.svg b/home-manager/wallpapers/dark-gray.svg new file mode 100644 index 0000000..7caf2bd --- /dev/null +++ b/home-manager/wallpapers/dark-gray.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/home-manager/wallpapers/frappe.svg b/home-manager/wallpapers/frappe.svg new file mode 100644 index 0000000..c11a827 --- /dev/null +++ b/home-manager/wallpapers/frappe.svg @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/home-manager/wallpapers/latte.svg b/home-manager/wallpapers/latte.svg new file mode 100644 index 0000000..20177be --- /dev/null +++ b/home-manager/wallpapers/latte.svg @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/home-manager/wallpapers/macchiato.svg b/home-manager/wallpapers/macchiato.svg new file mode 100644 index 0000000..a216fd1 --- /dev/null +++ b/home-manager/wallpapers/macchiato.svg @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/home-manager/wallpapers/mocha.svg b/home-manager/wallpapers/mocha.svg new file mode 100644 index 0000000..7e86a91 --- /dev/null +++ b/home-manager/wallpapers/mocha.svg @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/home-manager/wallpapers/solarized-light.svg b/home-manager/wallpapers/solarized-light.svg new file mode 100644 index 0000000..4eb4673 --- /dev/null +++ b/home-manager/wallpapers/solarized-light.svg @@ -0,0 +1,495 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/home-manager/wallpapers/solarized.svg b/home-manager/wallpapers/solarized.svg new file mode 100644 index 0000000..0fbd7f3 --- /dev/null +++ b/home-manager/wallpapers/solarized.svg @@ -0,0 +1,504 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/apps/default.nix b/modules/apps/default.nix new file mode 100755 index 0000000..12abdaf --- /dev/null +++ b/modules/apps/default.nix @@ -0,0 +1,5 @@ +{ + shell = import ./services/shell.nix; + gnome = import ./services/gnome.nix; + zed = import ./submodules/zed.nix; +} diff --git a/modules/apps/services/gnome.nix b/modules/apps/services/gnome.nix new file mode 100644 index 0000000..0c4d407 --- /dev/null +++ b/modules/apps/services/gnome.nix @@ -0,0 +1,4 @@ +{ + shell = import ../submodules/gnome-shell.nix; + apps = import ../submodules/gnome-apps.nix; +} diff --git a/modules/apps/services/shell.nix b/modules/apps/services/shell.nix new file mode 100644 index 0000000..ab8acd9 --- /dev/null +++ b/modules/apps/services/shell.nix @@ -0,0 +1,6 @@ +{ + zsh = import ../submodules/zsh.nix; + nh = import ../submodules/nh.nix; + git = import ../submodules/git.nix; + docker = import ../submodules/docker.nix; +} diff --git a/modules/apps/submodules/docker.nix b/modules/apps/submodules/docker.nix new file mode 100644 index 0000000..793a4ce --- /dev/null +++ b/modules/apps/submodules/docker.nix @@ -0,0 +1,17 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.shell.docker; +in +{ + options.within.shell.docker = { + enable = mkEnableOption "System docker service"; + }; + config = mkIf cfg.enable { + + virtualisation.docker = { + enable = true; + }; + + }; +} diff --git a/modules/apps/submodules/git.nix b/modules/apps/submodules/git.nix new file mode 100644 index 0000000..91239c6 --- /dev/null +++ b/modules/apps/submodules/git.nix @@ -0,0 +1,26 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.shell.git; +in +{ + options.within.shell.git = { + enable = mkEnableOption "System git service"; + }; + config = mkIf cfg.enable { + + programs.git = { + enable = true; + config = { + init.defaultBranch = "main"; + user = { + name = "Laurent Gueret"; + email = "gueretlob@icloud.com"; + }; + }; + }; + + programs.ssh.enableAskPassword = false; + + }; +} diff --git a/modules/apps/submodules/gnome-apps.nix b/modules/apps/submodules/gnome-apps.nix new file mode 100644 index 0000000..3b989ce --- /dev/null +++ b/modules/apps/submodules/gnome-apps.nix @@ -0,0 +1,34 @@ +{ + lib, + pkgs, + config, + ... +}: +with lib; +let + cfg = config.within.gnome.apps; +in +{ + options.within.gnome.apps = { + enable = mkEnableOption "System gnome apps service"; + }; + config = mkIf cfg.enable { + + environment = { + systemPackages = + with pkgs; + [ + # Gnome media apps + papers + celluloid + ] + ++ [ + # Gnome files explorer + nautilus + ]; + }; + + services.gvfs.enable = true; # SMB, FTP, ... access + + }; +} diff --git a/modules/apps/submodules/gnome-shell.nix b/modules/apps/submodules/gnome-shell.nix new file mode 100644 index 0000000..c099648 --- /dev/null +++ b/modules/apps/submodules/gnome-shell.nix @@ -0,0 +1,49 @@ +{ + lib, + pkgs, + config, + ... +}: +with lib; +let + cfg = config.within.gnome.shell; +in +{ + options.within.gnome.shell = { + enable = mkEnableOption "System gnome shell service"; + }; + config = mkIf cfg.enable { + + services.displayManager.gdm.enable = true; + services.desktopManager.gnome.enable = true; + + services.gnome.games.enable = false; + services.gnome.core-apps.enable = false; + services.gnome.core-developer-tools.enable = false; + + environment = { + + gnome.excludePackages = with pkgs; [ + gnome-tour + gnome-user-docs + ]; + + systemPackages = with pkgs; [ + + # Gnome terminal + ghostty + + # Gnome icons + papirus-icon-theme + + # Gnome Extensions + gnomeExtensions.vitals + gnomeExtensions.paperwm + gnomeExtensions.app-hider + gnomeExtensions.dash-to-panel + + ]; + }; + + }; +} diff --git a/modules/apps/submodules/nh.nix b/modules/apps/submodules/nh.nix new file mode 100644 index 0000000..4afc2b4 --- /dev/null +++ b/modules/apps/submodules/nh.nix @@ -0,0 +1,19 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.shell.nh; +in +{ + options.within.shell.nh = { + enable = mkEnableOption "System nh service"; + }; + config = mkIf cfg.enable { + + programs.nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 2d --keep 3"; + }; + + }; +} diff --git a/modules/apps/submodules/zsh.nix b/modules/apps/submodules/zsh.nix new file mode 100644 index 0000000..e3a4ccb --- /dev/null +++ b/modules/apps/submodules/zsh.nix @@ -0,0 +1,25 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.shell.zsh; +in +{ + options.within.shell.zsh = { + enable = mkEnableOption "System zsh service"; + }; + config = mkIf cfg.enable { + + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + }; + + programs.neovim = { + enable = true; + defaultEditor = true; + }; + + }; +} diff --git a/modules/home/default.nix b/modules/home/default.nix new file mode 100755 index 0000000..45aae31 --- /dev/null +++ b/modules/home/default.nix @@ -0,0 +1,6 @@ +# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..54fde2e --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,7 @@ +{ + boot = import ./services/boot.nix; + graphics = import ./services/graphics.nix; + networks = import ./services/networks.nix; + audio = import ./services/audio.nix; + keyboard = import ./services/keyboard.nix; +} diff --git a/modules/nixos/services/audio.nix b/modules/nixos/services/audio.nix new file mode 100644 index 0000000..c2676e1 --- /dev/null +++ b/modules/nixos/services/audio.nix @@ -0,0 +1,3 @@ +{ + pipewire = import ../submodules/pipewire.nix; +} diff --git a/modules/nixos/services/boot.nix b/modules/nixos/services/boot.nix new file mode 100644 index 0000000..69ed3a3 --- /dev/null +++ b/modules/nixos/services/boot.nix @@ -0,0 +1,4 @@ +{ + systemd = import ../submodules/systemd-boot.nix; + plymouth = import ../submodules/plymouth.nix; +} diff --git a/modules/nixos/services/graphics.nix b/modules/nixos/services/graphics.nix new file mode 100644 index 0000000..c20ff3a --- /dev/null +++ b/modules/nixos/services/graphics.nix @@ -0,0 +1,6 @@ +{ + nvidia = { + base = import ../submodules/nvidia.nix; + prime = import ../submodules/nvidia-prime.nix; + }; +} diff --git a/modules/nixos/services/keyboard.nix b/modules/nixos/services/keyboard.nix new file mode 100644 index 0000000..941f4da --- /dev/null +++ b/modules/nixos/services/keyboard.nix @@ -0,0 +1,3 @@ +{ + apple = import ../submodules/keyboard-apple.nix; +} diff --git a/modules/nixos/services/networks.nix b/modules/nixos/services/networks.nix new file mode 100755 index 0000000..e8bcc24 --- /dev/null +++ b/modules/nixos/services/networks.nix @@ -0,0 +1,4 @@ +{ + dns = import ../submodules/dns.nix; + manager = import ../submodules/manager.nix; +} diff --git a/modules/nixos/submodules/dns.nix b/modules/nixos/submodules/dns.nix new file mode 100644 index 0000000..1a16a22 --- /dev/null +++ b/modules/nixos/submodules/dns.nix @@ -0,0 +1,20 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.networks.dns; +in +{ + options.within.networks.dns = { + enable = mkEnableOption "System dns service"; + }; + config = mkIf cfg.enable { + + services.resolved.enable = true; + + services.avahi = { + enable = true; + nssmdns4 = true; + }; + + }; +} diff --git a/modules/nixos/submodules/keyboard-apple.nix b/modules/nixos/submodules/keyboard-apple.nix new file mode 100644 index 0000000..1fd7906 --- /dev/null +++ b/modules/nixos/submodules/keyboard-apple.nix @@ -0,0 +1,25 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.keyboard.apple; +in +{ + options.within.keyboard.apple = { + enable = mkEnableOption "System apple locales service"; + }; + config = mkIf cfg.enable { + + # Select internationalisation properties. + i18n.defaultLocale = "fr_BE.UTF-8"; + + # Configure console keymap + console.keyMap = "mac-fr"; + + # Configure keymap in X11 + services.xserver.xkb = { + model = "macintosh"; + layout = "fr"; + }; + + }; +} diff --git a/modules/nixos/submodules/manager.nix b/modules/nixos/submodules/manager.nix new file mode 100644 index 0000000..03f26db --- /dev/null +++ b/modules/nixos/submodules/manager.nix @@ -0,0 +1,15 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.networks.manager; +in +{ + options.within.networks.manager = { + enable = mkEnableOption "System networks manager service"; + }; + config = mkIf cfg.enable { + + networking.networkmanager.enable = true; + + }; +} diff --git a/modules/nixos/submodules/nvidia-prime.nix b/modules/nixos/submodules/nvidia-prime.nix new file mode 100644 index 0000000..4ec6b9a --- /dev/null +++ b/modules/nixos/submodules/nvidia-prime.nix @@ -0,0 +1,25 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.graphics.nvidia.prime; +in +{ + options.within.graphics.nvidia.prime = { + enable = mkEnableOption "System nvidia prime service"; + }; + config = mkIf cfg.enable { + + services.xserver.videoDrivers = [ + "modesetting" + "nvidia" + ]; + + hardware.powerManagement.finegrained = true; + hardware.prime = { + offload.enable = true; + intelBusId = "PCI:0@0:2:0"; + nvidiaBusId = "PCI:1@0:0:0"; + }; + + }; +} diff --git a/modules/nixos/submodules/nvidia.nix b/modules/nixos/submodules/nvidia.nix new file mode 100644 index 0000000..8602c77 --- /dev/null +++ b/modules/nixos/submodules/nvidia.nix @@ -0,0 +1,30 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.graphics.nvidia; +in +{ + options.within.graphics.nvidia = { + enable = mkEnableOption "System nvidia service"; + }; + config = mkIf cfg.enable { + + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "nvidia-x11" + ]; + + services.xserver.enable = true; + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.graphics.enable = true; + hardware.nvidia = { + open = true; + nvidiaSettings = false; + modesetting.enable = true; # Wayland requirements + powerManagement.enable = true; + }; + + }; +} diff --git a/modules/nixos/submodules/pipewire.nix b/modules/nixos/submodules/pipewire.nix new file mode 100644 index 0000000..0cd2d5c --- /dev/null +++ b/modules/nixos/submodules/pipewire.nix @@ -0,0 +1,23 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.audio.pipewire; +in +{ + options.within.audio.pipewire = { + enable = mkEnableOption "System pipewire service"; + }; + config = mkIf cfg.enable { + + security.rtkit.enable = true; + services.pulseaudio.enable = false; + + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + alsa.support32Bit = true; + }; + + }; +} diff --git a/modules/nixos/submodules/plymouth.nix b/modules/nixos/submodules/plymouth.nix new file mode 100644 index 0000000..9c68ac3 --- /dev/null +++ b/modules/nixos/submodules/plymouth.nix @@ -0,0 +1,23 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.boot.plymouth; +in +{ + options.within.boot.plymouth = { + enable = mkEnableOption "Boot plymouth service"; + }; + config = mkIf cfg.enable { + + boot.consoleLogLevel = 3; + boot.initrd.verbose = false; + boot.kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + ]; + + boot.plymouth.enable = true; + + }; +} diff --git a/modules/nixos/submodules/systemd-boot.nix b/modules/nixos/submodules/systemd-boot.nix new file mode 100644 index 0000000..9891082 --- /dev/null +++ b/modules/nixos/submodules/systemd-boot.nix @@ -0,0 +1,17 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.within.boot.systemd; +in +{ + options.within.boot.systemd = { + enable = mkEnableOption "Boot systemd service"; + }; + config = mkIf cfg.enable { + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.systemd-boot.consoleMode = "max"; + + }; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100755 index 0000000..965a211 --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,68 @@ +{ + inputs, + lib, + config, + ... +}: +{ + + imports = [ + + # Hardware + ./hardware-configuration.nix + ./configurations/kernel.nix + + # Configurations + ./configurations/users.nix + ./configurations/home-manager.nix + + # Modules + inputs.self.nixos.boot + inputs.self.nixos.graphics + inputs.self.nixos.audio + inputs.self.nixos.networks + inputs.self.nixos.keyboard + + ]; + + nixpkgs = { + overlays = [ + inputs.self.overlays.additions + inputs.self.overlays.modifications + inputs.self.overlays.unstable-packages + ]; + }; + + nix = + let + flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; + in + { + settings = { + experimental-features = "nix-command flakes"; + flake-registry = ""; # Opinionated: disable global registry + nix-path = config.nix.nixPath; # Workaround for https://github.com/NixOS/nix/issues/9574 + }; + # Opinionated: make flake registry and nix path match flake inputs + registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs; + nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; + channel.enable = false; # Opinionated: disable channels + }; + + networking.hostName = "nixos"; + time.timeZone = "Europe/Brussels"; + + # System services + within.boot.systemd = true; + within.boot.plymouth = true; + within.graphics.nvidia.base = true; + within.audio.pipewire = true; + within.networks.dns.enable = true; + within.networks.manager.enable = true; + + # System configurations + within.keyboard.apple.enable = true; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "25.11"; +} diff --git a/nixos/configurations/home-manager.nix b/nixos/configurations/home-manager.nix new file mode 100644 index 0000000..efb451a --- /dev/null +++ b/nixos/configurations/home-manager.nix @@ -0,0 +1,12 @@ +{ inputs, ... }: + +{ + imports = [ inputs.home-manager.nixosModules.home-manager ]; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + alistreaza = import ../home-manager/home.nix; + }; + }; +} diff --git a/nixos/configurations/kernel.nix b/nixos/configurations/kernel.nix new file mode 100644 index 0000000..a8e72b0 --- /dev/null +++ b/nixos/configurations/kernel.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +{ + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelModules = [ + "coretemp" + "nct6775" + ]; +} diff --git a/nixos/configurations/users.nix b/nixos/configurations/users.nix new file mode 100644 index 0000000..ce3c5bf --- /dev/null +++ b/nixos/configurations/users.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + users.users = { + alistreaza = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; + }; +} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100755 index 0000000..9849116 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,12 @@ +{inputs, ...}: { + + additions = final: _prev: import ../pkgs final.pkgs; + modifications = final: prev: {}; + + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + }; + }; + +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100755 index 0000000..3d9e23c --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,5 @@ +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' +pkgs: { + # example = pkgs.callPackage ./example { }; +}