refactor: separate NixOS and Home-Manager configuration

This commit is contained in:
Yorick Barbanneau 2024-10-09 00:37:47 +02:00
parent 9edca93fd5
commit d446f84030
5 changed files with 75 additions and 127 deletions

124
flake.nix
View file

@ -17,18 +17,46 @@
};
};
outputs = { self, nixpkgs, home-manager, nur, nixgl, sops-nix, ... }@inputs:
let
stateVersion = "23.11";
let
stateVersion = "23.11";
allSystems = [
"x86_64-linux" # 64bit AMD/Intel x86
"aarch64-linux" # 64bit ARM Linux
];
allSystems = [
"x86_64-linux" # 64bit AMD/Intel x86
"aarch64-linux" # 64bit ARM Linux
];
forAllSystems = fn:
nixpkgs.lib.genAttrs allSystems
(system: fn { pkgs = import nixpkgs { inherit system; }; });
in {
forAllSystems = fn:
nixpkgs.lib.genAttrs allSystems
(system: fn { pkgs = import nixpkgs { inherit system; }; });
createNixosSystem = { system, hostname, username ? "ephase" }: nixpkgs.lib.nixosSystem {
system = system;
specialArgs = {
inherit stateVersion inputs;
hostname = hostname;
username = username;
};
modules = [
./nixos/default.nix
];
};
createHomeConfiguration = { system ? "x86_64-linux", hostname, username ? "ephase" }:
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = system;
overlays = [ nixgl.overlay ];
};
extraSpecialArgs = {
inherit stateVersion inputs;
hostname = hostname;
username = username;
};
modules = [
./home-manager/default.nix
];
};
in {
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
name = "nixfiles";
@ -46,71 +74,19 @@ in {
};
});
nixosConfigurations = {
morty = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit stateVersion inputs;
hostname = "morty";
username = "ephase";
};
modules = [
./nixos/default.nix
home-manager.nixosModule
];
};
mrmeeseeks = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit stateVersion inputs;
hostname = "mrmeeseeks";
username = "ephase";
};
modules = [
./nixos/default.nix
home-manager.nixosModule
];
};
luci = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit stateVersion inputs;
hostname = "luci";
username = "ephase";
};
modules = [
./nixos/default.nix
home-manager.nixosModule
];
};
morty = createNixosSystem { system = "x86_64-linux"; hostname = "morty"; };
mrmeeseeks = createNixosSystem { system = "x86_64-linux"; hostname = "mrmeeseeks";};
luci = createNixosSystem { system = "x86_64-linux"; hostname = "luci"; };
};
homeConfigurations = {
rick = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = "aarch64-linux";
overlays = [ nixgl.overlay ];
};
extraSpecialArgs = {
inherit stateVersion inputs;
hostname = "rick";
username = "ephase";
};
modules = [
./home-manager/default.nix
];
};
work = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ nixgl.overlay ];
};
extraSpecialArgs = {
inherit stateVersion inputs;
hostname = "work";
username = "yorick-barbanneau";
};
modules = [
./home-manager/default.nix
];
"ephase@rick" = createHomeConfiguration { system = "aarch64-linux"; hostname = "rick";};
"ephase@luci" = createHomeConfiguration { system = "x86_64-linux"; hostname = "luci";};
"ephase@morty" = createHomeConfiguration { system = "x86_64-linux"; hostname = "morty";};
"ephase@mrmeeseeks" = createHomeConfiguration { system = "x86_64-linux"; hostname = "mrmeeseeks";};
"yorick-barbanneau@work" = createHomeConfiguration {
system = "x86_64-linux";
hostname = "work";
username = "yorick-barbanneau";
};
};
};