refactor!: multi-host setup
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
|
||||
{ config, lib, pkgs, meta, ... }:
|
||||
|
||||
{
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
environment.systemPackages = with pkgs; [ wget busybox stow ];
|
||||
programs.nix-ld.enable = true;
|
||||
networking.hostName = meta.hostname;
|
||||
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.luca = import ./users/luca/home.nix;
|
||||
users.users.luca.shell = pkgs.zsh;
|
||||
programs.zsh.enable = true;
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It's perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "24.05"; # Did you read the comment?
|
||||
}
|
||||
@@ -24,13 +24,10 @@
|
||||
meta = { hostname = host.name; };
|
||||
};
|
||||
system = "x86_64-linux";
|
||||
modules =
|
||||
[ ./configuration.nix home-manager.nixosModules.home-manager ]
|
||||
++ (if host.isWSL then [
|
||||
./wsl.nix
|
||||
nixos-wsl.nixosModules.default
|
||||
] else
|
||||
[ ]);
|
||||
modules = [
|
||||
./hosts/${host.name}/configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
] ++ (if host.isWSL then [ nixos-wsl.nixosModules.default ] else [ ]);
|
||||
};
|
||||
}) hosts);
|
||||
};
|
||||
|
||||
20
nix/hosts/wsl-kumatani/configuration.nix
Normal file
20
nix/hosts/wsl-kumatani/configuration.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
|
||||
{ config, lib, pkgs, meta, ... }:
|
||||
|
||||
{
|
||||
imports = [ ../../modules/default.nix ];
|
||||
|
||||
wsl.enable = true;
|
||||
wsl.defaultUser = "luca";
|
||||
networking.hostName = meta.hostname;
|
||||
programs.nix-ld.enable = true;
|
||||
hm.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs;
|
||||
config.commonPackages ++ [ asciiquarium ];
|
||||
|
||||
system.stateVersion = "24.05";
|
||||
}
|
||||
10
nix/modules/commonPackages.nix
Normal file
10
nix/modules/commonPackages.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{ pkgs, lib, ... }: {
|
||||
options = {
|
||||
commonPackages = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.package;
|
||||
default = [ ];
|
||||
description = "Common packages";
|
||||
};
|
||||
};
|
||||
config.commonPackages = with pkgs; [ wget busybox curl ];
|
||||
}
|
||||
1
nix/modules/default.nix
Normal file
1
nix/modules/default.nix
Normal file
@@ -0,0 +1 @@
|
||||
{ pkgs, lib, config, ... }: { imports = [ ./commonPackages.nix ./hm.nix ]; }
|
||||
11
nix/modules/hm.nix
Normal file
11
nix/modules/hm.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ lib, config, pkgs, ... }: {
|
||||
options = { hm.enable = lib.mkEnableOption "enable home-manager"; };
|
||||
|
||||
config = lib.mkIf config.hm.enable {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.luca = import ../users/luca/home.nix;
|
||||
users.users.luca.shell = pkgs.zsh;
|
||||
programs.zsh.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
wsl.enable = true;
|
||||
wsl.defaultUser = "luca";
|
||||
}
|
||||
Reference in New Issue
Block a user