diff --git a/flake.nix b/flake.nix index 7b44efe2..6a33ba70 100644 --- a/flake.nix +++ b/flake.nix @@ -32,13 +32,13 @@ }; }; flake = { - homeConfigurations."sam@minimal" = home.lib.homeManagerConfiguration { - pkgs = nixpkgs; - modules = [ - #./users/sam - ]; - extraSpecialArgs = { inherit inputs; }; - }; + #homeConfigurations."sam@minimal" = home.lib.homeManagerConfiguration { + # pkgs = nixpkgs; + # modules = [ + # #./users/sam + # ]; + # extraSpecialArgs = { inherit inputs; }; + #}; nixosConfigurations = let user = "sam"; in { diff --git a/nix/android/packages/activitywatch-android.nix b/nix/android/packages/activitywatch-android.nix index d3f085fa..06ebc7bc 100644 --- a/nix/android/packages/activitywatch-android.nix +++ b/nix/android/packages/activitywatch-android.nix @@ -1,5 +1,6 @@ { androidenv, activitywatch, aw-server-rust, lib, stdenv, fetchFromGitHub, }: androidenv.buildApp rec { + name = "activitywatch-android"; pname = "activitywatch-android"; version = "0.12.1"; diff --git a/nix/android/pops.nix b/nix/android/pops.nix index 08ed5f92..6028ce44 100644 --- a/nix/android/pops.nix +++ b/nix/android/pops.nix @@ -1,4 +1,8 @@ -{inputs, cell}@commonArgs: +{ inputs, cell, }@commonArgs: inputs.omnibusStd.mkBlocks.pops commonArgs { - packages = {src = ./packages; }; + #configs = {src = ./configs; }; + #devshellProfiles = {src = ./devshellProfiles; }; + #nixosProfiles = {src = ./nixosProfiles; }; + packages = { src = ./packages; }; + #shells = {src = ./shells; }; } diff --git a/nix/hive/devshellSuites.nix b/nix/hive/devshellSuites.nix new file mode 100644 index 00000000..e8886d82 --- /dev/null +++ b/nix/hive/devshellSuites.nix @@ -0,0 +1 @@ +{inputs,cell}: cell.pops.devshellSuites.exports.default diff --git a/nix/hive/devshellSuites/test.nix b/nix/hive/devshellSuites/test.nix new file mode 100644 index 00000000..ec2c7b23 --- /dev/null +++ b/nix/hive/devshellSuites/test.nix @@ -0,0 +1,6 @@ +{ inputs, config, lib, pkgs, ... }: { + imports = [ + inputs.cell.devshellProfiles.benchmarking + inputs.cell.devshellProfiles.normalize + ]; +} diff --git a/nix/hive/diskoSuites.nix b/nix/hive/diskoSuites.nix new file mode 100644 index 00000000..be13d17f --- /dev/null +++ b/nix/hive/diskoSuites.nix @@ -0,0 +1 @@ +{ inputs, cell, }@commonArgs: cell.pops.diskoSuites.exports.default diff --git a/nix/hive/diskoSuites/test.nix b/nix/hive/diskoSuites/test.nix new file mode 100644 index 00000000..d6d0736f --- /dev/null +++ b/nix/hive/diskoSuites/test.nix @@ -0,0 +1,6 @@ +{ inputs, config, lib, pkgs, ... }: { + imports = [ + inputs.cell.diskoProfiles.btrfs-luks.nix + inputs.cell.diskoProfiles.tmpfs-root + ]; +} diff --git a/nix/hive/hardwareProfiles.nix b/nix/hive/hardwareProfiles.nix new file mode 100644 index 00000000..8a69cf1b --- /dev/null +++ b/nix/hive/hardwareProfiles.nix @@ -0,0 +1 @@ +{inputs,cell}: cell.pops.hardwareProfiles.exports.default diff --git a/nix/hive/hardwareSuites.nix b/nix/hive/hardwareSuites.nix new file mode 100644 index 00000000..f6bca53d --- /dev/null +++ b/nix/hive/hardwareSuites.nix @@ -0,0 +1 @@ +{ inputs, cell, }@commonArgs: cell.pops.hardwareSuites.exports.default diff --git a/nix/hive/hardwareSuites/test.nix b/nix/hive/hardwareSuites/test.nix new file mode 100644 index 00000000..4e7f03b9 --- /dev/null +++ b/nix/hive/hardwareSuites/test.nix @@ -0,0 +1,3 @@ +{ inputs, config, lib, pkgs, ... }: { + imports = [ inputs.cell.hardwareProfiles.disk-nvme ]; +} diff --git a/nix/hive/homeConfigurations.nix b/nix/hive/homeConfigurations.nix index eccdc2cd..a81d6fe8 100644 --- a/nix/hive/homeConfigurations.nix +++ b/nix/hive/homeConfigurations.nix @@ -1,10 +1 @@ -{ inputs, cell, }@commonArgs: -cell.pops.homeConfigurations.exports.default -#let -# inherit (inputs.haumea.lib) load loaders matchers transformers; -#in -# load { -# src = ./homeConfigurations; -# loader = loaders.verbatim; -# transformer = transformers.liftDefaults; -# } +{inputs,cell}@commonArgs: cell.pops.homeConfigurations.exports.default diff --git a/nix/hive/homeConfigurations/Readme.md b/nix/hive/homeConfigurations/Readme.md index 81b348b3..9e1f2db9 100644 --- a/nix/hive/homeConfigurations/Readme.md +++ b/nix/hive/homeConfigurations/Readme.md @@ -18,3 +18,27 @@ homeConfigurations = { }; }; ``` + +File: `../homeConfigurations.nix` + + - Old: + + ```(nix) + { inputs, cell, }@commonArgs: + #let + # inherit (inputs.haumea.lib) load loaders matchers transformers; + #in + # load { + # src = ./homeConfigurations; + # loader = loaders.verbatim; + # transformer = transformers.liftDefaults; + # } + + ``` + + - New: + + ```(nix) + {inputs,cell}: cell.pops.homeConfigurations.exports.default + ``` + diff --git a/nix/hive/homeConfigurations/sam/default.nix b/nix/hive/homeConfigurations/sam/default.nix new file mode 100644 index 00000000..257b5a58 --- /dev/null +++ b/nix/hive/homeConfigurations/sam/default.nix @@ -0,0 +1,13 @@ +{ inputs, cell, }@commonArgs: +let + inherit (inputs.home-manager.lib) homeManagerConfiguration; + user = builtins.toString ./.; +in +homeManagerConfiguration { + pkgs = inputs.nixpkgs; + modules = [ + inputs.cells.hive.homeSuites.developer-default + (inputs.self + /users/${user}) + ]; + extraSpecialArgs = { inherit inputs cell user; }; +} diff --git a/nix/hive/homeModules.nix b/nix/hive/homeModules.nix index dff2b66d..7c866ae3 100644 --- a/nix/hive/homeModules.nix +++ b/nix/hive/homeModules.nix @@ -1,9 +1 @@ -{ inputs, cell, }: cell.pops.homeModules.exports.default -#let -# inherit (inputs.haumea.lib) load loaders matchers transformers; -#in -# load { -# src = ./homeModules; -# loader = loaders.verbatim; -# transformer = transformers.liftDefaults; -# } +{ inputs, cell, }@commonArgs: cell.pops.homeModules.exports.default diff --git a/nix/hive/homeModules/debug.nix b/nix/hive/homeModules/debug.nix new file mode 100644 index 00000000..571f6752 --- /dev/null +++ b/nix/hive/homeModules/debug.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }@args: +let + inherit (args) config lib; + inherit (lib) concatStringsSep mkEnableOption mkIf; + cfg = config.debug; +in +{ + imports = [ ]; + + options.debug = { enable = mkEnableOption "NixOS Debugging"; }; + + config = mkIf cfg.enable { + xdg.configFile = { + # TODO: Figure out how to pretty-print tree of attrs. + # TODO: Figure out how to restrict attrset depth. + "nix/debug/module-args.txt".text = + concatStringsSep "\n" (builtins.attrNames args); + "nix/debug/flake-inputs.txt".text = + concatStringsSep "\n" (builtins.attrNames args.inputs); + }; + }; +} diff --git a/nix/hive/homeProfiles/git/diff.nix b/nix/hive/homeProfiles/git/diff.nix index 2f7c1891..b74e28ba 100644 --- a/nix/hive/homeProfiles/git/diff.nix +++ b/nix/hive/homeProfiles/git/diff.nix @@ -1,13 +1,5 @@ -{ inputs -, config -, lib -, pkgs -, ... -}: +{ inputs , config , lib , pkgs , ... }: { - imports = [ - ]; - programs.git.delta = { enable = true; #options = { @@ -20,5 +12,4 @@ # whitespace-error-style = "22 reverse"; #}; }; - } diff --git a/nix/hive/homeProfiles/role-developer.nix b/nix/hive/homeProfiles/role-developer.nix index 348f93c2..52614557 100644 --- a/nix/hive/homeProfiles/role-developer.nix +++ b/nix/hive/homeProfiles/role-developer.nix @@ -1,11 +1,9 @@ -{ inputs -, config -, lib -, pkgs -, ... -}: -{ - imports = [ ../../git ]; +{ inputs, cell, config, lib, pkgs, ... }: { + imports = [ + #cell.homeProfiles. + #../../git + #../../../users/sam/git + ]; home.packages = [ #pkgs.nur.repos.federicoschonborn.devtoolbox # Multiple developer tools in one GTK4 app (Broken 9/23: pkgs.python310.daltonlens (v0.1.5) miss setuptools_git) #pkgs.nur.repos.federicoschonborn.atoms # Easily manage Linux chroots & containers diff --git a/nix/hive/homeProfiles/rust-utils.nix b/nix/hive/homeProfiles/rust-utils.nix index 9ed76c28..c97b138a 100644 --- a/nix/hive/homeProfiles/rust-utils.nix +++ b/nix/hive/homeProfiles/rust-utils.nix @@ -1,79 +1,94 @@ -{config, lib, pkgs, prefix ? false, ...}: +{ config, lib, pkgs, prefix ? false, ... }: # # https://github.com/TaKO8Ki/awesome-alternatives-in-rust # https://gist.github.com/sts10/daadbc2f403bdffad1b6d33aff016c0a # https://lib.rs/command-line-utilities # let - swap-util = gu: ru: { home.shellAliases = { - ${gu} = lib.getExe pkgs.${ru}); # Unprefixed set to rust version - rs-${gu} = lib.getExe pkgs.${ru}; # Prefixed alias of rust util - gnu-${gu} = lib.getExe' pkgs.coreutils-prefixed gu; # Prefixes old coreutil - }; }; - util-swap = gu: ru: let inherit (lib.attrsets) nameValuePair; in [ - (nameValuePair gu (lib.getExe ru)) - (nameValuePair "gnu-${gu}" (lib.getExe' pkgs.coreutils-prefixed gu)) - (nameValuePair "rs-${gu}" (lib.getExe ru)) - ]; - + swap-util = gu: ru: { + home.shellAliases = { + "${gu}" = lib.getExe pkgs.${ru}; # Unprefixed set to rust version + "rs-${gu}" = lib.getExe pkgs.${ru}; # Prefixed alias of rust util + "gnu-${gu}" = + lib.getExe' pkgs.coreutils-prefixed gu; # Prefixes old coreutil + }; + }; + util-swap = gu: ru: + let inherit (lib.attrsets) nameValuePair; + in [ + (nameValuePair gu (lib.getExe ru)) + (nameValuePair "gnu-${gu}" (lib.getExe' pkgs.coreutils-prefixed gu)) + (nameValuePair "rs-${gu}" (lib.getExe ru)) + ]; in { home = { packages = [ - pkgs.dog # DNS client - pkgs.fselect # SQL-like queries for files. + pkgs.dog # DNS client + pkgs.fselect # SQL-like queries for files. pkgs.git-cliff # Changelog generator following Conventional Commit spec - pkgs.gsv # CSV tool - pkgs.hexyl # Hex viewer - pkgs.htmlq # jq for HTML + pkgs.gsv # CSV tool + pkgs.hexyl # Hex viewer + pkgs.htmlq # jq for HTML pkgs.miniserve # Webserver - pkgs.monolith # Webpage saver to single HTML file - pkgs.pastel # Gen, analyze, convert, & manip colors - pkgs.pipr # Interactive pipe viewer - pkgs.skim # Fuzzy finder - pkgs.topgrade # Update everything - pkgs.xh # HTTP request util - ] ++ lib.optional !prefix pkgs.coreutils-prefixed # Prefix GNU coreutils if uutils w/ no prefix - ++ lib.optional !prefix pkgs.uutils-coreutils-noprefix # No prefix uutils - ++ lib.optional prefix pkgs.uutils-coreutils # Prefixed uutils + pkgs.monolith # Webpage saver to single HTML file + pkgs.pastel # Gen, analyze, convert, & manip colors + pkgs.pipr # Interactive pipe viewer + pkgs.skim # Fuzzy finder + pkgs.topgrade # Update everything + pkgs.xh # HTTP request util + ] ++ (if prefix then + [ pkgs.uutils-coreutils ] + else [ + pkgs.uutils-coreutils-noprefix + pkgs.coreutils-prefixed + ]) + #++ lib.optional !prefix pkgs.coreutils-prefixed # Prefix GNU coreutils if uutils w/ no prefix + #++ lib.optional !prefix pkgs.uutils-coreutils-noprefix # No prefix uutils + #++ lib.optional prefix pkgs.uutils-coreutils # Prefixed uutils ; - shellAliases = with lib.attrsets; mapAttrs' (n: v: nameValuePair "rs-${n}" (b v)) { - awk = pkgs.frawk; - bot = pkgs.bottom; - cp = pkgs.xcp; #cp = uutil "cp" "--progress"; - cut = pkgs.hck; - df = pkgs.lfs; - delt = pkgs.delta; # Really nice diff util - diff = pkgs.difftastic; # Also really nice diff util - ducttape = pkgs.dt; # Duct tape for your unix pipelines # TODO: Make aliases w this - du = pkgs.du-dust; gnu-du#pkgs.du-tree; - dupes = pkgs.fclones; #pkgs.fclones-gui; - http = pkgs.xh; - ps = pkgs.procs; - refact = pkgs.fastmod; - rm = [ pkgs.rip "--graveyard ${config.xdg.dataHome}/Trash" ]; - rn = pkgs.rnr; - sed = pkgs.sad; #pkgs.sd; - sysctl = pkgs.systeroid; # More powerful sysctl tool - system-info = pkgs.macchina; # Like neofetch but in Rust - time = pkgs.hyperfine; # Benchmark util - top = pkgs.bottom; - uniq = pkgs.huniq; - watche = pkgs.watchexec; - xargs = pkgs.rargs; - #tmux = pkgs.zellij; + shellAliases = with lib.attrsets; + mapAttrs' (n: v: nameValuePair "rs-${n}" (b v)) + { + awk = pkgs.frawk; + bot = pkgs.bottom; + cp = pkgs.xcp; # cp = uutil "cp" "--progress"; + cut = pkgs.hck; + df = pkgs.lfs; + delt = pkgs.delta; # Really nice diff util + diff = pkgs.difftastic; # Also really nice diff util + ducttape = + pkgs.dt; # Duct tape for your unix pipelines # TODO: Make aliases w this + du = pkgs.du-dust; + #gnu-du = #pkgs.du-tree; + dupes = pkgs.fclones; # pkgs.fclones-gui; + http = pkgs.xh; + ps = pkgs.procs; + refact = pkgs.fastmod; + rm = [ pkgs.rip "--graveyard ${config.xdg.dataHome}/Trash" ]; + rn = pkgs.rnr; + sed = pkgs.sad; # pkgs.sd; + sysctl = pkgs.systeroid; # More powerful sysctl tool + system-info = pkgs.macchina; # Like neofetch but in Rust + time = pkgs.hyperfine; # Benchmark util + top = pkgs.bottom; + uniq = pkgs.huniq; + watche = pkgs.watchexec; + xargs = pkgs.rargs; + #tmux = pkgs.zellij; - # Count lines of code & show stats - loc = pkgs.tokei; - } // { + # Count lines of code & show stats + loc = pkgs.tokei; + } // { + # Move in Rust w/ progress bar + mv = (lib.getExe' pkgs.uutils-coreutils "mv") "--progress"; - # Move in Rust w/ progress bar - mv = (lib.getExe' pkgs.uutils-coreutils "mv") "--progress"; - - # skim - Interactive Grep - # https://github.com/lotabout/skim - # TODO: Move skim to separate config - rgi = "${lib.getExe pkgs.skim} --ansi -i -c '${lib.getExe config.programs.ripgrep.package} --color=always --line-number {}'"; - }; + # skim - Interactive Grep + # https://github.com/lotabout/skim + # TODO: Move skim to separate config + rgi = "${lib.getExe pkgs.skim} --ansi -i -c '${ + lib.getExe config.programs.ripgrep.package + } --color=always --line-number {}'"; + }; }; } diff --git a/nix/hive/homeProfiles/shell-base.nix b/nix/hive/homeProfiles/shell-base.nix index 92970947..51b49caf 100644 --- a/nix/hive/homeProfiles/shell-base.nix +++ b/nix/hive/homeProfiles/shell-base.nix @@ -1,26 +1,26 @@ -{ inputs, config, lib, pkgs, ... }: { +{ inputs, cell, config, lib, pkgs, ... }: { imports = [ #inputs.home-extra-xhmm.homeManagerModules.console.program-variables #inputs.home-extra-xhmm.homeManagerModules.console.fish - inputs.self.homeProfiles.abook - inputs.self.homeProfiles.bat - inputs.self.homeProfiles.direnv - inputs.self.homeProfiles.documentation - inputs.self.homeProfiles.fetchers - inputs.self.homeProfiles.fzf - inputs.self.homeProfiles.ls - inputs.self.homeProfiles.navi - inputs.self.homeProfiles.nushell - inputs.self.homeProfiles.ripgrep - inputs.self.homeProfiles.starship - inputs.self.homeProfiles.shell-aliases - inputs.self.homeProfiles.tmux - inputs.self.homeProfiles.zsh + cell.homeProfiles.abook + cell.homeProfiles.bat + cell.homeProfiles.direnv + cell.homeProfiles.documentation + cell.homeProfiles.fetchers + cell.homeProfiles.fzf + cell.homeProfiles.ls + cell.homeProfiles.navi + cell.homeProfiles.nushell + cell.homeProfiles.ripgrep + cell.homeProfiles.starship + cell.homeProfiles.shell-aliases + cell.homeProfiles.tmux + cell.homeProfiles.zsh - #inputs.self.homeProfiles.bash - #inputs.self.homeProfiles.fish - #inputs.self.homeProfiles.readline - #inputs.self.homeProfiles.shell-colors + #cell.homeProfiles.bash + #cell.homeProfiles.fish + #cell.homeProfiles.readline + #cell.homeProfiles.shell-colors ]; programs.bash = { diff --git a/nix/hive/homeSuites/developer-default.nix b/nix/hive/homeSuites/developer-default.nix index 3fc01fca..d55273b9 100644 --- a/nix/hive/homeSuites/developer-default.nix +++ b/nix/hive/homeSuites/developer-default.nix @@ -1,49 +1,49 @@ -{ inputs, nixosConfig, osConfig, config, lib, pkgs, ... }: { +{ inputs, cell, nixosConfig, osConfig, config, lib, pkgs, ... }: { imports = [ - inputs.self.homeProfiles.abook - inputs.self.homeProfiles.bat - inputs.self.homeProfiles.cachix-agent - inputs.self.homeProfiles.editorconfig - inputs.self.homeProfiles.eza - inputs.self.homeProfiles.direnv - inputs.self.homeProfiles.distrobox - inputs.self.homeProfiles.documentation - inputs.self.homeProfiles.fetchers - inputs.self.homeProfiles.fonts - inputs.self.homeProfiles.fzf - inputs.self.homeProfiles.git - inputs.self.homeProfiles.gpg - inputs.self.homeProfiles.helix - inputs.self.homeProfiles.helm - inputs.self.homeProfiles.k9s - inputs.self.homeProfiles.lang-nodejs - inputs.self.homeProfiles.lang-python - inputs.self.homeProfiles.lang-rust - inputs.self.homeProfiles.ls - inputs.self.homeProfiles.lsd - inputs.self.homeProfiles.navi - inputs.self.homeProfiles.neovim - inputs.self.homeProfiles.nix - inputs.self.homeProfiles.ollama - inputs.self.homeProfiles.pls - inputs.self.homeProfiles.recoll - inputs.self.homeProfiles.ripgrep - inputs.self.homeProfiles.shell-base - inputs.self.homeProfiles.shell-aliases - inputs.self.homeProfiles.social-dl - inputs.self.homeProfiles.social-sleuth - inputs.self.homeProfiles.starship - inputs.self.homeProfiles.tmux - inputs.self.homeProfiles.vm - inputs.self.homeProfiles.xdg + cell.homeProfiles.abook + cell.homeProfiles.bat + cell.homeProfiles.cachix-agent + cell.homeProfiles.editorconfig + cell.homeProfiles.eza + cell.homeProfiles.direnv + cell.homeProfiles.distrobox + cell.homeProfiles.documentation + cell.homeProfiles.fetchers + cell.homeProfiles.fonts + cell.homeProfiles.fzf + cell.homeProfiles.git + cell.homeProfiles.gpg + cell.homeProfiles.helix + cell.homeProfiles.helm + cell.homeProfiles.k9s + cell.homeProfiles.lang-nodejs + cell.homeProfiles.lang-python + cell.homeProfiles.lang-rust + cell.homeProfiles.ls + cell.homeProfiles.lsd + cell.homeProfiles.navi + cell.homeProfiles.neovim + cell.homeProfiles.nix + cell.homeProfiles.ollama + cell.homeProfiles.pls + cell.homeProfiles.recoll + cell.homeProfiles.ripgrep + cell.homeProfiles.shell-base + cell.homeProfiles.shell-aliases + cell.homeProfiles.social-dl + cell.homeProfiles.social-sleuth + cell.homeProfiles.starship + cell.homeProfiles.tmux + cell.homeProfiles.vm + cell.homeProfiles.xdg #./apps #./gnome - inputs.self.homeProfiles.role-developer - inputs.self.homeProfiles.role-admin-activedirectory - inputs.self.homeProfiles.role-admin-azure - inputs.self.homeProfiles.role-admin-windows + cell.homeProfiles.role-developer + cell.homeProfiles.role-admin-activedirectory + cell.homeProfiles.role-admin-azure + cell.homeProfiles.role-admin-windows ]; home = { diff --git a/nix/hive/lib/mkHome.nix b/nix/hive/lib/mkHome.nix new file mode 100644 index 00000000..f0336386 --- /dev/null +++ b/nix/hive/lib/mkHome.nix @@ -0,0 +1,31 @@ +{ inputs, cell, }: +let + # Found here: https://github.com/GTrunSec/hivebus/blob/e9314e4f8537d61de4567697994f84203d244f56/nix/hive/cells/hosts/lib.nix + l = inputs.nixpkgs.lib // builtins; + inherit (inputs.nixpkgs.stdenv) isDarwin isLinux; + # nixpkgs = inputs.nixpkgs.appendOverlays ([] ++ cell.overlays.desktop); + # inherit nixpkgs; +in +user: host: shell: { + imports = [ + ({ pkgs, ... }: { + home-manager.users.${user} = { + inherit (cell.homeConfigurations."${host}") imports; + home.stateVersion = + if isDarwin then + cell.darwinConfigurations.${host}.bee.pkgs.lib.trivial.release + else + "23.05"; + }; + users.users.${user} = { + shell = pkgs."${shell}"; + home = if isDarwin then "/Users/${user}" else "/home/${user}"; + }; + programs.${shell}.enable = true; + }) + ] ++ l.optionals (shell == "zsh") [{ + environment.pathsToLink = [ "/share/zsh" ]; + }] ++ l.optionals isLinux [ + inputs.cells.users.nixosProfiles.${user} + ]; # inputs.cells.users.userProfiles.${user} +} diff --git a/nix/hive/lib/mkHomeConfig.nix b/nix/hive/lib/mkHomeConfig.nix new file mode 100644 index 00000000..7c44035e --- /dev/null +++ b/nix/hive/lib/mkHomeConfig.nix @@ -0,0 +1,18 @@ +{ inputs, cell, }: +let + l = inputs.nixpkgs.lib // builtins; + inherit (inputs) nixpkgs; +in +host: user: { + imports = l.flatten cell.pops.exports.${host}.homeSuites; + bee = + if nixpkgs.stdenv.isDarwin then + cell.darwinConfigurations.${host}.bee + else + cell.nixosConfigurations.${host}.bee; + home = rec { + homeDirectory = "/home/${username}"; + stateVersion = "23.05"; + username = user; + }; +} diff --git a/nix/hive/lib/mkNixOSHost.nix b/nix/hive/lib/mkNixOSHost.nix new file mode 100644 index 00000000..59ec6290 --- /dev/null +++ b/nix/hive/lib/mkNixOSHost.nix @@ -0,0 +1,15 @@ +{ inputs, cell, }: +let + # Found here: https://github.com/GTrunSec/hivebus/blob/e9314e4f8537d61de4567697994f84203d244f56/nix/hive/cells/hosts/lib.nix + l = inputs.nixpkgs.lib // builtins; +in +export: system: nixos: extra: home: { + imports = l.flatten export.imports; + bee = { + inherit system home; + pkgs = import nixos ({ + inherit system; + overlays = l.flatten export.overlays; + } // extra); + }; +} diff --git a/nix/hive/nixago.nix b/nix/hive/nixago.nix deleted file mode 100644 index 4dc27493..00000000 --- a/nix/hive/nixago.nix +++ /dev/null @@ -1 +0,0 @@ -{ inputs, cell, }: cell.pops.nixago.exports.default diff --git a/nix/hive/nixosConfigurations.nix b/nix/hive/nixosConfigurations.nix index 1a8800c8..b427bc75 100644 --- a/nix/hive/nixosConfigurations.nix +++ b/nix/hive/nixosConfigurations.nix @@ -1,9 +1 @@ { inputs, cell, }: cell.pops.nixosConfigurations.exports.default -#let -# inherit (inputs.haumea.lib) load loaders matchers transformers; -#in -# load { -# src = ./nixosConfigurations; -# loader = loaders.verbatim; -# transformer = transformers.liftDefaults; -# } diff --git a/nix/hive/disko-module.nix b/nix/hive/nixosProfiles/disko/module.nix similarity index 100% rename from nix/hive/disko-module.nix rename to nix/hive/nixosProfiles/disko/module.nix diff --git a/nix/hive/nixosProfiles/installer-old-base.nix b/nix/hive/nixosProfiles/installer-base.old similarity index 100% rename from nix/hive/nixosProfiles/installer-old-base.nix rename to nix/hive/nixosProfiles/installer-base.old diff --git a/nix/hive/nixosProfiles/installer-old.nix b/nix/hive/nixosProfiles/installer.old similarity index 100% rename from nix/hive/nixosProfiles/installer-old.nix rename to nix/hive/nixosProfiles/installer.old diff --git a/nix/hive/nixosProfiles/server-postgres.nix b/nix/hive/nixosProfiles/server-postgres.nix index a485f45d..65a5d70c 100644 --- a/nix/hive/nixosProfiles/server-postgres.nix +++ b/nix/hive/nixosProfiles/server-postgres.nix @@ -1,101 +1,76 @@ -{ - self, - system, - inputs, - host, - config, lib, pkgs, - ... -}: -let -in -{ - imports = [ +{ inputs, config, lib, pkgs, user, ... }: { + services.postgresql = { + enable = true; + enableJIT = lib.mkDefault + false; # default: false # Listen on all network interfaces (vs. unix domain socket & TCP connections to localhost) + #extraPlugins = with pkgs.postgresql_11.pkgs; [ postgis pg_repack ]; - ]; + # Mapping from system users to database users + # General Form: + #identMap = '' + # superUser root superuser + # primaryUser ${user} ${user} + #''; + #initdbArgs = [ "--data-checksums" "--allow-group-access" ]; + #initialScript = null; # File path containing SQL statements to execute on first startup + # logLinePrefix = "[%p] "; # "%m [%p] "; # Includes timestamp (unnecessary in journal) - services.postgresql.enable = true; - services.postgresql.enableJIT = lib.mkDefault false; # default: false - services.postgresql.enableJIT = lib.mkDefault true; # default: false # Listen on all network interfaces (vs. unix domain socket & TCP connections to localhost) - #services.postgresql.extraPlugins = with pkgs.postgresql_11.pkgs; [ postgis pg_repack ]; + port = 5432; + #recoveryConfig = null; # Contents of recovery.conf file. - # Mapping from system users to database users - # General Form: - #services.postgresql.identMap = '' - # superUser root superuser - # primaryUser ${host.users.primary} ${host.users.primary} - #''; - #services.postgresql.initdbArgs = [ "--data-checksums" "--allow-group-access" ]; - #services.postgresql.initialScript = null; # File path containing SQL statements to execute on first startup - # logLinePrefix = "[%p] "; # "%m [%p] "; # Includes timestamp (unnecessary in journal) + settings = { + log_connections = true; + #log_statement = "all"; + #logging_collector = true; + #log_disconnections = false; + #log_destination = lib.mkDefault "syslog"; + }; - services.postgresql.port = 5432; - #services.postgresql.recoveryConfig = null; # Contents of recovery.conf file. + # Databases to automatically create + ensureDatabases = [ "homeassistant" "nextcloud" ]; - services.postgresql.settings = { - log_connections = true; - #log_statement = "all"; - #logging_collector = true; - #log_disconnections = false; - #log_destination = lib.mkDefault "syslog"; + # Users to automatically create + ensureUsers = [ + { + name = user; + ensureClauses = { + createdb = true; + createrole = true; + login = true; + replication = false; + superuser = false; + }; + ensurePermissions = { "DATABASE nextcloud" = "ALL PRIVILEGES"; }; + } + { + name = "nextcloud"; + ensureClauses = { + bypassrls = false; + createdb = true; + createrole = true; + #inherit = null; + login = true; + replication = false; + superuser = true; + }; + ensurePermissions = { "DATABASE nextcloud" = "ALL PRIVILEGES"; }; + } + { + name = "superuser"; + ensurePermissions = { + "ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES"; + }; + } + ]; }; - # Databases to automatically create - services.postgresql.ensureDatabases = [ - "homeassistant" - "nextcloud" - "piwc-website" - "piwc-activedirectory" - "piwc-quickbooks" - "piwc-facts" - "piwc-square" - "piwc-devices" - "piwc-employees" - "piwc-licenses" - ]; - - # Users to automatically create - services.postgresql.ensureUsers = [ - { name = host.user.primary; - ensureClauses = { - createdb = true; - createrole = true; - login = true; - replication = false; - superuser = false; - }; - ensurePermissions = { - "DATABASE nextcloud" = "ALL PRIVILEGES"; - }; - } - { name = "nextcloud"; - ensureClauses = { - bypassrls = false; - createdb = true; - createrole = true; - #inherit = null; - login = true; - replication = false; - superuser = true; - }; - ensurePermissions = { - "DATABASE nextcloud" = "ALL PRIVILEGES"; - }; - } - { name = "superuser"; - ensurePermissions = { - "ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES"; - }; - } - ]; - services.postgresqlBackup = { enable = true; backupAll = true; - compression = "zstd"; # default: gzip + compression = "zstd"; # default: gzip compressionLevel = 6; #databases = [ ]; location = "/var/backup/postgresql"; pgdumpOptions = [ "-C" ]; }; - } diff --git a/nix/hive/nixosProfiles/systemd-networkd/wireguard.nix b/nix/hive/nixosProfiles/systemd-networkd-wireguard.nix similarity index 100% rename from nix/hive/nixosProfiles/systemd-networkd/wireguard.nix rename to nix/hive/nixosProfiles/systemd-networkd-wireguard.nix diff --git a/nix/hive/nixvimModules.nix b/nix/hive/nixvimModules.nix deleted file mode 100644 index 316986ce..00000000 --- a/nix/hive/nixvimModules.nix +++ /dev/null @@ -1 +0,0 @@ -{ inputs, cell, }: cell.pops.nixvimModules.exports.default diff --git a/nix/hive/pops.nix b/nix/hive/pops.nix index b7ca81fc..1edff951 100644 --- a/nix/hive/pops.nix +++ b/nix/hive/pops.nix @@ -3,170 +3,199 @@ let inherit (inputs) omnibusStd;# cellsFrom cellsFrom' _pops ; inherit (inputs.nixpkgs) lib; inherit (inputs.omnibus) pops; + inherit (inputs.omnibus.pops) load homeProfiles nixosProfiles; cellName = builtins.baseNameOf ./.; - #configTypes = [ "devshell" "disko" "flake" "hardware" "homeManager" "nixondroid" "nixos" "nixvim" "robotnix" ]; - #mkConfigTypes = t: { - # "${t}Configurations" = { - # src = cellsFrom + /${cellName}/${t}Configurations; - # }; - # "${t}Modules" = { - # src = cellsFrom + /${cellName}/${t}Modules; - # }; - # "${t}Profiles" = { - # src = cellsFrom + /${cellName}/${t}Profiles; - # }; - #}; # TODO: Which pops are available in `mkBlocks`, omnibus, hivebus? # # mkBlocks: configs, data, devshellProfiles, jupyenv, packages, pops, scripts, shells, tasks # # TODO: Kubernetes, containers, tests, checks, jupyenv, nixago, secrets + # TODO: Try: `src = cellsFrom + /${cellName}/packages;` + #lib.recursiveUpdate ( in -lib.recursiveUpdate - (omnibusStd.mkBlocks.pops commonArgs { - configs = { - src = ./configs; - inputs = { inherit inputs cell; }; - }; - devshellProfiles = { - src = ./devshellProfiles; - inputs = { inherit inputs cell; }; - }; - packages = { - src = ./packages; +omnibusStd.mkBlocks.pops commonArgs { + lib = pops.load { + src = ./lib; + loader = inputs.haumea.lib.loaders.default; + inputs = { inherit inputs cell; }; + }; + packages = { + src = ./packages; + inputs = { inherit inputs cell; }; + }; + + # --- DevShells ------------------------------------------- + #devshellModules = { src = ./devshellModules; inputs = { inherit inputs cell; }; }; + devshellProfiles = { + src = ./devshellProfiles; + inputs = { inherit inputs cell; }; + }; + devshellSuites = pops.nixosProfiles.addLoadExtender { + load = { + src = ./devshellSuites; + type = "nixosProfilesOmnibus"; inputs = { inherit inputs cell; }; }; - shells = { - src = ./shells; + }; + shells = { + src = ./shells; + inputs = { inherit inputs cell; }; + }; + + # --- Disko ------------------------------------------- + diskoConfigurations = pops.nixosProfiles.addLoadExtender { + load = { + src = ./diskoConfigurations; inputs = { inherit inputs cell; }; }; - - diskoProfiles = { + }; + diskoProfiles = pops.nixosProfiles.addLoadExtender { + load = { src = ./diskoProfiles; type = "nixosProfiles"; - #inputs = { inherit inputs cell; }; - }; - - homeModules = { src = ./homeModules; }; - homeProfiles = { - src = ./homeProfiles; - type = "nixosProfiles"; - }; - homeSuites = { - src = ./homeSuites; - type = "nixosProfiles"; - #type = "nixosProfilesOmnibus"; - }; - - nixosModules = { src = ./nixosModules; }; - nixosProfiles = { - src = ./nixosProfiles; - type = "nixosProfiles"; + }; # inputs = { inherit inputs cell; }; + }; + diskoSuites = pops.nixosProfiles.addLoadExtender { + load = { + src = ./diskoSuites; + type = "nixosProfilesOmnibus"; }; - #nixosSuites = { src = ./nixosSuites; type = "nixosProfilesOmnibus"; }; + }; - nixvimProfiles = { - src = ./nixvimProfiles; + # --- Hardware ------------------------------------------- + hardwareProfiles = pops.nixosProfiles.addLoadExtender { + load = { + src = ./hardwareProfiles; type = "nixosProfiles"; - #src = ./nixvim/profiles; - #inputs = { inherit inputs cell; }; }; - nixvimModules = { - #src = ./nixvim/modules; - src = ./nixvimModules; - type = "nixosModules"; - inputs = { inherit inputs cell; }; - }; - nixvimSuites = { - src = ./nixvimSuites; - #src = ./nixvim/suites; + }; + hardwareSuites = pops.nixosProfiles.addLoadExtender { + load = { + src = ./hardwareSuites; type = "nixosProfilesOmnibus"; inputs = { inherit inputs cell; }; }; - - lib = inputs.omnibus.pops.load { - src = ./lib; - loader = inputs.haumea.lib.loaders.default; - inputs = { inherit inputs cell; }; - }; - }) -{ - #} - - diskoConfigurations = { - src = ./diskoConfigurations; - inputs = { inherit inputs cell; }; }; - homeConfigurations = { + + # --- Home Manager ------------------------------------------- + homeConfigurations = pops.load { + #homeConfigurations = pops.nixosProfiles.addLoadExtender { + #homeConfigurations = pops.homeProfiles.addLoadExtender { + # load = { src = ./homeConfigurations; + #type = "nixosProfiles"; + #loader = [ inputs.haumea.lib.matchers.nix inputs.haumea.lib.loaders.scoped ]; + transformer = inputs.haumea.lib.transformers.liftDefault; inputs = { inherit inputs cell; }; + #}; + }; + homeModules = { src = ./homeModules; }; + homeProfiles = { + src = ./homeProfiles; + #loader = with inputs.haumea.lib; [ matchers.nix loaders.scoped ]; + type = "nixosProfiles"; + #inputs = { inherit inputs cell; }; + #transformer = inputs.haumea.lib.transformers.liftDefault; + }; + homeSuites = pops.homeProfiles.addLoadExtender { + load = { + src = ./homeSuites; + type = "nixosProfiles"; + inputs = { inherit inputs cell; }; + }; # type = "nixosProfilesOmnibus"; }; - #homeModules = { - # src = ./homeModules; - # inputs = { inherit inputs cell; }; - #}; - #homeSuites = { - # src = ./homeSuites; - # inputs = { inherit inputs cell; }; - #}; + # --- NixOS ------------------------------------------- nixosConfigurations = { src = ./nixosConfigurations; inputs = { inherit inputs cell; }; }; + nixosModules = { src = ./nixosModules; }; + nixosProfiles = { + src = ./nixosProfiles; + type = "nixosProfiles"; + }; + nixosSuites = pops.nixosProfiles.addLoadExtender { + load = { + src = ./nixosSuites; + type = "nixosProfilesOmnibus"; + }; + }; - nixvimConfigurations = { - src = ./nixvimConfigurations; - inputs = { inherit inputs cell; }; + # --- Nixvim ------------------------------------------- + #nixvimConfigurations = { + # src = ./nixvimConfigurations; + # inputs = { inherit inputs cell; }; + #}; + nixvimProfiles = pops.nixosProfiles.addLoadExtender { + load = { + # src = ./nixvim/profiles; inputs = { inherit inputs cell; }; + src = ./nixvimProfiles; + type = "nixosProfiles"; + }; + }; + nixvimModules = inputs.omnibus.pops.nixosModules.load { + src = ./nixvimModules; + type = "nixosModules"; + }; + nixvimSuites = pops.nixosProfiles.addLoadExtender { + load = { + src = ./nixvimSuites; + type = "nixosProfilesOmnibus"; + }; }; } +# +# +# --- OLD ATTEMPT ------------------------------------------ ## Attr args should match that of Haumea load +# #omnibusStd.mkBlocks.pops commonArgs ({ #configs = { src = cellsFrom + /${cellName}/configs; }; #containers = { src = cellsFrom + /${cellName}/configs; }; #data = { src = cellsFrom' + /${cellName}/data; }; +#lib = { src = cellsFrom + /${cellName}/lib; }; +#pops = { src = cellsFrom + /${cellName}/pops; }; +#shells = { src = cellsFrom /${cellName}/shells; }; +# +#robotnixConfigurations = { src = cellsFrom + /${cellName}/robotnixConfigurations; }; +#robotnixModules = { src = cellsFrom + /${cellName}/robotnixModules; }; +#robotnixProfiles = { src = cellsFrom + /${cellName}/robotnixProfiles; }; # -##devshells = { src = cellsFrom + /${cellName}/devshellModules; }; -##devshellModules = { src = cellsFrom + /${cellName}/devshellModules; }; +#devshells = { src = cellsFrom + /${cellName}/devshellModules; }; +#devshellModules = { src = cellsFrom + /${cellName}/devshellModules; }; #devshellProfiles = { # src = cellsFrom + /${cellName}/devshellProfiles; # inputs.inputs = { inherit (inputs.std.inputs) devshell; }; #}; # -##diskoConfigurations = { src = cellsFrom + /${cellName}/diskoConfigurations; }; -##diskoModules = { src = cellsFrom + /${cellName}/diskoModules; }; -##diskoProfiles = { src = cellsFrom + /${cellName}/diskoProfiles; }; -# -##lib = { src = cellsFrom + /${cellName}/lib; }; -# -##nixosConfigurations = { src = cellsFrom + /${cellName}/nixosConfigurations; }; -##nixosModules = { src = cellsFrom + /${cellName}/nixosModules; }; -##nixosProfiles = { src = cellsFrom + /${cellName}/nixosProfiles; }; -# -##nixvimConfigurations = { src = cellsFrom + /${cellName}/nixvimConfigurations; }; -##nixvimModules = { src = cellsFrom + /${cellName}/nixvimModules; }; -##nixvimProfiles = { src = cellsFrom + /${cellName}/nixvimProfiles; }; -# #packages = { # src = cellsFrom + /${cellName}/packages; # debug = true; # inputs.inputs = { inherit (inputs) nixpkgs; }; #}; -#pops = { -# src = cellsFrom + /${cellName}/pops; +#scripts = { +# src = cellsFrom + /${cellName}/scripts; +# inputs.inputs = { makesSrc = inputs.std.inputs.makes; }; +#}; +#tasks = { +# src = cellsFrom + /${cellName}/tasks; +# inputs.inputs = { makesSrc = inputs.std.inputs.makes; }; +#}; +#} // _pops) +# # -# #robotnixConfigurations = { src = cellsFrom + /${cellName}/robotnixConfigurations; }; -# #robotnixModules = { src = cellsFrom + /${cellName}/robotnixModules; }; -# #robotnixProfiles = { src = cellsFrom + /${cellName}/robotnixProfiles; }; +# --- HELPER LIBRARY --------------------------------------- # -# scripts = { -# src = cellsFrom + /${cellName}/scripts; -# inputs.inputs = { makesSrc = inputs.std.inputs.makes; }; +#configTypes = [ "devshell" "disko" "flake" "hardware" "homeManager" "nixondroid" "nixos" "nixvim" "robotnix" ]; +#mkConfigTypes = t: { +# "${t}Configurations" = { +# src = cellsFrom + /${cellName}/${t}Configurations; +# }; +# "${t}Modules" = { +# src = cellsFrom + /${cellName}/${t}Modules; # }; -# shells = { -# src = cellsFrom /${cellName}/shells; -# tasks = { -# src = cellsFrom + /${cellName}/tasks; -# inputs.inputs = { makesSrc = inputs.std.inputs.makes; }; -# }; -# } // _pops) +# "${t}Profiles" = { +# src = cellsFrom + /${cellName}/${t}Profiles; +# }; +#}; diff --git a/nix/kube/devshellProfiles/helm.nix b/nix/kube/devshellProfiles/helm.nix new file mode 100644 index 00000000..852932bc --- /dev/null +++ b/nix/kube/devshellProfiles/helm.nix @@ -0,0 +1,60 @@ +{ inputs, cell, config, lib, pkgs, ... }: { + imports = [ ]; + motd = lib.mkForce '' + {200} Hello! Welcome to the Helm devShell! {reset} + ''; + env = [ ]; + packages = with inputs.kubenix.packages.${pkgs.system}; [ + docs + generate-istio + generate-k8s + (pkgs.wrapHelm pkgs.kubernetes-helm { + plugins = [ + pkgs.kubernetes-helmPlugins.helm-cm-push + pkgs.kubernetes-helmPlugins.helm-diff + pkgs.kubernetes-helmPlugins.helm-git + pkgs.kubernetes-helmPlugins.helm-s3 + pkgs.kubernetes-helmPlugins.helm-secrets + pkgs.kubernetes-helmPlugins.helm-unittest + ]; + }) + pkgs.kubectl + pkgs.kubeadm + pkgs.k9s + pkgs.gitFull + pkgs.onefetch + ]; + devshell.startup = { + aaa-begin = { + deps = [ ]; + text = "echo 'Welcome to the Helm devShell!'"; + }; + onefetch = { + deps = [ "aaa-begin" ]; + # --no-merges --no-bots + text = '' + ${lib.getExe pkgs.onefetch} \ + --no-color-palette \ + --email \ + --include-hidden \ + --number-of-file-churns 8 \ + --number-separator comma \ + --type programming markup prose data + ''; + }; + }; + commands = [ + { + category = "Helm"; + name = "helm-repo-update"; + help = "Update Helm repositories"; + command = "${lib.getExe pkgs.kubernetes-helm} repo update"; + } + { + category = "Management"; + name = "k9s"; + help = "Interactive TUI for kubectl"; + command = "${lib.getExe pkgs.k9s}"; + } + ]; +} diff --git a/nix/kube/nixosModules.nix b/nix/kube/nixosModules.nix new file mode 100644 index 00000000..3f465d3d --- /dev/null +++ b/nix/kube/nixosModules.nix @@ -0,0 +1 @@ +{inputs, cell}: cell.pops.nixosModules.exports.default diff --git a/nix/kube/nixosModules/k3s.nix b/nix/kube/nixosModules/k3s/default.nix similarity index 100% rename from nix/kube/nixosModules/k3s.nix rename to nix/kube/nixosModules/k3s/default.nix diff --git a/nix/kube/nixosProfiles/k3s.nix b/nix/kube/nixosProfiles/k3s.nix new file mode 100644 index 00000000..585ac6b6 --- /dev/null +++ b/nix/kube/nixosProfiles/k3s.nix @@ -0,0 +1,94 @@ +{ + inputs, + self, + config, + lib, + pkgs, + ... +}: let + module-name = "k3s-profile"; + cfg = config.${module-name}; + secret-mgr = "sops"; + config-files = { + containerd = "/var/lib/rancher/k3s/agent/etc/containerd/config.toml"; + # Go template w/ config.Node passed to template. + containerd-template = "/var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl"; + etcd-server-ca-crt = "/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt"; + etcd-client-crt = "/var/lib/rancher/k3s/server/tls/etcd/client.crt"; + etcd-client-key = "/var/lib/rancher/k3s/server/tls/etcd/client.key"; + manifests = "/var/lib/rancher/k3s/server/manifests"; + service-env = "/etc/systemd/system/k3s.service.env"; + agent-service-env = "/etc/systemd/system/k3s-agent.service.env"; + }; +in { + imports = []; + + options.${module-name} = { + enable = lib.mkEnableOption module-name; + isMaster = lib.mkOption { + type = lib.types.bool; + description = "Whether this node is a cluster master node."; + default = true; + }; + }; + + config = lib.mkIf cfg.enable { + services.k3s = { + enable = true; + package = pkgs.k3s; + + # Init HA cluster using embedded etcd datastore + clusterInit = cfg.isMaster; + + # File path containing k3s YAML config. Useful when the config is generated. + configPath = null; + + disableAgent = false; + + # File path containing env vars for configuring the k3s service in the format of an EnvironmentFile. See systemd.exec(5) + environmentFile = null; + extraFlags = '' + --no-deploy traefik --cluster-cidr 10.24.0.0/16 + ''; + + role = + if cfg.isMaster + then "server" + else "agent"; + + # See: https://rancher.com/docs/k3s/latest/en/installation/installation-requirements/#networking + serverAddr = lib.mkIf cfg.isMaster ""; # "https://10.0.0.10:6443"; + token = config.sops.secrets.k3s-token.text; + }; + + environment = { + systemPackages = let + script-text = '' + sudo etcdctl version \ + --cacert=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt \ + --cert=/var/lib/rancher/k3s/server/tls/etcd/client.crt \ + --key=/var/lib/rancher/k3s/server/tls/etcd/client.key + ''; + script-text1 = with cfg.sops.secrets; '' + sudo etcdctl version \ + --cacert=${k3s-etcd-server-ca-crt.path} \ + --cert=${k3s-etcd-client-crt.path} \ + --key=${k3s-etcd-client-key.path} + ''; + in [pkgs.etcd (pkgs.writeShellScript "etcdctl-init" script-text)]; + }; + + sops.secrets = { + k3s-token = {}; + k3s-etcd-server-ca-crt = { + path = "/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt"; + }; + k3s-etcd-client-crt = { + path = "/var/lib/rancher/k3s/server/tls/etcd/client.crt"; + }; + k3s-etcd-client-key = { + path = "/var/lib/rancher/k3s/server/tls/etcd/client.key"; + }; + }; + }; +} diff --git a/nix/kube/pops.nix b/nix/kube/pops.nix index d7ddff7f..969f0778 100644 --- a/nix/kube/pops.nix +++ b/nix/kube/pops.nix @@ -1,8 +1,12 @@ { inputs, cell, }@commonArgs: let inherit (inputs) omnibusStd; in omnibusStd.mkBlocks.pops commonArgs { - configs = { src = ./configs; }; + #configs = { src = ./configs; }; devshellProfiles = { src = ./devshellProfiles; }; - nixosProfiles = { src = ./nixosProfiles; }; + nixosModules = { src = ./nixosModules; }; + nixosProfiles = { + src = ./nixosProfiles; + type = "nixosProfiles"; + }; shells = { src = ./shells; }; } diff --git a/nix/repo/configs/Readme.md b/nix/repo/configs/Readme.md new file mode 100644 index 00000000..e6f1dc08 --- /dev/null +++ b/nix/repo/configs/Readme.md @@ -0,0 +1,11 @@ +# Repo: Nixago Configs + +Nixago generates config files. +Nixago config definitons here will generate the config files for this repo. + +## To-Do + +- [ ] Remove `./default.nix` +- [ ] Create wrapper that adds attrs to Nixago configs: `meta.*` +- [ ] Rename `./configs` to `./nixago` to avoid confusion. + diff --git a/nix/repo/configs/conform.nix b/nix/repo/configs/conform.nix index d707082c..3ced4001 100644 --- a/nix/repo/configs/conform.nix +++ b/nix/repo/configs/conform.nix @@ -1,11 +1,9 @@ -{ - inputs, - cell, -}: +{ inputs, cell, }: { meta = rec { homepage = "https://github.com/siderolabs/conform"; - description = "siderolabs/conform: Tool to enforce policies on your commits."; + description = + "siderolabs/conform: Tool to enforce policies on your commits."; longDescription = '' **${description}** @@ -15,8 +13,7 @@ blockType: `nixago` ''; }; -} -// (inputs.std.lib.dev.mkNixago inputs.std.data.configs.conform { +} // (inputs.std.lib.dev.mkNixago inputs.std.data.configs.conform { # TODO: Find all options. data = { # TODO: What does this do? diff --git a/nix/repo/pkgs.nix b/nix/repo/pkgs.nix new file mode 100644 index 00000000..16cbc312 --- /dev/null +++ b/nix/repo/pkgs.nix @@ -0,0 +1,28 @@ +{ inputs, cell, }: +#cell.pops.pkgs.exports.default +{ + nixpkgs-master = + #{ inputs, cell, }: + import inputs.nixpkgs-master { inherit (inputs.nixpkgs) system; }; + nixpkgs-unstable = + #{ inputs, cell, }: + import inputs.nixpkgs-unstable { inherit (inputs.nixpkgs) system; }; + nixpkgs-stable = + #{ inputs, cell, }: + import inputs.nixpkgs-stable { inherit (inputs.nixpkgs) system; }; + nixpkgs-staging = + #{ inputs, cell, }: + import inputs.nixpkgs-staging { inherit (inputs.nixpkgs) system; }; + nixpkgs-staging-next = + #{ inputs, cell, }: + import inputs.nixpkgs-staging-next { inherit (inputs.nixpkgs) system; }; + nixpkgs-darwin = + #{ inputs, cell, }: + import inputs.nixpkgs-darwin { inherit (inputs.nixpkgs) system; }; + nixos-stable = + #{ inputs, cell, }: + import inputs.nixos-stable { inherit (inputs.nixpkgs) system; }; + nixos-unstable = + #{ inputs, cell, }: + import inputs.nixos-unstable { inherit (inputs.nixpkgs) system; }; +} diff --git a/nix/test/jupyenv.nix b/nix/test/jupyenv.nix deleted file mode 100644 index 59fb65b9..00000000 --- a/nix/test/jupyenv.nix +++ /dev/null @@ -1 +0,0 @@ -{inputs, cell}: cell.pops.jupyenv.exports.default diff --git a/nix/test/pops.nix b/nix/test/pops.nix index 2ebbc4c1..823a432e 100644 --- a/nix/test/pops.nix +++ b/nix/test/pops.nix @@ -1,18 +1,16 @@ { inputs, cell, }@commonArgs: inputs.omnibusStd.mkBlocks.pops commonArgs { configs = { src = ./configs; }; - devshellProfiles = { src = ./devshellProfiles; }; - packages = { src = ./packages; }; - shells = { src = ./shells; }; - data = { src = ./data; }; + devshellProfiles = { src = ./devshellProfiles; }; #jupyenv = { src = ./jupyenv; }; - #scripts = { src = ./scripts; }; - #tasks = { src = ./tasks; }; - nixosModules = { src = ./nixosModules; }; nixosProfiles = { src = ./nixosProfiles; type = "nixosProfiles"; }; + packages = { src = ./packages; }; + #scripts = { src = ./scripts; }; + shells = { src = ./shells; }; + #tasks = { src = ./tasks; }; } diff --git a/nix/test/scripts.nix b/nix/test/scripts.nix deleted file mode 100644 index f437c6c2..00000000 --- a/nix/test/scripts.nix +++ /dev/null @@ -1 +0,0 @@ -{inputs, cell}: cell.pops.scripts.exports.default diff --git a/nix/test/tasks.nix b/nix/test/tasks.nix deleted file mode 100644 index a6d0d763..00000000 --- a/nix/test/tasks.nix +++ /dev/null @@ -1 +0,0 @@ -{inputs, cell}: cell.pops.tasks.exports.default diff --git a/profiles/std/android.nix b/profiles/std/android.nix new file mode 100644 index 00000000..67067824 --- /dev/null +++ b/profiles/std/android.nix @@ -0,0 +1,13 @@ +{ inputs, ... }: { + std.harvest = { + #devShells = [ [ "android" "shells" ] ]; + packages = [ [ "android" "packages" ] ]; + }; + #std.pick = { + # configs = [ [ "android" "configs" ] ]; + # devshellProfiles = [ [ "android" "devshellProfiles" ] ]; + # nixosModules = [ [ "android" "nixosModules" ] ]; + # nixosProfiles = [ [ "android" "nixosProfiles" ] ]; + # popsTester = [ [ "android" "pops" ] ]; + #}; +} diff --git a/profiles/std/default.nix b/profiles/std/default.nix index b0ae2301..361409ff 100644 --- a/profiles/std/default.nix +++ b/profiles/std/default.nix @@ -8,8 +8,15 @@ let }).exports.default; in { - imports = - [ omnibusStd.flakeModule ./hive.nix ./kube.nix ./repo.nix ./test.nix ]; + imports = [ + omnibusStd.flakeModule + ./android.nix + ./hive.nix + ./kube.nix + ./repo.nix + ./test.nix + #./pops.nix + ]; std.std = omnibusStd.mkStandardStd { cellsFrom = ../../nix; @@ -20,6 +27,92 @@ in allowUnfree = true; overlays = [ inputs.nix-vscode-extensions.overlays.default ]; }; + cellBlocks = [ + #(inputs.std.blockTypes.functions "blockTypes") + # + # --- omnibus unused pops --- + # allData, darwinModules, darwinProfiles, devshellModules, + # example, flake, flake-parts, hive, load, microvms, + # overlays, self, srvos, std, systemManagerProfiles + + # --- flake.outputs --- + # checks, hydraJobs, nixConfig, templates + (inputs.std.blockTypes.functions "lib") + (inputs.std.blockTypes.functions "overlays") + (inputs.std.blockTypes.files "templates") + + # --- std missing blockTypes --- + (inputs.std.blockTypes.arion "arion") + (inputs.std.blockTypes.files "files") + (inputs.std.blockTypes.kubectl "kubectl") + (inputs.std.blockTypes.microvms "microvms") + (inputs.std.blockTypes.namaka "namaka") + (inputs.std.blockTypes.nixostests "nixosTests") + (inputs.std.blockTypes.nomad "nomad") + (inputs.std.blockTypes.nvfetcher "nvfetcher") + (inputs.std.blockTypes.pkgs "pkgs") + (inputs.std.blockTypes.terra "terra" + "git@github.com:lehmanator/nix-configs.git") + + # --- config types --- + inputs.hive.blockTypes.colmenaConfigurations + + inputs.hive.blockTypes.darwinConfigurations + (inputs.std.blockTypes.functions "darwinModules") + (inputs.std.blockTypes.functions "darwinProfiles") + (inputs.std.blockTypes.functions "darwinSuites") + + (inputs.std.blockTypes.functions "devshellModules") + (inputs.std.blockTypes.functions "devshellProfiles") + (inputs.std.blockTypes.functions "devshellSuites") + + inputs.hive.blockTypes.diskoConfigurations + (inputs.std.blockTypes.functions "diskoProfiles") + (inputs.std.blockTypes.functions "diskoSuites") + + (inputs.std.blockTypes.functions "flakeModules") + (inputs.std.blockTypes.functions "flakeProfiles") + (inputs.std.blockTypes.functions "flakeSuites") + + (inputs.std.blockTypes.functions "hardwareConfigurations") + (inputs.std.blockTypes.functions "hardwareProfiles") + (inputs.std.blockTypes.functions "hardwareSuites") + + inputs.hive.blockTypes.homeConfigurations + (inputs.std.blockTypes.functions "homeModules") + (inputs.std.blockTypes.functions "homeProfiles") + (inputs.std.blockTypes.functions "homeSuites") + + inputs.hive.blockTypes.nixosConfigurations + (inputs.std.blockTypes.functions "nixosModules") + (inputs.std.blockTypes.functions "nixosProfiles") + (inputs.std.blockTypes.functions "nixosSuites") + + (inputs.std.blockTypes.functions "nixvimConfigurations") + (inputs.std.blockTypes.functions "nixvimModules") + (inputs.std.blockTypes.functions "nixvimProfiles") + (inputs.std.blockTypes.functions "nixvimSuites") + + (inputs.std.blockTypes.functions "robotnixConfigurations") + (inputs.std.blockTypes.functions "robotnixModules") + (inputs.std.blockTypes.functions "robotnixProfiles") + (inputs.std.blockTypes.functions "robotnixSuites") + + (inputs.std.blockTypes.functions "systemManagerConfigurations") + (inputs.std.blockTypes.functions "systemManagerModules") + (inputs.std.blockTypes.functions "systemManagerProfiles") + (inputs.std.blockTypes.functions "systemManagerSuites") + + (inputs.std.blockTypes.functions "termuxConfigurations") + (inputs.std.blockTypes.functions "termuxModules") + (inputs.std.blockTypes.functions "termuxProfiles") + (inputs.std.blockTypes.functions "termuxSuites") + + (inputs.std.blockTypes.functions "wslConfigurations") + (inputs.std.blockTypes.functions "wslModules") + (inputs.std.blockTypes.functions "wslProfiles") + (inputs.std.blockTypes.functions "wslSuites") + ]; }; #std.grow = { diff --git a/profiles/std/hive.nix b/profiles/std/hive.nix index c4a837ab..8825d2e6 100644 --- a/profiles/std/hive.nix +++ b/profiles/std/hive.nix @@ -8,24 +8,49 @@ #}; harvest = { devShells = [ [ "hive" "shells" ] ]; - diskoConfigurations = [ [ "hive" "diskoConfigurations" ] ]; packages = [ [ "hive" "packages" ] ]; + + darwinConfigurations = [ [ "hive" "darwinConfigurations" ] ]; + diskoConfigurations = [ [ "hive" "diskoConfigurations" ] ]; + #homeConfigurations = [ [ "hive" "homeConfigurations" ] ]; + nixosConfigurations = [ [ "hive" "nixosConfigurations" ] ]; }; pick = { + lib = [ [ "hive" "lib" ] ]; + pops = [ [ "hive" "pops" ] ]; + pops-hive = [ [ "hive" "pops" ] ]; + + #devshellConfigurations = [ [ "hive" "devshellConfigurations" ] ]; + #devshellModules = [ [ "hive" "devshellModules" ] ]; + devshellSuites = [ [ "hive" "devshellSuites" ] ]; devshellProfiles = [ [ "hive" "devshellProfiles" ] ]; + + diskoConfigurations = [ [ "hive" "diskoConfigurations" ] ]; diskoProfiles = [ [ "hive" "diskoProfiles" ] ]; + #diskoModules = [ [ "hive" "diskoModules" ] ]; + diskoSuites = [ [ "hive" "diskoSuites" ] ]; - lib = [ [ "hive" "lib" ] ]; - pops = [ [ "hive" "pops" ] ]; + #flakeConfigurations = [ [ "hive" "flakeConfigurations" ] ]; + #flakeModules = [ [ "hive" "flakeModules" ] ]; + #flakeProfiles = [ [ "hive" "flakeProfiles" ] ]; + #flakeSuites = [ [ "hive" "flakeSuites" ] ]; + + #hardwareConfigurations = [ [ "hive" "hardwareConfigurations" ] ]; + #hardwareModules = [ [ "hive" "hardwareModules" ] ]; + hardwareProfiles = [ [ "hive" "hardwareProfiles" ] ]; + hardwareSuites = [ [ "hive" "hardwareSuites" ] ]; + homeConfigurations = [ [ "hive" "homeConfigurations" ] ]; homeModules = [ [ "hive" "homeModules" ] ]; homeProfiles = [ [ "hive" "homeProfiles" ] ]; homeSuites = [ [ "hive" "homeSuites" ] ]; + #nixosConfigurations = [ [ "hive" "nixosConfigurations" ] ]; nixosModules = [ [ "hive" "nixosModules" ] ]; nixosProfiles = [ [ "hive" "nixosProfiles" ] ]; nixosSuites = [ [ "hive" "nixosSuites" ] ]; + #nixvimConfigurations = [ [ "hive" "nixvimConfigurations" ] ]; nixvimModules = [ [ "hive" "nixvimModules" ] ]; nixvimProfiles = [ [ "hive" "nixvimProfiles" ] ]; nixvimSuites = [ [ "hive" "nixvimSuites" ] ]; diff --git a/profiles/std/kube.nix b/profiles/std/kube.nix index 49364732..6ee8dc6a 100644 --- a/profiles/std/kube.nix +++ b/profiles/std/kube.nix @@ -9,11 +9,12 @@ # Pick: Like `harvest` but remove the system for outputs that are system agnostic. pick = { devshellProfiles = [ [ "kube" "devshellProfiles" ] ]; - pops = [ [ "kube" "pops" ] ]; nixosModules = [ [ "kube" "nixosModules" ] ]; nixosProfiles = [ [ "kube" "nixosProfiles" ] ]; - nixosSuites = [ [ "kube" "nixosSuites" ] ]; + #nixosSuites = [ [ "kube" "nixosSuites" ] ]; shells = [ [ "kube" "shells" ] ]; + + pops-kube = [ [ "kube" "pops" ] ]; }; }; } diff --git a/profiles/std/repo.nix b/profiles/std/repo.nix index daab48b9..4f4f5901 100644 --- a/profiles/std/repo.nix +++ b/profiles/std/repo.nix @@ -4,15 +4,17 @@ harvest = { devShells = [ [ "repo" "shells" ] ]; nixago = [ [ "repo" "configs" ] ]; - packages = [ [ "repo" "packages" ] ]; + #packages = [ [ "repo" "packages" ] ]; + nixpkgs = [ [ "repo" "pkgs" ] ]; }; # Pick: Like `harvest` but remove the system for outputs that are system agnostic. pick = { + #nixago = [ [ "repo" "configs" ] ]; devshellProfiles = [ [ "repo" "devshellProfiles" ] ]; - #pops = [ [ "repo" "pops" ] ]; nixosProfiles = [ [ "repo" "nixosProfiles" ] ]; shells = [ [ "repo" "shells" ] ]; + pops-repo = [ [ "repo" "pops" ] ]; }; }; } diff --git a/profiles/std/test.nix b/profiles/std/test.nix index 5a7c0ef8..45fcac1d 100644 --- a/profiles/std/test.nix +++ b/profiles/std/test.nix @@ -5,9 +5,10 @@ }; std.pick = { configs = [ [ "test" "configs" ] ]; + data-repo = [ [ "test" "data" ] ]; devshellProfiles = [ [ "test" "devshellProfiles" ] ]; nixosModules = [ [ "test" "nixosModules" ] ]; nixosProfiles = [ [ "test" "nixosProfiles" ] ]; - popsTester = [ [ "test" "pops" ] ]; + pops-test = [ [ "test" "pops" ] ]; }; }