From 40699e65702e680785ac3cdfb6f9ae650ebad2f1 Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Sat, 29 May 2021 17:22:27 +0200 Subject: [PATCH] working nixos overlay --- config.nix | 2 ++ default.nix | 3 +++ nixos/logical/zazu.nix | 2 +- nixos/overlay.nix | 32 ++++++++++++++++++++++++++++++++ nixos/physical/3950x.nix | 2 +- nixos/physical/fractal.nix | 2 +- nixos/physical/nuc.nix | 2 +- nixos/physical/xps9360.nix | 2 +- nixos/roles/workstation.nix | 2 -- nixos/services/email.nix | 2 +- 10 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 default.nix create mode 100644 nixos/overlay.nix diff --git a/config.nix b/config.nix index 0f5bc7f..82b03e8 100644 --- a/config.nix +++ b/config.nix @@ -1,10 +1,12 @@ let sources = import ./nix/sources.nix; in { + allowUnfree = true; overlays = [ (import sources.nixpkgs-wayland) (import sources.nixpkgs-mozilla) (import sources.emacs-overlay) + (import ./nixos/overlay.nix) (import ./nix/.config/nixpkgs/overlays/01-backports.nix) (import ./nix/.config/nixpkgs/overlays/02-extrapkgs.nix) (import ./nix/.config/nixpkgs/overlays/03-customizations.nix) diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..8b0cf23 --- /dev/null +++ b/default.nix @@ -0,0 +1,3 @@ +let sources = import ./nix/sources.nix; +in +import sources.nixpkgs (import ./config.nix) diff --git a/nixos/logical/zazu.nix b/nixos/logical/zazu.nix index d4bc6c3..228552d 100644 --- a/nixos/logical/zazu.nix +++ b/nixos/logical/zazu.nix @@ -1,5 +1,5 @@ # Edit this configuration file to define what should be installed on your system. Help is available in the configuration.nix(5) man page and in the NixOS manual (accessible by running ‘nixos-help’). -let sources = import ../nix/sources.nix; in +let sources = import ../../nix/sources.nix; in { config, lib, pkgs, ... }: { diff --git a/nixos/overlay.nix b/nixos/overlay.nix new file mode 100644 index 0000000..0334142 --- /dev/null +++ b/nixos/overlay.nix @@ -0,0 +1,32 @@ +let + names = [ "pennyworth" "jarvis" "blackadder" "woodhouse" "frumar" "zazu" ]; +in +pkgs: super: { + yorick = rec { + nixos = + configuration: extraArgs: + let + c = import (pkgs.path + "/nixos/lib/eval-config.nix") { + inherit (pkgs.stdenv.hostPlatform) system; + inherit extraArgs; + modules = + [( + { lib, ... }: { + config.nixpkgs.pkgs = lib.mkDefault pkgs; + } + )] ++ ( + if builtins.isList configuration + then configuration + else [configuration] + ); + }; + in + c.config.system.build // c; + }; + yorick.machine = pkgs.lib.genAttrs names (name: nixos [ + ./roles + (./logical + "/${name}.nix") + ] { + inherit name; + }); +} diff --git a/nixos/physical/3950x.nix b/nixos/physical/3950x.nix index 23f79ec..bbec0c3 100644 --- a/nixos/physical/3950x.nix +++ b/nixos/physical/3950x.nix @@ -1,5 +1,5 @@ { config, pkgs, lib, ... }: -let sources = import ../nix/sources.nix; +let sources = import ../../nix/sources.nix; in { imports = diff --git a/nixos/physical/fractal.nix b/nixos/physical/fractal.nix index 7471c5d..daa9e26 100644 --- a/nixos/physical/fractal.nix +++ b/nixos/physical/fractal.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: -let sources = import ../nix/sources.nix; +let sources = import ../../nix/sources.nix; in { imports = diff --git a/nixos/physical/nuc.nix b/nixos/physical/nuc.nix index 8ffb03e..86e6afd 100644 --- a/nixos/physical/nuc.nix +++ b/nixos/physical/nuc.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, modulesPath, ... }: -let sources = import ../nix/sources.nix; +let sources = import ../../nix/sources.nix; in { diff --git a/nixos/physical/xps9360.nix b/nixos/physical/xps9360.nix index 5b80c09..35e9311 100644 --- a/nixos/physical/xps9360.nix +++ b/nixos/physical/xps9360.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: -let sources = import ../nix/sources.nix; +let sources = import ../../nix/sources.nix; in { imports = [ diff --git a/nixos/roles/workstation.nix b/nixos/roles/workstation.nix index 96ee28b..cd68c54 100644 --- a/nixos/roles/workstation.nix +++ b/nixos/roles/workstation.nix @@ -1,6 +1,5 @@ { config, lib, pkgs, ... }: let - sources = import ../nix/sources.nix; nixNetrcFile = pkgs.runCommand "nix-netrc-file" { hostname = "cache.lumi.guide"; username = "lumi"; @@ -17,7 +16,6 @@ in ./graphical.nix ]; - nixpkgs.overlays = [ (import sources.nixpkgs-wayland) ]; users.extraUsers.yorick.extraGroups = [ "input" "wireshark" "dialout" ]; services.printing = { enable = true; diff --git a/nixos/services/email.nix b/nixos/services/email.nix index 44a7dc8..33ad92a 100644 --- a/nixos/services/email.nix +++ b/nixos/services/email.nix @@ -1,6 +1,6 @@ { config, pkgs, lib, ... }: let - sources = import ../nix/sources.nix; + sources = import ../../nix/sources.nix; in { imports = [