diff --git a/homes/x86_64-linux/cholli@yggdrasil/default.nix b/homes/x86_64-linux/cholli@yggdrasil/default.nix index 6f5bfa6..a5ff062 100644 --- a/homes/x86_64-linux/cholli@yggdrasil/default.nix +++ b/homes/x86_64-linux/cholli@yggdrasil/default.nix @@ -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; - name = config.snowfallorg.user.name; - }; +# 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"; }; } diff --git a/modules/nixos/archetypes/gaming/default.nix b/modules/nixos/archetypes/gaming/default.nix new file mode 100644 index 0000000..372d67b --- /dev/null +++ b/modules/nixos/archetypes/gaming/default.nix @@ -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; + }; + }; +} diff --git a/modules/nixos/home/default.nix b/modules/nixos/home/default.nix new file mode 100644 index 0000000..0e8f1ee --- /dev/null +++ b/modules/nixos/home/default.nix @@ -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; + }; + }; +} diff --git a/modules/nixos/submodules/basics/default.nix b/modules/nixos/submodules/basics/default.nix new file mode 100644 index 0000000..ccfaad4 --- /dev/null +++ b/modules/nixos/submodules/basics/default.nix @@ -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; + }; + }; + }; +} diff --git a/modules/nixos/tools/direnv/default.nix b/modules/nixos/tools/direnv/default.nix new file mode 100644 index 0000000..1ed39f5 --- /dev/null +++ b/modules/nixos/tools/direnv/default.nix @@ -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; + }; + }; + }; +} diff --git a/modules/nixos/user/default.nix b/modules/nixos/user/default.nix new file mode 100644 index 0000000..5baea4b --- /dev/null +++ b/modules/nixos/user/default.nix @@ -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.`."); + }; + + 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; + }; +} diff --git a/modules/nixos/user/profile.png b/modules/nixos/user/profile.png new file mode 100644 index 0000000..de33904 Binary files /dev/null and b/modules/nixos/user/profile.png differ diff --git a/systems/x86_64-linux/yggdrasil/default.nix b/systems/x86_64-linux/yggdrasil/default.nix index b21d4c4..9086469 100644 --- a/systems/x86_64-linux/yggdrasil/default.nix +++ b/systems/x86_64-linux/yggdrasil/default.nix @@ -40,6 +40,12 @@ xkbVariant = ""; }; + wyrdgard = { + archetypes = { + gaming.enable = true; + }; + }; + # Configure Home-Manager options from NixOS. snowfallorg.user.cholli.home.config = { };