diff --git a/flake.nix b/flake.nix index e5cb361..ebe2850 100644 --- a/flake.nix +++ b/flake.nix @@ -30,12 +30,21 @@ inherit lib; - templates.default = { - path = ./templates/nixos; - description = "Omnibus & nixos"; - welcomeText = '' - You have created an Omnibus.nixos template! - ''; + templates = { + nixos = { + path = ./templates/nixos; + description = "Omnibus & nixos"; + welcomeText = '' + You have created an Omnibus.nixos template! + ''; + }; + hivebus = { + path = ./templates/hivebus; + description = "Omnibus & hive"; + welcomeText = '' + You have created an hivebus template! + ''; + }; }; } ; diff --git a/templates/hivebus/.envrc b/templates/hivebus/.envrc new file mode 100755 index 0000000..09be40a --- /dev/null +++ b/templates/hivebus/.envrc @@ -0,0 +1,10 @@ +# Disable the automatic menu displaying on every environment reload. +# export DEVSHELL_NO_MOTD=1 +watch_file flakes.nix flake.lock +watch_file ./nix/hive/flake.nix ./nix/hive/flake.lock +# shellcheck disable=SC1090 +source "$(fetchurl "https://raw.githubusercontent.com/gtrunsec/direnv/main/lib" "sha256-tuMA8WGkwcYq9V3MtlN6xdVvKd2YkdEpdK4ZyAN6VDM=")" + +registry="$PRJ_ROOT/nix/hive#__std" + +use envreload //repo/shells/default diff --git a/templates/hivebus/flake.lock b/templates/hivebus/flake.lock new file mode 100644 index 0000000..a9d995f --- /dev/null +++ b/templates/hivebus/flake.lock @@ -0,0 +1,489 @@ +{ + "nodes": { + "POP": { + "inputs": { + "flake-compat": [ + "omnibus", + "flops" + ], + "nixlib": "nixlib_2", + "nixpkgs": [ + "omnibus", + "flops" + ] + }, + "locked": { + "lastModified": 1655410953, + "narHash": "sha256-Er0zdhu7QwpWvVKfauqZqTnxDz6THTWOTVWLoz+Opmw=", + "owner": "divnix", + "repo": "POP", + "rev": "8babe4c9126298d05ebb5ab04727d741b51c022e", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "POP", + "type": "github" + } + }, + "call-flake": { + "locked": { + "lastModified": 1696728032, + "narHash": "sha256-bmhE1TmrJG4ba93l9WQTLuYM53kwGQAjYHRvHOeuxWU=", + "owner": "divnix", + "repo": "call-flake", + "rev": "c4928386ea2065351750992411c6e53f11552397", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "call-flake", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696360011, + "narHash": "sha256-HpPv27qMuPou4acXcZ8Klm7Zt0Elv9dgDvSJaomWb9Y=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "8b6ea26d5d2e8359d06278364f41fbc4b903b28a", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "darwin-unstable": { + "locked": { + "lastModified": 1696303624, + "narHash": "sha256-mL5k0klTRO3/59HCI8U1QujzGsnyL0GtQI+5XABXDNA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4d29250d5b55fe14280906afad7afacd910850b8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696266752, + "narHash": "sha256-wJnMDFM21+xXdsXSs6pXMElbv4YfqmQslcPApRuaYKs=", + "owner": "nix-community", + "repo": "disko", + "rev": "646ee25c25fffee122a66282861f5f56ad3e0fd9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "dmerge": { + "inputs": { + "haumea": [ + "omnibus", + "flops", + "haumea" + ], + "nixlib": [ + "omnibus", + "flops", + "nixlib" + ], + "yants": [ + "omnibus", + "flops", + "yants" + ] + }, + "locked": { + "lastModified": 1686862774, + "narHash": "sha256-ojGtRQ9pIOUrxsQEuEPerUkqIJEuod9hIflfNkY+9CE=", + "owner": "divnix", + "repo": "dmerge", + "rev": "9f7f7a8349d33d7bd02e0f2b484b1f076e503a96", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "dmerge", + "type": "github" + } + }, + "flops": { + "inputs": { + "POP": "POP", + "call-flake": "call-flake", + "dmerge": "dmerge", + "haumea": "haumea", + "nixlib": "nixlib_3", + "yants": "yants" + }, + "locked": { + "lastModified": 1697524403, + "narHash": "sha256-s9xi3msMYedaTY5hojT48XJSakvrsX8qrmfPEsg1Gao=", + "owner": "gtrunsec", + "repo": "flops", + "rev": "8e985bcff0f9fbdacb1cc2fdc08c3a7c4823c880", + "type": "github" + }, + "original": { + "owner": "gtrunsec", + "repo": "flops", + "type": "github" + } + }, + "haumea": { + "inputs": { + "nixpkgs": [ + "omnibus", + "flops", + "nixlib" + ] + }, + "locked": { + "lastModified": 1696529440, + "narHash": "sha256-bjWiVgh0zrd3dVb1rb5ODC5UY3tnhs2idbhDBc0ETbI=", + "owner": "nix-community", + "repo": "haumea", + "rev": "d9ec6a90764ddec918ef441e8b83d6aebae9226f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "haumea", + "type": "github" + } + }, + "home": { + "inputs": { + "nixpkgs": [ + "nixos" + ] + }, + "locked": { + "lastModified": 1696349083, + "narHash": "sha256-hs7GLezeY40EQpZSYYhfgcKhAogF3MBYKWZ1o+Bxrog=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "55ce64c3ca031eefb1adac85bb0025887ed7a221", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-23-05": { + "inputs": { + "nixpkgs": [ + "nixos-23-05" + ] + }, + "locked": { + "lastModified": 1695108154, + "narHash": "sha256-gSg7UTVtls2yO9lKtP0yb66XBHT1Fx5qZSZbGMpSn2c=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "07682fff75d41f18327a871088d20af2710d4744", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixlib": { + "locked": { + "lastModified": 1693701915, + "narHash": "sha256-waHPLdDYUOHSEtMKKabcKIMhlUOHPOOPQ9UyFeEoovs=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "f5af57d3ef9947a70ac86e42695231ac1ad00c25", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixlib_2": { + "locked": { + "lastModified": 1653180592, + "narHash": "sha256-sVGwmxTj7CY1D4ioy7E+iJE+1/yHqQlxjnTpar3ap/E=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "42c5f5785b70cd64b4afd830dc31d0b08461abd5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixlib_3": { + "locked": { + "lastModified": 1696726172, + "narHash": "sha256-89yxFXzTA7JRyWo6hg7SD4DlS/ejYt8Y8IvGZHbSWsg=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "59da6ac0c02c48aa92dee37057f978412797db2a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-23-05": { + "locked": { + "lastModified": 1696323343, + "narHash": "sha256-u7WLUrh5eb+6SBYwtkaGL2ryHpLcHzmLml+a+VqKJWE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3b79cc4bcd9c09b5aa68ea1957c25e437dc6bc58", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1696058303, + "narHash": "sha256-eNqKWpF5zG0SrgbbtljFOrRgFgRzCc4++TMFADBMLnc=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "150f38bd1e09e20987feacb1b0d5991357532fb5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1696161939, + "narHash": "sha256-HI1DxS//s46/qv9dcW06TzXaBjxL2DVTQP8R1QsnHzM=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "0ab3ee718e964fb42dc57ace6170f19cb0b66532", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixos-unstable": { + "locked": { + "lastModified": 1696303624, + "narHash": "sha256-mL5k0klTRO3/59HCI8U1QujzGsnyL0GtQI+5XABXDNA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4d29250d5b55fe14280906afad7afacd910850b8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1693714546, + "narHash": "sha256-3EMJZeGSZT6pD1eNwI/6Yc0R4rxklNvJ2SDFcsCnjpM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d816b5ab44187a2dd84806630ce77a733724f95f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-master": { + "locked": { + "lastModified": 1696365960, + "narHash": "sha256-TB688i3MeK5TcxXvkLOPh1NX88CmtvK54+x9GpsAiTU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "28562b6c75906da822189e6f93bf45768dc04ee6", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1697009197, + "narHash": "sha256-viVRhBTFT8fPJTb1N3brQIpFZnttmwo3JVKNuWRVc3s=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "01441e14af5e29c9d27ace398e6dd0b293e25a54", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1660438583, + "narHash": "sha256-rJUTYxFKlWUJI3njAwEc1pKAVooAViZGJvsgqfh/q/E=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "bbd8f7cd87d0b29294ef3072ffdbd61d60f05da4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "omnibus": { + "inputs": { + "POP": [ + "omnibus", + "flops", + "POP" + ], + "flops": "flops", + "haumea": [ + "omnibus", + "flops", + "haumea" + ] + }, + "locked": { + "lastModified": 1697527137, + "narHash": "sha256-dtoK7XELC939mhO7BRAZA7t0gaJW/M3KXpoybs+SrM0=", + "owner": "gtrunsec", + "repo": "omnibus", + "rev": "d37cbf233c7f84ade00dc9a96dee596043cd2ccd", + "type": "github" + }, + "original": { + "owner": "gtrunsec", + "repo": "omnibus", + "type": "github" + } + }, + "root": { + "inputs": { + "darwin": "darwin", + "darwin-unstable": "darwin-unstable", + "disko": "disko", + "flops": [ + "omnibus", + "flops" + ], + "haumea": [ + "omnibus", + "flops", + "haumea" + ], + "home": "home", + "home-23-05": "home-23-05", + "nixos": [ + "nixos-unstable" + ], + "nixos-23-05": "nixos-23-05", + "nixos-generators": "nixos-generators", + "nixos-hardware": "nixos-hardware", + "nixos-unstable": "nixos-unstable", + "nixpkgs": "nixpkgs_2", + "nixpkgs-master": "nixpkgs-master", + "omnibus": "omnibus", + "srvos": "srvos" + } + }, + "srvos": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696209841, + "narHash": "sha256-n9yIqmLwV7HPF3qiMzS5hWTVftEP6fEGEpoIHSEt/4I=", + "owner": "numtide", + "repo": "srvos", + "rev": "1541a2538a4e7bf94ff6e4adbbc8e47e98b8412d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "srvos", + "type": "github" + } + }, + "yants": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1686863218, + "narHash": "sha256-kooxYm3/3ornWtVBNHM3Zh020gACUyFX2G0VQXnB+mk=", + "owner": "divnix", + "repo": "yants", + "rev": "8f0da0dba57149676aa4817ec0c880fbde7a648d", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "yants", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/templates/hivebus/flake.nix b/templates/hivebus/flake.nix new file mode 100644 index 0000000..d3619a2 --- /dev/null +++ b/templates/hivebus/flake.nix @@ -0,0 +1,56 @@ +{ + inputs = { + nixos-generators.url = "github:nix-community/nixos-generators"; + nixos-hardware.url = "github:nixos/nixos-hardware"; + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; + + srvos.url = "github:numtide/srvos"; + srvos.inputs.nixpkgs.follows = "nixpkgs"; + + omnibus.url = "github:gtrunsec/omnibus"; + haumea.follows = "omnibus/flops/haumea"; + flops.follows = "omnibus/flops"; + }; + + # nixpkgs & home-manager + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nixpkgs-master.url = "github:nixos/nixpkgs"; + + darwin.url = "github:LnL7/nix-darwin"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; + + nixos.follows = "nixos-unstable"; + + darwin-unstable.url = "github:nixos/nixpkgs/nixos-unstable-small"; + nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable-small"; + + nixos-23-05.url = "github:nixos/nixpkgs/release-23.05"; + + home-23-05.url = "github:nix-community/home-manager/release-23.05"; + home-23-05.inputs.nixpkgs.follows = "nixos-23-05"; + + home.url = "github:nix-community/home-manager"; + home.inputs.nixpkgs.follows = "nixos"; + }; + + outputs = + { self, ... }@inputs: + let + eachSystem = inputs.nixpkgs.lib.genAttrs [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + "aarch64-darwin" + ]; + libPops = import ./nix/lib/__init.nix { inherit inputs eachSystem; }; + lib = libPops.layouts.default; + in + lib.exporter.flakeOutputs + // { + inherit lib; + pops = lib.exporter.pops; + } + ; +} diff --git a/templates/hivebus/local/data/env.toml b/templates/hivebus/local/data/env.toml new file mode 100644 index 0000000..90dbce2 --- /dev/null +++ b/templates/hivebus/local/data/env.toml @@ -0,0 +1,3 @@ +[nixos] +profile = "omnibus" +maintainer = "gtrunsec" diff --git a/templates/hivebus/local/data/personal.yaml b/templates/hivebus/local/data/personal.yaml new file mode 100644 index 0000000..043c496 --- /dev/null +++ b/templates/hivebus/local/data/personal.yaml @@ -0,0 +1,2 @@ +ssh: + public-key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDLxc7EBr1Qi4M65O1KjXZf4bOBZMQ6YeDSFYzKzFan7 Desktop-guangtao-03-02-2023 diff --git a/templates/hivebus/local/secrets/age/test.age b/templates/hivebus/local/secrets/age/test.age new file mode 100644 index 0000000..1cd89bb --- /dev/null +++ b/templates/hivebus/local/secrets/age/test.age @@ -0,0 +1 @@ +plaintext diff --git a/templates/hivebus/local/secrets/sops/plaintext.yaml b/templates/hivebus/local/secrets/sops/plaintext.yaml new file mode 100644 index 0000000..51e3d55 --- /dev/null +++ b/templates/hivebus/local/secrets/sops/plaintext.yaml @@ -0,0 +1 @@ +test: xxx diff --git a/templates/hivebus/nix/hive/cells/hosts/darwinConfigurations.nix b/templates/hivebus/nix/hive/cells/hosts/darwinConfigurations.nix new file mode 100644 index 0000000..c164116 --- /dev/null +++ b/templates/hivebus/nix/hive/cells/hosts/darwinConfigurations.nix @@ -0,0 +1,10 @@ +{ inputs, cell }: +let + inherit (inputs.nixpkgs) lib; + layouts = lib.pipe inputs.repo.lib.exporter.hosts [ + (lib.mapAttrs (_: v: v.layouts)) + ]; +in +{ + example-darwin = layouts.darwin.hive; +} diff --git a/templates/hivebus/nix/hive/cells/hosts/nixosConfigurations.nix b/templates/hivebus/nix/hive/cells/hosts/nixosConfigurations.nix new file mode 100644 index 0000000..ff026e5 --- /dev/null +++ b/templates/hivebus/nix/hive/cells/hosts/nixosConfigurations.nix @@ -0,0 +1,10 @@ +{ inputs, cell }: +let + inherit (inputs.nixpkgs) lib; + layouts = lib.pipe inputs.repo.lib.exporter.hosts [ + (lib.mapAttrs (_: v: v.layouts)) + ]; +in +{ + example = layouts.nixos.hive; +} diff --git a/templates/hivebus/nix/hive/cells/repo/configs.nix b/templates/hivebus/nix/hive/cells/repo/configs.nix new file mode 100755 index 0000000..0a97a12 --- /dev/null +++ b/templates/hivebus/nix/hive/cells/repo/configs.nix @@ -0,0 +1,22 @@ +/* This file holds configuration data for repo dotfiles. + + Q: Why not just put the put the file there? + + A: (1) dotfile proliferation + (2) have all the things in one place / fromat + (3) potentially share / re-use configuration data - keeping it in sync +*/ +{ inputs, cell }: +with inputs.std.inputs.dmerge; { + conform.data = { + commit.conventional.scopes = append [ + "nixosModules" + "nixosProfiles" + "homeProfiles" + "homeModules" + "darwinModules" + "darwinProfiles" + ".*." + ]; + }; +} diff --git a/templates/hivebus/nix/hive/cells/repo/lib.nix b/templates/hivebus/nix/hive/cells/repo/lib.nix new file mode 100644 index 0000000..a449723 --- /dev/null +++ b/templates/hivebus/nix/hive/cells/repo/lib.nix @@ -0,0 +1,8 @@ +{ inputs, cell }: +let + inherit (inputs) nixpkgs; + __inputs__ = (inputs.repo.flake.setSystem nixpkgs.system).inputs; +in +{ + inherit __inputs__; +} diff --git a/templates/hivebus/nix/hive/cells/repo/shells.nix b/templates/hivebus/nix/hive/cells/repo/shells.nix new file mode 100755 index 0000000..7b818d0 --- /dev/null +++ b/templates/hivebus/nix/hive/cells/repo/shells.nix @@ -0,0 +1,30 @@ +/* This file holds reproducible shells with commands in them. + + They conveniently also generate config files in their startup hook. +*/ +{ inputs, cell }: +let + inherit (inputs.std) lib; + inherit (inputs) nixpkgs; +in +{ + # Tool Homepage: https://numtide.github.io/devshell/ + default = lib.dev.mkShell { + name = "hivebus"; + + # imports = [ devshellProfiles.rust ]; + # Tool Homepage: https://nix-community.github.io/nixago/ + # This is Standard's devshell integration. + # It runs the startup hook when entering the shell. + nixago = + [ + # (inputs.std-ext.presets.nixago.conform cell.configs.conform) + # (inputs.std-ext.presets.nixago.treefmt) + # (inputs.std-ext.presets.nixago.lefthook) + ]; + + packages = [ ]; + + commands = [ ]; + }; +} diff --git a/templates/hivebus/nix/hive/flake.lock b/templates/hivebus/nix/hive/flake.lock new file mode 100644 index 0000000..a0cf482 --- /dev/null +++ b/templates/hivebus/nix/hive/flake.lock @@ -0,0 +1,568 @@ +{ + "nodes": { + "blank": { + "locked": { + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, + "call-flake": { + "locked": { + "lastModified": 1697332845, + "narHash": "sha256-bmhE1TmrJG4ba93l9WQTLuYM53kwGQAjYHRvHOeuxWU=", + "owner": "divnix", + "repo": "call-flake", + "rev": "088f8589c7f3ee59bea1858a89f5125d284c3c4a", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "call-flake", + "type": "github" + } + }, + "call-flake_2": { + "locked": { + "lastModified": 1687380775, + "narHash": "sha256-bmhE1TmrJG4ba93l9WQTLuYM53kwGQAjYHRvHOeuxWU=", + "owner": "divnix", + "repo": "call-flake", + "rev": "74061f6c241227cd05e79b702db9a300a2e4131a", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "call-flake", + "type": "github" + } + }, + "call-flake_3": { + "locked": { + "lastModified": 1687380775, + "narHash": "sha256-bmhE1TmrJG4ba93l9WQTLuYM53kwGQAjYHRvHOeuxWU=", + "owner": "divnix", + "repo": "call-flake", + "rev": "74061f6c241227cd05e79b702db9a300a2e4131a", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "call-flake", + "type": "github" + } + }, + "colmena": { + "locked": { + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, + "devshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1695973661, + "narHash": "sha256-BP2H4c42GThPIhERtTpV1yCtwQHYHEKdRu7pjrmQAwo=", + "owner": "numtide", + "repo": "devshell", + "rev": "cd4e2fda3150dd2f689caeac07b7f47df5197c31", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "devshell_2": { + "inputs": { + "nixpkgs": [ + "hive", + "nixpkgs" + ], + "systems": "systems_2" + }, + "locked": { + "lastModified": 1695973661, + "narHash": "sha256-BP2H4c42GThPIhERtTpV1yCtwQHYHEKdRu7pjrmQAwo=", + "owner": "numtide", + "repo": "devshell", + "rev": "cd4e2fda3150dd2f689caeac07b7f47df5197c31", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "dmerge": { + "inputs": { + "haumea": [ + "std", + "haumea" + ], + "nixlib": [ + "std", + "lib" + ], + "yants": [ + "std", + "yants" + ] + }, + "locked": { + "lastModified": 1686862774, + "narHash": "sha256-ojGtRQ9pIOUrxsQEuEPerUkqIJEuod9hIflfNkY+9CE=", + "owner": "divnix", + "repo": "dmerge", + "rev": "9f7f7a8349d33d7bd02e0f2b484b1f076e503a96", + "type": "github" + }, + "original": { + "owner": "divnix", + "ref": "0.2.1", + "repo": "dmerge", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "haumea": { + "inputs": { + "nixpkgs": [ + "std", + "lib" + ] + }, + "locked": { + "lastModified": 1685133229, + "narHash": "sha256-FePm/Gi9PBSNwiDFq3N+DWdfxFq0UKsVVTJS3cQPn94=", + "owner": "nix-community", + "repo": "haumea", + "rev": "34dd58385092a23018748b50f9b23de6266dffc2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "v0.2.2", + "repo": "haumea", + "type": "github" + } + }, + "hive": { + "inputs": { + "colmena": "colmena", + "devshell": "devshell_2", + "nixago": "nixago", + "nixpkgs": [ + "nixpkgs" + ], + "paisano": [ + "paisano" + ], + "std": [ + "std" + ] + }, + "locked": { + "lastModified": 1697493780, + "narHash": "sha256-vVGbhwlGjPI1RgtUK6Z+MqdL6sKWt5QLL5UdhpFXjkI=", + "owner": "divnix", + "repo": "hive", + "rev": "05facc4307d7aca173e46825f572bca72ea0c775", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "hive", + "type": "github" + } + }, + "incl": { + "inputs": { + "nixlib": [ + "std", + "lib" + ] + }, + "locked": { + "lastModified": 1669263024, + "narHash": "sha256-E/+23NKtxAqYG/0ydYgxlgarKnxmDbg6rCMWnOBqn9Q=", + "owner": "divnix", + "repo": "incl", + "rev": "ce7bebaee048e4cd7ebdb4cee7885e00c4e2abca", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "incl", + "type": "github" + } + }, + "lib": { + "locked": { + "lastModified": 1694306727, + "narHash": "sha256-26fkTOJOI65NOTNKFvtcJF9mzzf/kK9swHzfYt1Dl6Q=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "c30b6a84c0b84ec7aecbe74466033facc9ed103f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixago": { + "inputs": { + "flake-utils": "flake-utils", + "nixago-exts": [ + "hive" + ], + "nixpkgs": [ + "hive", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687381756, + "narHash": "sha256-IUMIlYfrvj7Yli4H2vvyig8HEPpfCeMaE6+kBGPzFyk=", + "owner": "nix-community", + "repo": "nixago", + "rev": "dacceb10cace103b3e66552ec9719fa0d33c0dc9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixago", + "type": "github" + } + }, + "nixago_2": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixago-exts": [], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687381756, + "narHash": "sha256-IUMIlYfrvj7Yli4H2vvyig8HEPpfCeMaE6+kBGPzFyk=", + "owner": "nix-community", + "repo": "nixago", + "rev": "dacceb10cace103b3e66552ec9719fa0d33c0dc9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixago", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1697379843, + "narHash": "sha256-RcnGuJgC2K/UpTy+d32piEoBXq2M+nVFzM3ah/ZdJzg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "12bdeb01ff9e2d3917e6a44037ed7df6e6c3df9d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nosys": { + "locked": { + "lastModified": 1668010795, + "narHash": "sha256-JBDVBnos8g0toU7EhIIqQ1If5m/nyBqtHhL3sicdPwI=", + "owner": "divnix", + "repo": "nosys", + "rev": "feade0141487801c71ff55623b421ed535dbdefa", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "nosys", + "type": "github" + } + }, + "nosys_2": { + "locked": { + "lastModified": 1668010795, + "narHash": "sha256-JBDVBnos8g0toU7EhIIqQ1If5m/nyBqtHhL3sicdPwI=", + "owner": "divnix", + "repo": "nosys", + "rev": "feade0141487801c71ff55623b421ed535dbdefa", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "nosys", + "type": "github" + } + }, + "paisano": { + "inputs": { + "call-flake": "call-flake_2", + "nixpkgs": [ + "nixpkgs" + ], + "nosys": "nosys", + "yants": "yants" + }, + "locked": { + "lastModified": 1693982790, + "narHash": "sha256-WTZYlqGUjzzz/PSzcvjEZz2kkwYSXObjeQVrFBaqa2Y=", + "owner": "paisano-nix", + "repo": "core", + "rev": "3e897a19418361ece34841105122ed4f9379ca96", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "repo": "core", + "type": "github" + } + }, + "paisano-tui": { + "flake": false, + "locked": { + "lastModified": 1694014205, + "narHash": "sha256-u0+T6vMznzfjDMUd01ZXQsrQPMEhMjrQwUPTFsPBR1k=", + "owner": "paisano-nix", + "repo": "tui", + "rev": "587ab9fd07bd969d59df73bfe527b5f8a4e752d1", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "ref": "0.2.0", + "repo": "tui", + "type": "github" + } + }, + "paisano_2": { + "inputs": { + "call-flake": "call-flake_3", + "nixpkgs": [ + "std", + "nixpkgs" + ], + "nosys": "nosys_2", + "yants": [ + "std", + "yants" + ] + }, + "locked": { + "lastModified": 1693982790, + "narHash": "sha256-WTZYlqGUjzzz/PSzcvjEZz2kkwYSXObjeQVrFBaqa2Y=", + "owner": "paisano-nix", + "repo": "core", + "rev": "3e897a19418361ece34841105122ed4f9379ca96", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "repo": "core", + "type": "github" + } + }, + "root": { + "inputs": { + "call-flake": "call-flake", + "devshell": "devshell", + "hive": "hive", + "nixago": "nixago_2", + "nixpkgs": "nixpkgs", + "paisano": "paisano", + "std": "std" + } + }, + "std": { + "inputs": { + "arion": [ + "std", + "blank" + ], + "blank": "blank", + "devshell": [ + "devshell" + ], + "dmerge": "dmerge", + "haumea": "haumea", + "incl": "incl", + "lib": "lib", + "makes": [ + "std", + "blank" + ], + "microvm": [ + "std", + "blank" + ], + "n2c": [ + "std", + "blank" + ], + "nixago": [ + "nixago" + ], + "nixpkgs": [ + "nixpkgs" + ], + "paisano": "paisano_2", + "paisano-tui": "paisano-tui", + "terranix": [ + "std", + "blank" + ], + "yants": "yants_2" + }, + "locked": { + "lastModified": 1695893106, + "narHash": "sha256-sUHZO7v65zT8HyQ6gZqp18HX8PgTRIhtX1xSg+/I+7M=", + "owner": "divnix", + "repo": "std", + "rev": "c5d97ddcd1bd33e87a7271ead97464f20f447058", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "std", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "yants": { + "inputs": { + "nixpkgs": [ + "paisano", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1677285314, + "narHash": "sha256-hlAcg2514zKrPu8jn24BUsIjjvXvCLdw1jvKgBTpqko=", + "owner": "divnix", + "repo": "yants", + "rev": "9eab24b273ce021406c852166c216b86e2bb4ec4", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "yants", + "type": "github" + } + }, + "yants_2": { + "inputs": { + "nixpkgs": [ + "std", + "lib" + ] + }, + "locked": { + "lastModified": 1686863218, + "narHash": "sha256-kooxYm3/3ornWtVBNHM3Zh020gACUyFX2G0VQXnB+mk=", + "owner": "divnix", + "repo": "yants", + "rev": "8f0da0dba57149676aa4817ec0c880fbde7a648d", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "yants", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/templates/hivebus/nix/hive/flake.nix b/templates/hivebus/nix/hive/flake.nix new file mode 100644 index 0000000..ad55c3c --- /dev/null +++ b/templates/hivebus/nix/hive/flake.nix @@ -0,0 +1,130 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + std = { + url = "github:divnix/std"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.devshell.follows = "devshell"; + inputs.nixago.follows = "nixago"; + }; + + nixago = { + url = "github:nix-community/nixago"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixago-exts.follows = ""; + }; + + devshell = { + url = "github:numtide/devshell"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + paisano = { + url = "github:paisano-nix/core"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + hive = { + url = "github:divnix/hive"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.paisano.follows = "paisano"; + inputs.std.follows = "std"; + }; + }; + + inputs = { + call-flake.url = "github:divnix/call-flake"; + }; + + outputs = + { + self, + std, + nixpkgs, + hive, + call-flake, + ... + }@inputs: + std.growOn + { + inputs = inputs // { + repo = call-flake ../..; + }; + systems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + + cellsFrom = ./cells; + + cellBlocks = + with std.blockTypes; + with hive.blockTypes; [ + # configurations can be deployed + colmenaConfigurations + homeConfigurations + nixosConfigurations + diskoConfigurations + darwinConfigurations + + (arion "arionConfigurations") + (microvms "microvms") + + # devshells can be entered + (devshells "shells") + + # jobs can be run + (runnables "entrypoints") + (runnables "scripts") + (functions "tasks") + (functions "apps") + + # lib holds shared knowledge made code + (functions "lib") + (data "data") + (functions "configs") + (installables "packages" { ci.build = true; }) + (functions "overlays") + + # nixago part + (nixago "nixago") + + # containers collection + (containers "containers" { ci.publish = true; }) + ]; + } + { + devShells = std.harvest inputs.self [ [ + "repo" + "shells" + ] ]; + } + # soil - the first (and only) layer implements adapters for tooling + { + # tools + colmenaHive = hive.collect self "colmenaConfigurations"; + nixosConfigurations = hive.collect self "nixosConfigurations"; + homeConfigurations = hive.collect self "homeConfigurations"; + darwinConfigurations = hive.collect self "darwinConfigurations"; + diskoConfigurations = hive.collect self "diskoConfigurations"; + }; + # --- Flake Local Nix Configuration ---------------------------- + nixConfig = { + extra-substituters = [ + "https://hyprland.cachix.org" + "https://colmena.cachix.org" + "https://nixpkgs-wayland.cachix.org" + "https://cachix.org/api/v1/cache/emacs" + "https://microvm.cachix.org" + ]; + extra-trusted-public-keys = [ + "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "colmena.cachix.org-1:7BzpDnjjH8ki2CT3f6GdOk7QAzPOl+1t3LvTLXqYcSg=" + "microvm.cachix.org-1:oXnBc6hRE3eX5rSYdRyMYXnfzcCxC7yKPTbZXALsqys=" + ]; + }; +} diff --git a/templates/hivebus/nix/lib/__init.nix b/templates/hivebus/nix/lib/__init.nix new file mode 100644 index 0000000..24321d4 --- /dev/null +++ b/templates/hivebus/nix/lib/__init.nix @@ -0,0 +1,10 @@ +{ inputs, eachSystem }: +(inputs.omnibus.pops.exporter.addLoadExtender { + load = { + src = ./.; + inputs = { + inherit inputs eachSystem; + projectDir = ../..; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/__lock/flake.lock b/templates/hivebus/nix/lib/__lock/flake.lock new file mode 100644 index 0000000..638ff4f --- /dev/null +++ b/templates/hivebus/nix/lib/__lock/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "catppuccin-bat": { + "flake": false, + "locked": { + "lastModified": 1668065083, + "narHash": "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=", + "owner": "catppuccin", + "repo": "bat", + "rev": "ba4d16880d63e656acced2b7d4e034e4a93f74b1", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "bat", + "type": "github" + } + }, + "nix-filter": { + "locked": { + "lastModified": 1694857738, + "narHash": "sha256-bxxNyLHjhu0N8T3REINXQ2ZkJco0ABFPn6PIe2QUfqo=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "41fd48e00c22b4ced525af521ead8792402de0ea", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, + "root": { + "inputs": { + "catppuccin-bat": "catppuccin-bat", + "nix-filter": "nix-filter" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/templates/hivebus/nix/lib/__lock/flake.nix b/templates/hivebus/nix/lib/__lock/flake.nix new file mode 100644 index 0000000..ba2a3d4 --- /dev/null +++ b/templates/hivebus/nix/lib/__lock/flake.nix @@ -0,0 +1,12 @@ +{ + inputs = { + nix-filter = { + url = "github:numtide/nix-filter"; + }; + catppuccin-bat = { + url = "github:catppuccin/bat"; + flake = false; + }; + }; + outputs = _: { }; +} diff --git a/templates/hivebus/nix/lib/exporter/flakeOutputs.nix b/templates/hivebus/nix/lib/exporter/flakeOutputs.nix new file mode 100644 index 0000000..20e0ed4 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/flakeOutputs.nix @@ -0,0 +1,50 @@ +{ + lib, + super, + omnibus, + eachSystem, +}: +let + filterConfigs = + config: + lib.pipe super.hosts [ + (lib.filterAttrs (_: v: v ? "${config}")) + (lib.mapAttrs (_: v: v.${config})) + ]; + inherit (omnibus.lib) mapPopsLayouts; +in +(mapPopsLayouts super.pops) +// { + nixosConfigurations = filterConfigs "nixosConfiguration"; + + darwinConfigurations = filterConfigs "darwinConfiguration"; + + local = eachSystem ( + system: + let + inputs' = (super.pops.flake.setSystem system).inputs; + dataAll = + (super.pops.omnibus.lib.addLoadExtender { load.inputs.inputs = inputs'; }) + .layouts.default.exporter.pops.dataAll; + in + { + data = + (dataAll.addLoadExtender { load.src = projectDir + "/local/data"; }) + .layouts.default; + } + ); + + packages = eachSystem ( + system: + let + inputs = (super.pops.flake.setSystem system).inputs; + in + ( + (flops.haumea.pops.default.setInit { + src = ../../packages; + loader = _: path: inputs.nixpkgs.callPackage path { }; + transformer = [ (_cursor: dir: if dir ? default then dir.default else dir) ]; + }) + ).layouts.default + ); +} diff --git a/templates/hivebus/nix/lib/exporter/hosts.nix b/templates/hivebus/nix/lib/exporter/hosts.nix new file mode 100644 index 0000000..758a22a --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/hosts.nix @@ -0,0 +1,11 @@ +(inputs.omnibus.pops.exporter.addLoadExtender { + load = { + src = inputs.self.outPath + "/units/nixos/hosts"; + inputs = { + inputs = inputs // root.exporter.pops.flake.inputs; + omnibus = inputs.omnibus // { + self = root.omnibus.lib.layouts.default; + }; + }; + }; +}).layouts.default diff --git a/templates/hivebus/nix/lib/exporter/pops/__hostsFun/darwinModules.nix b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/darwinModules.nix new file mode 100644 index 0000000..997bacf --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/darwinModules.nix @@ -0,0 +1,12 @@ +{ root, inputs }: +name: +(root.exporter.pops.nixosModules.addLoadExtender { + load = { + src = + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") + "darwinModules"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/__hostsFun/darwinProfiles.nix b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/darwinProfiles.nix new file mode 100644 index 0000000..521f563 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/darwinProfiles.nix @@ -0,0 +1,12 @@ +{ root, inputs }: +name: +(root.exporter.pops.nixosModules.addLoadExtender { + load = { + src = + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") + "darwinProfiles"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/__hostsFun/homeModules.nix b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/homeModules.nix new file mode 100644 index 0000000..1bdf6e1 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/homeModules.nix @@ -0,0 +1,12 @@ +{ root, inputs }: +name: +(root.exporter.pops.homeModules.addLoadExtender { + load = { + src = + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") + "homeModules"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/__hostsFun/homeProfiles.nix b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/homeProfiles.nix new file mode 100644 index 0000000..8c4fd27 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/homeProfiles.nix @@ -0,0 +1,12 @@ +{ root, inputs }: +name: +(root.exporter.pops.homeProfiles.addLoadExtender { + load = { + src = + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") + "homeProfiles"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/__hostsFun/nixosModules.nix b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/nixosModules.nix new file mode 100644 index 0000000..dbe11ca --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/nixosModules.nix @@ -0,0 +1,12 @@ +{ root, inputs }: +name: +(root.exporter.pops.nixosModules.addLoadExtender { + load = { + src = + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") + "nixosModules"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/__hostsFun/nixosProfiles.nix b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/nixosProfiles.nix new file mode 100644 index 0000000..ac68f70 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/__hostsFun/nixosProfiles.nix @@ -0,0 +1,12 @@ +{ root, inputs }: +name: +(root.exporter.pops.nixosProfiles.addLoadExtender { + load = { + src = + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") + "nixosProfiles"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/darwinModules.nix b/templates/hivebus/nix/lib/exporter/pops/darwinModules.nix new file mode 100644 index 0000000..9ba4b35 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/darwinModules.nix @@ -0,0 +1,8 @@ +(omnibus.pops.nixosModules.addLoadExtender { + load = { + src = inputs.self.outPath + "/units/nixos/darwinModules"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/darwinProfiles.nix b/templates/hivebus/nix/lib/exporter/pops/darwinProfiles.nix new file mode 100644 index 0000000..4f69002 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/darwinProfiles.nix @@ -0,0 +1,8 @@ +(omnibus.pops.nixosModules.addLoadExtender { + load = { + src = inputs.self.outPath + "/units/nixos/darwinProfiles"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/flake.nix b/templates/hivebus/nix/lib/exporter/pops/flake.nix new file mode 100644 index 0000000..a7afa89 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/flake.nix @@ -0,0 +1,13 @@ +(omnibus.pops.flake.addInputsExtender ( + POP.extendPop flops.flake.pops.inputsExtender ( + self: super: + let + selfInputs = omnibus.pops.flake.setInitInputs ../../__lock; + in + { + inputs = { + nixpkgs = inputs.nixpkgs.legacyPackages; + } // selfInputs.inputs; + } + ) +)) diff --git a/templates/hivebus/nix/lib/exporter/pops/homeModules.nix b/templates/hivebus/nix/lib/exporter/pops/homeModules.nix new file mode 100644 index 0000000..ae26a02 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/homeModules.nix @@ -0,0 +1,8 @@ +(omnibus.pops.homeModules.addLoadExtender { + load = { + src = inputs.self.outPath + "/units/nixos/homeModules"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/homeProfiles.nix b/templates/hivebus/nix/lib/exporter/pops/homeProfiles.nix new file mode 100644 index 0000000..d121565 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/homeProfiles.nix @@ -0,0 +1,8 @@ +(omnibus.pops.homeProfiles.addLoadExtender { + load = { + src = inputs.self.outPath + "/units/nixos/homeProfiles"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/hosts.nix b/templates/hivebus/nix/lib/exporter/pops/hosts.nix new file mode 100644 index 0000000..cb302c9 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/hosts.nix @@ -0,0 +1,18 @@ +{ + lib, + inputs, + super, +}: +let + hostsDir = lib.attrNames ( + lib.readDir (inputs.self.outPath + "/units/nixos/hosts") + ); +in +lib.listToAttrs ( + map + (name: { + inherit name; + value = lib.mapAttrs (_: v: v name) super.hostsFun; + }) + hostsDir +) diff --git a/templates/hivebus/nix/lib/exporter/pops/nixosModules.nix b/templates/hivebus/nix/lib/exporter/pops/nixosModules.nix new file mode 100644 index 0000000..fd3516e --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/nixosModules.nix @@ -0,0 +1,8 @@ +(omnibus.pops.nixosModules.addLoadExtender { + load = { + src = inputs.self.outPath + "/units/nixos/nixosModules"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/nixosProfiles.nix b/templates/hivebus/nix/lib/exporter/pops/nixosProfiles.nix new file mode 100644 index 0000000..c26c056 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/nixosProfiles.nix @@ -0,0 +1,8 @@ +(omnibus.pops.nixosProfiles.addLoadExtender { + load = { + src = inputs.self.outPath + "/units/nixos/nixosProfiles"; + inputs = { + inputs = inputs; + }; + }; +}) diff --git a/templates/hivebus/nix/lib/exporter/pops/omnibus/homeModules.nix b/templates/hivebus/nix/lib/exporter/pops/omnibus/homeModules.nix new file mode 100644 index 0000000..c99a577 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/omnibus/homeModules.nix @@ -0,0 +1 @@ +(omnibus.pops.homeModules.addLoadExtender { load = { }; }) diff --git a/templates/hivebus/nix/lib/exporter/pops/omnibus/homeProfiles.nix b/templates/hivebus/nix/lib/exporter/pops/omnibus/homeProfiles.nix new file mode 100644 index 0000000..e923a83 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/omnibus/homeProfiles.nix @@ -0,0 +1 @@ +(omnibus.pops.homeProfiles.addLoadExtender { load = { }; }) diff --git a/templates/hivebus/nix/lib/exporter/pops/omnibus/lib.nix b/templates/hivebus/nix/lib/exporter/pops/omnibus/lib.nix new file mode 100644 index 0000000..a4f6d8c --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/omnibus/lib.nix @@ -0,0 +1,5 @@ +omnibus.pops.lib.addLoadExtender { + load.inputs = { + inputs = inputs // root.exporter.pops.flake.inputs; + }; +} diff --git a/templates/hivebus/nix/lib/exporter/pops/omnibus/nixosModules.nix b/templates/hivebus/nix/lib/exporter/pops/omnibus/nixosModules.nix new file mode 100644 index 0000000..56cb3fd --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/omnibus/nixosModules.nix @@ -0,0 +1 @@ +(omnibus.pops.nixosModules.addLoadExtender { load = { }; }) diff --git a/templates/hivebus/nix/lib/exporter/pops/omnibus/nixosProfiles.nix b/templates/hivebus/nix/lib/exporter/pops/omnibus/nixosProfiles.nix new file mode 100644 index 0000000..90fb634 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/omnibus/nixosProfiles.nix @@ -0,0 +1,17 @@ +(omnibus.pops.nixosProfiles.addLoadExtender { load = { }; }).addExporters [ + (POP.extendPop flops.haumea.pops.exporter ( + self: super: { + exports.customModules = self.outputs [ { + value = { + enable = false; + customList = with inputs.dmerge; append [ "1" ]; + imports = with inputs.dmerge; append [ ]; + }; + path = [ + "services" + "openssh" + ]; + } ]; + } + )) +] diff --git a/templates/hivebus/nix/lib/exporter/pops/omnibus/srvos.nix b/templates/hivebus/nix/lib/exporter/pops/omnibus/srvos.nix new file mode 100644 index 0000000..18a66b0 --- /dev/null +++ b/templates/hivebus/nix/lib/exporter/pops/omnibus/srvos.nix @@ -0,0 +1,5 @@ +(omnibus.pops.srvos.addLoadExtender { load = { }; }).addExporters [ + (POP.extendPop flops.haumea.pops.exporter ( + self: super: { exports.customProfiles = { }; } + )) +] diff --git a/templates/hivebus/nix/lib/filterPopsSrc.nix b/templates/hivebus/nix/lib/filterPopsSrc.nix new file mode 100644 index 0000000..36830ba --- /dev/null +++ b/templates/hivebus/nix/lib/filterPopsSrc.nix @@ -0,0 +1,38 @@ +{ lib, root }: +src: dir: +let + inherit (root.exporter.pops.flake.inputs) nix-filter; + popsDirs = lib.attrNames ( + lib.removeAttrs root.exporter.pops [ + "hosts" + "omnibus" + ] + ); +in +# include = +# let +# srcDirs = lib.attrNames (lib.readDir src); +# popsDirs = lib.attrNames ( +# lib.removeAttrs root.exporter.pops [ +# "hosts" +# "omnibus" +# ] +# ); +# in +# lib.concatMap +# ( +# dir: +# let +# list = +# assert lib.assertMsg +# (if lib.lists.intersectLists dirs popsDirs != [ ] then true else false) +# '' +# The directory ${dir} is not a valid pops directory. +# Please check the pops attribute in the root exporter. +# ''; +# map (x: "${x}") dirs; +# in +# list +# ) +# srcDirs; +nix-filter.lib.filter { root = src + "/${dir}"; } diff --git a/templates/hivebus/nix/packages/hello.nix b/templates/hivebus/nix/packages/hello.nix new file mode 100644 index 0000000..59fc906 --- /dev/null +++ b/templates/hivebus/nix/packages/hello.nix @@ -0,0 +1,50 @@ +{ + callPackage, + lib, + stdenv, + fetchurl, + nixos, + testers, + hello, +}: + +stdenv.mkDerivation ( + finalAttrs: { + pname = "hello"; + version = "2.12.1"; + + src = fetchurl { + url = "mirror://gnu/hello/hello-${finalAttrs.version}.tar.gz"; + sha256 = "sha256-jZkUKv2SV28wsM18tCqNxoCZmLxdYH2Idh9RLibH2yA="; + }; + + doCheck = true; + + passthru.tests = { + version = testers.testVersion { package = hello; }; + + invariant-under-noXlibs = + testers.testEqualDerivation + "hello must not be rebuilt when environment.noXlibs is set." + hello + (nixos { environment.noXlibs = true; }).pkgs.hello; + }; + + passthru.tests.run = callPackage ./test.nix { + hello = finalAttrs.finalPackage; + }; + + meta = with lib; { + description = "A program that produces a familiar, friendly greeting"; + longDescription = '' + GNU Hello is a program that prints "Hello, world!" when you run it. + It is fully customizable. + ''; + homepage = "https://www.gnu.org/software/hello/manual/"; + changelog = "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${finalAttrs.version}"; + license = licenses.gpl3Plus; + maintainers = [ maintainers.eelco ]; + platforms = platforms.all; + }; + } +) diff --git a/templates/nixos/nixos/darwinModules/services/yabai.nix b/templates/hivebus/units/nixos/darwinModules/services/yabai.nix similarity index 100% rename from templates/nixos/nixos/darwinModules/services/yabai.nix rename to templates/hivebus/units/nixos/darwinModules/services/yabai.nix diff --git a/templates/nixos/nixos/darwinProfiles/presets/yabai.nix b/templates/hivebus/units/nixos/darwinProfiles/presets/yabai.nix similarity index 100% rename from templates/nixos/nixos/darwinProfiles/presets/yabai.nix rename to templates/hivebus/units/nixos/darwinProfiles/presets/yabai.nix diff --git a/templates/nixos/nixos/homeModules/programs/emacs.nix b/templates/hivebus/units/nixos/homeModules/programs/emacs.nix similarity index 100% rename from templates/nixos/nixos/homeModules/programs/emacs.nix rename to templates/hivebus/units/nixos/homeModules/programs/emacs.nix diff --git a/templates/nixos/nixos/homeProfiles/presets/emacs.nix b/templates/hivebus/units/nixos/homeProfiles/presets/emacs.nix similarity index 100% rename from templates/nixos/nixos/homeProfiles/presets/emacs.nix rename to templates/hivebus/units/nixos/homeProfiles/presets/emacs.nix diff --git a/templates/hivebus/units/nixos/hosts/darwin/darwinConfiguration.nix b/templates/hivebus/units/nixos/hosts/darwin/darwinConfiguration.nix new file mode 100644 index 0000000..0d32e7f --- /dev/null +++ b/templates/hivebus/units/nixos/hosts/darwin/darwinConfiguration.nix @@ -0,0 +1,8 @@ +let + inherit (inputs) nixpkgs; +in +darwin.lib.darwinSystem rec { + system = super.layouts.system; + pkgs = import nixpkgs { inherit system; }; + modules = lib.flatten [ super.layouts.darwinSuites ]; +} diff --git a/templates/nixos/nixos/hosts/nixos/nixosProfiles/bootstrap.nix b/templates/hivebus/units/nixos/hosts/darwin/darwinProfiles/bootstrap.nix similarity index 100% rename from templates/nixos/nixos/hosts/nixos/nixosProfiles/bootstrap.nix rename to templates/hivebus/units/nixos/hosts/darwin/darwinProfiles/bootstrap.nix diff --git a/templates/hivebus/units/nixos/hosts/darwin/layouts.nix b/templates/hivebus/units/nixos/hosts/darwin/layouts.nix new file mode 100644 index 0000000..3eec3eb --- /dev/null +++ b/templates/hivebus/units/nixos/hosts/darwin/layouts.nix @@ -0,0 +1,48 @@ +let + outputs = inputs.self; +in +# self' = inputs.self.hosts.nixos; +{ + system = "aarch64-linux"; + + data = outputs.local.${self.system}.data; + + hive = { + bee.system = self.system; + bee.home = inputs.home-manager; + bee.darwin = inputs.darwin; + bee.pkgs = import inputs.nixpkgs { inherit (self) system; }; + imports = lib.flatten self.darwinSuites; + }; + + darwinSuites = lib.flatten [ + outputs.hosts.nixos.nixosProfiles.bootstrap + + outputs.darwinModules.layouts.default.homebrew + # # # --custom profiles + # outputs.pops.nixosProfiles.layouts.customProfiles.presets.nix + # outputs.pops.nixosProfiles.layouts.customProfiles.presets.boot + # outputs.pops.nixosModules.layouts.customModules.boot + + # outputs.srvos.default.common.nix + (outputs.omnibus.lib.mkHome + { + admin = { + uid = 1000; + description = "default manager"; + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; + } + "zsh" + self.homeSuites + ) + ]; + + homeSuites = [ + outputs.homeProfiles.presets.emacs + # outputs.homeProfiles.presets.bat + # # # The parent directory of "presets" is categorized as a list type of "suites" + # (outputs.homeProfiles.shell { }).default + ]; +} diff --git a/templates/nixos/nixos/hosts/nixos/layouts.nix b/templates/hivebus/units/nixos/hosts/nixos/layouts.nix similarity index 84% rename from templates/nixos/nixos/hosts/nixos/layouts.nix rename to templates/hivebus/units/nixos/hosts/nixos/layouts.nix index d5c62d5..5171ca3 100644 --- a/templates/nixos/nixos/hosts/nixos/layouts.nix +++ b/templates/hivebus/units/nixos/hosts/nixos/layouts.nix @@ -7,6 +7,13 @@ in data = outputs.local.${self.system}.data; + hive = { + bee.system = self.system; + bee.home = inputs.home-manager; + bee.pkgs = import inputs.nixpkgs { inherit (self) system; }; + imports = lib.flatten self.nixosSuites; + }; + nixosSuites = lib.flatten [ outputs.hosts.nixos.nixosProfiles.bootstrap diff --git a/templates/nixos/nixos/hosts/nixos/nixosConfiguration.nix b/templates/hivebus/units/nixos/hosts/nixos/nixosConfiguration.nix similarity index 100% rename from templates/nixos/nixos/hosts/nixos/nixosConfiguration.nix rename to templates/hivebus/units/nixos/hosts/nixos/nixosConfiguration.nix diff --git a/templates/hivebus/units/nixos/hosts/nixos/nixosProfiles/bootstrap.nix b/templates/hivebus/units/nixos/hosts/nixos/nixosProfiles/bootstrap.nix new file mode 100644 index 0000000..098f183 --- /dev/null +++ b/templates/hivebus/units/nixos/hosts/nixos/nixosProfiles/bootstrap.nix @@ -0,0 +1,7 @@ +{ + imports = [ omnibus.nixosProfiles.presets.boot ]; + boot.__profiles__.systemd-boot.enable = true; + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + }; +} diff --git a/templates/nixos/nixos/nixosModules/boot.nix b/templates/hivebus/units/nixos/nixosModules/boot.nix similarity index 100% rename from templates/nixos/nixos/nixosModules/boot.nix rename to templates/hivebus/units/nixos/nixosModules/boot.nix diff --git a/templates/nixos/nixos/nixosProfiles/presets/boot.nix b/templates/hivebus/units/nixos/nixosProfiles/presets/boot.nix similarity index 100% rename from templates/nixos/nixos/nixosProfiles/presets/boot.nix rename to templates/hivebus/units/nixos/nixosProfiles/presets/boot.nix diff --git a/templates/nixos/nix/lib/exporter/hosts.nix b/templates/nixos/nix/lib/exporter/hosts.nix index 53856e5..758a22a 100644 --- a/templates/nixos/nix/lib/exporter/hosts.nix +++ b/templates/nixos/nix/lib/exporter/hosts.nix @@ -1,6 +1,6 @@ (inputs.omnibus.pops.exporter.addLoadExtender { load = { - src = inputs.self.outPath + "/nixos/hosts"; + src = inputs.self.outPath + "/units/nixos/hosts"; inputs = { inputs = inputs // root.exporter.pops.flake.inputs; omnibus = inputs.omnibus // { diff --git a/templates/nixos/nix/lib/exporter/pops/__hostsFun/darwinModules.nix b/templates/nixos/nix/lib/exporter/pops/__hostsFun/darwinModules.nix index 45325a0..997bacf 100644 --- a/templates/nixos/nix/lib/exporter/pops/__hostsFun/darwinModules.nix +++ b/templates/nixos/nix/lib/exporter/pops/__hostsFun/darwinModules.nix @@ -3,7 +3,7 @@ name: (root.exporter.pops.nixosModules.addLoadExtender { load = { src = - root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}") + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") "darwinModules"; inputs = { inputs = inputs; diff --git a/templates/nixos/nix/lib/exporter/pops/__hostsFun/darwinProfiles.nix b/templates/nixos/nix/lib/exporter/pops/__hostsFun/darwinProfiles.nix index 3f5abe6..521f563 100644 --- a/templates/nixos/nix/lib/exporter/pops/__hostsFun/darwinProfiles.nix +++ b/templates/nixos/nix/lib/exporter/pops/__hostsFun/darwinProfiles.nix @@ -3,7 +3,7 @@ name: (root.exporter.pops.nixosModules.addLoadExtender { load = { src = - root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}") + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") "darwinProfiles"; inputs = { inputs = inputs; diff --git a/templates/nixos/nix/lib/exporter/pops/__hostsFun/homeModules.nix b/templates/nixos/nix/lib/exporter/pops/__hostsFun/homeModules.nix index dd904c5..1bdf6e1 100644 --- a/templates/nixos/nix/lib/exporter/pops/__hostsFun/homeModules.nix +++ b/templates/nixos/nix/lib/exporter/pops/__hostsFun/homeModules.nix @@ -3,7 +3,7 @@ name: (root.exporter.pops.homeModules.addLoadExtender { load = { src = - root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}") + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") "homeModules"; inputs = { inputs = inputs; diff --git a/templates/nixos/nix/lib/exporter/pops/__hostsFun/homeProfiles.nix b/templates/nixos/nix/lib/exporter/pops/__hostsFun/homeProfiles.nix index d608de3..8c4fd27 100644 --- a/templates/nixos/nix/lib/exporter/pops/__hostsFun/homeProfiles.nix +++ b/templates/nixos/nix/lib/exporter/pops/__hostsFun/homeProfiles.nix @@ -3,7 +3,7 @@ name: (root.exporter.pops.homeProfiles.addLoadExtender { load = { src = - root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}") + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") "homeProfiles"; inputs = { inputs = inputs; diff --git a/templates/nixos/nix/lib/exporter/pops/__hostsFun/nixosModules.nix b/templates/nixos/nix/lib/exporter/pops/__hostsFun/nixosModules.nix index 37c1b23..dbe11ca 100644 --- a/templates/nixos/nix/lib/exporter/pops/__hostsFun/nixosModules.nix +++ b/templates/nixos/nix/lib/exporter/pops/__hostsFun/nixosModules.nix @@ -3,7 +3,7 @@ name: (root.exporter.pops.nixosModules.addLoadExtender { load = { src = - root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}") + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") "nixosModules"; inputs = { inputs = inputs; diff --git a/templates/nixos/nix/lib/exporter/pops/__hostsFun/nixosProfiles.nix b/templates/nixos/nix/lib/exporter/pops/__hostsFun/nixosProfiles.nix index 03e248d..ac68f70 100644 --- a/templates/nixos/nix/lib/exporter/pops/__hostsFun/nixosProfiles.nix +++ b/templates/nixos/nix/lib/exporter/pops/__hostsFun/nixosProfiles.nix @@ -3,7 +3,7 @@ name: (root.exporter.pops.nixosProfiles.addLoadExtender { load = { src = - root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}") + root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}") "nixosProfiles"; inputs = { inputs = inputs; diff --git a/templates/nixos/nix/lib/exporter/pops/darwinModules.nix b/templates/nixos/nix/lib/exporter/pops/darwinModules.nix index c5ce40d..9ba4b35 100644 --- a/templates/nixos/nix/lib/exporter/pops/darwinModules.nix +++ b/templates/nixos/nix/lib/exporter/pops/darwinModules.nix @@ -1,6 +1,6 @@ (omnibus.pops.nixosModules.addLoadExtender { load = { - src = inputs.self.outPath + "/nixos/darwinModules"; + src = inputs.self.outPath + "/units/nixos/darwinModules"; inputs = { inputs = inputs; }; diff --git a/templates/nixos/nix/lib/exporter/pops/darwinProfiles.nix b/templates/nixos/nix/lib/exporter/pops/darwinProfiles.nix index 6ef749c..4f69002 100644 --- a/templates/nixos/nix/lib/exporter/pops/darwinProfiles.nix +++ b/templates/nixos/nix/lib/exporter/pops/darwinProfiles.nix @@ -1,6 +1,6 @@ (omnibus.pops.nixosModules.addLoadExtender { load = { - src = inputs.self.outPath + "/nixos/darwinProfiles"; + src = inputs.self.outPath + "/units/nixos/darwinProfiles"; inputs = { inputs = inputs; }; diff --git a/templates/nixos/nix/lib/exporter/pops/homeModules.nix b/templates/nixos/nix/lib/exporter/pops/homeModules.nix index 365dcde..ae26a02 100644 --- a/templates/nixos/nix/lib/exporter/pops/homeModules.nix +++ b/templates/nixos/nix/lib/exporter/pops/homeModules.nix @@ -1,6 +1,6 @@ (omnibus.pops.homeModules.addLoadExtender { load = { - src = inputs.self.outPath + "/nixos/homeModules"; + src = inputs.self.outPath + "/units/nixos/homeModules"; inputs = { inputs = inputs; }; diff --git a/templates/nixos/nix/lib/exporter/pops/homeProfiles.nix b/templates/nixos/nix/lib/exporter/pops/homeProfiles.nix index 04d9e1c..d121565 100644 --- a/templates/nixos/nix/lib/exporter/pops/homeProfiles.nix +++ b/templates/nixos/nix/lib/exporter/pops/homeProfiles.nix @@ -1,6 +1,6 @@ (omnibus.pops.homeProfiles.addLoadExtender { load = { - src = inputs.self.outPath + "/nixos/homeProfiles"; + src = inputs.self.outPath + "/units/nixos/homeProfiles"; inputs = { inputs = inputs; }; diff --git a/templates/nixos/nix/lib/exporter/pops/hosts.nix b/templates/nixos/nix/lib/exporter/pops/hosts.nix index 69c96d0..cb302c9 100644 --- a/templates/nixos/nix/lib/exporter/pops/hosts.nix +++ b/templates/nixos/nix/lib/exporter/pops/hosts.nix @@ -4,7 +4,9 @@ super, }: let - hostsDir = lib.attrNames (lib.readDir (inputs.self.outPath + "/nixos/hosts")); + hostsDir = lib.attrNames ( + lib.readDir (inputs.self.outPath + "/units/nixos/hosts") + ); in lib.listToAttrs ( map diff --git a/templates/nixos/nix/lib/exporter/pops/nixosModules.nix b/templates/nixos/nix/lib/exporter/pops/nixosModules.nix index 772afd1..fd3516e 100644 --- a/templates/nixos/nix/lib/exporter/pops/nixosModules.nix +++ b/templates/nixos/nix/lib/exporter/pops/nixosModules.nix @@ -1,6 +1,6 @@ (omnibus.pops.nixosModules.addLoadExtender { load = { - src = inputs.self.outPath + "/nixos/nixosModules"; + src = inputs.self.outPath + "/units/nixos/nixosModules"; inputs = { inputs = inputs; }; diff --git a/templates/nixos/nix/lib/exporter/pops/nixosProfiles.nix b/templates/nixos/nix/lib/exporter/pops/nixosProfiles.nix index 7d46fc7..c26c056 100644 --- a/templates/nixos/nix/lib/exporter/pops/nixosProfiles.nix +++ b/templates/nixos/nix/lib/exporter/pops/nixosProfiles.nix @@ -1,6 +1,6 @@ (omnibus.pops.nixosProfiles.addLoadExtender { load = { - src = inputs.self.outPath + "/nixos/nixosProfiles"; + src = inputs.self.outPath + "/units/nixos/nixosProfiles"; inputs = { inputs = inputs; }; diff --git a/templates/nixos/units/nixos/darwinModules/services/yabai.nix b/templates/nixos/units/nixos/darwinModules/services/yabai.nix new file mode 100644 index 0000000..ffcd441 --- /dev/null +++ b/templates/nixos/units/nixos/darwinModules/services/yabai.nix @@ -0,0 +1 @@ +{ } diff --git a/templates/nixos/units/nixos/darwinProfiles/presets/yabai.nix b/templates/nixos/units/nixos/darwinProfiles/presets/yabai.nix new file mode 100644 index 0000000..e303088 --- /dev/null +++ b/templates/nixos/units/nixos/darwinProfiles/presets/yabai.nix @@ -0,0 +1 @@ +{ servcies.yabai.enable = true; } diff --git a/templates/nixos/units/nixos/homeModules/programs/emacs.nix b/templates/nixos/units/nixos/homeModules/programs/emacs.nix new file mode 100644 index 0000000..d1185b9 --- /dev/null +++ b/templates/nixos/units/nixos/homeModules/programs/emacs.nix @@ -0,0 +1,8 @@ +{ + options.__profiles__ = with lib; { + test = mkOption { + type = types.str; + default = "test"; + }; + }; +} diff --git a/templates/nixos/units/nixos/homeProfiles/presets/emacs.nix b/templates/nixos/units/nixos/homeProfiles/presets/emacs.nix new file mode 100644 index 0000000..f512122 --- /dev/null +++ b/templates/nixos/units/nixos/homeProfiles/presets/emacs.nix @@ -0,0 +1,4 @@ +{ + imports = [ inputs.self.homeModules.programs.emacs ]; + programs.emacs.__profiles__.test = "profile.test"; +} diff --git a/templates/nixos/units/nixos/hosts/darwin/darwinConfiguration.nix b/templates/nixos/units/nixos/hosts/darwin/darwinConfiguration.nix new file mode 100644 index 0000000..0d32e7f --- /dev/null +++ b/templates/nixos/units/nixos/hosts/darwin/darwinConfiguration.nix @@ -0,0 +1,8 @@ +let + inherit (inputs) nixpkgs; +in +darwin.lib.darwinSystem rec { + system = super.layouts.system; + pkgs = import nixpkgs { inherit system; }; + modules = lib.flatten [ super.layouts.darwinSuites ]; +} diff --git a/templates/nixos/units/nixos/hosts/darwin/darwinProfiles/bootstrap.nix b/templates/nixos/units/nixos/hosts/darwin/darwinProfiles/bootstrap.nix new file mode 100644 index 0000000..098f183 --- /dev/null +++ b/templates/nixos/units/nixos/hosts/darwin/darwinProfiles/bootstrap.nix @@ -0,0 +1,7 @@ +{ + imports = [ omnibus.nixosProfiles.presets.boot ]; + boot.__profiles__.systemd-boot.enable = true; + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + }; +} diff --git a/templates/nixos/units/nixos/hosts/darwin/layouts.nix b/templates/nixos/units/nixos/hosts/darwin/layouts.nix new file mode 100644 index 0000000..3eec3eb --- /dev/null +++ b/templates/nixos/units/nixos/hosts/darwin/layouts.nix @@ -0,0 +1,48 @@ +let + outputs = inputs.self; +in +# self' = inputs.self.hosts.nixos; +{ + system = "aarch64-linux"; + + data = outputs.local.${self.system}.data; + + hive = { + bee.system = self.system; + bee.home = inputs.home-manager; + bee.darwin = inputs.darwin; + bee.pkgs = import inputs.nixpkgs { inherit (self) system; }; + imports = lib.flatten self.darwinSuites; + }; + + darwinSuites = lib.flatten [ + outputs.hosts.nixos.nixosProfiles.bootstrap + + outputs.darwinModules.layouts.default.homebrew + # # # --custom profiles + # outputs.pops.nixosProfiles.layouts.customProfiles.presets.nix + # outputs.pops.nixosProfiles.layouts.customProfiles.presets.boot + # outputs.pops.nixosModules.layouts.customModules.boot + + # outputs.srvos.default.common.nix + (outputs.omnibus.lib.mkHome + { + admin = { + uid = 1000; + description = "default manager"; + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; + } + "zsh" + self.homeSuites + ) + ]; + + homeSuites = [ + outputs.homeProfiles.presets.emacs + # outputs.homeProfiles.presets.bat + # # # The parent directory of "presets" is categorized as a list type of "suites" + # (outputs.homeProfiles.shell { }).default + ]; +} diff --git a/templates/nixos/units/nixos/hosts/nixos/layouts.nix b/templates/nixos/units/nixos/hosts/nixos/layouts.nix new file mode 100644 index 0000000..5171ca3 --- /dev/null +++ b/templates/nixos/units/nixos/hosts/nixos/layouts.nix @@ -0,0 +1,49 @@ +let + outputs = inputs.self; +in +# self' = inputs.self.hosts.nixos; +{ + system = "x86_64-linux"; + + data = outputs.local.${self.system}.data; + + hive = { + bee.system = self.system; + bee.home = inputs.home-manager; + bee.pkgs = import inputs.nixpkgs { inherit (self) system; }; + imports = lib.flatten self.nixosSuites; + }; + + nixosSuites = lib.flatten [ + outputs.hosts.nixos.nixosProfiles.bootstrap + + outputs.nixosProfiles.presets.boot + # outputs.nixosModules.default.programs.git + + # # # --custom profiles + # outputs.pops.nixosProfiles.layouts.customProfiles.presets.nix + # outputs.pops.nixosProfiles.layouts.customProfiles.presets.boot + # outputs.pops.nixosModules.layouts.customModules.boot + + # outputs.srvos.default.common.nix + (outputs.omnibus.lib.mkHome + { + admin = { + uid = 1000; + description = "default manager"; + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; + } + "zsh" + self.homeSuites + ) + ]; + + homeSuites = [ + outputs.homeProfiles.presets.emacs + # outputs.homeProfiles.presets.bat + # # # The parent directory of "presets" is categorized as a list type of "suites" + # (outputs.homeProfiles.shell { }).default + ]; +} diff --git a/templates/nixos/units/nixos/hosts/nixos/nixosConfiguration.nix b/templates/nixos/units/nixos/hosts/nixos/nixosConfiguration.nix new file mode 100644 index 0000000..efee22e --- /dev/null +++ b/templates/nixos/units/nixos/hosts/nixos/nixosConfiguration.nix @@ -0,0 +1,8 @@ +let + inherit (inputs) nixpkgs; +in +nixpkgs.lib.nixosSystem rec { + system = super.layouts.system; + pkgs = import nixpkgs { inherit system; }; + modules = lib.flatten [ super.layouts.nixosSuites ]; +} diff --git a/templates/nixos/units/nixos/hosts/nixos/nixosProfiles/bootstrap.nix b/templates/nixos/units/nixos/hosts/nixos/nixosProfiles/bootstrap.nix new file mode 100644 index 0000000..098f183 --- /dev/null +++ b/templates/nixos/units/nixos/hosts/nixos/nixosProfiles/bootstrap.nix @@ -0,0 +1,7 @@ +{ + imports = [ omnibus.nixosProfiles.presets.boot ]; + boot.__profiles__.systemd-boot.enable = true; + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + }; +} diff --git a/templates/nixos/units/nixos/nixosModules/boot.nix b/templates/nixos/units/nixos/nixosModules/boot.nix new file mode 100644 index 0000000..d1185b9 --- /dev/null +++ b/templates/nixos/units/nixos/nixosModules/boot.nix @@ -0,0 +1,8 @@ +{ + options.__profiles__ = with lib; { + test = mkOption { + type = types.str; + default = "test"; + }; + }; +} diff --git a/templates/nixos/units/nixos/nixosProfiles/presets/boot.nix b/templates/nixos/units/nixos/nixosProfiles/presets/boot.nix new file mode 100644 index 0000000..5fd49f5 --- /dev/null +++ b/templates/nixos/units/nixos/nixosProfiles/presets/boot.nix @@ -0,0 +1,4 @@ +{ + imports = [ inputs.self.nixosModules.boot ]; + boot.__profiles__.test = "nixosProfiles.boot"; +} diff --git a/units/nixos/darwinModules/omnibus/bootstrap/default.nix b/units/nixos/darwinModules/omnibus/bootstrap/default.nix new file mode 100644 index 0000000..cd343be --- /dev/null +++ b/units/nixos/darwinModules/omnibus/bootstrap/default.nix @@ -0,0 +1,13 @@ +{ lib }: +{ + options = with lib; { + PATH = lib.mkOption { + default = [ ]; + type = types.listOf types.str; + apply = x: lib.concatStringsSep ":" x; + description = '' + A list of directories that will be added to the PATH environment + ''; + }; + }; +} diff --git a/units/nixos/darwinProfiles/presets/bootstrap.nix b/units/nixos/darwinProfiles/presets/bootstrap.nix new file mode 100644 index 0000000..c043a0d --- /dev/null +++ b/units/nixos/darwinProfiles/presets/bootstrap.nix @@ -0,0 +1,28 @@ +{ + omnibus, + pkgs, + lib, + config, +}: +let + inherit (pkgs.stdenv.hostPlatform) isAarch64; + cfg = config.omnibus.bootstrap; +in +{ + imports = [ omnibus.darwinModules.bootstrap ]; + config = { + omnibus.bootstrap.PATH = lib.mkBefore [ + "/run/current-system/sw/bin" + "/run/current-system/etc/profiles/per-user/$USER/bin" + "/opt/homebrew/bin" + "/bin/" + "/usr/bin" + "/usr/bin/sbin" + "/usr/local/bin" + "/usr/sbin" + "/sbin" + ]; + environment.systemPath = [ ]; + environment.variables.PATH = cfg.PATH; + }; +} diff --git a/units/nixos/nixosModules/omnibus/bootstrap/default.nix b/units/nixos/nixosModules/omnibus/bootstrap/default.nix new file mode 100644 index 0000000..afa97f8 --- /dev/null +++ b/units/nixos/nixosModules/omnibus/bootstrap/default.nix @@ -0,0 +1,26 @@ +{ lib, loadSubmodule }: +{ + options = with lib; { + minimal = mkOption { + type = types.bool; + default = true; + description = "Whether to use the minimal bootstrap"; + }; + default = mkOption { + type = types.bool; + default = false; + description = "Whether to use the default bootstrap"; + }; + full = mkOption { + type = types.bool; + default = false; + description = "Whether to use the full bootstrap"; + }; + contabo = mkOption { + type = types.bool; + default = false; + description = "Whether to use contabo init configuration"; + }; + }; + imports = [ (loadSubmodule ./packages.nix) ]; +} diff --git a/units/nixos/nixosModules/omnibus/bootstrap/packages.nix b/units/nixos/nixosModules/omnibus/bootstrap/packages.nix new file mode 100644 index 0000000..475346d --- /dev/null +++ b/units/nixos/nixosModules/omnibus/bootstrap/packages.nix @@ -0,0 +1,35 @@ +{ + config, + lib, + pkgs, + omnibus, +}: +let + cfg = config.omnibus.bootstrap; +in +{ + config = + with lib; + mkMerge [ + (mkIf (cfg.minimal || cfg.default) { + environment.systemPackages = with pkgs; [ + pciutils + openssl + wget + curl + gnumake + ]; + }) + (mkIf cfg.default { + environment.systemPackages = with pkgs; [ + unzip + gzip + clang + nixpkgs-fmt + pkg-config + nrepl + ripgrep + ]; + }) + ]; +} diff --git a/units/nixos/nixosModules/omnibus/coding/python.nix b/units/nixos/nixosModules/omnibus/coding/python.nix new file mode 100644 index 0000000..7d51259 --- /dev/null +++ b/units/nixos/nixosModules/omnibus/coding/python.nix @@ -0,0 +1,13 @@ +{ + options = with lib; { + lsp-bridge = + mkEnableOption + "Enable the language server protocol bridge support"; + emacs-eaf = mkEnableOption "Enable the Emacs Application Framework support"; + extraPackages = mkOption { + type = types.functionTo (types.listOf types.package); + default = ps: [ ]; + description = "The language server package to use"; + }; + }; +} diff --git a/units/nixos/nixosModules/virtualisation/default.nix b/units/nixos/nixosModules/virtualisation/default.nix new file mode 100644 index 0000000..749170f --- /dev/null +++ b/units/nixos/nixosModules/virtualisation/default.nix @@ -0,0 +1,27 @@ +{ lib, loadSubmodule }: +{ + imports = [ (loadSubmodule ./packages.nix) ]; + + options.__profiles__ = with lib; { + gui = mkOption { + type = types.bool; + default = false; + description = "Whether to enable the gui profile"; + }; + dockerCompose = mkOption { + type = types.bool; + default = false; + description = "Whether to enable the docker-compose profile"; + }; + user = mkOption { + type = types.str; + default = ""; + description = "The user to run the virtualization programs as"; + }; + nvidia = mkOption { + type = types.bool; + default = false; + description = "Whether to enable the nvidia profile"; + }; + }; +} diff --git a/units/nixos/nixosModules/virtualisation/packages.nix b/units/nixos/nixosModules/virtualisation/packages.nix new file mode 100644 index 0000000..5bd25c9 --- /dev/null +++ b/units/nixos/nixosModules/virtualisation/packages.nix @@ -0,0 +1,23 @@ +{ + pkgs, + config, + lib, + ... +}: +{ + config = + with lib; + mkMerge [ + (mkIf + ( + config.virtualisation.__profiles__.gui && config.virtualisation.libvirtd.enable + ) + { + environment.systemPackages = with pkgs; [ + pkgs.virt-manager + spice-gtk + ]; + } + ) + ]; +} diff --git a/units/nixos/nixosProfiles/presets/coding/python.nix b/units/nixos/nixosProfiles/presets/coding/python.nix new file mode 100644 index 0000000..4d4e49c --- /dev/null +++ b/units/nixos/nixosProfiles/presets/coding/python.nix @@ -0,0 +1,66 @@ +{ pkgs, lib, ... }: +let + cfg = config.omnibus.coding.python; + pythonEnv = + (pkgs.python3.withPackages ( + ps: + with ps; + (lib.optionals cfg.emacs-eaf [ + #emacs-eaf + shapely + dbus-python + qrcode + xlib + grip + black + keyring + # pyqt5 + # pyqtwebengine + markdown + feedparser + retrying + ]) + ++ (lib.optionals cfg.lsp-bridge [ + epc + orjson + ### + pypinyin + sexpdata + six + paramiko + rapidfuzz + ]) + ++ [ + pytest + #orgparse + pytest + jupyter + #voila + pygments + # orgbabelhelper + # jupyterlab + pdftotext + openai + ] + ++ lib.optionals pkgs.stdenv.isLinux [ + # pyqt6 + # pyqt6-webengine + pyinotify + pymupdf + # eaf depencencies + lxml + ] + )); +in +#.override (args: {ignoreCollisions = true;}); +{ + imports = [ omnibus.nixosModules.omnibus.coding.python ]; + environment.systemPackages = + with pkgs; + [ + pythonEnv + poetry + ] + ++ lib.optionals pkgs.stdenv.isLinux [ ] + ; +}