separa configuración en plataformas

This commit is contained in:
Fabián Montero 2022-11-29 13:55:12 -06:00
parent 1433a1f96b
commit 11b9855244
8 changed files with 83 additions and 17 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

View file

@ -0,0 +1,3 @@
{
}

View file

@ -19,19 +19,50 @@
pkgs = import nixpkgs {
inherit system;
};
inherit (pkgs) lib;
base = platform: {
name = platform;
value = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ ( import ./base ) ];
};
};
home = platform: {
name = "fabian@${platform}";
value = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
(import ./home {
inherit self nixpkgs unstable hm-isolation;
})
./home/platforms/${platform}.nix
{
config.local = { inherit platform; };
}
];
};
};
platforms = domain:
map
(lib.removeSuffix ".nix")
(lib.attrNames (builtins.readDir ./${domain}/platforms));
configs = domain: builder:
lib.listToAttrs
(map builder (platforms domain));
in
{
nixosConfigurations.posixlycorrect = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ ( import ./base ) ];
};
homeConfigurations."fabian@posixlycorrect" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ (import ./home {inherit self nixpkgs unstable hm-isolation; }) ];
};
nixosConfigurations = configs "base" base;
homeConfigurations = configs "home" home;
packages."${system}" = packages pkgs;

View file

@ -1,14 +1,15 @@
{ nixpkgs, unstable, self, hm-isolation }:
{ self, nixpkgs, unstable, hm-isolation }:
{ config, pkgs, lib, ... } :
with lib;
{
imports = [
(hm-isolation.homeManagerModule)
./allowUnfreeWhitelist.nix
./gui
./isolation.nix
./local.nix
./path.nix
./systemd
./allowUnfreeWhitelist.nix
];
nixpkgs.overlays = [ self.overlay ];

View file

@ -87,14 +87,13 @@ with lib;
workspaceOutputAssign = [
{
output = "DisplayPort-0";
output = config.local.display."0";
workspace = "1";
}
{
output = "DisplayPort-1";
] ++ optional (config.local.display."1" != null) {
output = config.local.display."1";
workspace = "10";
}
];
};
bars = [ ];
};

19
home/local.nix Normal file
View file

@ -0,0 +1,19 @@
{ config, lib, ... } :
with lib;
{
options.local = with types; {
platform = mkOption {
type = str;
};
display = {
"0" = mkOption {
type = str;
};
"1" = mkOption {
type = nullOr str;
};
};
};
}

View file

@ -0,0 +1,6 @@
{
config.local.display = {
"0" = "DisplayPort-0";
"1" = "DisplayPort-1";
};
}

View file

@ -0,0 +1,6 @@
{
config.local.display = {
"0" = "eDP-1";
"1" = null;
};
}