refactor(flake-parts): initial flake-parts configuration

This commit is contained in:
ooks-io 2024-05-13 22:50:56 +12:00
parent 8f67be9e68
commit 5603001d65
230 changed files with 380 additions and 717 deletions

View file

@ -1,18 +0,0 @@
{ lib, ... }:
{
imports = [
./monitors
./nix
./userDirs
./home
./mimeApps
];
options.homeModules.config = {
nix.enable = lib.mkEnableOption "enable nix configuration module";
home.enable = lib.mkEnableOption "enable home configuration module";
userDirs.enable = lib.mkEnableOption "enable userDirs configuration module";
mimeApps.enable = lib.mkEnableOption "enable mimeApps configuration module";
};
}

View file

@ -1,29 +0,0 @@
{ lib, config, ... }:
let
cfg = config.homeModules.config.home;
in
{
config = lib.mkIf cfg.enable {
programs.home-manager.enable = true;
home = {
username = lib.mkDefault "ooks";
homeDirectory = lib.mkDefault "/home/${config.home.username}";
stateVersion = lib.mkDefault "22.05";
sessionPath = [ "${config.home.homeDirectory}/.local/bin" ];
sessionVariables = {
TZ = "Pacific/Auckland";
};
};
# to save space
manual = {
html.enable = false;
json.enable = false;
manpages.enable = true;
};
};
}

View file

@ -1,40 +0,0 @@
{ lib, config, pkgs, ... }:
let
cfg = config.homeModules.config.mimeApps;
browser = ["${config.home.sessionVariables.BROWSER}.desktop"];
zathura = ["org.pwmt.zethura.desktop.desktop"];
associations = {
"text/html" = browser;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/ftp" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/unknown" = browser;
"application/x-extension-htm" = browser;
"application/x-extension-html" = browser;
"application/x-extension-shtml" = browser;
"application/xhtml+xml" = browser;
"application/x-extension-xhtml" = browser;
"application/x-extension-xht" = browser;
"audio/*" = ["mpv.desktop"];
"video/*" = ["mpv.dekstop"];
"image/*" = ["imv.desktop"];
"application/json" = browser;
"application/pdf" = zathura;
"x-scheme-handler/discord" = ["vesktop.desktop"];
};
in
{
config = lib.mkIf cfg.enable {
home.packages = [ pkgs.xdg-utils ];
xdg.mimeApps = {
enable = true;
associations.added = associations;
defaultApplications = associations;
};
};
}

View file

@ -1,62 +0,0 @@
{ lib, config, ... }:
let
inherit (lib) mkOption types;
cfg = config.monitors;
in
{
options.monitors = mkOption {
type = types.listOf (types.submodule {
options = {
name = mkOption {
type = types.str;
example = "DP-1";
};
primary = mkOption {
type = types.bool;
default = false;
};
width = mkOption {
type = types.int;
example = 1920;
};
height = mkOption {
type = types.int;
example = 1080;
};
refreshRate = mkOption {
type = types.int;
default = 60;
};
x = mkOption {
type = types.int;
default = 0;
};
y = mkOption {
type = types.int;
default = 0;
};
transform = mkOption {
type = types.int;
default = 0;
};
enabled = mkOption {
type = types.bool;
default = true;
};
workspace = mkOption {
type = types.nullOr types.str;
default = null;
};
};
});
default = [ ];
};
config = {
assertions = [{
assertion = ((lib.length config.monitors) != 0) ->
((lib.length (lib.filter (m: m.primary) config.monitors)) == 1);
message = "Exactly one monitor must be set to primary.";
}];
};
}

View file

@ -1,26 +0,0 @@
{ lib, config, pkgs, outputs, ... }:
let
cfg = config.homeModules.config.nix;
in
{
config = lib.mkIf cfg.enable {
nixpkgs = {
overlays = builtins.attrValues outputs.overlays;
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
};
};
nix = {
package = lib.mkDefault pkgs.nix;
settings = {
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
warn-dirty = false;
};
};
};
}

View file

@ -1,27 +0,0 @@
{ lib, config, ... }:
let
cfg = config.homeModules.config.userDirs;
in
{
config = lib.mkIf cfg.enable {
xdg = {
enable = true;
configHome = "${config.home.homeDirectory}/.config";
cacheHome = "${config.home.homeDirectory}/.cache";
dataHome = "${config.home.homeDirectory}/.local/share";
stateHome = "${config.home.homeDirectory}/.local/state";
userDirs = {
enable = true;
createDirectories = true;
desktop = "${config.home.homeDirectory}/Desktop";
documents = "${config.home.homeDirectory}/Documents";
music = "${config.home.homeDirectory}/Media/Music";
videos = "${config.home.homeDirectory}/Media/Videos";
pictures = "${config.home.homeDirectory}/Media/Pictures";
};
};
};
}