Don't use nix-channels

This commit is contained in:
Charlotte Van Petegem 2020-07-08 16:42:03 +02:00
parent 32ba100ee4
commit 280fdeeab0
17 changed files with 229 additions and 82 deletions

33
lib.nix Normal file
View file

@ -0,0 +1,33 @@
{
findImport = name:
let
localpath = ./.. + "/${name}";
importpath = ./imports + "/${name}";
in
if builtins.pathExists localpath then
localpath
else if builtins.pathExists importpath then
(import importpath)
else (abort "couldn't find import ${name}");
mkSystem = { nixpkgs, system ? "x86_64-linux", rev ? "git", extraModules ? [ ], ... }:
let
pkgs = import (nixpkgs) {
inherit (machine.config.nixpkgs) config overlays;
};
nixPath = pkgs.runCommand "nix-path"
{ } ''
mkdir -p $out
ln -s "${nixpkgs}" $out/nixpkgs
'';
machine = import "${nixpkgs}/nixos/lib/eval-config.nix" {
inherit system;
modules = [
({ ... }: {
nix.nixPath = [ "${nixPath}" ];
})
] ++ extraModules;
};
in
machine;
}