From 7254f34932f4fe3ba6d69b431986d8df0339a789 Mon Sep 17 00:00:00 2001 From: Bruno Adele Date: Sat, 23 Nov 2024 22:36:08 +0100 Subject: [PATCH] Update b4d14 desktop (#4) * feat: update b4d14 laptop * feat: use system wide home-manager * feat: update user configuration * feat: fix stylix wallpaper * feat: update flake --- flake.lock | 98 ++++++++----------- flake.nix | 36 +++++-- hosts/b4d14/default.nix | 37 +++---- justfile | 8 +- .../features/desktop/apps/fonts.nix | 2 +- nix/home-manager/features/term/base.nix | 14 +-- nix/home-manager/features/term/tools/zsh.nix | 2 +- nix/nixos/features/commons/nix.nix | 11 +-- users/badele/b4d14.nix | 74 ++++++++++---- 9 files changed, 157 insertions(+), 125 deletions(-) diff --git a/flake.lock b/flake.lock index 05fae95..5661ed9 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "fromYaml": "fromYaml" }, "locked": { - "lastModified": 1708890466, - "narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=", + "lastModified": 1732200724, + "narHash": "sha256-+R1BH5wHhfnycySb7Sy5KbYEaTJZWm1h+LW1OtyhiTs=", "owner": "SenchoPens", "repo": "base16.nix", - "rev": "665b3c6748534eb766c777298721cece9453fdae", + "rev": "153d52373b0fb2d343592871009a286ec8837aec", "type": "github" }, "original": { @@ -73,11 +73,11 @@ ] }, "locked": { - "lastModified": 1728922573, - "narHash": "sha256-FegyBabjV4868aJUbvFtqH0zKDEtUpeCAfnB1vWXeBg=", + "lastModified": 1732284644, + "narHash": "sha256-REGLarOB5McRMmFtOgNihEXXQILY6+2UBAY8lw8CJCI=", "owner": "nix-community", "repo": "disko", - "rev": "3b778f10eb275573da9f5c8a7a49e774200b87e5", + "rev": "abc8baff333ac9dca930fc4921a26a8fc248e442", "type": "github" }, "original": { @@ -126,11 +126,11 @@ "fromYaml": { "flake": false, "locked": { - "lastModified": 1689549921, - "narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=", + "lastModified": 1731966426, + "narHash": "sha256-lq95WydhbUTWig/JpqiB7oViTcHFP8Lv41IGtayokA8=", "owner": "SenchoPens", "repo": "fromYaml", - "rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84", + "rev": "106af9e2f715e2d828df706c386a685698f3223b", "type": "github" }, "original": { @@ -158,11 +158,11 @@ }, "hardware": { "locked": { - "lastModified": 1728729581, - "narHash": "sha256-oazkQ/z7r43YkDLLQdMg8oIB3CwWNb+2ZrYOxtLEWTQ=", + "lastModified": 1731797098, + "narHash": "sha256-UhWmEZhwJZmVZ1jfHZFzCg+ZLO9Tb/v3Y6LC0UNyeTo=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "a8dd1b21995964b115b1e3ec639dd6ce24ab9806", + "rev": "672ac2ac86f7dff2f6f3406405bddecf960e0db6", "type": "github" }, "original": { @@ -179,11 +179,11 @@ ] }, "locked": { - "lastModified": 1728903686, - "narHash": "sha256-ZHFrGNWDDriZ4m8CA/5kDa250SG1LiiLPApv1p/JF0o=", + "lastModified": 1732383377, + "narHash": "sha256-FnTC1Eycct/oD1I0ZUuy9FmQFfBeuymbVD2ptlQWaGc=", "owner": "nix-community", "repo": "home-manager", - "rev": "e1aec543f5caf643ca0d94b6a633101942fd065f", + "rev": "16fe78182e924c9a2b0cffa1f343efea80945ef2", "type": "github" }, "original": { @@ -201,11 +201,11 @@ ] }, "locked": { - "lastModified": 1724435763, - "narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=", + "lastModified": 1730837930, + "narHash": "sha256-0kZL4m+bKBJUBQse0HanewWO0g8hDdCvBhudzxgehqc=", "owner": "nix-community", "repo": "home-manager", - "rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be", + "rev": "2f607e07f3ac7e53541120536708e824acccfaa8", "type": "github" }, "original": { @@ -216,11 +216,11 @@ }, "impermanence": { "locked": { - "lastModified": 1727649413, - "narHash": "sha256-FA53of86DjFdeQzRDVtvgWF9o52rWK70VHGx0Y8fElQ=", + "lastModified": 1731242966, + "narHash": "sha256-B3C3JLbGw0FtLSWCjBxU961gLNv+BOOBC6WvstKLYMw=", "owner": "nix-community", "repo": "impermanence", - "rev": "d0b38e550039a72aff896ee65b0918e975e6d48e", + "rev": "3ed3f0eaae9fcc0a8331e77e9319c8a4abd8a71a", "type": "github" }, "original": { @@ -231,11 +231,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1728492678, - "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", + "lastModified": 1732014248, + "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", + "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", "type": "github" }, "original": { @@ -245,29 +245,13 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1728156290, - "narHash": "sha256-uogSvuAp+1BYtdu6UWuObjHqSbBohpyARXDWqgI12Ss=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "17ae88b569bb15590549ff478bab6494dde4a907", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "release-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_2": { "locked": { - "lastModified": 1725194671, - "narHash": "sha256-tLGCFEFTB5TaOKkpfw3iYT9dnk4awTP/q4w+ROpMfuw=", + "lastModified": 1731531548, + "narHash": "sha256-sz8/v17enkYmfpgeeuyzniGJU0QQBfmAjlemAUYhfy8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b833ff01a0d694b910daca6e2ff4a3f26dee478c", + "rev": "24f0d4acd634792badd6470134c387a3b039dace", "type": "github" }, "original": { @@ -279,11 +263,11 @@ }, "nur": { "locked": { - "lastModified": 1728989467, - "narHash": "sha256-HHdnfi+mps/5ir620XViqAtC3p59v422migqNHzW2E4=", + "lastModified": 1732387718, + "narHash": "sha256-qgOyvB5g41QCefVlK/6WjymS3D08+c+VekPsXL+VWi0=", "owner": "nix-community", "repo": "NUR", - "rev": "64526fb085fd7b042f800bfd06b66982fabe70d4", + "rev": "32a091f99d7422427f383de2b3b699dfef718d41", "type": "github" }, "original": { @@ -308,15 +292,14 @@ "inputs": { "nixpkgs": [ "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" + ] }, "locked": { - "lastModified": 1728345710, - "narHash": "sha256-lpunY1+bf90ts+sA2/FgxVNIegPDKCpEoWwOPu4ITTQ=", + "lastModified": 1732186149, + "narHash": "sha256-N9JGWe/T8BC0Tss2Cv30plvZUYoiRmykP7ZdY2on2b0=", "owner": "mic92", "repo": "sops-nix", - "rev": "06535d0e3d0201e6a8080dd32dbfde339b94f01b", + "rev": "53c853fb1a7e4f25f68805ee25c83d5de18dc699", "type": "github" }, "original": { @@ -342,11 +325,11 @@ "tinted-tmux": "tinted-tmux" }, "locked": { - "lastModified": 1728900372, - "narHash": "sha256-hmG/u7qZEm7CTh1XPDi+pg4Oi0nNrv7sL8PgZDRe6wg=", + "lastModified": 1732261424, + "narHash": "sha256-8uTKUHkaU980J5kRnLYrdwmjZYB88eBGUk1oVgIUHFE=", "owner": "danth", "repo": "stylix", - "rev": "33a2eff15181e557bb6dd9d2073b90f7d218975d", + "rev": "b667a340730dd3d0596083aa7c949eef01367c62", "type": "github" }, "original": { @@ -373,16 +356,17 @@ "tinted-foot": { "flake": false, "locked": { - "lastModified": 1696725948, - "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", + "lastModified": 1726913040, + "narHash": "sha256-+eDZPkw7efMNUf3/Pv0EmsidqdwNJ1TaOum6k7lngDQ=", "owner": "tinted-theming", "repo": "tinted-foot", - "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", + "rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4", "type": "github" }, "original": { "owner": "tinted-theming", "repo": "tinted-foot", + "rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 747559d..dd64054 100644 --- a/flake.nix +++ b/flake.nix @@ -27,9 +27,7 @@ # hardware.url = "github:badele/fork-nixos-hardware/xps-15-9530"; hardware.url = "github:NixOS/nixos-hardware/master"; - impermanence = { - url = "github:nix-community/impermanence"; - }; + impermanence = { url = "github:nix-community/impermanence"; }; nur = { url = "github:nix-community/NUR"; @@ -70,12 +68,8 @@ # Your custom packages # Acessible through 'nix build', 'nix shell', etc packages = forAllSystems (system: - let - pkgs = import nixpkgs { - inherit system; - }; - in - import ./nix/pkgs { inherit pkgs; }); + let pkgs = import nixpkgs { inherit system; }; + in import ./nix/pkgs { inherit pkgs; }); # Devshell for bootstrapping # Acessible through 'nix develop' or 'nix-shell' (legacy) devShells = forAllSystems (system: @@ -135,7 +129,29 @@ b4d14 = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs outputs; }; - modules = [ inputs.sops-nix.nixosModules.sops ./hosts/b4d14 ]; + modules = [ + inputs.sops-nix.nixosModules.sops + ./hosts/b4d14 + + home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + verbose = true; + users = { + root = import ./users/root/b4d14.nix; + badele = { + imports = [ + nur.nixosModules.nur + stylix.homeManagerModules.stylix + ./users/badele/b4d14.nix + ]; + }; + }; + }; + } + ]; }; badxps = nixpkgs.lib.nixosSystem { diff --git a/hosts/b4d14/default.nix b/hosts/b4d14/default.nix index b71d2ab..796f057 100644 --- a/hosts/b4d14/default.nix +++ b/hosts/b4d14/default.nix @@ -1,18 +1,12 @@ -########################################################## +# ######################################################### # NIXOS (hosts) ########################################################## -{ inputs -, config -, pkgs -, lib -, ... -}: -{ +{ inputs, config, pkgs, lib, ... }: { imports = [ ./hardware-configuration.nix - # https://github.com/NixOS/nixos-hardware/tree/master/dell/xps/15-9530 - inputs.hardware.nixosModules.dell-xps-15-9530-intel + # https://github.com/NixOS/nixos-hardware/tree/master/dell/xps/15-9520 + inputs.hardware.nixosModules.dell-xps-15-9520 ../../nix/modules/nixos/host.nix # Users @@ -59,7 +53,15 @@ }; initrd = { - availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "sr_mod" "rtsx_pci_sdmmc" ]; + availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usb_storage" + "sd_mod" + "sr_mod" + "rtsx_pci_sdmmc" + ]; kernelModules = [ "zfs" ]; }; }; @@ -78,8 +80,7 @@ #################################### # Hardware #################################### - videoDrivers = [ "intel" "i965" "nvidia" ]; - + # videoDrivers = [ "intel" "i965" "nvidia" ]; # Nvidia # hardware.opengl.enable = true; @@ -89,9 +90,11 @@ # hardware.bumblebee.pmMethod = See dell-xps-15-9530 # Pulseaudio + services.pipewire.enable = false; hardware.pulseaudio = { enable = true; - support32Bit = true; ## If compatibility with 32-bit applications is desired + support32Bit = + true; # # If compatibility with 32-bit applications is desired #extraConfig = "load-module module-combine-sink"; }; @@ -102,9 +105,7 @@ # Programs #################################### powerManagement.powertop.enable = true; - programs = { - dconf.enable = true; - }; + programs = { dconf.enable = true; }; #################################### # Secrets @@ -123,5 +124,5 @@ }; nixpkgs.hostPlatform.system = "x86_64-linux"; - system.stateVersion = "22.11"; + system.stateVersion = "24.05"; } diff --git a/justfile b/justfile index 5678b4c..e7f90ca 100644 --- a/justfile +++ b/justfile @@ -58,9 +58,11 @@ precommit-install: @flake-update: nix flake update -# @flake-sync-registry: -# nix flake metadata --json | jq -r '.locks.nodes."nixpkgs".locked.rev' -# nix flake metadata --json | jq -r '.locks.nodes."home-manager".locked.rev' +# Sync the nix registry with the current running nix version +@flake-sync-registry: + nix registry pin nixpkgs github:NixOS/nixpkgs/$(nix flake metadata --json | jq -r '.locks.nodes."nixpkgs".locked.rev') + # nix flake metadata --json | jq -r '.locks.nodes."nixpkgs".locked.rev' + # nix flake metadata --json | jq -r '.locks.nodes."home-manager".locked.rev' # Check the nix homelab configuration @flake-check: diff --git a/nix/home-manager/features/desktop/apps/fonts.nix b/nix/home-manager/features/desktop/apps/fonts.nix index 74417c4..eb9dd26 100644 --- a/nix/home-manager/features/desktop/apps/fonts.nix +++ b/nix/home-manager/features/desktop/apps/fonts.nix @@ -2,7 +2,7 @@ home.packages = with pkgs; [ noto-fonts - noto-fonts-cjk + noto-fonts-cjk-sans noto-fonts-emoji liberation_ttf fira-code diff --git a/nix/home-manager/features/term/base.nix b/nix/home-manager/features/term/base.nix index 5ef47bb..48cc890 100644 --- a/nix/home-manager/features/term/base.nix +++ b/nix/home-manager/features/term/base.nix @@ -1,11 +1,4 @@ -{ config -, inputs -, lib -, outputs -, pkgs -, ... -}: -{ +{ config, inputs, lib, outputs, pkgs, ... }: { imports = [ # Hardware informations @@ -34,12 +27,11 @@ nix = { package = lib.mkForce pkgs.nix; settings = { - experimental-features = [ "nix-command" "flakes" "repl-flake" ]; + experimental-features = [ "nix-command" "flakes" ]; warn-dirty = false; }; }; - # # NOTE: By default all programs enabled for the all shells programs = { yazi.enable = true; # Filemanager @@ -57,7 +49,7 @@ # FZF fzf = { enable = true; - enableZshIntegration = false; ## OMZ + enableZshIntegration = false; # # OMZ defaultCommand = "fd --type file --follow --hidden --exclude .git"; historyWidgetOptions = [ "--sort" "--exact" ]; }; diff --git a/nix/home-manager/features/term/tools/zsh.nix b/nix/home-manager/features/term/tools/zsh.nix index b6dc216..acbd962 100644 --- a/nix/home-manager/features/term/tools/zsh.nix +++ b/nix/home-manager/features/term/tools/zsh.nix @@ -270,7 +270,7 @@ in # NixOS experimental support NIX_CONFIG = - "extra-experimental-features = nix-command flakes repl-flake"; + "extra-experimental-features = nix-command flakes"; PATH = lib.concatStringsSep ":" [ "${config.home.homeDirectory}/.deno/bin" diff --git a/nix/nixos/features/commons/nix.nix b/nix/nixos/features/commons/nix.nix index 4403a9a..dd14a95 100644 --- a/nix/nixos/features/commons/nix.nix +++ b/nix/nixos/features/commons/nix.nix @@ -1,8 +1,6 @@ { pkgs, inputs, lib, config, ... }: -let - domain = config.networking.domain; -in -{ +let domain = config.networking.domain; +in { # Proprietary software nixpkgs.config.unfree = true; nixpkgs.config.allowUnfree = true; @@ -16,7 +14,8 @@ in registry = lib.mapAttrs (_: value: { flake = value; }) inputs; # Add all flake inputs to legacy / CMD: echo $NIX_PATH | tr ":" "\n" - nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") + config.nix.registry; settings = { substituters = [ @@ -31,7 +30,7 @@ in ]; trusted-users = [ "root" "@wheel" ]; auto-optimise-store = lib.mkDefault true; - experimental-features = [ "nix-command" "flakes" "repl-flake" ]; + experimental-features = [ "nix-command" "flakes" ]; warn-dirty = false; }; diff --git a/users/badele/b4d14.nix b/users/badele/b4d14.nix index a3a559a..3892e72 100644 --- a/users/badele/b4d14.nix +++ b/users/badele/b4d14.nix @@ -3,24 +3,31 @@ ########################################################## { config , inputs -, outputs , pkgs , lib , ... }: let feh = "${pkgs.feh}/bin/feh"; + theme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml"; + wallpaper = pkgs.runCommand "image.png" { } '' + COLOR=$(${pkgs.yq}/bin/yq -r .base00 ${theme}) + COLOR="#"$COLOR + ${pkgs.imagemagick}/bin/magick convert -size 1920x1080 xc:$COLOR $out + ''; in { imports = [ - # User - ./commons.nix + # homelab Modules + ../../nix/modules/home-manager/font.nix + ../../nix/modules/home-manager/userconf.nix - # Commons packages - ../../nix/home-manager/commons/packages.nix + # Common tools and packages for all badele user hosts + ./commons.nix # Editor - ../../nix/home-manager/features/term/editor/lazyvim.nix + # INFO: I use my independant neovim configuration => https://github.com/badele/vides + # ../../nix/home-manager/features/term/editor/lazyvim.nix # Term ../../nix/home-manager/features/term/base.nix @@ -32,24 +39,23 @@ in ../../nix/home-manager/features/language/python.nix # Desktop - ../../nix/home-manager/features/desktop/commons/base.nix + ../../nix/home-manager/features/desktop/apps/base.nix ../../nix/home-manager/features/desktop/xorg/base.nix ../../nix/home-manager/features/desktop/xorg/wm/i3.nix # Web browser - ../../nix/home-manager/features/desktop/commons/google-chrome.nix + ../../nix/home-manager/features/desktop/apps/google-chrome.nix ../../users/badele/firefox.nix # Multimedia - ../../nix/home-manager/features/desktop/commons/spotify.nix - - # Development term - ../../nix/home-manager/features/term/development/base.nix + ../../nix/home-manager/features/desktop/apps/spotify.nix # Development desktop - ../../nix/home-manager/features/desktop/commons/development/packages.nix - ../../nix/home-manager/features/desktop/commons/development/vscode.nix - ] ++ (builtins.attrValues outputs.homeManagerModules); + ../../nix/home-manager/features/desktop/apps/development/vscode.nix + + # Virtualisation + ../../nix/home-manager/features/desktop/xorg/virtualisation.nix + ]; ############################################################################### @@ -95,13 +101,45 @@ in }; hooks.postswitch = '' ${pkgs.i3}/bin/i3-msg restart - ${feh} --bg-scale '${config.wallpaper}' + ${feh} --bg-scale '${config.stylix.image}' ''; }; }; }; }; - # inv home.deploy ; neofetch ; ll - wallpaper = pkgs.wallpapers.forest-deer-landscape; + # You can preview the palette at ~/.config/stylix/palette.html + stylix.enable = true; + stylix.autoEnable = true; + + stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-medium.yaml"; + stylix.image = pkgs.fetchurl { + url = "https://w.wallhaven.cc/full/0w/wallhaven-0w3pdr.jpg"; + sha256 = "sha256-xrLfcRkr6TjTW464GYf9XNFHRe5HlLtjpB0LQAh/l6M="; + }; + + # Disable neovim, it managed by https://github.com/badele/vide + stylix.targets.neovim.enable = false; + + stylix.fonts = { + serif = { + package = pkgs.dejavu_fonts; + name = "DejaVu Serif"; + }; + + sansSerif = { + package = pkgs.dejavu_fonts; + name = "DejaVu Sans"; + }; + + monospace = { + package = pkgs.dejavu_fonts; + name = "DejaVu Sans Mono"; + }; + + emoji = { + package = pkgs.noto-fonts-emoji; + name = "Noto Color Emoji"; + }; + }; }