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

View file

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

View file

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

View file

@ -3,15 +3,9 @@ let
inherit (config.catppuccin) sources;
cfg = config.programs.tofi.catppuccin;
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
{
options.programs.tofi = lib.ctp.mkVersionedOpts minVersion {
catppuccin = lib.ctp.mkCatppuccinOpt "tofi";
};
options.programs.tofi.catppuccin = lib.ctp.mkCatppuccinOpt "tofi";
config.programs.tofi = lib.mkIf enable {
settings = lib.ctp.fromINI (sources.tofi + "/catppuccin-${cfg.flavor}");

View file

@ -145,4 +145,11 @@ in
option
else
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, ... }:
{
config = {
assertions = [ (lib.ctp.assertMinimumVersion "24.05") ];
};
options.catppuccin = {
enable = lib.mkEnableOption "Catppuccin globally";

View file

@ -10,45 +10,35 @@ let
ctp
types
mkOption
versionAtLeast
;
cfg = config.services.displayManager.sddm.catppuccin;
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";
enable = cfg.enable && config.services.displayManager.sddm.enable;
in
{
options.services.displayManager = ctp.mkVersionedOpts minVersion {
sddm.catppuccin = ctp.mkCatppuccinOpt "sddm" // {
font = mkOption {
type = types.str;
default = "Noto Sans";
description = "Font to use for the login screen";
};
options.services.displayManager.sddm.catppuccin = ctp.mkCatppuccinOpt "sddm" // {
font = mkOption {
type = types.str;
default = "Noto Sans";
description = "Font to use for the login screen";
};
fontSize = mkOption {
type = types.str;
default = "9";
description = "Font size to use for the login screen";
};
fontSize = mkOption {
type = types.str;
default = "9";
description = "Font size to use for the login screen";
};
background = mkOption {
type = with types; (either path str);
default = "";
description = "Background image to use for the login screen";
};
background = mkOption {
type = with types; (either path str);
default = "";
description = "Background image to use for the login screen";
};
loginBackground = mkOption {
type = types.bool;
default = true;
description = "Add an additional background layer to the login panel";
};
loginBackground = mkOption {
type = types.bool;
default = true;
description = "Add an additional background layer to the login panel";
};
};