refactor: don't include the whole modules
Instead only import the nixos/hm/nixvim module. This _should_ reduce rebuilds.
This commit is contained in:
parent
5359f13621
commit
c1309a5d43
6 changed files with 78 additions and 87 deletions
40
example-vm/default.nix
Normal file
40
example-vm/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
imports = [ ./vm-config.nix ];
|
||||||
|
|
||||||
|
time.timeZone = "Europe/Berlin";
|
||||||
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
users.users.jdoe = {
|
||||||
|
password = "example";
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [
|
||||||
|
"wheel"
|
||||||
|
"video"
|
||||||
|
"networkmanager"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
home-manager.users.jdoe = {
|
||||||
|
home = {
|
||||||
|
username = "jdoe";
|
||||||
|
homeDirectory = "/home/jdoe";
|
||||||
|
};
|
||||||
|
jhome = {
|
||||||
|
enable = true;
|
||||||
|
gui.enable = true;
|
||||||
|
dev = {
|
||||||
|
enable = true;
|
||||||
|
rust.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# password is 'test' see module documentation for more options
|
||||||
|
services.jupyter.password = "'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'";
|
||||||
|
jconfig = {
|
||||||
|
enable = true;
|
||||||
|
dev = {
|
||||||
|
enable = true;
|
||||||
|
jupyter.enable = true;
|
||||||
|
};
|
||||||
|
gui.enable = true;
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,31 +1,34 @@
|
||||||
|
## Default QEMU guest config
|
||||||
{
|
{
|
||||||
services.qemuGuest.enable = true;
|
services = {
|
||||||
|
qemuGuest.enable = true;
|
||||||
|
openssh.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [
|
boot = {
|
||||||
"xhci_pci"
|
loader.systemd-boot.enable = true;
|
||||||
"ehci_pci"
|
initrd.availableKernelModules = [
|
||||||
"ahci"
|
"xhci_pci"
|
||||||
"usbhid"
|
"ehci_pci"
|
||||||
"usb_storage"
|
"ahci"
|
||||||
"sd_mod"
|
"usbhid"
|
||||||
"virtio_balloon"
|
"usb_storage"
|
||||||
"virtio_blk"
|
"sd_mod"
|
||||||
"virtio_pci"
|
"virtio_balloon"
|
||||||
"virtio_ring"
|
"virtio_blk"
|
||||||
# "virtio_vga"
|
"virtio_pci"
|
||||||
"virtio_gpu"
|
"virtio_ring"
|
||||||
];
|
# "virtio_vga"
|
||||||
|
"virtio_gpu"
|
||||||
|
];
|
||||||
|
};
|
||||||
fileSystems."/".device = "/dev/disk/by-label/nixos";
|
fileSystems."/".device = "/dev/disk/by-label/nixos";
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
|
||||||
|
|
||||||
services.openssh.enable = true;
|
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
# This value determines the NixOS release from which the default
|
||||||
# settings for stateful data, like file locations and database versions
|
# settings for stateful data, like file locations and database versions
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
# 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.
|
# this value at the release version of the first install of this system.
|
||||||
# Before changing this value read the documentation for this option
|
# Before changing this value read the documentation for this option
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||||
system.stateVersion = "22.11"; # Did you read the comment?
|
system.stateVersion = "24.11"; # Did you read the comment?
|
||||||
}
|
}
|
|
@ -8,47 +8,11 @@ in
|
||||||
{
|
{
|
||||||
# Example vm configuration
|
# Example vm configuration
|
||||||
flake.nixosConfigurations.vm = lib.nixosSystem {
|
flake.nixosConfigurations.vm = lib.nixosSystem {
|
||||||
inherit system pkgs;
|
inherit pkgs;
|
||||||
modules = [
|
modules = [
|
||||||
inputs.self.nixosModules.vm # import vm module
|
inputs.self.nixosModules.default
|
||||||
{
|
../example-vm # import vm configuration
|
||||||
time.timeZone = "Europe/Berlin";
|
{ nix.registry.nixpkgs.flake = inputs.nixpkgs; }
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
|
||||||
users.users.jdoe = {
|
|
||||||
password = "example";
|
|
||||||
isNormalUser = true;
|
|
||||||
extraGroups = [
|
|
||||||
"wheel"
|
|
||||||
"video"
|
|
||||||
"networkmanager"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
home-manager.users.jdoe = {
|
|
||||||
home = {
|
|
||||||
username = "jdoe";
|
|
||||||
homeDirectory = "/home/jdoe";
|
|
||||||
};
|
|
||||||
jhome = {
|
|
||||||
enable = true;
|
|
||||||
gui.enable = true;
|
|
||||||
dev = {
|
|
||||||
enable = true;
|
|
||||||
rust.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
|
||||||
# password is 'test' see module documentation for more options
|
|
||||||
services.jupyter.password = "'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'";
|
|
||||||
jconfig = {
|
|
||||||
enable = true;
|
|
||||||
dev = {
|
|
||||||
enable = true;
|
|
||||||
jupyter.enable = true;
|
|
||||||
};
|
|
||||||
gui.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
{ self, inputs, ... }:
|
{ self, inputs, ... }:
|
||||||
let
|
|
||||||
modules = ../modules;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
# FIXME(25.05): this version of HM should have the flake module
|
# FIXME(25.05): this version of HM should have the flake module
|
||||||
# imports = [ inputs.home-manager.flakeModules.home-manager ];
|
# imports = [ inputs.home-manager.flakeModules.home-manager ];
|
||||||
|
@ -11,7 +8,7 @@ in
|
||||||
defaultModules = [
|
defaultModules = [
|
||||||
inputs.nixvim.homeManagerModules.nixvim
|
inputs.nixvim.homeManagerModules.nixvim
|
||||||
self.nixvimModules.homeManager
|
self.nixvimModules.homeManager
|
||||||
(modules + "/hm")
|
../modules/hm
|
||||||
];
|
];
|
||||||
nixos = {
|
nixos = {
|
||||||
imports = defaultModules;
|
imports = defaultModules;
|
||||||
|
|
|
@ -4,9 +4,6 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
|
||||||
modules = ../modules;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
flake.nixosModules =
|
flake.nixosModules =
|
||||||
let
|
let
|
||||||
|
@ -14,7 +11,7 @@ in
|
||||||
imports = [
|
imports = [
|
||||||
inputs.stylix.nixosModules.stylix
|
inputs.stylix.nixosModules.stylix
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
(modules + "/nixos")
|
../modules/nixos
|
||||||
] ++ lib.optional (inputs.lix-module != null) inputs.lix-module.nixosModules.default;
|
] ++ lib.optional (inputs.lix-module != null) inputs.lix-module.nixosModules.default;
|
||||||
home-manager = {
|
home-manager = {
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
|
@ -24,20 +21,9 @@ in
|
||||||
# Pin nixpkgs
|
# Pin nixpkgs
|
||||||
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
machines = [ "vm" ];
|
|
||||||
mkMachine = hostname: {
|
|
||||||
imports = [
|
|
||||||
nixosModule
|
|
||||||
(import (../machines + "/${hostname}"))
|
|
||||||
];
|
|
||||||
home-manager.sharedModules = [ { jhome.hostName = hostname; } ];
|
|
||||||
};
|
|
||||||
machineModules = lib.genAttrs machines mkMachine;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = nixosModule;
|
default = nixosModule;
|
||||||
inherit nixosModule;
|
inherit nixosModule;
|
||||||
}
|
};
|
||||||
// machineModules;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
{ self, inputs, ... }:
|
{ self, inputs, ... }:
|
||||||
let
|
|
||||||
modules = ../modules;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
imports = [ inputs.nixvim.flakeModules.default ];
|
imports = [ inputs.nixvim.flakeModules.default ];
|
||||||
|
|
||||||
|
@ -10,10 +7,14 @@ in
|
||||||
checks.enable = false; # FIXME: borked due to nix-community/nixvim#3074
|
checks.enable = false; # FIXME: borked due to nix-community/nixvim#3074
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.nixvimModules = {
|
flake.nixvimModules =
|
||||||
standalone = modules + "/nixvim/standalone.nix";
|
let
|
||||||
homeManager = modules + "/nixvim";
|
module = ../modules/nixvim;
|
||||||
};
|
in
|
||||||
|
{
|
||||||
|
standalone = "${module}/standalone.nix";
|
||||||
|
homeManager = module;
|
||||||
|
};
|
||||||
|
|
||||||
perSystem =
|
perSystem =
|
||||||
{ system, ... }:
|
{ system, ... }:
|
||||||
|
|
Loading…
Add table
Reference in a new issue