diff --git a/flake.lock b/flake.lock index 8821e62..98190ce 100644 --- a/flake.lock +++ b/flake.lock @@ -54,24 +54,6 @@ "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": { "inputs": { "nixpkgs": [ @@ -126,7 +108,6 @@ "root": { "inputs": { "colmena": "colmena", - "flake-utils": "flake-utils_2", "home-manager": "home-manager", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" @@ -147,21 +128,6 @@ "repo": "nixpkgs", "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", diff --git a/flake.nix b/flake.nix index bfa27dd..02e3ead 100644 --- a/flake.nix +++ b/flake.nix @@ -2,9 +2,11 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-23.11"; nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - colmena.url = "github:zhaofengli/colmena"; - colmena.inputs.nixpkgs.follows = "nixpkgs"; + + colmena = { + url = "github:zhaofengli/colmena"; + inputs.nixpkgs.follows = "nixpkgs"; + }; home-manager = { url = "github:nix-community/home-manager/release-23.11"; @@ -31,29 +33,33 @@ }; }); - colmenaHive = colmena.lib.makeHive { - meta = { - description = "All my NixoS machines"; - specialArgs = { - inherit inputs outputs; - pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; + colmena = + let + hosts = lib.genAttrs (builtins.attrNames (builtins.readDir ./hosts)) (name: { }); + in + { + meta = { + description = "All my NixoS machines"; + specialArgs = { + inherit inputs outputs; + pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; + }; + nixpkgs = import nixpkgs { system = "x86_64-linux"; }; }; - nixpkgs = import nixpkgs { system = "x86_64-linux"; }; - }; - defaults = { lib, config, name, ... }: { - imports = [ ./hosts/${name} ./profiles/base ]; + defaults = { lib, config, name, ... }: { + imports = [ ./hosts/${name} ./profiles/base ]; - home-manager.extraSpecialArgs = { - inherit inputs outputs; - pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; + networking.hostName = name; + + home-manager.extraSpecialArgs = { + inherit inputs outputs; + pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; + }; }; - }; + } // hosts; - bengal = { }; - ocelot = { }; - iso = { }; - }; + colmenaHive = inputs.colmena.lib.makeHive colmena; nixosConfigurations = { } // colmenaHive.nodes; @@ -62,19 +68,14 @@ homeConfigurations = let pkgs = import nixpkgs { system = "x86_64-linux"; }; - mkHome = { user ? "sammy", hostname ? null }: - lib.homeManagerConfiguration { - inherit pkgs; - modules = [ ./users/${user}/home.nix ] ++ lib.optional (!isNull hostname) (./. + "/users/${user}@${hostname}/home.nix"); - extraSpecialArgs = { - inherit inputs outputs; - pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; - }; - }; in - { - sammy = mkHome { }; - "sammy@chansey" = mkHome { hostname = "chansey"; }; - }; + lib.genAttrs (builtins.attrNames (builtins.readDir ./users)) (name: lib.homeManagerConfiguration { + inherit pkgs; + modules = [ ./users/${name}/home.nix ]; + extraSpecialArgs = { + inherit inputs outputs; + pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; + }; + }); }; } diff --git a/hosts/bengal/default.nix b/hosts/bengal/default.nix index 0ef3207..816af2e 100644 --- a/hosts/bengal/default.nix +++ b/hosts/bengal/default.nix @@ -6,7 +6,6 @@ boot.loader.systemd-boot.enable = true; - networking.hostName = "bengal"; networking.networkmanager.enable = true; services.printing.enable = true; diff --git a/hosts/iso/default.nix b/hosts/iso/default.nix index 076419a..34c358c 100644 --- a/hosts/iso/default.nix +++ b/hosts/iso/default.nix @@ -27,4 +27,3 @@ # Use faster squashfs compression isoImage.squashfsCompression = "gzip -Xcompression-level 1"; } - diff --git a/hosts/ocelot/default.nix b/hosts/ocelot/default.nix index ecafe1d..3ba8718 100644 --- a/hosts/ocelot/default.nix +++ b/hosts/ocelot/default.nix @@ -6,7 +6,5 @@ boot.tmp.cleanOnBoot = true; zramSwap.enable = true; - networking.hostName = "ocelot"; - networking.domain = ""; system.stateVersion = "23.11"; } diff --git a/hosts/test-vm/default.nix b/hosts/test-vm/default.nix deleted file mode 100644 index 18febbd..0000000 --- a/hosts/test-vm/default.nix +++ /dev/null @@ -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"; -} diff --git a/profiles/base/default.nix b/profiles/base/default.nix index 904b40f..c1cfa97 100644 --- a/profiles/base/default.nix +++ b/profiles/base/default.nix @@ -1,6 +1,7 @@ { lib, config, pkgs, inputs, ... }: { imports = [ - ../../users + ../../users/root + ../../users/sammy inputs.home-manager.nixosModules.home-manager ]; @@ -123,6 +124,4 @@ whois wireguard-tools ]; - - } diff --git a/users/default.nix b/users/default.nix deleted file mode 100644 index 6d5f25a..0000000 --- a/users/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: { - imports = [ - ./sammy - ./root - ]; -} diff --git a/users/sammy@chansey/home.nix b/users/sammy@chansey/home.nix index 20e9b82..fcd6d85 100644 --- a/users/sammy@chansey/home.nix +++ b/users/sammy@chansey/home.nix @@ -1,4 +1,7 @@ { ... }: { + imports = [ + ../sammy/home.nix + ]; programs.ssh.includes = [ "./famedly-config" ];