diff --git a/flake-def.nix b/flake-def.nix new file mode 100644 index 0000000..bd2ed80 --- /dev/null +++ b/flake-def.nix @@ -0,0 +1,61 @@ +{ + description = "NixOS configuration"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.03"; + unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager.url = "github:rycee/home-manager"; + emacs.url = "github:nix-community/emacs-overlay"; + hardware.url = "github:NixOS/nixos-hardware"; + }; + + outputs = inputs: { + nixosConfigurations.nixos = { + 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/nixos) + + inputs.home.nixosModules.home-manager + (import ./modules/core.nix) + + inputs.nixpkgs.nixosModules.notDetected + hm-nixos-as-super + ]; + in lib.nixosSystem { inherit system modules specialArgs; }; + }; + }; +} diff --git a/flake-old.nix b/flake-old.nix deleted file mode 100644 index d688d92..0000000 --- a/flake-old.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.03"; - unstable.url = "github:nixos/nixpkgs/nixos-unstable"; - home.url = "github:rycee/home-manager/bqv-flakes"; - 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; }; - }; - nixos = inputs.self.nixosConfigurations.nixos.config.system.build.toplevel; - }; -} diff --git a/flake.lock b/flake.lock index 4ec7a2b..88bd284 100644 --- a/flake.lock +++ b/flake.lock @@ -30,74 +30,35 @@ "type": "github" } }, - "home": { + "home-manager": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1591751635, - "narHash": "sha256-KgGtyFlkI/fsp+j8VEgJ/ynY9B91aX35Xp04HlDLRTo=", + "lastModified": 1600023128, + "narHash": "sha256-oSkMOe0rQ90bC5pfNSl85ren05cmk9Z9xrzrf5rVbr0=", "owner": "rycee", "repo": "home-manager", - "rev": "b3fee796fcd5531693d9b84ece76ad6836bb1cfa", + "rev": "472ca211cac604efdf621337067a237be9df389e", "type": "github" }, "original": { "owner": "rycee", - "ref": "bqv-flakes", "repo": "home-manager", "type": "github" } }, - "lowdown-src": { - "flake": false, - "locked": { - "lastModified": 1598296217, - "narHash": "sha256-ha7lyNY1d8m+osmDpPc9f/bfZ3ZC1IVIXwfyklSWg8I=", - "owner": "edolstra", - "repo": "lowdown", - "rev": "c7a4e715af1e233080842db82d15b261cb74cb28", - "type": "github" - }, - "original": { - "owner": "edolstra", - "ref": "no-structs-in-anonymous-unions", - "repo": "lowdown", - "type": "github" - } - }, - "nix": { - "inputs": { - "lowdown-src": "lowdown-src", - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1600268550, - "narHash": "sha256-DAUyHA/o9Q2KzFO/iA/6GBayTulH6siLn2RZtWdZT+M=", - "owner": "NixOS", - "repo": "nix", - "rev": "5080d4e7b2525d1656282c65a217a22ff8381df3", - "type": "github" - }, - "original": { - "id": "nix", - "type": "indirect" - } - }, "nixpkgs": { "locked": { - "lastModified": 1591633336, - "narHash": "sha256-oVXv4xAnDJB03LvZGbC72vSVlIbbJr8tpjEW5o/Fdek=", + "lastModified": 1600352596, + "narHash": "sha256-5Sdj60tu0hopH+PLLiCje47rJjfPsIBG5OzswKN4uLg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "70717a337f7ae4e486ba71a500367cad697e5f09", + "rev": "19f22514cb40bef8febef448e3ac9bb039118436", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-20.03-small", "type": "indirect" } }, @@ -121,8 +82,7 @@ "inputs": { "emacs": "emacs", "hardware": "hardware", - "home": "home", - "nix": "nix", + "home-manager": "home-manager", "nixpkgs": "nixpkgs_2", "unstable": "unstable" } diff --git a/flake.nix b/flake.nix index 7ec619d..41a84a7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,61 +1,34 @@ { - description = "NixOS configuration"; - inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.03"; unstable.url = "github:nixos/nixpkgs/nixos-unstable"; - home-manager.url = "github:rycee/home-manager"; + home.url = "github:rycee/home-manager"; emacs.url = "github:nix-community/emacs-overlay"; hardware.url = "github:NixOS/nixos-hardware"; }; - 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/nixos) - - inputs.home.nixosModules.home-manager - (import ./modules/core.nix) - - inputs.nixpkgs.nixosModules.notDetected - hm-nixos-as-super - ]; - in lib.nixosSystem { inherit system modules specialArgs; }; + 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/nixos) + + inputs.home.nixosModules.home-manager + (import ./modules/core.nix) + + inputs.nixpkgs.nixosModules.notDetected + ]; + specialArgs = { inherit inputs; }; }; + nixos = inputs.self.nixosConfigurations.nixos.config.system.build.toplevel; }; }