Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate nixos to 24.05 #77

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
],
"cSpell.words": [
"ahci",
"alacritty",
"bootloader",
"bootmgfw",
"catppuccin",
Expand All @@ -37,6 +38,7 @@
"Filesystems",
"flatpak",
"Hyprland",
"hyprpaper",
"insmod",
"jetbrains",
"menuentry",
Expand All @@ -51,13 +53,15 @@
"pkgs",
"polkit",
"Redistributable",
"stylix",
"substituters",
"swraid",
"thalheim",
"togglable",
"usbhid",
"vfat",
"xhci",
"xorg",
"zoxide"
],
"conventionalCommits.scopes": [
Expand Down
6 changes: 3 additions & 3 deletions configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
};

console.keyMap = "pl";
services.xserver.layout = "pl";
services.xserver.xkb.layout = "pl";

# Fonts
fonts.packages = with pkgs; [
Expand Down Expand Up @@ -121,7 +121,7 @@
useGlobalPkgs = true;
users.${username}.home = {
inherit username;
stateVersion = "23.11";
stateVersion = "24.05";
homeDirectory = "/home/${username}";
packages = scripts.mkShellExports config;
};
Expand All @@ -147,5 +147,5 @@
};

# System
system.stateVersion = "23.11";
system.stateVersion = "24.05";
}
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 = {
Expand Down Expand Up @@ -52,7 +52,7 @@
};
nil = {
url = "github:oxalica/nil";
inputs.nixpkgs.follows = "nixpkgs-unstable";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
Expand Down
3 changes: 0 additions & 3 deletions lib/hosts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
65 changes: 0 additions & 65 deletions lib/mapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions modules/desktop/apps/alacritty.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
pkgs,
config,
lib,
username,
...
}: {
}:
with lib; {
home-manager.users.${username} = {
# stylix.targets.alacritty.enable = true;

programs.alacritty = {
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;
Expand Down
2 changes: 1 addition & 1 deletion modules/desktop/apps/qt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ in {

qt = {
enable = true;
platformTheme = "qtct";
platformTheme.name = "qtct";
style.name = "kvantum";
};

Expand Down
7 changes: 3 additions & 4 deletions modules/desktop/sddm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion modules/desktop/wm/hyprland.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ in

# Input settings
input = {
kb_layout = config.services.xserver.layout;
kb_layout = config.services.xserver.xkb.layout;
follow_mouse = 2;
};

Expand Down
2 changes: 0 additions & 2 deletions modules/hardware/bootloader.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
47 changes: 11 additions & 36 deletions modules/services/wallpaper.nix
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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 = ["$"];
};
};
};
}
1 change: 0 additions & 1 deletion modules/shell/eza.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ in {
home-manager.users.${username} = {
programs.eza = {
enable = true;
enableAliases = true;
git = config.modules.dev.git.enable;
icons = true;
};
Expand Down