-
-
Save tilpner/a41773272946c32d69df9603d2f346bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ ... }: | |
# to use: | |
# nib -A system bootstrap.nix | |
# s result/bin/switch-to-configuration switch | |
# todo: fix polybar fonts | |
# todo: backups, pass on oneplus | |
let | |
currentDevice = ./devices/lelouch.nix; | |
in let | |
config = { | |
allowUnfree = true; | |
useSandbox = true; | |
}; | |
readDirAbsolute = with builtins; dir: map (e: dir + ("/" + e)) (attrNames (readDir dir)); | |
overlays = [ (self: super: { inherit readDirAbsolute; }) ] | |
++ map (o: import o) (readDirAbsolute ./overlays); | |
bootstrap = import (builtins.fetchTarball { | |
url = https://github.com/nixos/nixpkgs/archive/9e5a13f6f1418700c9747da8dbbbff51d11c8dc0.tar.gz; | |
sha256 = "0a6i79xl3y0j9w8k3b5ggsfkjskmia8sgasrdhrr83fbdk7f24b1"; | |
}) { inherit config; }; | |
# branch nixos-17.03 | |
stableSrc = bootstrap.fetchgit rec { | |
name = "stable.${rev}"; | |
url = https://github.com/nixos/nixpkgs-channels; | |
rev = "c40b85d4fd06613150cd665d22a4e98448662b2d"; | |
sha256 = "0mwnw8i1jpy90ddivl95mqmbyvhqpbf2fy2hq6qbgsi0qh7bzi1i"; | |
}; | |
stable = import stableSrc { inherit config overlays; }; | |
# branch nixos-unstable | |
unstableSrc = bootstrap.fetchgit rec { | |
name = "unstable.${rev}"; | |
url = https://github.com/nixos/nixpkgs-channels; | |
rev = "a7c8f5e419ba07711c132bf81baaab0e74862cce"; | |
sha256 = "1y8j32a2ni8ji94bhlmpakikq3f62z040b71966y23jy7nvf8656"; | |
}; | |
unstable = import unstableSrc { inherit config overlays; }; | |
pkgs = stable; | |
nixConfig = { | |
nixPath = [ "nixpkgs=/cfg/nixos/nixpkgs.nix" ]; | |
package = stable.nixUnstable; | |
useSandbox = true; | |
buildCores = 7; | |
maxJobs = 7; | |
autoOptimiseStore = true; | |
}; | |
nixosSrc = stableSrc + "/nixos"; | |
nixos = import nixosSrc { | |
configuration = { | |
# Arguments to all imported modules | |
# Required because standard pkgs doesn't know about overlays | |
_module.args = { inherit pkgs stable stableSrc unstable unstableSrc; }; | |
imports = readDirAbsolute ./modules ++ [ currentDevice ]; | |
nix = nixConfig; | |
}; | |
}; | |
in nixos // { | |
inherit pkgs stable stableSrc unstable unstableSrc; | |
} | |
#(import ./base.nix { | |
# inherit pkgs stable unstable; | |
# config = nixos.config; | |
# }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment