wip: niri take 2 [skip-ci] #357

Draft
jalil wants to merge 2 commits from push-xstqnkxmwxvm into main
8 changed files with 152 additions and 87 deletions

40
example-vm/default.nix Normal file
View file

@ -0,0 +1,40 @@
{
import = [ ./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;
};
}

View file

@ -1,7 +1,13 @@
## Default QEMU guest config
{
services.qemuGuest.enable = true;
services = {
qemuGuest.enable = true;
openssh.enable = true;
};
boot.initrd.availableKernelModules = [
boot = {
loader.systemd-boot.enable = true;
initrd.availableKernelModules = [
"xhci_pci"
"ehci_pci"
"ahci"
@ -15,17 +21,14 @@
# "virtio_vga"
"virtio_gpu"
];
};
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
# settings for stateful data, like file locations and database versions
# on your system were taken. Its 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 = "22.11"; # Did you read the comment?
system.stateVersion = "24.11"; # Did you read the comment?
}

View file

@ -8,47 +8,11 @@ in
{
# Example vm configuration
flake.nixosConfigurations.vm = lib.nixosSystem {
inherit system pkgs;
inherit pkgs;
modules = [
inputs.self.nixosModules.vm # import vm module
{
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;
};
};
};
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;
};
}
inputs.self.nixosModules.default
../example-vm # import vm configuration
{ nix.registry.nixpkgs.flake = inputs.nixpkgs; }
];
};

View file

@ -1,7 +1,4 @@
{ self, inputs, ... }:
let
modules = ../modules;
in
{
# FIXME(25.05): this version of HM should have the flake module
# imports = [ inputs.home-manager.flakeModules.home-manager ];
@ -11,7 +8,7 @@ in
defaultModules = [
inputs.nixvim.homeManagerModules.nixvim
self.nixvimModules.homeManager
(modules + "/hm")
../module/hm
];
nixos = {
imports = defaultModules;

View file

@ -4,17 +4,15 @@
lib,
...
}:
let
modules = ../modules;
in
{
flake.nixosModules =
let
nixosModule = {
imports = [
inputs.niri.nixosModules.niri
inputs.stylix.nixosModules.stylix
inputs.home-manager.nixosModules.home-manager
(modules + "/nixos")
../modules/nixos
] ++ lib.optional (inputs.lix-module != null) inputs.lix-module.nixosModules.default;
home-manager = {
useGlobalPkgs = true;
@ -24,20 +22,9 @@ in
# Pin 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
{
default = nixosModule;
inherit nixosModule;
}
// machineModules;
};
}

View file

@ -1,7 +1,4 @@
{ self, inputs, ... }:
let
modules = ../modules;
in
{
imports = [ inputs.nixvim.flakeModules.default ];
@ -10,9 +7,13 @@ in
checks.enable = false; # FIXME: borked due to nix-community/nixvim#3074
};
flake.nixvimModules = {
standalone = modules + "/nixvim/standalone.nix";
homeManager = modules + "/nixvim";
flake.nixvimModules =
let
module = ../modules/nixvim;
in
{
standalone = "${module}/standalone.nix";
homeManager = module;
};
perSystem =

62
flake.lock generated
View file

@ -275,6 +275,50 @@
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.92.0.tar.gz"
}
},
"niri": {
"inputs": {
"niri-stable": "niri-stable",
"niri-unstable": [],
"nixpkgs": [
"unstable"
],
"nixpkgs-stable": [
"nixpkgs"
],
"xwayland-satellite-stable": "xwayland-satellite-stable",
"xwayland-satellite-unstable": []
},
"locked": {
"lastModified": 1742108116,
"narHash": "sha256-NrV9ysEfSbeRUPo0jdCBeesuNLTVrpHGXg40snH1YGE=",
"owner": "sodiboo",
"repo": "niri-flake",
"rev": "824f10012de455a1d0ef795a605f28948ee10467",
"type": "github"
},
"original": {
"owner": "sodiboo",
"repo": "niri-flake",
"type": "github"
}
},
"niri-stable": {
"flake": false,
"locked": {
"lastModified": 1740117926,
"narHash": "sha256-mTTHA0RAaQcdYe+9A3Jx77cmmyLFHmRoZdd8RpWa+m8=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "b94a5db8790339cf9134873d8b490be69e02ac71",
"type": "github"
},
"original": {
"owner": "YaLTeR",
"ref": "v25.02",
"repo": "niri",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1742388435,
@ -334,6 +378,7 @@
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"lix-module": "lix-module",
"niri": "niri",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim",
"stylix": "stylix",
@ -471,6 +516,23 @@
"repo": "treefmt-nix",
"type": "github"
}
},
"xwayland-satellite-stable": {
"flake": false,
"locked": {
"lastModified": 1739246919,
"narHash": "sha256-/hBM43/Gd0/tW+egrhlWgOIISeJxEs2uAOIYVpfDKeU=",
"owner": "Supreeeme",
"repo": "xwayland-satellite",
"rev": "44590a416d4a3e8220e19e29e0b6efe64a80315d",
"type": "github"
},
"original": {
"owner": "Supreeeme",
"ref": "v0.5.1",
"repo": "xwayland-satellite",
"type": "github"
}
}
},
"root": "root",

View file

@ -43,6 +43,17 @@
nuschtosSearch.follows = "";
};
};
niri = {
url = "github:sodiboo/niri-flake";
inputs = {
# Deduplicate
nixpkgs.follows = "unstable";
nixpkgs-stable.follows = "nixpkgs";
# Unused
niri-unstable.follows = "";
xwayland-satellite-unstable.follows = "";
};
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";