From 126efb4bc4eb3d8d5016e79e4117d0e9699bc814 Mon Sep 17 00:00:00 2001 From: Krzysztof Saczuk Date: Fri, 31 May 2024 12:22:25 +0200 Subject: [PATCH] feat: migrate nixos to `24.05` --- .vscode/settings.json | 4 ++ configuration.nix | 6 +-- flake.lock | 18 ++++----- flake.nix | 6 +-- lib/hosts.nix | 3 -- lib/mapper.nix | 65 ------------------------------ modules/desktop/apps/alacritty.nix | 12 +++--- modules/desktop/apps/qt.nix | 2 +- modules/desktop/sddm.nix | 7 ++-- modules/desktop/wm/hyprland.nix | 2 +- modules/hardware/bootloader.nix | 2 - modules/services/wallpaper.nix | 47 +++++---------------- modules/shell/eza.nix | 1 - 13 files changed, 41 insertions(+), 134 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6d8a3a4..7f71f8e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -28,6 +28,7 @@ ], "cSpell.words": [ "ahci", + "alacritty", "bootloader", "bootmgfw", "catppuccin", @@ -37,6 +38,7 @@ "Filesystems", "flatpak", "Hyprland", + "hyprpaper", "insmod", "jetbrains", "menuentry", @@ -51,6 +53,7 @@ "pkgs", "polkit", "Redistributable", + "stylix", "substituters", "swraid", "thalheim", @@ -58,6 +61,7 @@ "usbhid", "vfat", "xhci", + "xorg", "zoxide" ], "conventionalCommits.scopes": [ diff --git a/configuration.nix b/configuration.nix index 39aec4e..eb45106 100644 --- a/configuration.nix +++ b/configuration.nix @@ -54,7 +54,7 @@ }; console.keyMap = "pl"; - services.xserver.layout = "pl"; + services.xserver.xkb.layout = "pl"; # Fonts fonts.packages = with pkgs; [ @@ -121,7 +121,7 @@ useGlobalPkgs = true; users.${username}.home = { inherit username; - stateVersion = "23.11"; + stateVersion = "24.05"; homeDirectory = "/home/${username}"; packages = scripts.mkShellExports config; }; @@ -147,5 +147,5 @@ }; # System - system.stateVersion = "23.11"; + system.stateVersion = "24.05"; } diff --git a/flake.lock b/flake.lock index b6172e2..e9fcefe 100644 --- a/flake.lock +++ b/flake.lock @@ -340,16 +340,16 @@ ] }, "locked": { - "lastModified": 1716729592, - "narHash": "sha256-Y3bOjoh2cFBqZN0Jw1zUdyr7tjygyxl2bD/QY73GZP0=", + "lastModified": 1716736833, + "narHash": "sha256-rNObca6dm7Qs524O4st8VJH6pZ/Xe1gxl+Rx6mcWYo0=", "owner": "nix-community", "repo": "home-manager", - "rev": "2c78a57c544dd19b07442350727ced097e1aa6e6", + "rev": "a631666f5ec18271e86a5cde998cba68c33d9ac6", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.11", + "ref": "release-24.05", "repo": "home-manager", "type": "github" } @@ -360,7 +360,7 @@ "flake-utils" ], "nixpkgs": [ - "nixpkgs-unstable" + "nixpkgs" ], "rust-overlay": "rust-overlay" }, @@ -399,16 +399,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1716361217, - "narHash": "sha256-mzZDr00WUiUXVm1ujBVv6A0qRd8okaITyUp4ezYRgc4=", + "lastModified": 1717090882, + "narHash": "sha256-Up5tvtY9YlVEyVn9hfZcxFQi5qVhQ5hdVNGPQOUchNw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "46397778ef1f73414b03ed553a3368f0e7e33c2f", + "rev": "d24e7fdcfaecdca496ddd426cae98c9e2d12dfe8", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-23.11", + "ref": "nixos-24.05", "type": "indirect" } }, diff --git a/flake.nix b/flake.nix index 09c3465..938ccf9 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "A Super-Duper Invincible Shining Sparkly Magic NixOS Config"; # Credits: Genshin Impact inputs = { - nixpkgs.url = "nixpkgs/nixos-23.11"; + nixpkgs.url = "nixpkgs/nixos-24.05"; nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; nix-colors.url = "github:misterio77/nix-colors"; @@ -12,7 +12,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; home-manager = { - url = "github:nix-community/home-manager/release-23.11"; + url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; }; distro-grub-themes = { @@ -52,7 +52,7 @@ }; nil = { url = "github:oxalica/nil"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; + inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; }; diff --git a/lib/hosts.nix b/lib/hosts.nix index fed3ad2..faa025e 100644 --- a/lib/hosts.nix +++ b/lib/hosts.nix @@ -23,9 +23,6 @@ with lib.my; { ./../configuration.nix ./../hosts/${name}/configuration.nix - # TODO: Remove this when nixos 24.05 releases - "${unstable.path}/nixos/modules/programs/nh.nix" - inputs.home-manager.nixosModules.default inputs.sops-nix.nixosModules.default inputs.stylix.nixosModules.default diff --git a/lib/mapper.nix b/lib/mapper.nix index 0e2b5a4..46e3707 100644 --- a/lib/mapper.nix +++ b/lib/mapper.nix @@ -39,71 +39,6 @@ with lib; rec { toTOML = name: attrs: (pkgs.formats.toml {}).generate name attrs; - # TODO: Replace with `lib.hm.generators.toHyprconf` when nix-community/home-manager#5324 lands in a stable release - toHyprconf = { - attrs, - indentLevel ? 0, - importantPrefixes ? ["$"], - }: let - inherit - (lib) - all - concatMapStringsSep - concatStrings - concatStringsSep - filterAttrs - foldl - generators - hasPrefix - isAttrs - isList - mapAttrsToList - replicate - ; - - initialIndent = concatStrings (replicate indentLevel " "); - - toHyprconf' = indent: attrs: let - sections = - filterAttrs (n: v: isAttrs v || (isList v && all isAttrs v)) attrs; - - mkSection = n: attrs: - if lib.isList attrs - then (concatMapStringsSep "\n" (a: mkSection n a) attrs) - else '' - ${indent}${n} { - ${toHyprconf' " ${indent}" attrs}${indent}} - ''; - - mkFields = generators.toKeyValue { - listsAsDuplicateKeys = true; - inherit indent; - }; - - allFields = - filterAttrs (n: v: !(isAttrs v || (isList v && all isAttrs v))) - attrs; - - isImportantField = n: _: - foldl (acc: prev: - if hasPrefix prev n - then true - else acc) - false - importantPrefixes; - - importantFields = filterAttrs isImportantField allFields; - - fields = - builtins.removeAttrs allFields - (mapAttrsToList (n: _: n) importantFields); - in - mkFields importantFields - + concatStringsSep "\n" (mapAttrsToList mkSection sections) - + mkFields fields; - in - toHyprconf' initialIndent attrs; - toCfg = name: attrs: let # This script fix problem for nitrogen, becauses for some resons # nitrogen read path with " chars and throws exception for that diff --git a/modules/desktop/apps/alacritty.nix b/modules/desktop/apps/alacritty.nix index ada4c77..66e9fa9 100644 --- a/modules/desktop/apps/alacritty.nix +++ b/modules/desktop/apps/alacritty.nix @@ -1,8 +1,10 @@ { - pkgs, + config, + lib, username, ... -}: { +}: +with lib; { home-manager.users.${username} = { # stylix.targets.alacritty.enable = true; @@ -10,10 +12,8 @@ enable = true; catppuccin.enable = true; settings = { - general = { - shell = "${pkgs.fish}/bin/fish"; - "live_config_reload" = false; - }; + shell = getExe config.users.users.${username}.shell; + "live_config_reload" = false; window = { padding = { x = 10; diff --git a/modules/desktop/apps/qt.nix b/modules/desktop/apps/qt.nix index 1268e50..0977b72 100644 --- a/modules/desktop/apps/qt.nix +++ b/modules/desktop/apps/qt.nix @@ -32,7 +32,7 @@ in { qt = { enable = true; - platformTheme = "qtct"; + platformTheme.name = "qtct"; style.name = "kvantum"; }; diff --git a/modules/desktop/sddm.nix b/modules/desktop/sddm.nix index 9a0aa0a..30e7ed7 100644 --- a/modules/desktop/sddm.nix +++ b/modules/desktop/sddm.nix @@ -12,10 +12,9 @@ in { }; config = mkIf (cfg.enable) { - services.xserver = { - enable = true; - # TODO: Update this configuration when nixos 24.05 releases - displayManager.sddm = { + services.xserver.enable = true; + services.displayManager = { + sddm = { enable = true; autoNumlock = true; }; diff --git a/modules/desktop/wm/hyprland.nix b/modules/desktop/wm/hyprland.nix index 643e405..217afe7 100644 --- a/modules/desktop/wm/hyprland.nix +++ b/modules/desktop/wm/hyprland.nix @@ -59,7 +59,7 @@ in # Input settings input = { - kb_layout = config.services.xserver.layout; + kb_layout = config.services.xserver.xkb.layout; follow_mouse = 2; }; diff --git a/modules/hardware/bootloader.nix b/modules/hardware/bootloader.nix index de35433..56ae6f4 100644 --- a/modules/hardware/bootloader.nix +++ b/modules/hardware/bootloader.nix @@ -38,8 +38,6 @@ in { }; config = mkIf (cfg.enable) { - # TODO: Replace OS Prober with manual boot entries generated from options - boot.loader.grub = { inherit (cfg) extraEntries; diff --git a/modules/services/wallpaper.nix b/modules/services/wallpaper.nix index 1131074..b808042 100644 --- a/modules/services/wallpaper.nix +++ b/modules/services/wallpaper.nix @@ -1,14 +1,12 @@ { config, lib, - pkgs, username, ... }: with lib; with lib.my; let cfg = config.modules.services.wallpaper; - home = config.home-manager.users.${username}; in { options.modules.services.wallpaper = { enable = mkEnableOption "wallpaper config"; @@ -37,40 +35,17 @@ in { }; }; - config = mkIf (cfg.enable) { - home-manager.users.${username} = mkMerge [ - # Enable this config only if Hyprland is enabled - # TODO: Update this configuration when nix-community/home-manager#5344 is merged and lands in a stable release - (optionalAttrs config.programs.hyprland.enable { - xdg.configFile."hypr/hyprpaper.conf" = { - text = mapper.toHyprconf { - attrs = { - ipc = "off"; - preload = builtins.map (x: ''${x.wallpaper}'') cfg.settings; - wallpaper = builtins.map (x: ''${x.monitor.wayland},${x.wallpaper}'') cfg.settings; - }; - importantPrefixes = ["$"]; - }; - }; - - systemd.user.services."hyprpaper" = { - Unit = { - ConditionEnvironment = "WAYLAND_DISPLAY"; - Description = "hyprpaper"; - After = ["graphical-session-pre.target"]; - PartOf = ["graphical-session.target"]; - X-Restart-Triggers = ["${home.xdg.configFile."hypr/hyprpaper.conf".source}"]; - }; - Service = { - ExecStart = "${getExe pkgs.hyprpaper}"; - Restart = "always"; - RestartSec = "10"; - }; - Install = { - WantedBy = ["graphical-session.target"]; - }; + config = mkIf (cfg.enable && config.programs.hyprland.enable) { + home-manager.users.${username} = { + services.hyprpaper = { + enable = true; + settings = { + ipc = "off"; + preload = builtins.map (x: ''${x.wallpaper}'') cfg.settings; + wallpaper = builtins.map (x: ''${x.monitor.wayland},${x.wallpaper}'') cfg.settings; }; - }) - ]; + importantPrefixes = ["$"]; + }; + }; }; } diff --git a/modules/shell/eza.nix b/modules/shell/eza.nix index 6bb46cf..2b275ef 100644 --- a/modules/shell/eza.nix +++ b/modules/shell/eza.nix @@ -16,7 +16,6 @@ in { home-manager.users.${username} = { programs.eza = { enable = true; - enableAliases = true; git = config.modules.dev.git.enable; icons = true; };