aboutsummaryrefslogtreecommitdiffhomepage
path: root/flake.nix
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-01-22 13:02:57 +0900
committernsfisis <nsfisis@gmail.com>2025-01-22 13:02:57 +0900
commitad442e140c643eb3a80f5d4f59aa00b21c00888f (patch)
treeec23c74150656e9d4ead72bb607377c4196f72b1 /flake.nix
parent9d03982f63be8baa73f1072c51fe8fa15fcf6c20 (diff)
downloaddotfiles-ad442e140c643eb3a80f5d4f59aa00b21c00888f.tar.gz
dotfiles-ad442e140c643eb3a80f5d4f59aa00b21c00888f.tar.zst
dotfiles-ad442e140c643eb3a80f5d4f59aa00b21c00888f.zip
nix: refactor flake.nix by flake-utils
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix66
1 files changed, 36 insertions, 30 deletions
diff --git a/flake.nix b/flake.nix
index ae4dec7..c8d8d33 100644
--- a/flake.nix
+++ b/flake.nix
@@ -28,40 +28,46 @@
...
}:
let
- readJSON = p: builtins.fromJSON (builtins.readFile p);
- machines = [
- (readJSON ./mitamae/node.akashi.json)
- (readJSON ./mitamae/node.hotaru.json)
- (readJSON ./mitamae/node.pc168.json)
- ];
- mkHomeConfiguration =
- {
- system,
- env,
- ...
- }:
- home-manager.lib.homeManagerConfiguration {
- pkgs = import nixpkgs {
+ eachDefaultSystem =
+ f:
+ flake-utils.lib.eachDefaultSystem (
+ system:
+ f {
inherit system;
- config.allowUnfree = true;
- };
- extraSpecialArgs = { inherit env; };
- modules = [
- ./home-manager/home.nix
- ];
- };
+ pkgs = import nixpkgs { inherit system; };
+ }
+ );
in
- flake-utils.lib.eachDefaultSystem (system: {
- formatter = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
- })
+ eachDefaultSystem (
+ { system, pkgs }:
+ {
+ formatter = pkgs.nixfmt-rfc-style;
+ }
+ )
// {
homeConfigurations = (
- builtins.listToAttrs (
- builtins.map (machine: {
- name = machine.name;
- value = mkHomeConfiguration machine.flake;
- }) machines
- )
+ let
+ readJSON = p: builtins.fromJSON (builtins.readFile p);
+ mkHomeConfiguration =
+ {
+ system,
+ env,
+ ...
+ }:
+ home-manager.lib.homeManagerConfiguration {
+ pkgs = import nixpkgs { inherit system; };
+ extraSpecialArgs = { inherit env; };
+ modules = [
+ ./home-manager/home.nix
+ ];
+ };
+ mkHomeConfigurationFromJSON = p: mkHomeConfiguration (readJSON p).flake;
+ in
+ {
+ akashi = mkHomeConfigurationFromJSON ./mitamae/node.akashi.json;
+ hotaru = mkHomeConfigurationFromJSON ./mitamae/node.hotaru.json;
+ pc168 = mkHomeConfigurationFromJSON ./mitamae/node.pc168.json;
+ }
);
};
}