diff options
author | Adrian Kummerlaender | 2021-08-19 23:33:53 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2021-08-19 23:33:53 +0200 |
commit | 14e72c5f239dd02234cbe467c3a4be1c0845c7cd (patch) | |
tree | ffbfe47590e3e74c54e145e76e7da0832e33e4d1 | |
parent | d7376225387e88547ac56409aefb7443af32b7fd (diff) | |
download | nixos_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.
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | flake.lock | 107 | ||||
-rw-r--r-- | flake.nix | 69 | ||||
-rw-r--r-- | gui/gtk.nix | 4 | ||||
-rw-r--r-- | home.nix | 7 | ||||
-rw-r--r-- | tasks/default.nix | 6 |
6 files changed, 122 insertions, 78 deletions
@@ -16,13 +16,12 @@ The `host` folder contains a selection of host specific definitions to be select ## Instantiation -If you are me and want to instantiate the setup on a new host: +If you are me and want to instantiate the setup on a given host: ```sh -nix flake clone git+https://code.kummerlaender.eu/nixos_home -f dotfiles +nix flake clone git+https://code.kummerlaender.eu/nixos_home --dest dotfiles cd dotfiles -cp host/$template.nix host/$hostname.nix -nix run --impure +nix run .#host ``` ## Modules @@ -16,10 +16,25 @@ "type": "github" } }, + "flake-utils": { + "locked": { + "lastModified": 1623660459, + "narHash": "sha256-OTmOsh43po7r5F9s9H6lVCBQ2b0FikWbmiwLbMAGRdw=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "98c8d36b1828009b20f12544214683c7489935a1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ - "nixpkgs" + "stable" ] }, "locked": { @@ -38,28 +53,34 @@ } }, "jupyter": { - "flake": false, + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "stable" + ] + }, "locked": { - "lastModified": 1627572257, - "narHash": "sha256-0zNm9EM7xJbYfaWylPvwApo1MM65eJiFkVlZRwJzGgY=", - "owner": "tweag", + "lastModified": 1628121465, + "narHash": "sha256-eQzY+yymJzIVRYx58Kim21AfS1v8eTTkiLj3ZtPW4Nc=", + "owner": "GTrunSec", "repo": "jupyterWith", - "rev": "37cd8caefd951eaee65d9142544aa4bd9dfac54f", + "rev": "efbbc51cf4551cb3625ed47761368f02dcccf39b", "type": "github" }, "original": { - "owner": "tweag", + "owner": "GTrunSec", + "ref": "flakes", "repo": "jupyterWith", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1629139728, - "narHash": "sha256-XuddZZNg61qSLsczyYGg/bugA+zR7I394Ev8A8SrdoY=", + "lastModified": 1629271619, + "narHash": "sha256-by9D3OkEKk4rOzJIMbC0uP2wP3Bt81auP5xmbmPg2a8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "94c989365d563238068841763ecc5f7f4b25b22c", + "rev": "7bbca9877caed472c6b5866ea09302cfcdce3dbf", "type": "github" }, "original": { @@ -69,42 +90,64 @@ "type": "github" } }, - "nixpkgs-unstable": { + "personal": { + "inputs": { + "nixpkgs": "nixpkgs" + }, "locked": { - "lastModified": 1629169812, - "narHash": "sha256-krVVUNxRjSBJaFWKelNe0MWvxhklXSGKmisoJP4P5/Q=", + "lastModified": 1629367653, + "narHash": "sha256-TYovgHylzgcVC7M714mPVdCCsnHV9Uh2DiLWhi/KWe8=", + "owner": "KnairdA", + "repo": "pkgs", + "rev": "5e27bc6838920fe2948bc0953a519232bced0397", + "type": "github" + }, + "original": { + "owner": "KnairdA", + "repo": "pkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "emacs": "emacs", + "home-manager": "home-manager", + "jupyter": "jupyter", + "personal": "personal", + "stable": "stable", + "unstable": "unstable" + } + }, + "stable": { + "locked": { + "lastModified": 1629271619, + "narHash": "sha256-by9D3OkEKk4rOzJIMbC0uP2wP3Bt81auP5xmbmPg2a8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "70dc433f2eb84cc7ed848a30feaa5aab5890d23c", + "rev": "7bbca9877caed472c6b5866ea09302cfcdce3dbf", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "nixos-21.05", "repo": "nixpkgs", "type": "github" } }, - "personal": { - "flake": false, + "unstable": { "locked": { - "narHash": "sha256-wQkw+oZMiSvWVVLWJ4AzsQk9uuqYmtWAElxhWGN6tPs=", - "type": "tarball", - "url": "https://pkgs.kummerlaender.eu/nixexprs.tar.xz" + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://pkgs.kummerlaender.eu/nixexprs.tar.xz" - } - }, - "root": { - "inputs": { - "emacs": "emacs", - "home-manager": "home-manager", - "jupyter": "jupyter", - "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable", - "personal": "personal" + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" } } }, @@ -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); }; } diff --git a/gui/gtk.nix b/gui/gtk.nix index fc86160..f4bac43 100644 --- a/gui/gtk.nix +++ b/gui/gtk.nix @@ -9,7 +9,7 @@ in { theme = { name = "oomox"; - package = pkgs-personal.oomox-gtk-theme { + package = pkgs-personal.customizable.oomox-gtk-theme { accent_bg = "aadb0f"; bg = "d8d8d8"; fg = "101010"; @@ -38,7 +38,7 @@ in { iconTheme = { name = "oomox-archdroid"; - package = pkgs-personal.oomox-archdroid-icon-theme "909636"; + package = pkgs-personal.customizable.oomox-archdroid-icon-theme "909636"; }; font = { @@ -1,10 +1,7 @@ -{ config, pkgs, pkgs-personal, ... }: +{ config, pkgs, pkgs-personal, hostname, ... }: { - imports = let - # impure access to system config - hostname = (import <nixpkgs/nixos> { }).config.networking.hostName; - in [ + imports = [ # define options custom to this config ./custom.nix # load host specific stuff diff --git a/tasks/default.nix b/tasks/default.nix index 075af56..2d76551 100644 --- a/tasks/default.nix +++ b/tasks/default.nix @@ -1,4 +1,4 @@ -{ pkgs, jupyter, ... }: +{ pkgs, ... }: let mkShellDerivation = n: ps: pkgs.stdenvNoCC.mkDerivation rec { @@ -27,7 +27,7 @@ let ''; }; - mkJupyterEnv = kernel: jupyter.jupyterlabWith { + mkJupyterEnv = kernel: pkgs.jupyterWith.jupyterlabWith { kernels = [ kernel ]; }; @@ -59,7 +59,7 @@ in { directory = "~/"; type = "jupyter-lab"; environment = mkJupyterEnv ( - jupyter.kernels.iPythonWith { + pkgs.jupyterWith.kernels.iPythonWith { name = "python"; packages = p: with p; [ numpy |