mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-31 17:20:53 +02:00
Trying to add new machine
This commit is contained in:
parent
5889cfdbdb
commit
d05b910886
4 changed files with 55 additions and 3 deletions
|
@ -31,6 +31,7 @@
|
||||||
outputs = { self, home-manager, nixpkgs, unstable, sops-nix, neovim-nightly-overlay, nur, ... }@inputs:
|
outputs = { self, home-manager, nixpkgs, unstable, sops-nix, neovim-nightly-overlay, nur, ... }@inputs:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||||
|
pkgsrpi = import nixpkgs { system = "aarch64-linux";};
|
||||||
lib = nixpkgs.lib.extend (import ./lib inputs);
|
lib = nixpkgs.lib.extend (import ./lib inputs);
|
||||||
in
|
in
|
||||||
with lib;
|
with lib;
|
||||||
|
@ -42,10 +43,15 @@
|
||||||
})
|
})
|
||||||
(builtins.attrNames (builtins.readDir ./modules)));
|
(builtins.attrNames (builtins.readDir ./modules)));
|
||||||
|
|
||||||
nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine name value self.nixosModules)) (importConfig ./machines);
|
nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine {host=name; host-config=value; modules=self.nixosModules;})) (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 {};
|
||||||
};
|
};
|
||||||
|
packages."aarch64-linux" = {
|
||||||
|
tinystatus = import ./packages/tinystatus { pkgs = pkgsrpi; };
|
||||||
|
mosh = pkgsrpi.callPackage ./packages/mosh {};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
||||||
mkMachine = host: host-config: modules: nixpkgs.lib.nixosSystem {
|
mkMachine = {host, host-config, modules, system ? "x86_64-linux"}: nixpkgs.lib.nixosSystem {
|
||||||
lib = final;
|
lib = final;
|
||||||
system = "x86_64-linux";
|
system = system;
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.maxJobs = lib.mkDefault 4;
|
nix.maxJobs = lib.mkDefault 4;
|
||||||
|
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
||||||
|
|
||||||
services.fail2ban.enable = true;
|
services.fail2ban.enable = true;
|
||||||
|
|
||||||
|
|
45
rpi.nix
Normal file
45
rpi.nix
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
{
|
||||||
|
# NixOS wants to enable GRUB by default
|
||||||
|
boot.loader.grub.enable = false;
|
||||||
|
|
||||||
|
# if you have a Raspberry Pi 2 or 3, pick this:
|
||||||
|
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
|
||||||
|
# A bunch of boot parameters needed for optimal runtime on RPi 3b+
|
||||||
|
boot.kernelParams = ["cma=256M"];
|
||||||
|
boot.loader.raspberryPi.enable = true;
|
||||||
|
boot.loader.raspberryPi.version = 3;
|
||||||
|
boot.loader.raspberryPi.uboot.enable = true;
|
||||||
|
boot.loader.raspberryPi.firmwareConfig = ''
|
||||||
|
gpu_mem=256
|
||||||
|
'';
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
libraspberrypi
|
||||||
|
tinystatus
|
||||||
|
];
|
||||||
|
|
||||||
|
# File systems configuration for using the installer's partition layout
|
||||||
|
fileSystems = {
|
||||||
|
"/" = {
|
||||||
|
device = "/dev/disk/by-label/NIXOS_SD";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Preserve space by sacrificing documentation and history
|
||||||
|
documentation.nixos.enable = false;
|
||||||
|
nix.gc.automatic = true;
|
||||||
|
nix.gc.options = "--delete-older-than 30d";
|
||||||
|
boot.cleanTmpDir = true;
|
||||||
|
|
||||||
|
# Configure basic SSH access
|
||||||
|
services.openssh.enable = true;
|
||||||
|
# services.openssh.permitRootLogin = "yes";
|
||||||
|
|
||||||
|
# Use 1GB of additional swap memory in order to not run out of memory
|
||||||
|
# when installing lots of things while running other things at the same time.
|
||||||
|
swapDevices = [ { device = "/swapfile"; size = 1024; } ];
|
||||||
|
|
||||||
|
luj.hmgr.julien = {};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue