nixos-config/flake.nix

54 lines
1.5 KiB
Nix
Raw Normal View History

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