to be continued

This commit is contained in:
christoph.hollizeck 2024-03-22 18:18:58 +01:00
parent 5490596247
commit db30ab1fa9
8 changed files with 255 additions and 36 deletions

View file

@ -1,43 +1,21 @@
{
# Snowfall Lib provides a customized `lib` instance with access to your flake's library
# as well as the libraries available from your flake's inputs.
lib
, # An instance of `pkgs` with your overlays and packages applied is also available.
pkgs
, # You also have access to your flake's inputs.
inputs
, # Additional metadata is provided by Snowfall Lib.
home
, # The home architecture for this host (eg. `x86_64-linux`).
target
, # The Snowfall Lib target for this home (eg. `x86_64-home`).
format
, # A normalized name for the home target (eg. `home`).
virtual
, # A boolean to determine whether this home is a virtual target using nixos-generators.
host
, # The host name for this home.
# All other arguments come from the home home.
config
{ lib
, pkgs
, config
, ...
}:
with lib.wyrdgard; {
wyrdgard = {
user = {
enable = true;
# User information gathered by Snowfall Lib is available.
let
name = config.snowfallorg.user.name;
};
home = config.snowfallorg.user.home.directory;
in
{
home = {
packages = with pkgs; [ neovim firefox ];
submodule = {
basics.enable = true;
graphical-interface.enable = true;
};
sessionVariables = { EDITOR = "nvim"; };
system.hardware = {
audio.enable = true;
bluetooth.enable = true;
networking.enable = true;
};
shellAliases = { vimdiff = "nvim -d"; };
stateVersion = "23.11";
};
}

View file

@ -0,0 +1,21 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.wyrdgard;
let
cfg = config.wyrdgard.archetypes.gaming;
in
{
options.wyrdgard.archetypes.gaming = with types; {
enable = mkBoolOpt false "Whether or not to enable the gaming archetype.";
};
config = mkIf cfg.enable {
wyrdgard.submodules = {
basics = enabled;
graphical-interface = enabled;
games = enabled;
socials = enabled;
};
};
}

View file

@ -0,0 +1,38 @@
{ options
, config
, pkgs
, lib
, inputs
, ...
}:
with lib;
with lib.wyrdgard; let
cfg = config.wyrdgard.home;
in
{
options.wyrdgard.home = with types; {
file =
mkOpt attrs { }
(mdDoc "A set of files to be managed by home-manager's `home.file`.");
configFile =
mkOpt attrs { }
(mdDoc "A set of files to be managed by home-manager's `xdg.configFile`.");
extraOptions = mkOpt attrs { } "Options to pass directly to home-manager.";
};
config = {
wyrdgard.home.extraOptions = {
home.stateVersion = config.system.stateVersion;
home.file = mkAliasDefinitions options.wyrdgard.home.file;
xdg.enable = true;
xdg.configFile = mkAliasDefinitions options.wyrdgard.home.configFile;
};
snowfallorg.user.${config.wyrdgard.user.name}.home.config = config.plusultra.home.extraOptions;
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
};
};
}

View file

@ -0,0 +1,44 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib;
with lib.wyrdgard; let
cfg = config.wyrdgard.suites.common;
in {
options.wyrdgard.submodules.basics = with types; {
enable = mkBoolOpt false "Whether or not to enable basic configuration.";
};
config = mkIf cfg.enable {
environment.systemPackages = [
];
wyrdgard = {
nix = enabled;
tools = {
git = enabled;
nix-ld = enabled;
};
system.hardware = {
audio = enabled;
bluetooth = enabled;
networking = enabled;
};
system = {
boot = enabled;
fonts = enabled;
locale = enabled;
time = enabled;
xkb = enabled;
};
};
};
}

View file

@ -0,0 +1,20 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.wyrdgard;
let cfg = config.wyrdgard.tools.direnv;
in
{
options.wyrdgard.tools.direnv = with types; {
enable = mkBoolOpt false "Whether or not to enable direnv.";
};
config = mkIf cfg.enable {
wyrdgard.home.extraOptions = {
programs.direnv = {
enable = true;
nix-direnv = enabled;
};
};
};
}

View file

@ -0,0 +1,112 @@
{ options
, config
, pkgs
, lib
, ...
}:
with lib;
with lib.wyrdgard; let
cfg = config.wyrdgard.user;
defaultIconFileName = "profile.png";
defaultIcon = pkgs.stdenvNoCC.mkDerivation {
name = "default-icon";
src = ./. + "/${defaultIconFileName}";
dontUnpack = true;
installPhase = ''
cp $src $out
'';
passthru = { fileName = defaultIconFileName; };
};
propagatedIcon =
pkgs.runCommandNoCC "propagated-icon"
{ passthru = { fileName = cfg.icon.fileName; }; }
''
local target="$out/share/wyrdgard-icons/user/${cfg.name}"
mkdir -p "$target"
cp ${cfg.icon} "$target/${cfg.icon.fileName}"
'';
in
{
options.wyrdgard.user = with types; {
name = mkOpt str "short" "The name to use for the user account.";
fullName = mkOpt str "Christoph Hollizeck" "The full name of the user.";
email = mkOpt str "christoph.hollizeck@hey.com" "The email of the user.";
initialPassword =
mkOpt str "asdf"
"The initial password to use when the user is first created.";
icon =
mkOpt (nullOr package) defaultIcon
"The profile picture to use for the user.";
extraGroups = mkOpt (listOf str) [ ] "Groups for the user to be assigned.";
extraOptions =
mkOpt attrs { }
(mdDoc "Extra options passed to `users.users.<name>`.");
};
config = {
environment.systemPackages = with pkgs; [
];
programs.zsh = {
enable = true;
autosuggestions.enable = true;
histFile = "$XDG_CACHE_HOME/zsh.history";
};
wyrdgard.home = {
file = {
"Desktop/.keep".text = "";
"Documents/.keep".text = "";
"Downloads/.keep".text = "";
"Music/.keep".text = "";
"Pictures/.keep".text = "";
"Videos/.keep".text = "";
"work/.keep".text = "";
".face".source = cfg.icon;
"Pictures/${
cfg.icon.fileName or (builtins.baseNameOf cfg.icon)
}".source =
cfg.icon;
};
extraOptions = {
home.shellAliases = {
lc = "${pkgs.colorls}/bin/colorls --sd";
lcg = "lc --gs";
lcl = "lc -1";
lclg = "lc -1 --gs";
lcu = "${pkgs.colorls}/bin/colorls -U";
lclu = "${pkgs.colorls}/bin/colorls -U -1";
};
};
};
users.users.${cfg.name} =
{
isNormalUser = true;
inherit (cfg) name initialPassword;
home = "/home/${cfg.name}";
group = "users";
shell = pkgs.zsh;
# Arbitrary user ID to use for the user. Since I only
# have a single user on my machines this won't ever collide.
# However, if you add multiple users you'll need to change this
# so each user has their own unique uid (or leave it out for the
# system to select).
uid = 1000;
extraGroups = [ "steamcmd" ] ++ cfg.extraGroups;
}
// cfg.extraOptions;
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View file

@ -40,6 +40,12 @@
xkbVariant = "";
};
wyrdgard = {
archetypes = {
gaming.enable = true;
};
};
# Configure Home-Manager options from NixOS.
snowfallorg.user.cholli.home.config = { };