Skip to content

Commit

Permalink
Add new flake.nix file
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiyq Widianto committed Sep 17, 2020
1 parent 17e8aef commit aad8168
Showing 1 changed file with 50 additions and 23 deletions.
73 changes: 50 additions & 23 deletions flake.nix
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;
};
}

0 comments on commit aad8168

Please sign in to comment.