aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorAdrian Kummerlaender2021-08-19 23:33:53 +0200
committerAdrian Kummerlaender2021-08-19 23:33:53 +0200
commit14e72c5f239dd02234cbe467c3a4be1c0845c7cd (patch)
treeffbfe47590e3e74c54e145e76e7da0832e33e4d1 /flake.nix
parentd7376225387e88547ac56409aefb7443af32b7fd (diff)
downloadnixos_home-14e72c5f239dd02234cbe467c3a4be1c0845c7cd.tar
nixos_home-14e72c5f239dd02234cbe467c3a4be1c0845c7cd.tar.gz
nixos_home-14e72c5f239dd02234cbe467c3a4be1c0845c7cd.tar.bz2
nixos_home-14e72c5f239dd02234cbe467c3a4be1c0845c7cd.tar.lz
nixos_home-14e72c5f239dd02234cbe467c3a4be1c0845c7cd.tar.xz
nixos_home-14e72c5f239dd02234cbe467c3a4be1c0845c7cd.tar.zst
nixos_home-14e72c5f239dd02234cbe467c3a4be1c0845c7cd.zip
Enable pure instantiation of config via flake
i.e. via `nix run .#hostname`. Currently pulling in a pending pull request at jupyterWith for flakeified JupyterLab installations. The entire system consisting of `nixos_system` and `nixos_home` flakes can now be purely instantiated from clones in the user directory. No "/etc/nixos" resp. ".config/nixpkgs" needed. This is nice, probably not going to bother merging both repositories.
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix69
1 files changed, 37 insertions, 32 deletions
diff --git a/flake.nix b/flake.nix
index 9569468..9861ee7 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,60 +2,65 @@
description = "Computing environment of Adrian Kummerlaender";
inputs = {
- nixpkgs.url = github:NixOS/nixpkgs/nixos-21.05;
- nixpkgs-unstable.url = github:NixOS/nixpkgs/nixpkgs-unstable;
+ stable.url = github:NixOS/nixpkgs/nixos-21.05;
+ unstable.url = github:NixOS/nixpkgs/nixpkgs-unstable;
+ personal.url = github:KnairdA/pkgs;
home-manager = {
url = github:nix-community/home-manager/release-21.05;
- inputs = { nixpkgs.follows = "nixpkgs"; };
+ inputs = { nixpkgs.follows = "stable"; };
};
emacs.url = github:nix-community/emacs-overlay/master;
- personal = {
- url = https://pkgs.kummerlaender.eu/nixexprs.tar.xz;
- flake = false;
- };
- jupyter = {
- url = github:tweag/jupyterWith;
- flake = false;
- };
+ jupyter.url = github:GTrunSec/jupyterWith/flakes;
};
outputs = {
- self, nixpkgs, nixpkgs-unstable, emacs, home-manager, personal, jupyter, ...
+ self, stable, unstable, personal, emacs, home-manager, jupyter, ...
}: let
system = "x86_64-linux";
- pkgs = import nixpkgs {
+ pkgs-unstable = import unstable {
inherit system;
config = { allowUnfree = true; };
+ overlays = [ emacs.overlay ];
};
- home = home-manager.lib.homeManagerConfiguration {
- configuration = { pkgs, ... }: {
- _module.args = {
- pkgs-personal = import personal { };
- pkgs-unstable = import nixpkgs-unstable {
- inherit system;
- config = { allowUnfree = true; };
- overlays = [ emacs.overlay ];
- };
- jupyter = import jupyter { };
- };
+ pkgs-personal = personal;
+
+ jupyter-overlay = (final: prev: {
+ jupyterWith = jupyter.defaultPackage."${final.system}";
+ });
+
+ config = hostname: home-manager.lib.homeManagerConfiguration {
+ system = system;
+ homeDirectory = "/home/common";
+ username = "common";
+ extraSpecialArgs = {
+ inherit pkgs-unstable;
+ inherit pkgs-personal;
+ inherit hostname;
+ };
+ configuration = { ... }: {
imports = [ ./home.nix ];
nixpkgs = {
config = { allowUnfree = true; };
+ overlays = [ jupyter-overlay ];
};
};
- system = system;
- homeDirectory = "/home/common";
- username = "common";
};
+ hostnames = builtins.map
+ (h: builtins.replaceStrings [ ".nix" ] [ "" ] h)
+ (stable.lib.mapAttrsToList (name: type: name) (builtins.readDir ./host));
+
in {
- defaultPackage.x86_64-linux = home.activationPackage;
+ packages.x86_64-linux = builtins.listToAttrs
+ (map (h: { name = h; value = (config h).activationPackage; }) hostnames);
- defaultApp.x86_64-linux = {
- type = "app";
- program = "${home.activationPackage}/activate";
- };
+ apps.x86_64-linux = builtins.listToAttrs
+ (map (h: { name = h; value = {
+ type = "app";
+ program = "${(config h).activationPackage}/activate";
+ };
+ }) hostnames);
};
}