made fancier, hosts and users get generated from directory structure now

:3
This commit is contained in:
CherryKitten 2024-04-06 14:00:33 +02:00
parent 566ec67fdd
commit 6e1d429869
Signed by: sammy
GPG key ID: 98D8F75FB0658276
9 changed files with 40 additions and 94 deletions

View file

@ -54,24 +54,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -126,7 +108,6 @@
"root": { "root": {
"inputs": { "inputs": {
"colmena": "colmena", "colmena": "colmena",
"flake-utils": "flake-utils_2",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable"
@ -147,21 +128,6 @@
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -2,9 +2,11 @@
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11"; nixpkgs.url = "nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable"; nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
colmena.url = "github:zhaofengli/colmena"; colmena = {
colmena.inputs.nixpkgs.follows = "nixpkgs"; url = "github:zhaofengli/colmena";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-23.11"; url = "github:nix-community/home-manager/release-23.11";
@ -31,7 +33,11 @@
}; };
}); });
colmenaHive = colmena.lib.makeHive { colmena =
let
hosts = lib.genAttrs (builtins.attrNames (builtins.readDir ./hosts)) (name: { });
in
{
meta = { meta = {
description = "All my NixoS machines"; description = "All my NixoS machines";
specialArgs = { specialArgs = {
@ -44,16 +50,16 @@
defaults = { lib, config, name, ... }: { defaults = { lib, config, name, ... }: {
imports = [ ./hosts/${name} ./profiles/base ]; imports = [ ./hosts/${name} ./profiles/base ];
networking.hostName = name;
home-manager.extraSpecialArgs = { home-manager.extraSpecialArgs = {
inherit inputs outputs; inherit inputs outputs;
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
}; };
}; };
} // hosts;
bengal = { }; colmenaHive = inputs.colmena.lib.makeHive colmena;
ocelot = { };
iso = { };
};
nixosConfigurations = { } // colmenaHive.nodes; nixosConfigurations = { } // colmenaHive.nodes;
@ -62,19 +68,14 @@
homeConfigurations = homeConfigurations =
let let
pkgs = import nixpkgs { system = "x86_64-linux"; }; pkgs = import nixpkgs { system = "x86_64-linux"; };
mkHome = { user ? "sammy", hostname ? null }: in
lib.homeManagerConfiguration { lib.genAttrs (builtins.attrNames (builtins.readDir ./users)) (name: lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ ./users/${user}/home.nix ] ++ lib.optional (!isNull hostname) (./. + "/users/${user}@${hostname}/home.nix"); modules = [ ./users/${name}/home.nix ];
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs outputs; inherit inputs outputs;
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
}; };
}; });
in
{
sammy = mkHome { };
"sammy@chansey" = mkHome { hostname = "chansey"; };
};
}; };
} }

View file

@ -6,7 +6,6 @@
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
networking.hostName = "bengal";
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
services.printing.enable = true; services.printing.enable = true;

View file

@ -27,4 +27,3 @@
# Use faster squashfs compression # Use faster squashfs compression
isoImage.squashfsCompression = "gzip -Xcompression-level 1"; isoImage.squashfsCompression = "gzip -Xcompression-level 1";
} }

View file

@ -6,7 +6,5 @@
boot.tmp.cleanOnBoot = true; boot.tmp.cleanOnBoot = true;
zramSwap.enable = true; zramSwap.enable = true;
networking.hostName = "ocelot";
networking.domain = "";
system.stateVersion = "23.11"; system.stateVersion = "23.11";
} }

View file

@ -1,13 +0,0 @@
{ lib, pkgs, ... }: {
services.openssh = {
enable = true;
settings.PasswordAuthentication = lib.mkForce true;
};
networking.firewall.allowedTCPPorts = [ 22 ];
environment.systemPackages = with pkgs; [
htop
];
system.stateVersion = "23.10";
}

View file

@ -1,6 +1,7 @@
{ lib, config, pkgs, inputs, ... }: { { lib, config, pkgs, inputs, ... }: {
imports = [ imports = [
../../users ../../users/root
../../users/sammy
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
]; ];
@ -123,6 +124,4 @@
whois whois
wireguard-tools wireguard-tools
]; ];
} }

View file

@ -1,6 +0,0 @@
{ ... }: {
imports = [
./sammy
./root
];
}

View file

@ -1,4 +1,7 @@
{ ... }: { { ... }: {
imports = [
../sammy/home.nix
];
programs.ssh.includes = [ programs.ssh.includes = [
"./famedly-config" "./famedly-config"
]; ];