aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-12-04 21:40:42 +0100
committerKarel Kočí <cynerd@email.cz>2022-12-04 21:40:42 +0100
commit9c6072e87d7afe519c2f92c82a9e8b4bd3825193 (patch)
tree6fff4f9c4fa3a4c0c7f5b7a59ae528b357e46831
parent9996cca17aeb63ed0d51d59d4572dced0b050aee (diff)
downloadnixos-personal-9c6072e87d7afe519c2f92c82a9e8b4bd3825193.tar.gz
nixos-personal-9c6072e87d7afe519c2f92c82a9e8b4bd3825193.tar.bz2
nixos-personal-9c6072e87d7afe519c2f92c82a9e8b4bd3825193.zip
nixos: move configurations from top level flake file
-rw-r--r--flake.nix110
-rw-r--r--nixos/configurations.nix100
-rw-r--r--nixos/default.nix4
3 files changed, 103 insertions, 111 deletions
diff --git a/flake.nix b/flake.nix
index 8279b30..f5ee8d5 100644
--- a/flake.nix
+++ b/flake.nix
@@ -16,118 +16,12 @@
usbkey.url = "git+https://git.cynerd.cz/usbkey?ref=modules";
};
- outputs = { self
- , nixpkgs, flake-utils, nixos-hardware, nix
- , personal-secret
- , nixturris, vpsadminos
- , shellrc, usbkey, sterm
- }:
+ outputs = { self, nixpkgs, nix, nixos-hardware, flake-utils, shellrc, ... }:
with flake-utils.lib;
{
overlays.default = final: prev: import ./pkgs { inherit self; nixpkgs = prev; };
nixosModules = import ./nixos self;
-
- nixosConfigurations = let
-
- modules = hostname: [
- self.nixosModules.default
- self.nixosModules."machine-${hostname}"
- shellrc.nixosModules.default
- usbkey.nixosModules.default
- (personal-secret.lib.personalSecrets hostname)
- {
- networking.hostName = hostname;
- nixpkgs.overlays = [
- self.overlays.default
- sterm.overlay
- ];
- }
- ];
-
- genericSystem = {system ? "x86_64-linux", extra_modules ? []}:
- hostname: {
- ${hostname} = nixpkgs.lib.nixosSystem {
- system = system;
- modules = (modules hostname) ++ extra_modules;
- };
- };
- amd64System = genericSystem { };
- vpsSystem = genericSystem {
- extra_modules = [
- vpsadminos.nixosConfigurations.container
- { boot.loader.systemd-boot.enable = false; }
- ];
- };
- raspi2System = genericSystem {
- system = "armv7l-linux";
- extra_modules = [
- nixos-hardware.nixosModules.raspberry-pi-2
- nixturris.nixosModules.turris-crossbuild
- nixturris.nixosModules.armv7l-overlay
- ({pkgs, ...}: {
- boot.loader.systemd-boot.enable = false;
- boot.kernelPackages = pkgs.linuxPackages_latest;
- })
- { nixpkgs.overlays = [ (final: super: {
- makeModulesClosure = x:
- super.makeModulesClosure (x // { allowMissing = true; });
- })]; }
- ];
- };
- raspi3System = genericSystem {
- system = "aarch64-linux";
- extra_modules = [
- nixturris.nixosModules.turris-crossbuild
- {
- boot.loader.grub.enable = false;
- boot.loader.systemd-boot.enable = false;
- boot.loader.raspberryPi = {
- enable = true; version = 3;
- };
- }
- ];
- };
- beagleboneSystem = genericSystem {
- system = "armv7l-linux";
- extra_modules = [
- nixturris.nixosModules.turris-crossbuild
- nixturris.nixosModules.armv7l-overlay
- {
- boot.loader.grub.enable = false;
- boot.loader.systemd-boot.enable = false;
- boot.loader.generic-extlinux-compatible.enable = true;
- }
- ];
- };
-
- turrisSystem = board: hostname: {
- ${hostname} = nixturris.lib.nixturrisSystem {
- nixpkgs = nixpkgs;
- board = board;
- modules = modules hostname;
- };
- };
- turrisMoxSystem = turrisSystem "mox";
- turrisOmniaSystem = turrisSystem "omnia";
-
- in
- amd64System "albert" //
- amd64System "binky" //
- amd64System "errol" //
- amd64System "ridcully" //
- amd64System "susan" //
- vpsSystem "lipwig" //
- vpsSystem "mrpump" //
- raspi2System "spt-mpd" //
- raspi3System "adm-mpd" //
- beagleboneSystem "gaspode" //
- turrisMoxSystem "dean" //
- turrisOmniaSystem "spt-omnia" //
- turrisMoxSystem "spt-mox" //
- turrisMoxSystem "spt-mox2" //
- turrisOmniaSystem "adm-omnia" //
- turrisOmniaSystem "adm-omnia2";
-
+ nixosConfigurations = import ./nixos/configurations.nix self;
} // eachDefaultSystem (system: {
packages = filterPackages system (flattenTree (
import ./pkgs { inherit self; nixpkgs = nixpkgs.legacyPackages."${system}"; }
diff --git a/nixos/configurations.nix b/nixos/configurations.nix
new file mode 100644
index 0000000..8977c7c
--- /dev/null
+++ b/nixos/configurations.nix
@@ -0,0 +1,100 @@
+self:
+with self.inputs;
+let
+
+ modules = hostname: [
+ self.nixosModules.default
+ self.nixosModules."machine-${hostname}"
+ shellrc.nixosModules.default
+ usbkey.nixosModules.default
+ (personal-secret.lib.personalSecrets hostname)
+ {
+ networking.hostName = hostname;
+ nixpkgs.overlays = [
+ self.overlays.default
+ sterm.overlay
+ ];
+ }
+ ];
+
+ genericSystem = {system ? "x86_64-linux", extra_modules ? []}:
+ hostname: {
+ ${hostname} = nixpkgs.lib.nixosSystem {
+ system = system;
+ modules = (modules hostname) ++ extra_modules;
+ };
+ };
+ amd64System = genericSystem { };
+ vpsSystem = genericSystem {
+ extra_modules = [
+ vpsadminos.nixosConfigurations.container
+ { boot.loader.systemd-boot.enable = false; }
+ ];
+ };
+ raspi2System = genericSystem {
+ system = "armv7l-linux";
+ extra_modules = [
+ nixos-hardware.nixosModules.raspberry-pi-2
+ nixturris.nixosModules.turris-crossbuild
+ nixturris.nixosModules.armv7l-overlay
+ ({pkgs, ...}: {
+ boot.loader.systemd-boot.enable = false;
+ boot.initrd.includeDefaultModules = false;
+ })
+ ];
+ };
+ raspi3System = genericSystem {
+ system = "aarch64-linux";
+ extra_modules = [
+ nixturris.nixosModules.turris-crossbuild
+ ({pkgs, ...}: {
+ boot.kernelPackages = pkgs.linuxPackages_rpi3;
+ boot.initrd.includeDefaultModules = false;
+ boot.loader.grub.enable = false;
+ boot.loader.systemd-boot.enable = false;
+ boot.loader.raspberryPi = {
+ enable = true; version = 3;
+ };
+ })
+ ];
+ };
+ beagleboneSystem = genericSystem {
+ system = "armv7l-linux";
+ extra_modules = [
+ nixturris.nixosModules.turris-crossbuild
+ nixturris.nixosModules.armv7l-overlay
+ {
+ boot.loader.grub.enable = false;
+ boot.loader.systemd-boot.enable = false;
+ boot.loader.generic-extlinux-compatible.enable = true;
+ }
+ ];
+ };
+
+ turrisSystem = board: hostname: {
+ ${hostname} = nixturris.lib.nixturrisSystem {
+ nixpkgs = nixpkgs;
+ board = board;
+ modules = modules hostname;
+ };
+ };
+ turrisMoxSystem = turrisSystem "mox";
+ turrisOmniaSystem = turrisSystem "omnia";
+
+in
+ amd64System "albert" //
+ amd64System "binky" //
+ amd64System "errol" //
+ amd64System "ridcully" //
+ amd64System "susan" //
+ vpsSystem "lipwig" //
+ vpsSystem "mrpump" //
+ raspi2System "spt-mpd" //
+ raspi3System "adm-mpd" //
+ beagleboneSystem "gaspode" //
+ turrisMoxSystem "dean" //
+ turrisOmniaSystem "spt-omnia" //
+ turrisMoxSystem "spt-mox" //
+ turrisMoxSystem "spt-mox2" //
+ turrisOmniaSystem "adm-omnia" //
+ turrisOmniaSystem "adm-omnia2"
diff --git a/nixos/default.nix b/nixos/default.nix
index 64593bb..939d438 100644
--- a/nixos/default.nix
+++ b/nixos/default.nix
@@ -1,6 +1,4 @@
-self:
-
-let
+self: let
modules = import ./modules self.inputs.nixpkgs;
machines = import ./machine self;