-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rafiyq Widianto
committed
Sep 17, 2020
1 parent
17e8aef
commit aad8168
Showing
1 changed file
with
50 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,61 @@ | ||
{ | ||
description = "NixOS configuration"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.03"; | ||
unstable.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
home.url = "github:rycee/home-manager/bqv-flakes"; | ||
home-manager.url = "github:rycee/home-manager"; | ||
emacs.url = "github:nix-community/emacs-overlay"; | ||
hardware.url = "github:NixOS/nixos-hardware"; | ||
}; | ||
|
||
outputs = { self, nix, ... }@inputs: { | ||
nixosConfigurations.nixos = inputs.nixpkgs.lib.nixosSystem { | ||
system = "x86_64-linux"; | ||
modules = [ | ||
{ | ||
nixpkgs.overlays = [ inputs.emacs.overlay ]; | ||
system.configurationRevision = | ||
if self ? rev | ||
then self.rev | ||
else throw "Refusing to build from a dirty Git tree!"; | ||
} | ||
|
||
inputs.hardware.nixosModules.lenovo-thinkpad-x220 | ||
(import ./hosts/thinkpad-x220) | ||
|
||
inputs.home.nixosModules.home-manager | ||
(import ./modules/home.nix) | ||
|
||
inputs.nixpkgs.nixosModules.notDetected | ||
]; | ||
specialArgs = { inherit inputs; }; | ||
outputs = inputs: { | ||
nixosConfigurations = { | ||
hostname = let | ||
system = "x86_64-linux"; | ||
pkgs = inputs.nixpkgs.legacyPackages.${system}; | ||
inherit (inputs.nixpkgs) lib; | ||
|
||
# Things in this set are passed to modules and accessible | ||
# in the top-level arguments (e.g. `{ pkgs, lib, inputs, ... }:`). | ||
specialArgs = { | ||
inherit inputs; | ||
}; | ||
|
||
hm-nixos-as-super = { config, ... }: { | ||
# Submodules have merge semantics, making it possible to amend | ||
# the `home-manager.users` submodule for additional functionality. | ||
options.home-manager.users = lib.mkOption { | ||
type = lib.types.attrsOf (lib.types.submoduleWith { | ||
modules = [ ]; | ||
# Makes specialArgs available to Home Manager modules as well. | ||
specialArgs = specialArgs // { | ||
# Allow accessing the parent NixOS configuration. | ||
super = config; | ||
}; | ||
}); | ||
}; | ||
}; | ||
|
||
modules = [ | ||
{ | ||
nixpkgs.overlays = [ inputs.emacs.overlay ]; | ||
system.configurationRevision = | ||
if self ? rev | ||
then self.rev | ||
else throw "Refusing to build from a dirty Git tree!"; | ||
} | ||
|
||
inputs.hardware.nixosModules.lenovo-thinkpad-x220 | ||
(import ./hosts/thinkpad-x220) | ||
|
||
inputs.home.nixosModules.home-manager | ||
(import ./modules/home.nix) | ||
|
||
inputs.nixpkgs.nixosModules.notDetected | ||
hm-nixos-as-super | ||
]; | ||
in lib.nixosSystem { inherit system modules specialArgs; }; | ||
}; | ||
nixos = inputs.self.nixosConfigurations.nixos.config.system.build.toplevel; | ||
}; | ||
} |