Skip to content

Commit

Permalink
generalize
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Sep 28, 2024
1 parent 21a1b60 commit 82a14ba
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
35 changes: 35 additions & 0 deletions flake-parts/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# An opinionated module that creates flake outputs based on a known directory structure.
#
# cf. Convention over configuration
{ inputs, self, ... }:
let
inherit (inputs.nixpkgs) lib;
in
{

flake = {
darwinConfigurations = inputs.nixpkgs.lib.mapAttrs'
(fn: _:
let
inherit (inputs.nixpkgs) lib;
hostname = lib.removeSuffix ".nix" fn;
in
lib.nameValuePair hostname (self.nixos-flake.lib.mkMacosSystem
{ home-manager = true; }
"${self}/configurations/darwin/${fn}")
)
(builtins.readDir "${self}/configurations/darwin");

nixosConfigurations = inputs.nixpkgs.lib.mapAttrs'
(fn: _:
let
inherit (inputs.nixpkgs) lib;
hostname = lib.removeSuffix ".nix" fn;
in
lib.nameValuePair hostname (self.nixos-flake.lib.mkLinuxSystem
{ home-manager = true; }
"${self}/configurations/nixos/${fn}")
)
(builtins.readDir "${self}/configurations/nixos");
};
}
13 changes: 1 addition & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,10 @@
./home
./nixos
./nix-darwin
./flake-parts
];


flake = {
darwinConfigurations.appreciate =
self.nixos-flake.lib.mkMacosSystem
{ home-manager = true; }
./configurations/darwin/appreciate.nix;

nixosConfigurations.immediacy =
self.nixos-flake.lib.mkLinuxSystem
{ home-manager = true; }
./configurations/nixos/immediacy.nix;
};

perSystem = { self', inputs', pkgs, system, config, ... }: {
# My Ubuntu VM
legacyPackages.homeConfigurations."srid@ubuntu" =
Expand Down

0 comments on commit 82a14ba

Please sign in to comment.