Skip to content

Commit

Permalink
feat: add nh
Browse files Browse the repository at this point in the history
  • Loading branch information
squirmy committed Jun 25, 2024
1 parent 52e1ffb commit 748d762
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 3 deletions.
6 changes: 5 additions & 1 deletion configuration/nix-darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pkgs,
...
}: {
imports = [./nix.nix ./nixpkgs.nix ./zsh.nix];
imports = [./nix.nix ./nixpkgs.nix ./nh.nix ./zsh.nix];

# Set the user's name & home directory. This should be
# in sync with home manager.
Expand All @@ -15,4 +15,8 @@

# Always include bash in /etc/shells if nix-machine is being used to enable shells
environment.shells = lib.mkIf config.nix-machine.shells.zsh.enable [pkgs.bashInteractive];

# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
}
8 changes: 8 additions & 0 deletions configuration/nix-darwin/nh.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{...}: {
environment.shellAliases.nh = "nh-darwin";

programs.nh = {
enable = true;
clean.enable = true;
};
}
7 changes: 5 additions & 2 deletions flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
modules = flakeLib.config.merge cfg.configurations;
darwinSystem = flakeLib.systems.darwin {inherit inputs;};

asDarwinConfiguration = machineName: machineConfig: (darwinSystem {
asDarwinConfiguration = _machineName: machineConfig: (darwinSystem {
inherit modules;
inherit machineConfig;
inherit machineName;
});

configurationOptions = {
Expand Down Expand Up @@ -55,5 +54,9 @@ in {

imports = [./configuration];

config.flake.nix-machine.lib = {
mkDarwinMachine = asDarwinConfiguration "_";
};

config.flake.darwinConfigurations = builtins.mapAttrs asDarwinConfiguration cfg.macos;
}
1 change: 1 addition & 0 deletions lib/systems/darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
imports = modules.home ++ [machineConfig];
};
}
inputs.nh-darwin.nixDarwinModules.prebuiltin
]
++ modules.darwin
++ [machineConfig];
Expand Down
1 change: 1 addition & 0 deletions templates/expose-configuration/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
nix-machine.url = "github:squirmy/nix-machine";
nix-machine.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
nh-darwin.url = "github:ToyVo/nh-darwin";
};

outputs = inputs:
Expand Down
1 change: 1 addition & 0 deletions templates/minimal/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
nix-machine.url = "github:squirmy/nix-machine";
nix-machine.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
nh-darwin.url = "github:ToyVo/nh-darwin";
};

outputs = inputs:
Expand Down
1 change: 1 addition & 0 deletions templates/simple-macos/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
nix-machine.url = "github:squirmy/nix-machine";
nix-machine.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
nh-darwin.url = "github:ToyVo/nh-darwin";
};

outputs = inputs:
Expand Down

0 comments on commit 748d762

Please sign in to comment.