about summary refs log tree commit diff stats
path: root/flake/default.nix
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-04-22 12:07:54 +0200
committerSoispha <soispha@vhack.eu>2023-05-09 19:31:20 +0200
commit3fc2c8d0c8c4a3c839fc12abad94ca83f4d21870 (patch)
treec0172a350b9f4bb0e3448b3f20c228c1403dbe0d /flake/default.nix
parentFix(hosts): Rename spawn to marduk to comply with scheme (diff)
downloadnixos-config-3fc2c8d0c8c4a3c839fc12abad94ca83f4d21870.zip
Feat(flake): Modularize
Diffstat (limited to 'flake/default.nix')
-rw-r--r--flake/default.nix120
1 files changed, 120 insertions, 0 deletions
diff --git a/flake/default.nix b/flake/default.nix
new file mode 100644
index 00000000..c88bfe56
--- /dev/null
+++ b/flake/default.nix
@@ -0,0 +1,120 @@
+{
+  # core
+  self,
+  pkgs,
+  system,
+  sysLib,
+  nixpkgs,
+  # modules
+  home-manager,
+  nixos-generators,
+  impermanence,
+  agenix,
+  ragenix,
+  # external dependencies
+  neovim_config,
+  user_js,
+  snap-sync,
+  templates,
+  # my binaries
+  video_pause,
+  strip_js_comments,
+  shell-library,
+  river_init_lesser,
+  yambar_memory,
+  yambar_cpu,
+  grades,
+}: let
+  homeManagerConfig = {
+    home-manager = {
+      useGlobalPkgs = true;
+      useUserPackages = true;
+      users.soispha = import ../home-manager;
+      extraSpecialArgs = {
+        inherit
+          pkgs
+          sysLib
+          # extra information
+          
+          system
+          # bins
+          
+          video_pause
+          yambar_cpu
+          yambar_memory
+          strip_js_comments
+          river_init_lesser
+          grades
+          shell-library
+          # external deps
+          
+          user_js
+          neovim_config
+          snap-sync
+          # modules
+          
+          impermanence
+          ;
+      };
+    };
+  };
+  ageConfig = import ../secrets;
+  impermanenceConfig = import ../system/impermanence;
+  defaultModules = [
+    agenix.nixosModules.default
+    ageConfig
+
+    home-manager.nixosModules.home-manager
+
+    homeManagerConfig
+
+    impermanence.nixosModules.impermanence
+    impermanenceConfig
+  ];
+  defaultSpecialArgs = {
+    nixpkgs-as-input = nixpkgs;
+    inherit templates sysLib;
+  };
+in {
+  nixosConfigurations = import ./nixosConfigurations {
+    inherit
+      system
+      pkgs
+      nixpkgs
+      sysLib
+      # configs
+      
+      defaultModules
+      defaultSpecialArgs
+      # bins
+      
+      video_pause
+      yambar_cpu
+      yambar_memory
+      strip_js_comments
+      river_init_lesser
+      grades
+      shell-library
+      # external deps
+      
+      user_js
+      neovim_config
+      snap-sync
+      templates
+      # modules
+      
+      impermanence
+      home-manager
+      agenix
+      ;
+  };
+  packages."${system}" = import ./packages {inherit nixos-generators defaultSpecialArgs pkgs shell-library;};
+
+  apps."${system}" = import ./apps {inherit self system;};
+
+  devShells."${system}" = {
+    default = pkgs.mkShell {
+      packages = with pkgs; [nil alejandra statix ragenix.packages."${system}".default shellcheck ltex-ls];
+    };
+  };
+}