add de cosmic to new flake based approach

This commit is contained in:
RingOfStorms (Joshua Bell) 2024-12-27 14:57:44 -06:00
parent b69246de06
commit 985d584213
14 changed files with 426 additions and 68 deletions

View file

@ -11,70 +11,64 @@
outputs =
{
self,
cosmic,
nixpkgs,
...
}:
let
lib = nixpkgs.lib;
cosmicConfigDir = ./config;
cosmicFiles = builtins.attrNames (builtins.readDir cosmicConfigDir);
cosmicConfigFiles = builtins.map (fileName: {
name = "cosmic/${fileName}";
value = {
source = "${cosmicConfigDir}/${fileName}";
};
}) cosmicFiles;
cosmicConfigFilesAttrs = builtins.listToAttrs cosmicConfigFiles;
in
with lib;
{
nixosModules = {
default = {
options = {
# mods.de_cosmic = {
# nvidiaExtraDisplayFix = mkOption {
# type = types.bool;
# default = false;
# description = ''
# Enable extra display fix for nvidia cards.
# '';
# };
# };
};
config = {
default =
{
config,
lib,
pkgs,
...
}:
with lib;
{
options.mods.de_cosmic = {
users = mkOption {
type = types.listOf types.str;
description = "Users to apply cosmic DE settings to.";
default = [
"root"
] ++ (lib.optionals (config.mods.common.primaryUser != null) [ config.mods.common.primaryUser ]);
};
};
imports = [
cosmic.nixosModules.default
];
# Use cosmic binary cache
nix.settings = {
substituters = [ "https://cosmic.cachix.org/" ];
trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ];
};
config = {
environment.systemPackages = with pkgs; [
wl-clipboard
];
# Use cosmic binary cache
nix.settings = {
substituters = [ "https://cosmic.cachix.org/" ];
trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ];
};
# Enable cosmic
services.desktopManager.cosmic.enable = true;
services.displayManager.cosmic-greeter.enable = true;
environment.cosmic.excludePackages = with pkgs; [
cosmic-edit
cosmic-term
cosmic-store
];
environment.systemPackages = with pkgs; [
wl-clipboard
];
# Config
home-manager.backupFileExtension = "bak";
home-manager.users.${settings.user.username} = {
xdg.configFile = cosmicConfigFilesAttrs;
# Enable cosmic
services.desktopManager.cosmic.enable = true;
services.displayManager.cosmic-greeter.enable = true;
environment.cosmic.excludePackages = with pkgs; [
cosmic-edit
cosmic-term
cosmic-store
];
# Config
environment.etc = lib.mkIf (config.mods.de_cosmic.users != null) (
lib.genAttrs config.mods.de_cosmic.users (user: {
source = ./config;
target = "/home/${user}/.config/cosmic";
})
);
};
};
};
};
};
}