chore(ops/nixos): Move NixOS configuration one level up

This commit is contained in:
Vincent Ambo 2020-01-04 15:08:49 +00:00 committed by Vincent Ambo
parent 3638048c9b
commit 1d687c5303
19 changed files with 51 additions and 14 deletions

View file

@ -1,6 +0,0 @@
{ ... }:
builtins.throw ''
The Nix derivations at infra/nixos are not meant to be evaluated
like a derivation as they represent NixOS configuration.
''

View file

@ -40,14 +40,6 @@
firewall.allowedTCPPorts = [ 3000 5556 5558 ];
};
# Generate an immutable /etc/resolv.conf from the nameserver settings
# above (otherwise DHCP overwrites it):
environment.etc."resolv.conf" = with lib; with pkgs; {
source = writeText "resolv.conf" ''
${concatStringsSep "\n" (map (ns: "nameserver ${ns}") config.networking.nameservers)}
options edns0
'';
};
# Configure emacs:
# (actually, that's a lie, this only installs emacs!)

48
ops/nixos/default.nix Normal file
View file

@ -0,0 +1,48 @@
{ pkgs, ... }:
let
inherit (pkgs) third_party lib;
configuration = rec {
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.cleanTmpDir = true;
hardware.pulseaudio.enable = true;
hardware.cpu.intel.updateMicrocode = true;
time.timeZone = "Europe/London";
networking = {
# Don't use ISP's DNS servers:
nameservers = [
"8.8.8.8"
"8.8.4.4"
];
# Open Chromecast-related ports & servedir
firewall.allowedTCPPorts = [ 3000 5556 5558 ];
};
# Generate an immutable /etc/resolv.conf from the nameserver settings
# above (otherwise DHCP overwrites it):
environment.etc."resolv.conf" = with lib; with pkgs; {
source = writeText "resolv.conf" ''
${concatStringsSep "\n" (map (ns: "nameserver ${ns}") networking.nameservers)}
options edns0
'';
};
nixpkgs.config.allowUnfree = true;
};
# Desktop at home
stallo = {
networking.hostName = "stallo";
services.xserver.videoDrivers = [ "nvidia" ];
boot.initrd.luks.devices.stallo-luks.device = "/dev/disk/by-uuid/b484cf1e-a27b-4785-8bd6-fa85a004b073";
fileSystems."/".device = "/dev/disk/by-label/stallo-root";
};
in {
stallo = third_party.nixos {
configuration = lib.recursiveUpdate configuration stallo;
};
}

View file

@ -103,4 +103,7 @@ in exposed // {
originals = {
inherit (nixpkgs) git notmuch;
};
# Make NixOS available
nixos = import "${nixpkgsSrc}/nixos";
}