Compare commits

...

2 commits

Author SHA1 Message Date
1a17da37ba
feat(home): My module 2024-11-15 17:45:23 -08:00
5f7cfe4858
feat(snowfall): Setup Snowfall migration
WIP!!!!!!!
2024-11-15 17:45:23 -08:00
60 changed files with 149 additions and 3 deletions

View file

@ -2,6 +2,18 @@
description = "marleyOS";
outputs =
inputs:
inputs.snowfall-lib.mkFlake {
inherit inputs;
src = ./.;
snowfall = {
namespace = "marleyos";
title = "marleyOS";
};
};
old =
{ self, ... }@inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
debug = true;
@ -64,11 +76,13 @@
};
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixos-unified.url = "github:srid/nixos-unified";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
snowfall-lib = {
url = "github:snowfallorg/lib";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";

View file

@ -0,0 +1,4 @@
{ ... }:
{
home.stateVersion = "24.05";
}

51
lib/module/default.nix Normal file
View file

@ -0,0 +1,51 @@
{ lib, ... }:
with lib;
rec {
## Create a NixOS module option.
##
## ```nix
## lib.mkOpt nixpkgs.lib.types.str "My default" "Description of my option."
## ```
##
#@ Type -> Any -> String
mkOpt =
type: default: description:
mkOption {
inherit
type
default
description
;
};
## Create a boolean NixOS module option.
##
## ```nix
## lib.mkBoolOpt true "Description of my option."
## ```
##
#@ Type -> Any -> String
mkBoolOpt = mkOpt types.bool;
enabled = {
## Quickly enable an option.
##
## ```nix
## services.nginx = enabled;
## ```
##
#@ true
enable = true;
};
disabled = {
## Quickly disable an option.
##
## ```nix
## services.nginx = enabled;
## ```
##
#@ false
enable = false;
};
}

View file

@ -0,0 +1,4 @@
{ namespace, lib, ... }:
{
}

View file

@ -0,0 +1,73 @@
{
namespace,
lib,
config,
...
}:
let
inherit (lib)
mkOption
types
mkDefault
mkIf
;
in
{
options.${namespace}.my = rec {
name = mkOption {
type = types.str;
default = config.snowfallorg.user.name or "marley";
description = "Your username, for use as your login name.";
};
username = mkOption {
type = types.str;
default = name;
description = "Your username, for external profiles.";
};
fullName = mkOption {
type = types.str;
default = name;
description = "Your full name, for display purposes.";
};
email = mkOption {
type = types.NullOr types.str;
default = null;
description = "Your email";
};
git.name = mkOption {
type = types.str;
default = name;
description = "Your git committer name.";
};
git.email = mkOption {
type = types.nullOr types.str;
default = email;
description = "Your git committer email.";
};
};
config =
let
cfg = config.${namespace}.my;
in
{
assertions = [
{
assertion = cfg.name != null;
message = "${namespace}.my.name must be set.";
}
];
home.username = mkDefault cfg.name;
programs.git = mkIf config.programs.git.enable {
userName = mkDefault cfg.git.name;
userEmail = mkDefault cfg.git.email;
};
};
}