nixos-config/flake.nix

54 lines
1.5 KiB
Nix
Raw Normal View History

2021-03-31 18:15:08 -04:00
{
2021-10-06 00:16:18 -04:00
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
2021-08-13 12:14:42 -04:00
inputs.impermanence.url = "github:nix-community/impermanence";
2021-04-05 23:11:17 -04:00
2021-10-06 00:16:18 -04:00
outputs = { self, nixpkgs, impermanence, ... }:
2021-08-20 13:40:05 -04:00
let
2021-11-01 14:45:18 -04:00
mypkgs = import ./pkgs;
2021-08-20 13:40:05 -04:00
in
2021-06-05 02:22:38 -04:00
{
2021-09-10 00:42:41 -04:00
nixosModules =
{ inherit (impermanence.nixosModules) impermanence; } //
nixpkgs.lib.mapAttrs'
(name: type: {
2021-10-08 13:31:06 -04:00
name = nixpkgs.lib.removeSuffix ".nix" name;
2021-09-10 00:42:41 -04:00
value = import (./modules + "/${name}");
})
(builtins.readDir ./modules);
2021-06-11 21:32:23 -04:00
2021-08-15 23:20:11 -04:00
nixosModule = { pkgs, ... }: {
imports = builtins.attrValues self.nixosModules;
2021-08-20 13:40:05 -04:00
nixpkgs.overlays = [ (_: mypkgs) ];
2021-08-15 23:20:11 -04:00
};
2021-06-05 02:22:38 -04:00
2021-08-22 20:42:09 -04:00
nixosConfigurations = self.lib.getHosts {
path = ./hosts;
2021-10-06 00:16:18 -04:00
inherit nixpkgs;
2021-08-22 20:42:09 -04:00
inherit (self) nixosModule;
};
2021-06-05 02:22:38 -04:00
2021-06-25 01:04:30 -04:00
lib = {
getHosts = import lib/hosts.nix;
2021-09-09 23:46:13 -04:00
morphHosts = import lib/morph.nix;
2021-10-29 23:37:16 -04:00
forAllSystems = f: builtins.listToAttrs (map
(name: { inherit name; value = f name; })
(with nixpkgs.lib.systems.supported; tier1 ++ tier2));
2021-06-25 01:04:30 -04:00
};
2021-06-10 15:51:04 -04:00
2021-08-20 13:40:05 -04:00
packages = self.lib.forAllSystems
(system: mypkgs nixpkgs.legacyPackages.${system});
2021-06-11 22:41:50 -04:00
2021-06-25 01:04:30 -04:00
apps = self.lib.forAllSystems (system:
with nixpkgs.legacyPackages.${system};
2021-06-27 21:20:04 -04:00
let
2021-08-05 15:58:27 -04:00
jupy = python3.withPackages (p: with p; [ jupyterlab ipython ]);
2021-06-27 21:20:04 -04:00
in
2021-06-11 22:41:50 -04:00
{
2021-08-05 15:58:27 -04:00
jupyterlab = writeShellScriptBin "jupyterlab" ''
exec ${jupy}/bin/python -m jupyterlab "$@"
'';
2021-06-25 01:04:30 -04:00
}
);
};
2021-03-31 18:15:08 -04:00
}