home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 76d14074028e2aa90668774213d6f059a7445ca5
parent 937229214a00abebd789232ac9035682ebcd97c0
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Sat, 23 May 2020 13:54:16 +0200

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>

Diffstat:
Adefault.nix | 25+++++++++++++++++++++++++
Mhardware/thinkpad.nix | 2+-
Ahosts.nix | 4++++
Mmodules/hardware/sane-extra-config.nixos.nix | 33+++++++++++++++++----------------
Anix/default.nix | 11+++++++++++
Ashell.nix | 16++++++++++++++++
Asystems/hokkaido.nix | 23+++++++++++++++++++++++
7 files changed, 97 insertions(+), 17 deletions(-)

diff --git a/default.nix b/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 diff --git a/hardware/thinkpad.nix b/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 = [ diff --git a/hosts.nix b/hosts.nix @@ -0,0 +1,4 @@ +{ + hokkaido = "x86_64-linux"; + # mypi = "aarch64-linux"; +} diff --git a/modules/hardware/sane-extra-config.nixos.nix b/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 = { diff --git a/nix/default.nix b/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; +} diff --git a/shell.nix b/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}" + ''; +} diff --git a/systems/hokkaido.nix b/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"; }]; + +}