feat(modules)!: bump minimum supported release to 24.05 (#203)

* chore(modules)!: bump minimum supported release to 24.05

* feat(modules): assert minimum supported version
This commit is contained in:
seth 2024-06-04 11:29:28 +00:00 committed by GitHub
parent 2c7661c9fa
commit dc9553ef0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 57 additions and 56 deletions

View file

@ -27,48 +27,50 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1715381426, "lastModified": 1716736833,
"narHash": "sha256-wPuqrAQGdv3ISs74nJfGb+Yprm23U/rFpcHFFNWgM94=", "narHash": "sha256-rNObca6dm7Qs524O4st8VJH6pZ/Xe1gxl+Rx6mcWYo0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "ab5542e9dbd13d0100f8baae2bc2d68af901f4b4", "rev": "a631666f5ec18271e86a5cde998cba68c33d9ac6",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-23.11", "ref": "release-24.05",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1715787315, "lastModified": 1716948383,
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=", "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5", "rev": "ad57eef4ef0659193044870c731987a6df5cf56b",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"type": "indirect" "repo": "nixpkgs",
"type": "github"
} }
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1716239187, "lastModified": 1717144377,
"narHash": "sha256-5oyOV5ZlqXYQ8RB6lvVrKxVBeBPE/ZsLY+qQKqSJLZM=", "narHash": "sha256-F/TKWETwB5RaR8owkPPi+SPJh83AQsm6KrQAlJ8v/uA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f88df4bf25b729d78712c441fb0910f7085e9395", "rev": "805a384895c696f802a9bf5bf4720f37385df547",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "NixOS",
"ref": "release-23.11", "ref": "nixos-24.05",
"type": "indirect" "repo": "nixpkgs",
"type": "github"
} }
}, },
"root": { "root": {

View file

@ -2,8 +2,8 @@
description = "Soothing pastel theme for Nix"; description = "Soothing pastel theme for Nix";
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "nixpkgs/release-23.11"; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
@ -11,7 +11,7 @@
}; };
home-manager-stable = { home-manager-stable = {
url = "github:nix-community/home-manager/release-23.11"; url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs-stable"; inputs.nixpkgs.follows = "nixpkgs-stable";
}; };
}; };

View file

@ -1,5 +1,9 @@
{ lib, ... }: { lib, ... }:
{ {
config = {
assertions = [ (lib.ctp.assertMinimumVersion "24.05") ];
};
options.catppuccin = { options.catppuccin = {
enable = lib.mkEnableOption "Catppuccin globally"; enable = lib.mkEnableOption "Catppuccin globally";

View file

@ -3,15 +3,9 @@ let
inherit (config.catppuccin) sources; inherit (config.catppuccin) sources;
cfg = config.programs.tofi.catppuccin; cfg = config.programs.tofi.catppuccin;
enable = cfg.enable && config.programs.tofi.enable; enable = cfg.enable && config.programs.tofi.enable;
# `programs.tofi` was added in 24.05 and not backported
# TODO: remove when 24.05 is stable
minVersion = "24.05";
in in
{ {
options.programs.tofi = lib.ctp.mkVersionedOpts minVersion { options.programs.tofi.catppuccin = lib.ctp.mkCatppuccinOpt "tofi";
catppuccin = lib.ctp.mkCatppuccinOpt "tofi";
};
config.programs.tofi = lib.mkIf enable { config.programs.tofi = lib.mkIf enable {
settings = lib.ctp.fromINI (sources.tofi + "/catppuccin-${cfg.flavor}"); settings = lib.ctp.fromINI (sources.tofi + "/catppuccin-${cfg.flavor}");

View file

@ -145,4 +145,11 @@ in
option option
else else
lib.mkSinkUndeclaredOptions { }; lib.mkSinkUndeclaredOptions { };
# string -> a
# this is to ensure users are running a supported version of nixos/home-manager
assertMinimumVersion = version: {
assertion = lib.versionAtLeast ctp.getModuleRelease version;
message = "`catppuccin/nix` requires at least version ${version} of NixOS/home-manager";
};
} }

View file

@ -1,5 +1,9 @@
{ lib, ... }: { lib, ... }:
{ {
config = {
assertions = [ (lib.ctp.assertMinimumVersion "24.05") ];
};
options.catppuccin = { options.catppuccin = {
enable = lib.mkEnableOption "Catppuccin globally"; enable = lib.mkEnableOption "Catppuccin globally";

View file

@ -10,45 +10,35 @@ let
ctp ctp
types types
mkOption mkOption
versionAtLeast
; ;
cfg = config.services.displayManager.sddm.catppuccin; cfg = config.services.displayManager.sddm.catppuccin;
enable = enable = cfg.enable && config.services.displayManager.sddm.enable;
versionAtLeast ctp.getModuleRelease minVersion
&& cfg.enable
&& config.services.displayManager.sddm.enable;
# versions >= 24.05 renamed `services.xserver.displayManager` to `services.displayManager`
# TODO: remove when 24.05 is stable
minVersion = "24.05";
in in
{ {
options.services.displayManager = ctp.mkVersionedOpts minVersion { options.services.displayManager.sddm.catppuccin = ctp.mkCatppuccinOpt "sddm" // {
sddm.catppuccin = ctp.mkCatppuccinOpt "sddm" // { font = mkOption {
font = mkOption { type = types.str;
type = types.str; default = "Noto Sans";
default = "Noto Sans"; description = "Font to use for the login screen";
description = "Font to use for the login screen"; };
};
fontSize = mkOption { fontSize = mkOption {
type = types.str; type = types.str;
default = "9"; default = "9";
description = "Font size to use for the login screen"; description = "Font size to use for the login screen";
}; };
background = mkOption { background = mkOption {
type = with types; (either path str); type = with types; (either path str);
default = ""; default = "";
description = "Background image to use for the login screen"; description = "Background image to use for the login screen";
}; };
loginBackground = mkOption { loginBackground = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "Add an additional background layer to the login panel"; description = "Add an additional background layer to the login panel";
};
}; };
}; };