mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-04-01 17:50:51 +02:00
Refactoring of the machines
This commit is contained in:
parent
4841bdf10f
commit
b9f3d8f46c
5 changed files with 97 additions and 11 deletions
39
flake.lock
generated
39
flake.lock
generated
|
@ -16,6 +16,27 @@
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dns": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1635273082,
|
||||||
|
"narHash": "sha256-EHiDP2jEa7Ai5ZwIf5uld9RVFcV77+2SUxjQXwJsJa0=",
|
||||||
|
"owner": "kirelagin",
|
||||||
|
"repo": "dns.nix",
|
||||||
|
"rev": "c7b9645da9c0ddce4f9de4ef27ec01bb8108039a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "kirelagin",
|
||||||
|
"repo": "dns.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -33,6 +54,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1614513358,
|
||||||
|
"narHash": "sha256-LakhOx3S1dRjnh0b5Dg3mbZyH0ToC9I8Y2wKSkBaTzU=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "5466c5bbece17adaab2d82fae80b46e807611bf3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1629481132,
|
"lastModified": 1629481132,
|
||||||
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
|
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
|
||||||
|
@ -85,7 +121,7 @@
|
||||||
},
|
},
|
||||||
"neovim-flake": {
|
"neovim-flake": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils_2",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -204,6 +240,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"dns": "dns",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"homepage": "homepage",
|
"homepage": "homepage",
|
||||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dns = {
|
||||||
|
url = "github:kirelagin/dns.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
neovim-nightly-overlay = {
|
neovim-nightly-overlay = {
|
||||||
url = "github:nix-community/neovim-nightly-overlay";
|
url = "github:nix-community/neovim-nightly-overlay";
|
||||||
inputs.nixpkgs.follows = "unstable";
|
inputs.nixpkgs.follows = "unstable";
|
||||||
|
@ -48,8 +53,7 @@
|
||||||
})
|
})
|
||||||
(builtins.attrNames (builtins.readDir ./modules)));
|
(builtins.attrNames (builtins.readDir ./modules)));
|
||||||
|
|
||||||
nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine {host=name; host-config=value; modules=self.nixosModules;})) (importConfig ./machines) //
|
nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine { host = name; host-config = value; modules = self.nixosModules; system = luj.machines.${name}.arch; })) (importConfig ./machines);
|
||||||
{"lambda" = mkMachine { host = "lambda"; host-config = import ./rpi.nix; modules=self.nixosModules; system="aarch64-linux";};};
|
|
||||||
packages."x86_64-linux" = {
|
packages."x86_64-linux" = {
|
||||||
tinystatus = import ./packages/tinystatus { inherit pkgs; };
|
tinystatus = import ./packages/tinystatus { inherit pkgs; };
|
||||||
mosh = pkgs.callPackage ./packages/mosh { };
|
mosh = pkgs.callPackage ./packages/mosh { };
|
||||||
|
|
|
@ -52,5 +52,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
luj = import ./luj.nix final;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
43
lib/luj.nix
Normal file
43
lib/luj.nix
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
lib: with lib; let
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
|
options.machines = mkOption {
|
||||||
|
description = "My machines";
|
||||||
|
type = with types; attrsOf (submodule ({ name, ... }: {
|
||||||
|
freeformType = attrs;
|
||||||
|
options = {
|
||||||
|
hostname = mkOption {
|
||||||
|
description = "The machine's hostname";
|
||||||
|
type = str;
|
||||||
|
default = name;
|
||||||
|
readOnly = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
_module.freeformType = with types; attrs;
|
||||||
|
|
||||||
|
domain = "julienmalka.me";
|
||||||
|
|
||||||
|
machines = {
|
||||||
|
lisa = {
|
||||||
|
arch = "x86_64-linux";
|
||||||
|
};
|
||||||
|
newton = {
|
||||||
|
arch = "x86_64-linux";
|
||||||
|
};
|
||||||
|
macintosh = {
|
||||||
|
arch = "x86_64-linux";
|
||||||
|
};
|
||||||
|
lambda = {
|
||||||
|
arch = "aarch64-linux";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
in (evalModules { inherit modules; }).config
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
imports = [ ./users/status.nix ];
|
imports = [ ../../users/status.nix ];
|
||||||
# NixOS wants to enable GRUB by default
|
# NixOS wants to enable GRUB by default
|
||||||
boot.loader.grub.enable = false;
|
boot.loader.grub.enable = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue