Commit 76d14074028e

Vincent Demeester <vincent@sbr.pm>
2020-05-23 13:54:16
systems: add hokkaido and infrastructure around
- use `nix/*` for all packageset (no need for channels) - hosts.nix list the host "buildable" - add hokkaido to try things out Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 9372292
hardware/thinkpad.nix
@@ -12,7 +12,7 @@
       options snd_hda_intel power_save=1
     '';
     initrd = {
-      availableKernelModules = [ "aesni-intel" "aes_x86_64" "cryptd" ];
+      availableKernelModules = [ "ehci_pci" "ahci" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" "aesni-intel" "aes_x86_64" "cryptd" ];
     };
     kernelModules = [ "kvm_intel" ];
     kernelParams = [
modules/hardware/sane-extra-config.nixos.nix
@@ -9,22 +9,23 @@ let
     else pkgs.sane-backends;
   backends = [ pkg ] ++ cfg.extraBackends;
   saneConfig = pkgs.mkSaneConfig { paths = backends; };
-  saneExtraConfig = pkgs.runCommand "sane-extra-config"
-    { } ''
-    cp -Lr '${pkgs.mkSaneConfig { paths = [ pkgs.sane-backends ]; }}'/etc/sane.d $out
-    chmod +w $out
-    ${concatMapStrings
-      (
-      c: ''
-        f="$out/${c.name}.conf"
-        [ ! -e "$f" ] || chmod +w "$f"
-        cat ${builtins.toFile "" (c.value + "\n")} >>"$f"
-        chmod -w "$f"
-      ''
-      )
-      (mapAttrsToList nameValuePair cfg.extraConfig)}
-    chmod -w $out
-  '';
+  saneExtraConfig =
+    pkgs.runCommand "sane-extra-config"
+      { } ''
+      cp -Lr '${pkgs.mkSaneConfig { paths = [ pkgs.sane-backends ]; }}'/etc/sane.d $out
+      chmod +w $out
+      ${concatMapStrings
+        (
+        c: ''
+          f="$out/${c.name}.conf"
+          [ ! -e "$f" ] || chmod +w "$f"
+          cat ${builtins.toFile "" (c.value + "\n")} >>"$f"
+          chmod -w "$f"
+        ''
+        )
+        (mapAttrsToList nameValuePair cfg.extraConfig)}
+      chmod -w $out
+    '';
 in
 {
   options = {
nix/default.nix
@@ -0,0 +1,11 @@
+let
+  sources = import ./sources.nix;
+in
+rec {
+  home-manager = import (sources.home-manager + "/nixos");
+  lib = import (sources.nixos + "/lib");
+  pkgs = import sources.nixos;
+  lib-unstable = import (sources.nixos-unstable + "/lib");
+  pkgs-unstable = import sources.nixos-unstable;
+  nixpkgs = import sources.nixpkgs;
+}
systems/hokkaido.nix
@@ -0,0 +1,23 @@
+{ lib, pkgs, ... }:
+{
+  imports = [
+    ../hardware/thinkpad-x220.nix
+    ../modules/module-list.nixos.nix
+  ];
+
+  fileSystems."/" =
+    {
+      device = "/dev/disk/by-uuid/884a3d57-f652-49b2-9c8b-f6eebd5edbeb";
+      fsType = "ext4";
+    };
+
+  fileSystems."/boot" =
+    {
+      device = "/dev/disk/by-uuid/C036-34B9";
+      fsType = "vfat";
+    };
+
+  swapDevices =
+    [{ device = "/dev/disk/by-uuid/e1833693-77ac-4d52-bcc7-54d082788639"; }];
+
+}
default.nix
@@ -0,0 +1,25 @@
+{ sources ? import ./nix, lib ? sources.lib, pkgs ? sources.pkgs { } }:
+with builtins; with lib;
+let
+  mkNixOS = name: arch:
+    let
+      configuration = ./systems + "/${name}.nix";
+      system = arch;
+      nixos = import (pkgs.path + "/nixos") { inherit configuration system; };
+    in
+    nixos.config.system.build;
+  mkSystem = name: arch: (mkNixOS name arch).toplevel;
+  # mkDigitalOceanImage = name: arch: (mkNixOS name arch).digitalocean
+
+  systemAttrs = (mapAttrs mkSystem (import ./hosts.nix));
+
+  filterSystems = arch: attrValues (filterAttrs (_:v: v.system == arch) systemAttrs);
+  x86_64Systems = filterSystems "x86_64-linux";
+  aarch64Systems = filterSystems "aarch64-linux";
+  allSystems = attrValues systemAttrs;
+in
+{
+  systems = pkgs.linkFarmFromDrvs "systems" allSystems;
+  aarch64 = pkgs.linkFarmFromDrvs "aarch64" aarch64Systems;
+  x86_64-linux = pkgs.linkFarmFromDrvs "x86_64-linux" x86_64Systems;
+} // systemAttrs
hosts.nix
@@ -0,0 +1,4 @@
+{
+  hokkaido = "x86_64-linux";
+  # mypi = "aarch64-linux";
+}
shell.nix
@@ -0,0 +1,16 @@
+let
+  sources = import ./nix;
+  pkgs = sources.pkgs { };
+in
+pkgs.mkShell {
+  name = "nix-config";
+  buildInputs = with pkgs; [
+    cachix
+    morph
+    niv
+    nixpkgs-fmt
+  ];
+  shellHook = ''
+    export NIX_PATH="nixpkgs=${pkgs.path}"
+  '';
+}